diff options
Diffstat (limited to 'sd/source/filter/html')
-rw-r--r-- | sd/source/filter/html/HtmlOptionsDialog.cxx | 287 | ||||
-rw-r--r-- | sd/source/filter/html/buttonset.cxx | 309 | ||||
-rw-r--r-- | sd/source/filter/html/buttonset.hxx | 53 | ||||
-rwxr-xr-x | sd/source/filter/html/htmlattr.cxx | 102 | ||||
-rwxr-xr-x | sd/source/filter/html/htmlattr.hxx | 51 | ||||
-rwxr-xr-x | sd/source/filter/html/htmlex.cxx | 3392 | ||||
-rwxr-xr-x | sd/source/filter/html/htmlex.hxx | 239 | ||||
-rw-r--r-- | sd/source/filter/html/makefile.mk | 68 | ||||
-rwxr-xr-x | sd/source/filter/html/pubdlg.cxx | 1756 | ||||
-rw-r--r-- | sd/source/filter/html/pubdlg.src | 817 | ||||
-rw-r--r-- | sd/source/filter/html/sdhtmlfilter.cxx | 86 |
11 files changed, 7160 insertions, 0 deletions
diff --git a/sd/source/filter/html/HtmlOptionsDialog.cxx b/sd/source/filter/html/HtmlOptionsDialog.cxx new file mode 100644 index 000000000000..14bd3e46c581 --- /dev/null +++ b/sd/source/filter/html/HtmlOptionsDialog.cxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * 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_sd.hxx" +#include <osl/file.hxx> +#include <vos/module.hxx> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <cppuhelper/implbase5.hxx> +#include <vcl/svapp.hxx> + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::document; +using namespace com::sun::star::beans; +using namespace com::sun::star::container; +using namespace com::sun::star::frame; +using namespace com::sun::star::ui::dialogs; + +#include "pres.hxx" +#include "sdabstdlg.hxx" +#include "tools/debug.hxx" +class SdHtmlOptionsDialog : public cppu::WeakImplHelper5 +< + XExporter, + XExecutableDialog, + XPropertyAccess, + XInitialization, + XServiceInfo +> +{ + const Reference< XMultiServiceFactory > &mrxMgr; + Sequence< PropertyValue > maMediaDescriptor; + Sequence< PropertyValue > maFilterDataSequence; + ::rtl::OUString aDialogTitle; + DocumentType meDocType; + +public: + + SdHtmlOptionsDialog( const Reference< XMultiServiceFactory >& _rxORB ); + ~SdHtmlOptionsDialog(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XInitialization + virtual void SAL_CALL initialize( const Sequence< Any > & aArguments ) throw ( Exception, RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw ( RuntimeException ); + virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw ( RuntimeException ); + + // XPropertyAccess + virtual Sequence< PropertyValue > SAL_CALL getPropertyValues() throw ( RuntimeException ); + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > & aProps ) + throw ( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // XExecuteDialog + virtual sal_Int16 SAL_CALL execute() + throw ( com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XExporter + virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) + throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + +}; + +// ------------------------- +// - SdHtmlOptionsDialog - +// ------------------------- + +Reference< XInterface > + SAL_CALL SdHtmlOptionsDialog_CreateInstance( + const Reference< XMultiServiceFactory > & _rxFactory ) +{ + return static_cast< ::cppu::OWeakObject* > ( new SdHtmlOptionsDialog( _rxFactory ) ); +} + +::rtl::OUString SdHtmlOptionsDialog_getImplementationName() + throw( RuntimeException ) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.draw.SdHtmlOptionsDialog" ) ); +} +#define SERVICE_NAME "com.sun.star.ui.dialog.FilterOptionsDialog" +sal_Bool SAL_CALL SdHtmlOptionsDialog_supportsService( const ::rtl::OUString& ServiceName ) + throw( RuntimeException ) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SERVICE_NAME ) ); +} + +Sequence< ::rtl::OUString > SAL_CALL SdHtmlOptionsDialog_getSupportedServiceNames() + throw( RuntimeException ) +{ + Sequence< ::rtl::OUString > aRet(1); + ::rtl::OUString* pArray = aRet.getArray(); + pArray[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) ); + return aRet; +} +#undef SERVICE_NAME + +// ----------------------------------------------------------------------------- + +SdHtmlOptionsDialog::SdHtmlOptionsDialog( const Reference< XMultiServiceFactory > & xMgr ) : + mrxMgr ( xMgr ), + meDocType ( DOCUMENT_TYPE_DRAW ) +{ +} + +// ----------------------------------------------------------------------------- + +SdHtmlOptionsDialog::~SdHtmlOptionsDialog() +{ +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL SdHtmlOptionsDialog::acquire() throw() +{ + OWeakObject::acquire(); +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL SdHtmlOptionsDialog::release() throw() +{ + OWeakObject::release(); +} + +// XInitialization +void SAL_CALL SdHtmlOptionsDialog::initialize( const Sequence< Any > & ) + throw ( Exception, RuntimeException ) +{ +} + +// XServiceInfo +::rtl::OUString SAL_CALL SdHtmlOptionsDialog::getImplementationName() + throw( RuntimeException ) +{ + return SdHtmlOptionsDialog_getImplementationName(); +} +sal_Bool SAL_CALL SdHtmlOptionsDialog::supportsService( const ::rtl::OUString& rServiceName ) + throw( RuntimeException ) +{ + return SdHtmlOptionsDialog_supportsService( rServiceName ); +} +Sequence< ::rtl::OUString > SAL_CALL SdHtmlOptionsDialog::getSupportedServiceNames() + throw ( RuntimeException ) +{ + return SdHtmlOptionsDialog_getSupportedServiceNames(); +} + + +// XPropertyAccess +Sequence< PropertyValue > SdHtmlOptionsDialog::getPropertyValues() + throw ( RuntimeException ) +{ + sal_Int32 i, nCount; + for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) + { + if ( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) + break; + } + if ( i == nCount ) + maMediaDescriptor.realloc( ++nCount ); + + // the "FilterData" Property is an Any that will contain our PropertySequence of Values + maMediaDescriptor[ i ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) ); + maMediaDescriptor[ i ].Value <<= maFilterDataSequence; + return maMediaDescriptor; +} + +void SdHtmlOptionsDialog::setPropertyValues( const Sequence< PropertyValue > & aProps ) + throw ( UnknownPropertyException, PropertyVetoException, + IllegalArgumentException, WrappedTargetException, + RuntimeException ) +{ + maMediaDescriptor = aProps; + + sal_Int32 i, nCount; + for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) + { + if ( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) + { + maMediaDescriptor[ i ].Value >>= maFilterDataSequence; + break; + } + } +} + +// XExecutableDialog +void SdHtmlOptionsDialog::setTitle( const ::rtl::OUString& aTitle ) + throw ( RuntimeException ) +{ + aDialogTitle = aTitle; +} + +sal_Int16 SdHtmlOptionsDialog::execute() + throw ( RuntimeException ) +{ + sal_Int16 nRet = ExecutableDialogResults::CANCEL; + + SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); + if( pFact ) + { + AbstractSdPublishingDlg* pDlg = pFact->CreateSdPublishingDlg( Application::GetDefDialogParent(), meDocType ); + if( pDlg ) + { + if( pDlg->Execute() ) + { + pDlg->GetParameterSequence( maFilterDataSequence ); + nRet = ExecutableDialogResults::OK; + } + else + { + nRet = ExecutableDialogResults::CANCEL; + } + delete pDlg; + } + } + return nRet; +} + +// XEmporter +void SdHtmlOptionsDialog::setSourceDocument( const Reference< XComponent >& xDoc ) + throw ( IllegalArgumentException, RuntimeException ) +{ + // try to set the corresponding metric unit + String aConfigPath; + Reference< XServiceInfo > xServiceInfo + ( xDoc, UNO_QUERY ); + if ( xServiceInfo.is() ) + { + if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) ) + { + meDocType = DOCUMENT_TYPE_IMPRESS; + return; + } + else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) ) + { + meDocType = DOCUMENT_TYPE_DRAW; + return; + } + } + throw IllegalArgumentException(); +} diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx new file mode 100644 index 000000000000..be6da8ddb74b --- /dev/null +++ b/sd/source/filter/html/buttonset.cxx @@ -0,0 +1,309 @@ +/************************************************************************* + * + * 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_sd.hxx" + +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hpp> + +#include <osl/file.hxx> +#include <comphelper/storagehelper.hxx> +#include <comphelper/oslfile2streamwrap.hxx> +#include <comphelper/processfactory.hxx> +#include <tools/debug.hxx> +#include <vcl/graph.hxx> +#include <vcl/virdev.hxx> +#include <vcl/image.hxx> +#include <unotools/pathoptions.hxx> + +#include <boost/shared_ptr.hpp> + +#include "buttonset.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::graphic; +using namespace ::com::sun::star::embed; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::lang; + +class ButtonsImpl +{ +public: + ButtonsImpl( const OUString& rURL ); + + Reference< XInputStream > getInputStream( const OUString& rName ); + + bool getGraphic( const Reference< XGraphicProvider >& xGraphicProvider, const OUString& rName, Graphic& rGraphic ); + + bool copyGraphic( const OUString& rName, const OUString& rPath ); + +private: + Reference< XStorage > mxStorage; +}; + +ButtonsImpl::ButtonsImpl( const OUString& rURL ) +{ + try + { + mxStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( ZIP_STORAGE_FORMAT_STRING, rURL, ElementModes::READ ); + } + catch( Exception& ) + { + DBG_ERROR("sd::ButtonsImpl::ButtonsImpl(), exception caught!" ); + } +} + +Reference< XInputStream > ButtonsImpl::getInputStream( const OUString& rName ) +{ + Reference< XInputStream > xInputStream; + if( mxStorage.is() ) try + { + Reference< XStream > xStream( mxStorage->openStreamElement( rName, ElementModes::READ ) ); + if( xStream.is() ) + xInputStream = xStream->getInputStream(); + } + catch( Exception& ) + { + DBG_ERROR( "sd::ButtonsImpl::getInputStream(), exception caught!" ); + } + return xInputStream; +} + +bool ButtonsImpl::getGraphic( const Reference< XGraphicProvider >& xGraphicProvider, const rtl::OUString& rName, Graphic& rGraphic ) +{ + Reference< XInputStream > xInputStream( getInputStream( rName ) ); + if( xInputStream.is() && xGraphicProvider.is() ) try + { + Sequence< PropertyValue > aMediaProperties( 1 ); + aMediaProperties[0].Name = ::rtl::OUString::createFromAscii( "InputStream" ); + aMediaProperties[0].Value <<= xInputStream; + Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties ) ); + + if( xGraphic.is() ) + { + rGraphic = Graphic( xGraphic ); + return true; + } + } + catch( Exception& ) + { + DBG_ERROR( "sd::ButtonsImpl::getGraphic(), exception caught!" ); + } + return false; +} + +bool ButtonsImpl::copyGraphic( const OUString& rName, const OUString& rPath ) +{ + Reference< XInputStream > xInput( getInputStream( rName ) ); + if( xInput.is() ) try + { + osl::File::remove( rPath ); + osl::File aOutputFile( rPath ); + if( aOutputFile.open( OpenFlag_Write|OpenFlag_Create ) == osl::FileBase::E_None ) + { + Reference< XOutputStream > xOutput( new comphelper::OSLOutputStreamWrapper( aOutputFile ) ); + comphelper::OStorageHelper::CopyInputToOutput( xInput, xOutput ); + return true; + } + } + catch( Exception& ) + { + DBG_ERROR( "sd::ButtonsImpl::copyGraphic(), exception caught!" ); + } + + return false; +} + +typedef std::vector< boost::shared_ptr< ButtonsImpl > > ButtonVector; +class ButtonSetImpl +{ +public: + ButtonSetImpl(); + + int getCount() const; + + bool getPreview( int nSet, const std::vector< rtl::OUString >& rButtons, Image& rImage ); + bool exportButton( int nSet, const rtl::OUString& rPath, const rtl::OUString& rName ); + + void scanForButtonSets( const OUString& rPath ); + + Reference< XGraphicProvider > getGraphicProvider(); + + ButtonVector maButtons; + Reference< XGraphicProvider > mxGraphicProvider; +}; + +ButtonSetImpl::ButtonSetImpl() +{ + const OUString sSubPath( RTL_CONSTASCII_USTRINGPARAM( "/wizard/web/buttons" ) ); + + OUString sSharePath( SvtPathOptions().GetConfigPath() ); + sSharePath += sSubPath; + scanForButtonSets( sSharePath ); + + OUString sUserPath( SvtPathOptions().GetUserConfigPath() ); + sUserPath += sSubPath; + scanForButtonSets( sUserPath ); +} + +void ButtonSetImpl::scanForButtonSets( const OUString& rPath ) +{ + OUString aSystemPath; + osl::Directory aDirectory( rPath ); + if( aDirectory.open() == osl::FileBase::E_None ) + { + osl::DirectoryItem aItem; + while( aDirectory.getNextItem( aItem, 2211 ) == osl::FileBase::E_None ) + { + osl::FileStatus aStatus( FileStatusMask_FileName|FileStatusMask_FileURL ); + if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) + { + OUString sFileName( aStatus.getFileName() ); + if( sFileName.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(".zip" ) ) ) + maButtons.push_back( boost::shared_ptr< ButtonsImpl >( new ButtonsImpl( aStatus.getFileURL() ) ) ); + } + } + } +} + +int ButtonSetImpl::getCount() const +{ + return maButtons.size(); +} + +bool ButtonSetImpl::getPreview( int nSet, const std::vector< rtl::OUString >& rButtons, Image& rImage ) +{ + if( (nSet >= 0) && (nSet < static_cast<int>(maButtons.size()))) + { + ButtonsImpl& rSet = *maButtons[nSet].get(); + + std::vector< Graphic > aGraphics; + + VirtualDevice aDev; + aDev.SetMapMode(MapMode(MAP_PIXEL)); + + Size aSize; + std::vector< rtl::OUString >::const_iterator aIter( rButtons.begin() ); + while( aIter != rButtons.end() ) + { + Graphic aGraphic; + if( !rSet.getGraphic( getGraphicProvider(), (*aIter++), aGraphic ) ) + return false; + + aGraphics.push_back(aGraphic); + + Size aGraphicSize( aGraphic.GetSizePixel( &aDev ) ); + aSize.Width() += aGraphicSize.Width(); + + if( aSize.Height() < aGraphicSize.Height() ) + aSize.Height() = aGraphicSize.Height(); + + if( aIter != rButtons.end() ) + aSize.Width() += 3; + } + + aDev.SetOutputSizePixel( aSize ); + + Point aPos; + + std::vector< Graphic >::iterator aGraphIter( aGraphics.begin() ); + while( aGraphIter != aGraphics.end() ) + { + Graphic aGraphic( (*aGraphIter++) ); + + aGraphic.Draw( &aDev, aPos ); + + aPos.X() += aGraphic.GetSizePixel().Width() + 3; + } + + rImage = Image( aDev.GetBitmapEx( Point(), aSize ) ); + return true; + } + return false; +} + +bool ButtonSetImpl::exportButton( int nSet, const rtl::OUString& rPath, const rtl::OUString& rName ) +{ + if( (nSet >= 0) && (nSet < static_cast<int>(maButtons.size()))) + { + ButtonsImpl& rSet = *maButtons[nSet].get(); + + return rSet.copyGraphic( rName, rPath ); + } + return false; +} + +Reference< XGraphicProvider > ButtonSetImpl::getGraphicProvider() +{ + if( !mxGraphicProvider.is() ) + { + Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory() ); + if( xServiceManager.is() ) try + { + Reference< XGraphicProvider > xGraphProvider( + xServiceManager->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW ); + + mxGraphicProvider = xGraphProvider; + } + catch( Exception& ) + { + DBG_ERROR("sd::ButtonSetImpl::getGraphicProvider(), could not get graphic provider!"); + } + } + return mxGraphicProvider; +} + + +ButtonSet::ButtonSet() +: mpImpl( new ButtonSetImpl() ) +{ +} + +ButtonSet::~ButtonSet() +{ + delete mpImpl; +} + +int ButtonSet::getCount() const +{ + return mpImpl->getCount(); +} + +bool ButtonSet::getPreview( int nSet, const std::vector< rtl::OUString >& rButtons, Image& rImage ) +{ + return mpImpl->getPreview( nSet, rButtons, rImage ); +} + +bool ButtonSet::exportButton( int nSet, const rtl::OUString& rPath, const rtl::OUString& rName ) +{ + return mpImpl->exportButton( nSet, rPath, rName ); +} + diff --git a/sd/source/filter/html/buttonset.hxx b/sd/source/filter/html/buttonset.hxx new file mode 100644 index 000000000000..6027ad4dbf01 --- /dev/null +++ b/sd/source/filter/html/buttonset.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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 _SD_HTMLEX_BUTTONSET_HXX +#define _SD_HTMLEX_BUTTONSET_HXX + +#include <rtl/ustring.hxx> +#include <boost/scoped_ptr.hpp> +#include <vector> + +class Image; +class ButtonSetImpl; + +class ButtonSet +{ +public: + ButtonSet(); + ~ButtonSet(); + + int getCount() const; + + bool getPreview( int nSet, const std::vector< rtl::OUString >& rButtons, Image& rImage ); + bool exportButton( int nSet, const rtl::OUString& rPath, const rtl::OUString& rName ); + +private: + ButtonSetImpl* mpImpl; +}; + +#endif // _SD_HTMLEX_BUTTONSET_HXX diff --git a/sd/source/filter/html/htmlattr.cxx b/sd/source/filter/html/htmlattr.cxx new file mode 100755 index 000000000000..4bcb73535ba1 --- /dev/null +++ b/sd/source/filter/html/htmlattr.cxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + +#include "htmlattr.hxx" +#include "htmlex.hxx" +#include <tools/link.hxx> +#include <vcl/decoview.hxx> + + +// ===================================================================== +// ===================================================================== +SdHtmlAttrPreview::SdHtmlAttrPreview( Window* pParent, const ResId& rResId ) +:Control( pParent, rResId ) +{ +// SetMapMode( MAP_100TH_MM ); +} + +// ===================================================================== +// ===================================================================== +SdHtmlAttrPreview::~SdHtmlAttrPreview() +{ +} + +// ===================================================================== +// ===================================================================== +void SdHtmlAttrPreview::Paint( const Rectangle& rRect ) +{ + DecorationView aDecoView( this ); + + Rectangle aTextRect; + aTextRect.SetSize(GetOutputSize()); + + SetLineColor(m_aBackColor); + SetFillColor(m_aBackColor); + DrawRect(rRect); + SetFillColor(); + + int nHeight = (aTextRect.nBottom - aTextRect.nTop) >> 2; + aTextRect.nBottom = nHeight + aTextRect.nTop; + + SetTextColor(m_aTextColor); + DrawText( aTextRect, String(SdResId(STR_HTMLATTR_TEXT)), + TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER ); + + aTextRect.Move(0,nHeight); + SetTextColor(m_aLinkColor); + DrawText( aTextRect, String(SdResId(STR_HTMLATTR_LINK)), + TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER ); + + aTextRect.Move(0,nHeight); + SetTextColor(m_aALinkColor); + DrawText( aTextRect, String(SdResId(STR_HTMLATTR_ALINK)), + TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER ); + + aTextRect.Move(0,nHeight); + SetTextColor(m_aVLinkColor); + DrawText( aTextRect, String(SdResId(STR_HTMLATTR_VLINK)), + TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER ); +} + +// ===================================================================== +// ===================================================================== +void SdHtmlAttrPreview::SetColors( Color& aBack, Color& aText, Color& aLink, + Color& aVLink, Color& aALink ) +{ + m_aBackColor = aBack; + m_aTextColor = aText; + m_aLinkColor = aLink; + m_aVLinkColor = aVLink; + m_aALinkColor = aALink; +} diff --git a/sd/source/filter/html/htmlattr.hxx b/sd/source/filter/html/htmlattr.hxx new file mode 100755 index 000000000000..1caa16822ab1 --- /dev/null +++ b/sd/source/filter/html/htmlattr.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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 _SD_HTMLATTR_HXX +#define _SD_HTMLATTR_HXX + +#include <vcl/ctrl.hxx> +#include <tools/color.hxx> + +class SdHtmlAttrPreview : public Control +{ +protected: + + Color m_aBackColor, m_aTextColor, m_aLinkColor; + Color m_aVLinkColor, m_aALinkColor; + +public: + SdHtmlAttrPreview( Window* pParent, const ResId& rResId ); + ~SdHtmlAttrPreview(); + + virtual void Paint( const Rectangle& rRect ); + + void SetColors( Color& aBack, Color& aText, Color& aLink, + Color& aVLink, Color& aALink ); +}; + +#endif // _SD_HTMLATTR_HXX diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx new file mode 100755 index 000000000000..9de46771e14c --- /dev/null +++ b/sd/source/filter/html/htmlex.cxx @@ -0,0 +1,3392 @@ +/************************************************************************* + * + * 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_sd.hxx" + +#include "htmlex.hxx" +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/document/XFilter.hpp> + +#include <rtl/uri.hxx> +#include <comphelper/processfactory.hxx> +#include <osl/file.hxx> +#include <tools/fsys.hxx> +#include <unotools/pathoptions.hxx> +#include <svtools/FilterConfigItem.hxx> +#ifndef _UNOTOOLS_UCBSTREAMHELPER_HXX +#include <unotools/ucbstreamhelper.hxx> +#endif +#include <unotools/localfilehelper.hxx> +#include <com/sun/star/frame/XStorable.hpp> +#include <sfx2/progress.hxx> +#include <sfx2/progress.hxx> +#include <vcl/wrkwin.hxx> +#include <svl/aeitem.hxx> +#include <svx/svditer.hxx> +#include <svtools/imaprect.hxx> +#include <svtools/imapcirc.hxx> +#include <svtools/imappoly.hxx> +#include <vcl/msgbox.hxx> +#include <sfx2/app.hxx> +#include <editeng/outlobj.hxx> +#include <editeng/editobj.hxx> +#include <svx/svdopath.hxx> +#include <svx/xoutbmp.hxx> +#include <svtools/htmlout.hxx> +#include <sfx2/docfile.hxx> +#include <vcl/cvtgrf.hxx> +#include <svtools/colorcfg.hxx> +#include <svtools/filter.hxx> +#include <editeng/colritem.hxx> +#include <editeng/editeng.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/crsditem.hxx> +#include <editeng/flditem.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/fcontnr.hxx> +#include <svl/style.hxx> +#define _SVSTDARR_USHORTS +#include <svl/svstdarr.hxx> +#include <editeng/frmdiritem.hxx> +#include <svx/svdoutl.hxx> +#include <tools/urlobj.hxx> // INetURLObject +#include <vcl/bmpacc.hxx> +#include <svtools/sfxecode.hxx> +#include <com/sun/star/beans/PropertyState.hpp> +#include <tools/resmgr.hxx> +#include "comphelper/anytostring.hxx" +#include "cppuhelper/exc_hlp.hxx" + +#include "drawdoc.hxx" +#include "Outliner.hxx" +#include "sdpage.hxx" +#include "sdattr.hxx" +#include "glob.hrc" +#include "anminfo.hxx" +#include "imapinfo.hxx" +#include "sdresid.hxx" +#include "buttonset.hxx" +#include <basegfx/polygon/b2dpolygon.hxx> + +using ::rtl::OUString; +using ::rtl::OString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::document; + +#define KEY_QUALITY "JPG-EXPORT-QUALITY" + +// Parameter aus Itemset abfragen + +#define RESTOHTML( res ) StringToHTMLString(String(SdResId(res))) +#define S2H( str ) StringToHTMLString( str ) + +// bei Aenderungen auch NUM_BUTTONS in pubdlg.hxx aendern!! +const char *pButtonNames[NUM_BUTTONS] = +{ + "first-inactive.png", + "first.png", + "left-inactive.png", + "left.png", + "right-inactive.png", + "right.png", + "last-inactive.png", + "last.png", + "home.png", + "text.png", + "expand.png", + "collapse.png", +}; + +#define BTN_FIRST_0 0 +#define BTN_FIRST_1 1 +#define BTN_PREV_0 2 +#define BTN_PREV_1 3 +#define BTN_NEXT_0 4 +#define BTN_NEXT_1 5 +#define BTN_LAST_0 6 +#define BTN_LAST_1 7 +#define BTN_INDEX 8 +#define BTN_TEXT 9 +#define BTN_MORE 10 +#define BTN_LESS 11 + +// Fuer Detectfilter +#define CALC_OPTIONS "9,34,SYSTEM" + +// ********************************************************************* +// Hilfsklasse fuer das simple erzeugen von Dateien lokal/remote +// ********************************************************************* +class EasyFile +{ +private: + SvStream* pOStm; + SfxMedium* pMedium; + bool bOpen; + +public: + + EasyFile(); + ~EasyFile(); + + ULONG createStream( const String& rUrl, SvStream*& rpStr ); + ULONG createFileName( const String& rUrl, String& rFileName ); + ULONG close(); +}; + +// ********************************************************************* +// Hilfsklasse fuer das einbinden von Textattributen in die Html-Ausgabe +// ********************************************************************* +class HtmlState +{ +private: + bool mbColor; + bool mbWeight; + bool mbItalic; + bool mbUnderline; + bool mbStrike; + bool mbLink; + Color maColor; + Color maDefColor; + String maLink; + String maTarget; + +public: + HtmlState( Color aDefColor ); + + String SetWeight( bool bWeight ); + String SetItalic( bool bItalic ); + String SetUnderline( bool bUnderline ); + String SetColor( Color aColor ); + String SetStrikeout( bool bStrike ); + String SetLink( const String& aLink, const String& aTarget ); + String Flush(); +}; + +// ===================================================================== +// alle noch offennen Tags schliessen +// ===================================================================== +String HtmlState::Flush() +{ + String aStr, aEmpty; + + aStr += SetWeight(false); + aStr += SetItalic(false); + aStr += SetUnderline(false); + aStr += SetStrikeout(false); + aStr += SetColor(maDefColor); + aStr += SetLink(aEmpty,aEmpty); + + return aStr; +} + +// ===================================================================== +// c'tor mit Defaultfarbe fuer die Seite +// ===================================================================== +HtmlState::HtmlState( Color aDefColor ) +{ + mbColor = false; + mbWeight = false; + mbItalic = false; + mbUnderline = false; + mbLink = false; + mbStrike = false; + maDefColor = aDefColor; +} + +// ===================================================================== +// aktiviert/deaktiviert Fettdruck +// ===================================================================== +String HtmlState::SetWeight( bool bWeight ) +{ + String aStr; + + if(bWeight && !mbWeight) + aStr.AppendAscii( "<b>" ); + else if(!bWeight && mbWeight) + aStr.AppendAscii( "</b>" ); + + mbWeight = bWeight; + return aStr; +} + +// ===================================================================== +// aktiviert/deaktiviert Italic +// ===================================================================== +String HtmlState::SetItalic( bool bItalic ) +{ + String aStr; + + if(bItalic && !mbItalic) + aStr.AppendAscii( "<i>" ); + else if(!bItalic && mbItalic) + aStr.AppendAscii( "</i>" ); + + mbItalic = bItalic; + return aStr; +} + +// ===================================================================== +// aktiviert/deaktiviert Unterstrichen +// ===================================================================== +String HtmlState::SetUnderline( bool bUnderline ) +{ + String aStr; + + if(bUnderline && !mbUnderline) + aStr.AppendAscii( "<u>" ); + else if(!bUnderline && mbUnderline) + aStr.AppendAscii( "</u>" ); + + mbUnderline = bUnderline; + return aStr; +} + +// ===================================================================== +// aktiviert/deaktiviert Durchstreichen +// ===================================================================== +String HtmlState::SetStrikeout( bool bStrike ) +{ + String aStr; + + if(bStrike && !mbStrike) + aStr.AppendAscii( "<strike>" ); + else if(!bStrike && mbStrike) + aStr.AppendAscii( "</strike>" ); + + mbStrike = bStrike; + return aStr; +} + +// ===================================================================== +// Setzt die angegebenne Textfarbe +// ===================================================================== +String HtmlState::SetColor( Color aColor ) +{ + String aStr; + + if(mbColor && aColor == maColor) + return aStr; + + if(mbColor) + { + aStr.AppendAscii( "</font>" ); + mbColor = false; + } + + if(aColor != maDefColor) + { + maColor = aColor; + + aStr.AppendAscii( "<font color=\"" ); + aStr += HtmlExport::ColorToHTMLString(aColor); + aStr.AppendAscii( "\">" ); + + mbColor = true; + } + + return aStr; +} + +// ===================================================================== +// aktiviert/deaktiviert einen Hyperlink +// ===================================================================== +String HtmlState::SetLink( const String& aLink, const String& aTarget ) +{ + String aStr; + + if(mbLink&&maLink == aLink&&maTarget==aTarget) + return aStr; + + if(mbLink) + { + aStr.AppendAscii( "</a>" ); + mbLink = false; + } + + if(aLink.Len()) + { + aStr.AppendAscii( "<a href=\"" ); + aStr += HtmlExport::StringToURL(aLink); + if(aTarget.Len()) + { + aStr.AppendAscii( "\" target=\"" ); + aStr += aTarget; + } + aStr.AppendAscii( "\">" ); + mbLink = true; + maLink = aLink; + maTarget = aTarget; + } + + return aStr; +} + +// ********************************************************************* +// class HtmlExport Methoden +// ********************************************************************* + +static String getParagraphStyle( SdrOutliner* pOutliner, USHORT nPara ) +{ + SfxItemSet aParaSet( pOutliner->GetParaAttribs( nPara ) ); + + String sStyle( RTL_CONSTASCII_USTRINGPARAM("direction:") ); + if( static_cast<const SvxFrameDirectionItem*>(aParaSet.GetItem( EE_PARA_WRITINGDIR ))->GetValue() == FRMDIR_HORI_RIGHT_TOP ) + { + sStyle += String( RTL_CONSTASCII_USTRINGPARAM("rtl;") ); + } + else + { + sStyle += String( RTL_CONSTASCII_USTRINGPARAM("ltr;") ); + } + return sStyle; +} + +// ===================================================================== +// Konstruktor fuer die Html Export Hilfsklasse +// ===================================================================== +HtmlExport::HtmlExport( + OUString aPath, + const Sequence< PropertyValue >& rParams, + SdDrawDocument* pExpDoc, + ::sd::DrawDocShell* pDocShell ) + : maPath( aPath ), + mpDoc(pExpDoc), + mpDocSh( pDocShell ), + meEC(NULL), + meMode( PUBLISH_HTML ), + mbContentsPage(false), + mnButtonThema(-1), + mnWidthPixel( PUB_LOWRES_WIDTH ), + meFormat( FORMAT_JPG ), + mbNotes(false), + mnCompression( -1 ), + mbDownload( false ), + mbSlideSound(true), + mbHiddenSlides(true), + mbUserAttr(false), + mbDocColors(false), + maHTMLExtension(SdResId(STR_HTMLEXP_DEFAULT_EXTENSION)), + mpHTMLFiles(NULL), + mpImageFiles(NULL), + mpPageNames(NULL), + mpTextFiles(NULL), + maIndexUrl(RTL_CONSTASCII_USTRINGPARAM("index")), + meScript( SCRIPT_ASP ), + maHTMLHeader( RTL_CONSTASCII_USTRINGPARAM( + "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n" + " \"http://www.w3.org/TR/html4/transitional.dtd\">\r\n" + "<html>\r\n<head>\r\n" ) ), + mpButtonSet( new ButtonSet() ) +{ + bool bChange = mpDoc->IsChanged(); + + maIndexUrl += maHTMLExtension; + + InitExportParameters( rParams ); + + switch( meMode ) + { + case PUBLISH_HTML: + case PUBLISH_FRAMES: + ExportHtml(); + break; + case PUBLISH_WEBCAST: + ExportWebCast(); + break; + case PUBLISH_KIOSK: + ExportKiosk(); + break; + } + + mpDoc->SetChanged(bChange); +} + +HtmlExport::~HtmlExport() +{ + // ------------------------------------------------------------------ + // Listen loeschen + // ------------------------------------------------------------------ + if(mpImageFiles && mpHTMLFiles && mpPageNames && mpTextFiles) + { + for ( USHORT nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++) + { + delete mpImageFiles[nSdPage]; + delete mpHTMLFiles[nSdPage]; + delete mpPageNames[nSdPage]; + delete mpTextFiles[nSdPage]; + } + } + + delete[] mpImageFiles; + delete[] mpHTMLFiles; + delete[] mpPageNames; + delete[] mpTextFiles; +} + +/** get common export parameters from item set */ +void HtmlExport::InitExportParameters( const Sequence< PropertyValue >& rParams ) +{ + mbImpress = mpDoc && mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS; + + sal_Int32 nArgs = rParams.getLength(); + const PropertyValue* pParams = rParams.getConstArray(); + OUString aStr; + while( nArgs-- ) + { + if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PublishMode" ) ) ) + { + sal_Int32 temp = 0; + pParams->Value >>= temp; + meMode = (HtmlPublishMode)temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IndexURL" ) ) ) + { + pParams->Value >>= aStr; + maIndexUrl = aStr; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Format" ) ) ) + { + sal_Int32 temp = 0; + pParams->Value >>= temp; + meFormat = (PublishingFormat)temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Compression" ) ) ) + { + pParams->Value >>= aStr; + String aTmp( aStr ); + if(aTmp.Len()) + { + xub_StrLen nPos = aTmp.Search( '%' ); + if(nPos != STRING_NOTFOUND) + aTmp.Erase(nPos,1); + mnCompression = (INT16)aTmp.ToInt32(); + } + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) ) ) + { + sal_Int32 temp = 0; + pParams->Value >>= temp; + mnWidthPixel = (sal_uInt16)temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UseButtonSet" ) ) ) + { + sal_Int32 temp = 0; + pParams->Value >>= temp; + mnButtonThema = (sal_Int16)temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsExportNotes" ) ) ) + { + if( mbImpress ) + { + sal_Bool temp = sal_False; + pParams->Value >>= temp; + mbNotes = temp; + } + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsExportContentsPage" ) ) ) + { + sal_Bool temp = sal_False; + pParams->Value >>= temp; + mbContentsPage = temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Author" ) ) ) + { + pParams->Value >>= aStr; + maAuthor = aStr; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EMail" ) ) ) + { + pParams->Value >>= aStr; + maEMail = aStr; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HomepageURL" ) ) ) + { + pParams->Value >>= aStr; + maHomePage = aStr; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UserText" ) ) ) + { + pParams->Value >>= aStr; + maInfo = aStr; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EnableDownload" ) ) ) + { + sal_Bool temp = sal_False; + pParams->Value >>= temp; + mbDownload = temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SlideSound" ) ) ) + { + sal_Bool temp = sal_True; + pParams->Value >>= temp; + mbSlideSound = temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HiddenSlides" ) ) ) + { + sal_Bool temp = sal_True; + pParams->Value >>= temp; + mbHiddenSlides = temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BackColor" ) ) ) + { + sal_Int32 temp = 0; + pParams->Value >>= temp; + maBackColor = temp; + mbUserAttr = true; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TextColor" ) ) ) + { + sal_Int32 temp = 0; + pParams->Value >>= temp; + maTextColor = temp; + mbUserAttr = true; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LinkColor" ) ) ) + { + sal_Int32 temp = 0; + pParams->Value >>= temp; + maLinkColor = temp; + mbUserAttr = true; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VLinkColor" ) ) ) + { + sal_Int32 temp = 0; + pParams->Value >>= temp; + maVLinkColor = temp; + mbUserAttr = true; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ALinkColor" ) ) ) + { + sal_Int32 temp = 0; + pParams->Value >>= temp; + maALinkColor = temp; + mbUserAttr = true; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsUseDocumentColors" ) ) ) + { + sal_Bool temp = sal_False; + pParams->Value >>= temp; + mbDocColors = temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "KioskSlideDuration" ) ) ) + { + sal_Int32 temp = sal_False; + pParams->Value >>= temp; + mnSlideDuration = temp; + mbAutoSlide = true; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "KioskEndless" ) ) ) + { + sal_Bool temp = sal_False; + pParams->Value >>= temp; + mbEndless = temp; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "WebCastCGIURL" ) ) ) + { + pParams->Value >>= aStr; + maCGIPath = aStr; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "WebCastTargetURL" ) ) ) + { + pParams->Value >>= aStr; + maURLPath = aStr; + } + else if( pParams->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "WebCastScriptLanguage" ) ) ) + { + pParams->Value >>= aStr; + if( aStr.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "asp" ) ) ) + { + meScript = SCRIPT_ASP; + } + else + { + meScript = SCRIPT_PERL; + } + } + else + { + DBG_ERROR("Unknown property for html export detected!"); + } + + pParams++; + } + + if( meMode == PUBLISH_KIOSK ) + { + mbContentsPage = false; + mbNotes = false; + + } + + // calculate image sizes + SdPage* pPage = mpDoc->GetSdPage(0, PK_STANDARD); + Size aTmpSize( pPage->GetSize() ); + double dRatio=((double)aTmpSize.Width())/aTmpSize.Height(); + +/* + switch( mnWidthPixel ) + { + case 800: + mnWidthPixel = 640; + break; + case 1024: + mnWidthPixel = 800; + break; + case 640: + default: + mnWidthPixel = 512; + break; + } +*/ + mnHeightPixel = (USHORT)(mnWidthPixel/dRatio); + + //------------------------------------------------------------------ + // Ziel ausklamuestern... + + INetURLObject aINetURLObj( maPath ); + DBG_ASSERT( aINetURLObj.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + maExportPath = aINetURLObj.GetPartBeforeLastName(); // with trailing '/' + maIndex = aINetURLObj.GetLastName(); + + mnSdPageCount = mpDoc->GetSdPageCount( PK_STANDARD ); +// USHORT nHiddenSlides = 0; + for( USHORT nPage = 0; nPage < mnSdPageCount; nPage++ ) + { + pPage = mpDoc->GetSdPage( nPage, PK_STANDARD ); + + if( mbHiddenSlides || !pPage->IsExcluded() ) + { + maPages.push_back( pPage ); + maNotesPages.push_back( mpDoc->GetSdPage( nPage, PK_NOTES ) ); + } + } + mnSdPageCount = maPages.size(); + + mbFrames = meMode == PUBLISH_FRAMES; + + maDocFileName = maIndex; +} + +/////////////////////////////////////////////////////////////////////// +// Exportiert das im Konstruktor angegebenne Impress Dokument nach HTML +/////////////////////////////////////////////////////////////////////// +void HtmlExport::ExportHtml() +{ + if(mbUserAttr) + { + if( maTextColor == COL_AUTO ) + { + if( !maBackColor.IsDark() ) + maTextColor = COL_BLACK; + } + } + else if( mbDocColors ) + { + // Standard Farben fuer das Farbschema 'Aus Dokument' + SetDocColors(); + maFirstPageColor = maBackColor; + } + + // get name for downloadable presentation if needed + if( mbDownload ) + { + // Separator such und Extension ausblenden + USHORT nSepPos = maDocFileName.Search( sal_Unicode('.') ); + + if(nSepPos != STRING_NOTFOUND) + maDocFileName.Erase(nSepPos); + + maDocFileName.AppendAscii( ".odp" ); + } + + ////// + + USHORT nProgrCount = mnSdPageCount; + nProgrCount += mbImpress?mnSdPageCount:0; + nProgrCount += mbContentsPage?1:0; + nProgrCount += (mbFrames && mbNotes)?mnSdPageCount:0; + nProgrCount += (mbFrames)?8:0; + InitProgress( nProgrCount ); + + mpDocSh->SetWaitCursor( true ); + + //------------------------------------------------------------------ + // Exceptions sind doch was schoennes... + + CreateFileNames(); + + // this is not a true while + while( 1 ) + { + if( checkForExistingFiles() ) + break; + + if( !CreateImagesForPresPages() ) + break; + + if( !CreateHtmlForPresPages() ) + break; + + if( mbImpress ) + if( !CreateHtmlTextForPresPages() ) + break; + + if( mbFrames ) + { + if( !CreateFrames() ) + break; + + if( !CreateOutlinePages() ) + break; + + if( !CreateNavBarFrames() ) + break; + + if( mbNotes && mbImpress ) + if( !CreateNotesPages() ) + break; + + } + + if( mbContentsPage ) + if( !CreateContentPage() ) + break; + + if( !CreateBitmaps() ) + break; + + mpDocSh->SetWaitCursor( false ); + ResetProgress(); + + if( mbDownload ) + SavePresentation(); + + return; + } + + // if we get to this point the export was + // canceled by the user after an error + mpDocSh->SetWaitCursor( false ); + ResetProgress(); +} + +/////////////////////////////////////////////////////////////////////// + +void HtmlExport::SetDocColors( SdPage* pPage ) +{ + if( pPage == NULL ) + pPage = mpDoc->GetSdPage(0, PK_STANDARD); + + svtools::ColorConfig aConfig; + maVLinkColor = Color(aConfig.GetColorValue(svtools::LINKSVISITED).nColor); + maALinkColor = Color(aConfig.GetColorValue(svtools::LINKS).nColor); + maLinkColor = Color(aConfig.GetColorValue(svtools::LINKS).nColor); + maTextColor = Color(COL_BLACK); + + SfxStyleSheet* pSheet = NULL; + + if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ) + { + // Standard Textfarbe aus Outline-Vorlage der ersten Seite + pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_OUTLINE); + if(pSheet == NULL) + pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_TEXT); + if(pSheet == NULL) + pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_TITLE); + } + + if(pSheet == NULL) + pSheet = mpDoc->GetDefaultStyleSheet(); + + if(pSheet) + { + SfxItemSet& rSet = pSheet->GetItemSet(); + if(rSet.GetItemState(EE_CHAR_COLOR,TRUE) == SFX_ITEM_ON) + maTextColor = ((SvxColorItem*)rSet.GetItem(EE_CHAR_COLOR,TRUE))->GetValue(); + } + + // Standard Hintergrundfarbe aus Background der MasterPage der ersten Seite + maBackColor = pPage->GetPageBackgroundColor(); + + if( maTextColor == COL_AUTO ) + { + if( !maBackColor.IsDark() ) + maTextColor = COL_BLACK; + } +} + +/////////////////////////////////////////////////////////////////////// + +void HtmlExport::InitProgress( USHORT nProgrCount ) +{ + String aStr(SdResId(STR_CREATE_PAGES)); + mpProgress = new SfxProgress( mpDocSh, aStr, nProgrCount ); +} + +/////////////////////////////////////////////////////////////////////// + +void HtmlExport::ResetProgress() +{ + delete mpProgress; + mpProgress = NULL; +} + +/////////////////////////////////////////////////////////////////////// + +void HtmlExport::ExportKiosk() +{ + mnPagesWritten = 0; + InitProgress( 2*mnSdPageCount ); + + CreateFileNames(); + if( !checkForExistingFiles() ) + { + if( CreateImagesForPresPages() ) + CreateHtmlForPresPages(); + } + + ResetProgress(); +} + +/////////////////////////////////////////////////////////////////////// +// Export Document with WebCast (TM) Technology +/////////////////////////////////////////////////////////////////////// +void HtmlExport::ExportWebCast() +{ + mnPagesWritten = 0; + InitProgress( mnSdPageCount + 9 ); + + mpDocSh->SetWaitCursor( TRUE ); + + CreateFileNames(); + + String aEmpty; + if(maCGIPath.Len() == 0) + maCGIPath.Assign( sal_Unicode('.') ); + + if( maCGIPath.GetChar( maCGIPath.Len() - 1 ) != sal_Unicode('/') ) + maCGIPath.Append( sal_Unicode('/') ); + + if( meScript == SCRIPT_ASP ) + { + maURLPath.AssignAscii( "./" ); + } + else + { + String aEmpty2; + if(maURLPath.Len() == 0) + maURLPath.Assign( sal_Unicode('.') ); + + if( maURLPath.GetChar( maURLPath.Len() - 1 ) != sal_Unicode('/') ) + maURLPath.Append( sal_Unicode('/') ); + } + + // this is not a true while + while(1) + { + if( checkForExistingFiles() ) + break; + + if(!CreateImagesForPresPages()) + break; + + if( meScript == SCRIPT_ASP ) + { + if(!CreateASPScripts()) + break; + } + else + { + if(!CreatePERLScripts()) + break; + } + + if(!CreateImageFileList()) + break; + + if(!CreateImageNumberFile()) + break; + + break; + } + + mpDocSh->SetWaitCursor( false ); + ResetProgress(); +} + +/////////////////////////////////////////////////////////////////////// +// Save the presentation as a downloadable file in the dest directory +/////////////////////////////////////////////////////////////////////// + +bool HtmlExport::SavePresentation() +{ + meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, maDocFileName ); + + OUString aURL( maExportPath ); + aURL += maDocFileName; + + + mpDocSh->EnableSetModified( true ); + + try + { + uno::Reference< frame::XStorable > xStorable( mpDoc->getUnoModel(), uno::UNO_QUERY ); + if( xStorable.is() ) + { + uno::Sequence< beans::PropertyValue > aProperties( 2 ); + aProperties[ 0 ].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Overwrite")); + aProperties[ 0 ].Value <<= (sal_Bool)sal_True; + aProperties[ 1 ].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")); + aProperties[ 1 ].Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("impress8")); + xStorable->storeToURL( aURL, aProperties ); + + mpDocSh->EnableSetModified( false ); + + return true; + } + } + catch( Exception& ) + { + } + + mpDocSh->EnableSetModified( false ); + + return false; +} + +// ===================================================================== +// Image-Dateien anlegen +// ===================================================================== +bool HtmlExport::CreateImagesForPresPages() +{ + try + { + Reference < XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); + if( !xMSF.is() ) + return false; + + Reference< XExporter > xGraphicExporter( xMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicExportFilter") ) ), UNO_QUERY ); + Reference< XFilter > xFilter( xGraphicExporter, UNO_QUERY ); + + DBG_ASSERT( xFilter.is(), "no com.sun.star.drawing.GraphicExportFilter?" ); + if( !xFilter.is() ) + return false; + + Sequence< PropertyValue > aFilterData(((meFormat==FORMAT_JPG)&&(mnCompression != -1))? 3 : 2); + aFilterData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PixelWidth") ); + aFilterData[0].Value <<= (sal_Int32)mnWidthPixel; + aFilterData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PixelHeight") ); + aFilterData[1].Value <<= (sal_Int32)mnHeightPixel; + if((meFormat==FORMAT_JPG)&&(mnCompression != -1)) + { + aFilterData[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Quality") ); + aFilterData[2].Value <<= (sal_Int32)mnCompression; + } + + Sequence< PropertyValue > aDescriptor( 3 ); + aDescriptor[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ); + aDescriptor[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") ); + OUString sFormat; + if( meFormat == FORMAT_PNG ) + sFormat = OUString( RTL_CONSTASCII_USTRINGPARAM("PNG") ); + else if( meFormat == FORMAT_GIF ) + sFormat = OUString( RTL_CONSTASCII_USTRINGPARAM("GIF") ); + else + sFormat = OUString( RTL_CONSTASCII_USTRINGPARAM("JPG") ); + + aDescriptor[1].Value <<= sFormat; + aDescriptor[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterData") ); + aDescriptor[2].Value <<= aFilterData; + + for (USHORT nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++) + { + SdPage* pPage = maPages[ nSdPage ]; + + OUString aFull(maExportPath); + aFull += *mpImageFiles[nSdPage]; + + aDescriptor[0].Value <<= aFull; + + Reference< XComponent > xPage( pPage->getUnoPage(), UNO_QUERY ); + xGraphicExporter->setSourceDocument( xPage ); + xFilter->filter( aDescriptor ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + } + } + catch( Exception& ) + { + return false; + } + + return true; +} + +// ===================================================================== +// Ermittelt das SdrTextObject mit dem Layout Text dieser Seite +// ===================================================================== +SdrTextObj* HtmlExport::GetLayoutTextObject(SdrPage* pPage) +{ + ULONG nObjectCount = pPage->GetObjCount(); + SdrObject* pObject = NULL; + SdrTextObj* pResult = NULL; + + for (ULONG nObject = 0; nObject < nObjectCount; nObject++) + { + pObject = pPage->GetObj(nObject); + if (pObject->GetObjInventor() == SdrInventor && + pObject->GetObjIdentifier() == OBJ_OUTLINETEXT) + { + pResult = (SdrTextObj*)pObject; + break; + } + } + return pResult; +} + +// ===================================================================== +// HTML-Text Versionen fuer Impress Seiten erzeugen +// ===================================================================== + +String HtmlExport::WriteMetaCharset() const +{ + String aStr; + const sal_Char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 ); + if ( pCharSet ) + { + aStr.AppendAscii( " <meta HTTP-EQUIV=CONTENT-TYPE CONTENT=\"text/html; charset=" ); + aStr.AppendAscii( pCharSet ); + aStr.AppendAscii( "\">\r\n" ); + } + return aStr; +} + +bool HtmlExport::CreateHtmlTextForPresPages() +{ + bool bOk = true; + + SdrOutliner* pOutliner = mpDoc->GetInternalOutliner(); + + for(USHORT nSdPage = 0; nSdPage < mnSdPageCount && bOk; nSdPage++) + { + SdPage* pPage = maPages[ nSdPage ]; + + if( mbDocColors ) + { + SetDocColors( pPage ); +// maBackColor = pPage->GetPageBackgroundColor(); + } + +// HTML Kopf + String aStr(maHTMLHeader); + aStr += WriteMetaCharset(); + aStr.AppendAscii( " <title>" ); + aStr += StringToHTMLString( *mpPageNames[nSdPage] ); + aStr.AppendAscii( "</title>\r\n" ); + aStr.AppendAscii( "</head>\r\n" ); + aStr += CreateBodyTag(); + +// Navigationsleiste + aStr += CreateNavBar(nSdPage, true); + +// Seitentitel + String sTitleText( CreateTextForTitle(pOutliner,pPage, pPage->GetPageBackgroundColor()) ); + aStr.AppendAscii( "<h1 style=\""); + aStr.Append( getParagraphStyle( pOutliner, 0 ) ); + aStr.AppendAscii( "\">" ); + aStr += sTitleText; + aStr.AppendAscii( "</h1>\r\n" ); + +// Gliederungstext schreiben + aStr += CreateTextForPage( pOutliner, pPage, true, pPage->GetPageBackgroundColor() ); + +// Notizen + if(mbNotes) + { + SdPage* pNotesPage = maNotesPages[ nSdPage ]; + String aNotesStr( CreateTextForNotesPage( pOutliner, pNotesPage, true, maBackColor) ); + + if( aNotesStr.Len() ) + { + aStr.AppendAscii( "<br>\r\n<h3>" ); + aStr += RESTOHTML(STR_HTMLEXP_NOTES); + aStr.AppendAscii( ":</h3>\r\n" ); + + aStr += aNotesStr; + } + } + +// Seite beenden + aStr.AppendAscii( "</body>\r\n</html>" ); + + bOk = WriteHtml( *mpTextFiles[nSdPage], false, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + + } + + pOutliner->Clear(); + + return bOk; +} + +/** exports the given html data into a non unicode file in the current export path with + the given filename */ +bool HtmlExport::WriteHtml( const String& rFileName, bool bAddExtension, const String& rHtmlData ) +{ + ULONG nErr = 0; + + String aFileName( rFileName ); + if( bAddExtension ) + aFileName += maHTMLExtension; + + meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, rFileName ); + EasyFile aFile; + SvStream* pStr; + String aFull( maExportPath ); + aFull += aFileName; + nErr = aFile.createStream(aFull , pStr); + if(nErr == 0) + { + ByteString aStr( rHtmlData , RTL_TEXTENCODING_UTF8 ) ; + *pStr << aStr.GetBuffer(); + nErr = aFile.close(); + } + + if( nErr != 0 ) + ErrorHandler::HandleError(nErr); + + return nErr == 0; +} + +// ===================================================================== + +/** Erzeugt den Outliner Text fuer das Titelobjekt einer Seite + */ +String HtmlExport::CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor ) +{ + SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_TITLE); + if(!pTO) + pTO = GetLayoutTextObject(pPage); + + if (pTO && !pTO->IsEmptyPresObj()) + { + OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject(); + if(pOPO && pOutliner->GetParagraphCount() != 0) + { + pOutliner->Clear(); + pOutliner->SetText(*pOPO); + return ParagraphToHTMLString(pOutliner,0, rBackgroundColor); + } + } + + return String(); +} + +// ===================================================================== +// Erzeugt den Outliner Text fuer eine Seite +// ===================================================================== +String HtmlExport::CreateTextForPage( SdrOutliner* pOutliner, + SdPage* pPage, + bool bHeadLine, const Color& rBackgroundColor ) +{ + String aStr; + + SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_TEXT); + if(!pTO) + pTO = GetLayoutTextObject(pPage); + + if (pTO && !pTO->IsEmptyPresObj()) + { + OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject(); + if (pOPO) + { + pOutliner->Clear(); + pOutliner->SetText( *pOPO ); + + ULONG nCount = pOutliner->GetParagraphCount(); + + Paragraph* pPara = NULL; + sal_Int16 nActDepth = -1; + + String aParaText; + for (ULONG nPara = 0; nPara < nCount; nPara++) + { + pPara = pOutliner->GetParagraph(nPara); + if(pPara == 0) + continue; + + const sal_Int16 nDepth = (USHORT) pOutliner->GetDepth( (USHORT) nPara ); + aParaText = ParagraphToHTMLString(pOutliner,nPara,rBackgroundColor); + + if(aParaText.Len() == 0) + continue; + + if(nDepth < nActDepth ) + { + do + { + aStr.AppendAscii( "</ul>" ); + nActDepth--; + } + while(nDepth < nActDepth); + } + else if(nDepth > nActDepth ) + { + do + { + aStr.AppendAscii( "<ul>" ); + nActDepth++; + } + while( nDepth > nActDepth ); + } + + String sStyle( getParagraphStyle( pOutliner, nPara ) ); + if(nActDepth >= 0 ) + { + aStr.AppendAscii( "<li style=\""); + aStr.Append( sStyle ); + aStr.AppendAscii( "\">" ); + } + + if(nActDepth <= 0 && bHeadLine) + { + if( nActDepth == 0 ) + { + aStr.AppendAscii( "<h2>" ); + } + else + { + aStr.AppendAscii( "<h2 style=\""); + aStr.Append( sStyle ); + aStr.AppendAscii( "\">" ); + } + } + aStr += aParaText; + if(nActDepth == 0 && bHeadLine) + aStr.AppendAscii( "</h2>" ); + if(nActDepth >= 0 ) + aStr.AppendAscii( "</li>" ); + aStr.AppendAscii( "\r\n" ); + } + + while( nActDepth >= 0 ) + { + aStr.AppendAscii( "</ul>" ); + nActDepth--; + }; + } + } + + return aStr; +} + +// ===================================================================== +// Erzeugt den Outliner Text fuer eine Notizseite +// ===================================================================== +String HtmlExport::CreateTextForNotesPage( SdrOutliner* pOutliner, + SdPage* pPage, + bool, + const Color& rBackgroundColor ) +{ + String aStr; + + SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_NOTES); + + if (pTO && !pTO->IsEmptyPresObj()) + { + OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject(); + if (pOPO) + { + pOutliner->Clear(); + pOutliner->SetText( *pOPO ); + + ULONG nCount = pOutliner->GetParagraphCount(); + for (ULONG nPara = 0; nPara < nCount; nPara++) + { + aStr.AppendAscii("<p style=\""); + aStr.Append( getParagraphStyle( pOutliner, nPara ) ); + aStr.AppendAscii("\">"); + aStr += ParagraphToHTMLString( pOutliner, nPara,rBackgroundColor ); + aStr.AppendAscii( "</p>\r\n" ); + } + } + } + + return aStr; +} + +// ===================================================================== +// Wandelt einen Paragraphen des Outliners in Html +// ===================================================================== +String HtmlExport::ParagraphToHTMLString( SdrOutliner* pOutliner, ULONG nPara, const Color& rBackgroundColor ) +{ + String aStr; + + if(NULL == pOutliner) + return aStr; + + // TODO: MALTE!!! + EditEngine& rEditEngine = *(EditEngine*)&pOutliner->GetEditEngine(); + bool bOldUpdateMode = rEditEngine.GetUpdateMode(); + rEditEngine.SetUpdateMode(TRUE); + + Paragraph* pPara = pOutliner->GetParagraph(nPara); + if(NULL == pPara) + return aStr; + + HtmlState aState( (mbUserAttr || mbDocColors) ? maTextColor : Color(COL_BLACK) ); + SvUShorts aPortionList; + rEditEngine.GetPortions( (USHORT) nPara, aPortionList ); + USHORT nPortionCount = aPortionList.Count(); + + USHORT nPos1 = 0; + for( USHORT nPortion = 0; nPortion < nPortionCount; nPortion++ ) + { + USHORT nPos2 = aPortionList.GetObject(nPortion); + + ESelection aSelection( (USHORT) nPara, nPos1, (USHORT) nPara, nPos2); + + SfxItemSet aSet( rEditEngine.GetAttribs( aSelection ) ); + + String aPortion(StringToHTMLString(rEditEngine.GetText( aSelection ))); + + aStr += TextAttribToHTMLString( &aSet, &aState, rBackgroundColor ); + aStr += aPortion; + + nPos1 = nPos2; + } + aStr += aState.Flush(); + rEditEngine.SetUpdateMode(bOldUpdateMode); + + return aStr; +} + +// ===================================================================== +// Erzeugt anhand der Attribute im angegebennen Set und dem gegebennen +// HtmlState die noetigen Html-Tags um die Attribute zu uebernehmen +// ===================================================================== +String HtmlExport::TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState, const Color& rBackgroundColor ) +{ + String aStr; + + if(NULL == pSet) + return aStr; + + String aLink, aTarget; + if ( pSet->GetItemState( EE_FEATURE_FIELD ) == SFX_ITEM_ON ) + { + SvxFieldItem* pItem = (SvxFieldItem*)pSet->GetItem( EE_FEATURE_FIELD ); + if(pItem) + { + SvxURLField* pURL = PTR_CAST(SvxURLField, pItem->GetField()); + if(pURL) + { + aLink = pURL->GetURL(); + aTarget = pURL->GetTargetFrame(); + } + } + } + + bool bTemp; + String aTemp; + + if ( pSet->GetItemState( EE_CHAR_WEIGHT ) == SFX_ITEM_ON ) + { + bTemp = ((const SvxWeightItem&)pSet->Get( EE_CHAR_WEIGHT )).GetWeight() == WEIGHT_BOLD; + aTemp = pState->SetWeight( bTemp ); + if( bTemp ) + aStr.Insert( aTemp, 0 ); + else + aStr += aTemp; + } + + if ( pSet->GetItemState( EE_CHAR_UNDERLINE ) == SFX_ITEM_ON ) + { + bTemp = ((const SvxUnderlineItem&)pSet->Get( EE_CHAR_UNDERLINE )).GetLineStyle() != UNDERLINE_NONE; + aTemp = pState->SetUnderline( bTemp ); + if( bTemp ) + aStr.Insert( aTemp, 0 ); + else + aStr += aTemp; + } + + if ( pSet->GetItemState( EE_CHAR_STRIKEOUT ) == SFX_ITEM_ON ) + { + bTemp = ((const SvxCrossedOutItem&)pSet->Get( EE_CHAR_STRIKEOUT )).GetStrikeout() != STRIKEOUT_NONE; + aTemp = pState->SetStrikeout( bTemp ); + if( bTemp ) + aStr.Insert( aTemp, 0 ); + else + aStr += aTemp; + } + + if ( pSet->GetItemState( EE_CHAR_ITALIC ) == SFX_ITEM_ON ) + { + bTemp = ((const SvxPostureItem&)pSet->Get( EE_CHAR_ITALIC )).GetPosture() != ITALIC_NONE; + aTemp = pState->SetItalic( bTemp ); + if( bTemp ) + aStr.Insert( aTemp, 0 ); + else + aStr += aTemp; + } + + if(mbDocColors) + { + if ( pSet->GetItemState( EE_CHAR_COLOR ) == SFX_ITEM_ON ) + { + Color aTextColor = ((const SvxColorItem&) pSet->Get( EE_CHAR_COLOR )).GetValue(); + if( aTextColor == COL_AUTO ) + { + if( !rBackgroundColor.IsDark() ) + aTextColor = COL_BLACK; + } + aStr += pState->SetColor( aTextColor ); + } + } + + if( aLink.Len() ) + aStr.Insert( pState->SetLink(aLink, aTarget), 0 ); + else + aStr += pState->SetLink(aLink, aTarget); + + return aStr; +} + +// ===================================================================== +// HTML-Wrapper fuer Bild-Dateien erzeugen +// ===================================================================== +bool HtmlExport::CreateHtmlForPresPages() +{ + bool bOk = true; + + List aClickableObjects; + + for(USHORT nSdPage = 0; nSdPage < mnSdPageCount && bOk; nSdPage++) + { + // Klickbare Objekte finden (auch auf der Masterpage) und + // in Liste stellen. In umgekehrter Zeichenreihenfolge in + // die Liste stellen, da in HTML bei Ueberlappungen die + // _erstgenannte_ Area wirkt. + + SdPage* pPage = maPages[ nSdPage ]; + + if( mbDocColors ) + { + SetDocColors( pPage ); + } + + bool bMasterDone = false; + + while (!bMasterDone) + { + // TRUE = rueckwaerts + SdrObjListIter aIter(*pPage, IM_DEEPWITHGROUPS, TRUE); + + SdrObject* pObject = aIter.Next(); + while (pObject) + { + SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObject); + SdIMapInfo* pIMapInfo = mpDoc->GetIMapInfo(pObject); + + if ((pInfo && + (pInfo->meClickAction == presentation::ClickAction_BOOKMARK || + pInfo->meClickAction == presentation::ClickAction_DOCUMENT || + pInfo->meClickAction == presentation::ClickAction_PREVPAGE || + pInfo->meClickAction == presentation::ClickAction_NEXTPAGE || + pInfo->meClickAction == presentation::ClickAction_FIRSTPAGE || + pInfo->meClickAction == presentation::ClickAction_LASTPAGE)) || + pIMapInfo) + { + aClickableObjects.Insert(pObject, LIST_APPEND); + } + + pObject = aIter.Next(); + } + // jetzt zur Masterpage oder beenden + if (!pPage->IsMasterPage()) + pPage = (SdPage*)(&(pPage->TRG_GetMasterPage())); + else + bMasterDone = true; + } + ULONG nClickableObjectCount = aClickableObjects.Count(); + +// HTML Head + String aStr(maHTMLHeader); + aStr += WriteMetaCharset(); + aStr.AppendAscii( " <title>" ); + aStr += StringToHTMLString(*mpPageNames[nSdPage]); + aStr.AppendAscii( "</title>\r\n" ); + +// insert timing information + pPage = maPages[ nSdPage ]; + if( meMode == PUBLISH_KIOSK ) + { + ULONG nSecs = 0; + bool bEndless = false; + if( !mbAutoSlide ) + { + if( pPage->GetPresChange() != PRESCHANGE_MANUAL ) + { + nSecs = pPage->GetTime(); + bEndless = mpDoc->getPresentationSettings().mbEndless; + } + } + else + { + nSecs = mnSlideDuration; + bEndless = mbEndless; + } + + if( nSecs != 0 ) + { + if( nSdPage < (mnSdPageCount-1) || bEndless ) + { + aStr.AppendAscii( "<meta http-equiv=\"refresh\" content=\"" ); + aStr += String::CreateFromInt32(nSecs); + aStr.AppendAscii( "; URL=" ); + + int nPage = nSdPage + 1; + if( nPage == mnSdPageCount ) + nPage = 0; + + aStr += StringToURL(*mpHTMLFiles[nPage]); + + aStr.AppendAscii( "\">\r\n" ); + } + } + } + + aStr.AppendAscii( "</head>\r\n" ); + +// HTML Body + aStr += CreateBodyTag(); + + if( mbSlideSound && pPage->IsSoundOn() ) + aStr += InsertSound( pPage->GetSoundFile() ); + +// Navigationsleiste + if(!mbFrames ) + aStr += CreateNavBar( nSdPage, false ); +// Image + aStr.AppendAscii( "<center>" ); + aStr.AppendAscii( "<img src=\"" ); + aStr += StringToURL( *mpImageFiles[nSdPage] ); + aStr.AppendAscii( "\" alt=\"\"" ); + + if (nClickableObjectCount > 0) + aStr.AppendAscii( " USEMAP=\"#map0\"" ); + + aStr.AppendAscii( "></center>\r\n" ); + +// Notizen + if(mbNotes && !mbFrames) + { + SdrOutliner* pOutliner = mpDoc->GetInternalOutliner(); + SdPage* pNotesPage = maNotesPages[ nSdPage ]; + String aNotesStr( CreateTextForNotesPage( pOutliner, pNotesPage, true, maBackColor) ); + pOutliner->Clear(); + + if( aNotesStr.Len() ) + { + aStr.AppendAscii( "<h3>" ); + aStr += RESTOHTML(STR_HTMLEXP_NOTES); + aStr.AppendAscii( ":</h3><br>\r\n\r\n<p>" ); + + aStr += aNotesStr; + aStr.AppendAscii( "\r\n</p>\r\n" ); + } + } + +// ggfs. Imagemap erzeugen + if (nClickableObjectCount > 0) + { + aStr.AppendAscii( "<map name=\"map0\">\r\n" ); + + for (ULONG nObject = 0; nObject < nClickableObjectCount; nObject++) + { + SdrObject* pObject = (SdrObject*)aClickableObjects.GetObject(nObject); + SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObject); + SdIMapInfo* pIMapInfo = mpDoc->GetIMapInfo(pObject); + + Rectangle aRect(pObject->GetCurrentBoundRect()); + Point aLogPos(aRect.TopLeft()); + bool bIsSquare = aRect.GetWidth() == aRect.GetHeight(); + + ULONG nPageWidth = pPage->GetSize().Width() - pPage->GetLftBorder() - + pPage->GetRgtBorder(); + + // das BoundRect bezieht sich auf den physikalischen + // Seitenursprung, nicht auf den Koordinatenursprung + aRect.Move(-pPage->GetLftBorder(), -pPage->GetUppBorder()); + + double fLogicToPixel = ((double)mnWidthPixel) / nPageWidth; + aRect.Left() = (long)(aRect.Left() * fLogicToPixel); + aRect.Top() = (long)(aRect.Top() * fLogicToPixel); + aRect.Right() = (long)(aRect.Right() * fLogicToPixel); + aRect.Bottom() = (long)(aRect.Bottom() * fLogicToPixel); + long nRadius = aRect.GetWidth() / 2; + + + /************************************************************* + |* wenn das Objekt eine eigene Imagemap enthaelt, werden ihre + |* Areas in diese Imagemap eingefuegt + \************************************************************/ + if (pIMapInfo) + { + const ImageMap& rIMap = pIMapInfo->GetImageMap(); + UINT16 nAreaCount = rIMap.GetIMapObjectCount(); + for (UINT16 nArea = 0; nArea < nAreaCount; nArea++) + { + IMapObject* pArea = rIMap.GetIMapObject(nArea); + UINT16 nType = pArea->GetType(); + String aURL( pArea->GetURL() ); + + // ggfs. Seiten- oder Objektnamen umwandeln in den + // Namen der entsprechenden HTML-Datei + BOOL bIsMasterPage; + USHORT nPgNum = mpDoc->GetPageByName( aURL, bIsMasterPage ); + SdrObject* pObj = NULL; + + if (nPgNum == SDRPAGE_NOTFOUND) + { + // Ist das Bookmark ein Objekt? + pObj = mpDoc->GetObj( aURL ); + if (pObj) + nPgNum = pObj->GetPage()->GetPageNum(); + } + if (nPgNum != SDRPAGE_NOTFOUND) + { + nPgNum = (nPgNum - 1) / 2; // SdrPageNum --> SdPageNum + aURL = CreatePageURL(nPgNum); + } + + switch(nType) + { + case IMAP_OBJ_RECTANGLE: + { + Rectangle aArea(((IMapRectangleObject*)pArea)-> + GetRectangle(false)); + + // Umrechnung in Pixelkoordinaten + aArea.Move(aLogPos.X() - pPage->GetLftBorder(), + aLogPos.Y() - pPage->GetUppBorder()); + aArea.Left() = (long)(aArea.Left() * fLogicToPixel); + aArea.Top() = (long)(aArea.Top() * fLogicToPixel); + aArea.Right() = (long)(aArea.Right() * fLogicToPixel); + aArea.Bottom() = (long)(aArea.Bottom() * fLogicToPixel); + + aStr += CreateHTMLRectArea(aArea, aURL); + } + break; + + case IMAP_OBJ_CIRCLE: + { + Point aCenter(((IMapCircleObject*)pArea)-> + GetCenter(false)); + aCenter += Point(aLogPos.X() - pPage->GetLftBorder(), + aLogPos.Y() - pPage->GetUppBorder()); + aCenter.X() = (long)(aCenter.X() * fLogicToPixel); + aCenter.Y() = (long)(aCenter.Y() * fLogicToPixel); + + ULONG nCircleRadius = (((IMapCircleObject*)pArea)-> + GetRadius(false)); + nCircleRadius = (ULONG)(nCircleRadius * fLogicToPixel); + aStr += CreateHTMLCircleArea(nCircleRadius, + aCenter.X(), aCenter.Y(), + aURL); + } + break; + + case IMAP_OBJ_POLYGON: + { + Polygon aArea(((IMapPolygonObject*)pArea)->GetPolygon(false)); + aStr += CreateHTMLPolygonArea(::basegfx::B2DPolyPolygon(aArea.getB2DPolygon()), Size(aLogPos.X() - pPage->GetLftBorder(), aLogPos.Y() - pPage->GetUppBorder()), fLogicToPixel, aURL); + } + break; + + default: + { + DBG_WARNING("unbekannter IMAP_OBJ_Typ"); + } + break; + } + } + } + + + + /************************************************************* + |* wenn es eine presentation::ClickAction gibt, Bookmark bestimmen und eine + |* Area fuer das ganze Objekt erzeugen + \************************************************************/ + if( pInfo ) + { + String aHRef; + presentation::ClickAction eClickAction = pInfo->meClickAction; + + switch( eClickAction ) + { + case presentation::ClickAction_BOOKMARK: + { + BOOL bIsMasterPage; + USHORT nPgNum = mpDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage ); + SdrObject* pObj = NULL; + + if( nPgNum == SDRPAGE_NOTFOUND ) + { + // Ist das Bookmark ein Objekt? + pObj = mpDoc->GetObj(pInfo->GetBookmark()); + if (pObj) + nPgNum = pObj->GetPage()->GetPageNum(); + } + + if( SDRPAGE_NOTFOUND != nPgNum ) + aHRef = CreatePageURL(( nPgNum - 1 ) / 2 ); + } + break; + + case presentation::ClickAction_DOCUMENT: + aHRef = pInfo->GetBookmark(); + break; + + case presentation::ClickAction_PREVPAGE: + { + ULONG nPage = nSdPage; + if (nSdPage == 0) + nPage = 0; + else + nPage = nSdPage - 1; + + aHRef = CreatePageURL( (USHORT) nPage); + } + break; + + case presentation::ClickAction_NEXTPAGE: + { + ULONG nPage = nSdPage; + if (nSdPage == mnSdPageCount - 1) + nPage = mnSdPageCount - 1; + else + nPage = nSdPage + 1; + + aHRef = CreatePageURL( (USHORT) nPage); + } + break; + + case presentation::ClickAction_FIRSTPAGE: + aHRef = CreatePageURL(0); + break; + + case presentation::ClickAction_LASTPAGE: + aHRef = CreatePageURL(mnSdPageCount - 1); + break; + + default: + break; + } + + // jetzt die Areas + if( aHRef.Len() ) + { + // ein Kreis? + if (pObject->GetObjInventor() == SdrInventor && + pObject->GetObjIdentifier() == OBJ_CIRC && + bIsSquare ) + { + aStr += CreateHTMLCircleArea(aRect.GetWidth() / 2, + aRect.Left() + nRadius, + aRect.Top() + nRadius, + aHRef); + } + // ein Polygon? + else if (pObject->GetObjInventor() == SdrInventor && + (pObject->GetObjIdentifier() == OBJ_PATHLINE || + pObject->GetObjIdentifier() == OBJ_PLIN || + pObject->GetObjIdentifier() == OBJ_POLY)) + { + aStr += CreateHTMLPolygonArea(((SdrPathObj*)pObject)->GetPathPoly(), Size(-pPage->GetLftBorder(), -pPage->GetUppBorder()), fLogicToPixel, aHRef); + } + // was anderes: das BoundRect nehmen + else + { + aStr += CreateHTMLRectArea(aRect, aHRef); + } + + } + } + } + + aStr.AppendAscii( "</map>\r\n" ); + } + aClickableObjects.Clear(); + + aStr.AppendAscii( "</body>\r\n</html>" ); + + bOk = WriteHtml( *mpHTMLFiles[nSdPage], false, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + } + + return bOk; +} + +// ===================================================================== +// Uebersichtsseite erzeugen +// ===================================================================== +bool HtmlExport::CreateContentPage() +{ + // Parameter + String aEmpty; + + if( mbDocColors ) + SetDocColors(); + + // Html Kopf + String aStr(maHTMLHeader); + aStr += WriteMetaCharset(); + aStr.AppendAscii( " <title>" ); + aStr += StringToHTMLString(*mpPageNames[0]); + aStr.AppendAscii( "</title>\r\n</head>\r\n" ); + aStr += CreateBodyTag(); + + // Seitenkopf + aStr.AppendAscii( "<center>\r\n" ); + + if(mbHeader) + { + aStr.AppendAscii( "<h1>" ); + aStr += getDocumentTitle(); + aStr.AppendAscii( "</h1><br>\r\n" ); + } + + aStr.AppendAscii( "<h2>" ); + + // #92564# Solaris compiler bug workaround + if( mbFrames ) + aStr += CreateLink( maFramePage, + RESTOHTML(STR_HTMLEXP_CLICKSTART) ); + else + aStr += CreateLink( StringToHTMLString(*mpHTMLFiles[0]), + RESTOHTML(STR_HTMLEXP_CLICKSTART) ); + + aStr.AppendAscii( "</h2>\r\n</center>\r\n" ); + + aStr.AppendAscii( "<center><table width=\"90%\"><tr>\r\n" ); + + // Inhaltsverzeichnis + aStr.AppendAscii( "<td valign=\"top\" align=\"left\" width=\"50%\">\r\n" ); + aStr.AppendAscii( "<h3>" ); + aStr += RESTOHTML(STR_HTMLEXP_CONTENTS); + aStr.AppendAscii( "</h3>" ); + + for(USHORT nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++) + { + String aPageName = *mpPageNames[nSdPage]; + aStr.AppendAscii( "<div align=\"left\">" ); + if(mbFrames) + aStr += StringToHTMLString(aPageName); + else + aStr += CreateLink(*mpHTMLFiles[nSdPage], aPageName); + aStr.AppendAscii( "</div>\r\n" ); + } + aStr.AppendAscii( "</td>\r\n" ); + + // Dokument Infos + aStr.AppendAscii( "<td valign=\"top\" width=\"50%\">\r\n" ); + + if(maAuthor.Len()) + { + aStr.AppendAscii( "<p><strong>" ); + aStr += RESTOHTML(STR_HTMLEXP_AUTHOR); + aStr.AppendAscii( ":</strong> " ); + aStr += StringToHTMLString(maAuthor); + aStr.AppendAscii( "</p>\r\n" ); + } + + if(maEMail.Len()) + { + aStr.AppendAscii( "<p><strong>" ); + aStr += RESTOHTML(STR_HTMLEXP_EMAIL); + aStr.AppendAscii( ":</strong> <a href=\"mailto:" ); + aStr += StringToURL(maEMail); + aStr.AppendAscii( "\">" ); + aStr += StringToHTMLString(maEMail); + aStr.AppendAscii( "</a></p>\r\n" ); + } + + if(maHomePage.Len()) + { + aStr.AppendAscii( "<p><strong>" ); + aStr += RESTOHTML(STR_HTMLEXP_HOMEPAGE); + aStr.AppendAscii( ":</strong> <a href=\"" ); + aStr += StringToURL(maHomePage); + aStr.AppendAscii( "\">" ); + aStr += StringToHTMLString(maHomePage); + aStr.AppendAscii( "</a> </p>\r\n" ); + } + + if(maInfo.Len()) + { + aStr.AppendAscii( "<p><strong>" ); + aStr += RESTOHTML(STR_HTMLEXP_INFO); + aStr.AppendAscii( ":</strong><br>\r\n" ); + aStr += StringToHTMLString(maInfo); + aStr.AppendAscii( "</p>\r\n" ); + } + + if(mbDownload) + { + aStr.AppendAscii( "<p><a href=\"" ); + aStr += StringToURL(maDocFileName); + aStr.AppendAscii( "\">" ); + aStr += RESTOHTML(STR_HTMLEXP_DOWNLOAD); + aStr.AppendAscii( "</a></p>\r\n" ); + } + + aStr.AppendAscii( "</td></tr></table></center>\r\n" ); + + aStr.AppendAscii( "</body>\r\n</html>" ); + + bool bOk = WriteHtml( maIndex, false, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + + return bOk; +} + +// ===================================================================== +// Notiz Seiten erzeugen (fuer Frames) +// ===================================================================== +bool HtmlExport::CreateNotesPages() +{ + bool bOk = true; + + SdrOutliner* pOutliner = mpDoc->GetInternalOutliner(); + for( USHORT nSdPage = 0; bOk && nSdPage < mnSdPageCount; nSdPage++ ) + { + SdPage* pPage = maNotesPages[nSdPage]; + if( mbDocColors ) + SetDocColors( pPage ); + + // Html Kopf + String aStr(maHTMLHeader); + aStr += WriteMetaCharset(); + aStr.AppendAscii( " <title>" ); + aStr += StringToHTMLString(*mpPageNames[0]); + aStr.AppendAscii( "</title>\r\n</head>\r\n" ); + aStr += CreateBodyTag(); + + if(pPage) + aStr += CreateTextForNotesPage( pOutliner, pPage, true, maBackColor ); + + aStr.AppendAscii( "</body>\r\n</html>" ); + + String aFileName( RTL_CONSTASCII_USTRINGPARAM("note") ); + aFileName += String::CreateFromInt32(nSdPage); + bOk = WriteHtml( aFileName, true, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + } + + pOutliner->Clear(); + + return bOk; +} + +// ===================================================================== +// Outline Seiten erzeugen (fuer Frames) +// ===================================================================== +bool HtmlExport::CreateOutlinePages() +{ + bool bOk = true; + + if( mbDocColors ) + { + SetDocColors(); + } + + // Seite 0 wird der zugeklappte Outline, Seite 1 der aufgeklappte + for( int nPage = 0; nPage < (mbImpress?2:1) && bOk; nPage++ ) + { + // Html Kopf + String aStr(maHTMLHeader); + aStr += WriteMetaCharset(); + aStr.AppendAscii( " <title>" ); + aStr += StringToHTMLString(*mpPageNames[0]); + aStr.AppendAscii( "</title>\r\n</head>\r\n" ); + aStr += CreateBodyTag(); + + SdrOutliner* pOutliner = mpDoc->GetInternalOutliner(); + for(USHORT nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++) + { + SdPage* pPage = maPages[ nSdPage ]; + + aStr.AppendAscii( "<div align=\"left\">" ); + String aLink( RTL_CONSTASCII_USTRINGPARAM( "JavaScript:parent.NavigateAbs(" ) ); + aLink += String::CreateFromInt32(nSdPage); + aLink.Append( sal_Unicode(')') ); + + String aTitle = CreateTextForTitle(pOutliner,pPage, maBackColor); + if(aTitle.Len() == 0) + aTitle = *mpPageNames[nSdPage]; + + aStr.AppendAscii("<p style=\""); + aStr.Append( getParagraphStyle( pOutliner, 0 ) ); + aStr.AppendAscii("\">"); + aStr += CreateLink(aLink, aTitle); + aStr.AppendAscii("</p>"); + + if(nPage==1) + { + aStr += CreateTextForPage( pOutliner, pPage, false, maBackColor ); + } + aStr.AppendAscii( "</div>\r\n" ); + } + pOutliner->Clear(); + + aStr.AppendAscii( "</body>\r\n</html>" ); + + String aFileName( RTL_CONSTASCII_USTRINGPARAM("outline") ); + aFileName += String::CreateFromInt32(nPage); + bOk = WriteHtml( aFileName, true, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + } + + return bOk; +} + +// ===================================================================== +// Dateinamen festlegen +// ===================================================================== +void HtmlExport::CreateFileNames() +{ + // Listen mit neuen Dateinamen anlegen + mpHTMLFiles = new String*[mnSdPageCount]; + mpImageFiles = new String*[mnSdPageCount]; + mpPageNames = new String*[mnSdPageCount]; + mpTextFiles = new String*[mnSdPageCount]; + + mbHeader = false; // Ueberschrift auf Uebersichtsseite? + + for (USHORT nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++) + { + String* pName; + if(nSdPage == 0 && !mbContentsPage && !mbFrames ) + pName = new String(maIndex); + else + { + pName = new String( RTL_CONSTASCII_USTRINGPARAM("img") ); + *pName += String::CreateFromInt32(nSdPage); + *pName += maHTMLExtension; + } + + mpHTMLFiles[nSdPage] = pName; + + pName = new String( RTL_CONSTASCII_USTRINGPARAM("img") ); + *pName += String::CreateFromInt32(nSdPage); + if( meFormat==FORMAT_GIF ) + pName->AppendAscii( ".gif" ); + else if( meFormat==FORMAT_JPG ) + pName->AppendAscii( ".jpg" ); + else + pName->AppendAscii( ".png" ); + + mpImageFiles[nSdPage] = pName; + + pName = new String( RTL_CONSTASCII_USTRINGPARAM("text")); + *pName += String::CreateFromInt32(nSdPage); + *pName += maHTMLExtension; + mpTextFiles[nSdPage] = pName; + + SdPage* pSdPage = maPages[ nSdPage ]; + + // get slide title from page name + String* pPageTitle = new String(); + *pPageTitle = pSdPage->GetName(); + mpPageNames[nSdPage] = pPageTitle; + } + + if(!mbContentsPage && mbFrames) + maFramePage = maIndex; + else + { + maFramePage.AssignAscii( "siframes" ); + maFramePage += maHTMLExtension; + } +} + +String HtmlExport::getDocumentTitle() +{ + // check for a title object in this page, if its the first + // title it becomes this documents title for the content + // page + if( !mbHeader ) + { + if(mbImpress) + { + // falls es ein nicht-leeres Titelobjekt gibt, dessen ersten Absatz + // als Seitentitel benutzen + SdPage* pSdPage = mpDoc->GetSdPage(0, PK_STANDARD); + SdrObject* pTitleObj = pSdPage->GetPresObj(PRESOBJ_TITLE); + if (pTitleObj && !pTitleObj->IsEmptyPresObj()) + { + OutlinerParaObject* pParaObject = pTitleObj->GetOutlinerParaObject(); + if (pParaObject) + { + const EditTextObject& rEditTextObject = + pParaObject->GetTextObject(); + if (&rEditTextObject) + { + String aTest(rEditTextObject.GetText(0)); + if (aTest.Len() > 0) + mDocTitle = aTest; + } + } + } + + for( UINT16 i = 0; i < mDocTitle.Len(); i++ ) + if( mDocTitle.GetChar(i) == (sal_Unicode)0xff) + mDocTitle.SetChar(i, sal_Unicode(' ') ); + } + + if( !mDocTitle.Len() ) + { + mDocTitle = maDocFileName; + int nDot = mDocTitle.Search( '.' ); + if( nDot > 0 ) + mDocTitle.Erase( (USHORT)nDot ); + } + mbHeader = true; + } + + return mDocTitle; +} + +/* +var nCurrentPage = 0; +var nPageCount = JSCRIPT2; + +function NavigateAbs( nPage ) +{ + frames[\"show\"].location.href = \"img\" + nPage + \".htm\"; + frames[\"notes\"].location.href = \"note\" + nPage + \".htm\"; + nCurrentPage = nPage; + if(nCurrentPage==0) + { + frames[\"navbar1\"].location.href = \"navbar0.htm\"; + } + else if(nCurrentPage==nPageCount-1) + { + frames[\"navbar1\"].location.href = \"navbar2.htm\"; + } + else + frames[\"navbar1\"].location.href = \"navbar1.htm\"; + } +} + +function NavigateRel( nDelta ) +{ + var nPage = parseInt(nCurrentPage) + parseInt(nDelta); + if( (nPage >= 0) && (nPage < nPageCount) ) + { + NavigateAbs( nPage ); + } +} + +function ExpandOutline() +{ + frames[\"navbar2\"].location.href = \"navbar4.htm\"; + frames[\"outline\"].location.href = \"outline1.htm\"; +} + +function CollapseOutline() +{ + frames[\"navbar2\"].location.href = \"navbar3.htm\"; + frames[\"outline\"].location.href = \"outline0.htm\"; +} +*/ + +static const char* JS_NavigateAbs = + "function NavigateAbs( nPage )\r\n" + "{\r\n" + " frames[\"show\"].location.href = \"img\" + nPage + \".$EXT\";\r\n" + " //frames[\"notes\"].location.href = \"note\" + nPage + \".$EXT\";\r\n" + " nCurrentPage = nPage;\r\n" + " if(nCurrentPage==0)\r\n" + " {\r\n" + " frames[\"navbar1\"].location.href = \"navbar0.$EXT\";\r\n" + " }\r\n" + " else if(nCurrentPage==nPageCount-1)\r\n" + " {\r\n" + " frames[\"navbar1\"].location.href = \"navbar2.$EXT\";\r\n" + " }\r\n" + " else\r\n" + " {\r\n" + " frames[\"navbar1\"].location.href = \"navbar1.$EXT\";\r\n" + " }\r\n" + "}\r\n\r\n"; + +static const char* JS_NavigateRel = + "function NavigateRel( nDelta )\r\n" + "{\r\n" + " var nPage = parseInt(nCurrentPage) + parseInt(nDelta);\r\n" + " if( (nPage >= 0) && (nPage < nPageCount) )\r\n" + " {\r\n" + " NavigateAbs( nPage );\r\n" + " }\r\n" + "}\r\n\r\n"; + +static const char* JS_ExpandOutline = + "function ExpandOutline()\r\n" + "{\r\n" + " frames[\"navbar2\"].location.href = \"navbar4.$EXT\";\r\n" + " frames[\"outline\"].location.href = \"outline1.$EXT\";\r\n" + "}\r\n\r\n"; + +static const char * JS_CollapseOutline = + "function CollapseOutline()\r\n" + "{\r\n" + " frames[\"navbar2\"].location.href = \"navbar3.$EXT\";\r\n" + " frames[\"outline\"].location.href = \"outline0.$EXT\";\r\n" + "}\r\n\r\n"; + +// ==================================================================== +// Seite mit den Frames erzeugen +// ==================================================================== +bool HtmlExport::CreateFrames() +{ + String aTmp; + String aStr( RTL_CONSTASCII_USTRINGPARAM( + "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\r\n" + " \"http://www.w3.org/TR/html4/frameset.dtd\">\r\n" + "<html>\r\n<head>\r\n" ) ); + + aStr += WriteMetaCharset(); + aStr.AppendAscii( " <title>" ); + aStr += StringToHTMLString(*mpPageNames[0]); + aStr.AppendAscii( "</title>\r\n" ); + + aStr.AppendAscii( "<script type=\"text/javascript\">\r\n<!--\r\n" ); + + aStr.AppendAscii( "var nCurrentPage = 0;\r\nvar nPageCount = " ); + aStr += String::CreateFromInt32(mnSdPageCount); + aStr.AppendAscii( ";\r\n\r\n" ); + + String aFunction; + aFunction.AssignAscii(JS_NavigateAbs); + + if(mbNotes) + { + String aEmpty; + String aSlash( RTL_CONSTASCII_USTRINGPARAM( "//" ) ); + aFunction.SearchAndReplaceAll( aSlash, aEmpty); + } + + // substitute HTML file extension + String aPlaceHolder(RTL_CONSTASCII_USTRINGPARAM(".$EXT")); + aFunction.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension); + aStr += aFunction; + + aTmp.AssignAscii( JS_NavigateRel ); + aTmp.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension); + aStr += aTmp; + + if(mbImpress) + { + aTmp.AssignAscii( JS_ExpandOutline ); + aTmp.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension); + aStr += aTmp; + + aTmp.AssignAscii( JS_CollapseOutline ); + aTmp.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension); + aStr += aTmp; + } + aStr.AppendAscii( "// -->\r\n</script>\r\n" ); + + aStr.AppendAscii( "</head>\r\n" ); + + aStr.AppendAscii( "<frameset cols=\"*," ); + aStr += String::CreateFromInt32((mnWidthPixel + 16)); + aStr.AppendAscii( "\">\r\n" ); + if(mbImpress) + { + aStr.AppendAscii( " <frameset rows=\"42,*\">\r\n" ); + aStr.AppendAscii( " <frame src=\"navbar3" ); + aStr += StringToURL(maHTMLExtension); + aStr.AppendAscii( "\" name=\"navbar2\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n" ); + } + aStr.AppendAscii( " <frame src=\"outline0" ); + aStr += StringToURL(maHTMLExtension); + aStr.AppendAscii( "\" name=\"outline\">\r\n" ); + if(mbImpress) + aStr.AppendAscii( " </frameset>\r\n" ); + + if(mbNotes) + { + aStr.AppendAscii( " <frameset rows=\"42," ); + aStr += String::CreateFromInt32((int)((double)mnWidthPixel * 0.75) + 16); + aStr.AppendAscii( ",*\">\r\n" ); + } + else + aStr.AppendAscii( " <frameset rows=\"42,*\">\r\n" ); + + aStr.AppendAscii( " <frame src=\"navbar0" ); + aStr += StringToURL(maHTMLExtension); + aStr.AppendAscii( "\" name=\"navbar1\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n" ); + + aStr.AppendAscii( " <frame src=\"" ); + aStr += StringToURL(*mpHTMLFiles[0]); + aStr.AppendAscii( "\" name=\"show\" marginwidth=\"4\" marginheight=\"4\">\r\n" ); + + if(mbNotes) + { + aStr.AppendAscii( " <frame src=\"note0" ); + aStr += StringToURL(maHTMLExtension); + aStr.AppendAscii( "\" name=\"notes\">\r\n" ); + } + aStr.AppendAscii( " </frameset>\r\n" ); + + aStr.AppendAscii( "<noframes>\r\n" ); + aStr += CreateBodyTag(); + aStr += RESTOHTML(STR_HTMLEXP_NOFRAMES); + aStr.AppendAscii( "\r\n</noframes>\r\n</frameset>\r\n</html>" ); + + bool bOk = WriteHtml( maFramePage, false, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + + return bOk; +} + +// ==================================================================== +// Buttonleiste fuer Standard ausgeben +// Es werden 4 html files erstellt +// navbar0.htm Navigationsleiste Grafik fuer erste Seite +// navbar1.htm Navigationsleiste Grafik fuer zweite bis vorletzte Seite +// navbar2.htm Navigationsleiste Grafik fuer letzte Seite +// navbar3.htm Navigationsleiste Outline zugeklappt +// navbar4.htm Navigationsleiste Outline aufgeklappt +// ==================================================================== +bool HtmlExport::CreateNavBarFrames() +{ + bool bOk = true; + String aButton; + + if( mbDocColors ) + { + SetDocColors(); + maBackColor = maFirstPageColor; + } + + for( int nFile = 0; nFile < 3 && bOk; nFile++ ) + { + String aStr(maHTMLHeader); + aStr += WriteMetaCharset(); + aStr.AppendAscii( " <title>" ); + aStr += StringToHTMLString(*mpPageNames[0]); + aStr.AppendAscii( "</title>\r\n</head>\r\n" ); + aStr += CreateBodyTag(); + aStr.AppendAscii( "<center>\r\n" ); + + // erste Seite + aButton = String(SdResId(STR_HTMLEXP_FIRSTPAGE)); + if(mnButtonThema != -1) + aButton = CreateImage(GetButtonName((nFile == 0 || mnSdPageCount == 1? + BTN_FIRST_0:BTN_FIRST_1)), aButton); + + if(nFile != 0 && mnSdPageCount > 1) + aButton = CreateLink( String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateAbs(0)")), aButton); + + aStr += aButton; + aStr.AppendAscii( "\r\n" ); + + // zur vorherigen Seite + aButton = String(SdResId(STR_PUBLISH_BACK)); + if(mnButtonThema != -1) + aButton = CreateImage(GetButtonName((nFile == 0 || mnSdPageCount == 1? + BTN_PREV_0:BTN_PREV_1)), aButton); + + if(nFile != 0 && mnSdPageCount > 1) + aButton = CreateLink( String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateRel(-1)")), aButton); + + aStr += aButton; + aStr.AppendAscii( "\r\n" ); + + // zur naechsten Seite + aButton = String(SdResId(STR_PUBLISH_NEXT)); + if(mnButtonThema != -1) + aButton = CreateImage(GetButtonName((nFile ==2 || mnSdPageCount == 1? + BTN_NEXT_0:BTN_NEXT_1)), aButton); + + if(nFile != 2 && mnSdPageCount > 1) + aButton = CreateLink(String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateRel(1)")), aButton); + + aStr += aButton; + aStr.AppendAscii( "\r\n" ); + + // zur letzten Seite + aButton = String(SdResId(STR_HTMLEXP_LASTPAGE)); + if(mnButtonThema != -1) + aButton = CreateImage(GetButtonName((nFile ==2 || mnSdPageCount == 1? + BTN_LAST_0:BTN_LAST_1)), aButton); + + if(nFile != 2 && mnSdPageCount > 1) + { + String aLink(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateAbs(")); + aLink += String::CreateFromInt32(mnSdPageCount-1); + aLink.AppendAscii( ")" ); + aButton = CreateLink( aLink, aButton); + } + + aStr += aButton; + aStr.AppendAscii( "\r\n" ); + + // Inhalt + if (mbContentsPage) + { + aButton = String(SdResId(STR_PUBLISH_OUTLINE)); + if(mnButtonThema != -1) + aButton = CreateImage(GetButtonName(BTN_INDEX), aButton); + + // zur Uebersicht + aStr += CreateLink(maIndex, aButton, String(RTL_CONSTASCII_USTRINGPARAM("_top"))); + aStr.AppendAscii( "\r\n" ); + } + + // Textmodus + if(mbImpress) + { + aButton = String(SdResId(STR_HTMLEXP_SETTEXT)); + if(mnButtonThema != -1) + aButton = CreateImage(GetButtonName(BTN_TEXT), aButton); + + String aText0( RTL_CONSTASCII_USTRINGPARAM("text0")); + aText0 += maHTMLExtension; + aStr += CreateLink( aText0, aButton, String(RTL_CONSTASCII_USTRINGPARAM("_top"))); + aStr.AppendAscii( "\r\n" ); + } + + // Und fertich... + aStr.AppendAscii( "</center>\r\n" ); + aStr.AppendAscii( "</body>\r\n</html>" ); + + String aFileName( RTL_CONSTASCII_USTRINGPARAM("navbar") ); + aFileName += String::CreateFromInt32(nFile); + + bOk = WriteHtml( aFileName, true, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + } + + // Jetzt kommt die Navigatonsleiste Outliner zugeklappt... + if(bOk) + { + String aStr(maHTMLHeader); + aStr += WriteMetaCharset(); + aStr.AppendAscii( " <title>" ); + aStr += StringToHTMLString(*mpPageNames[0]); + aStr.AppendAscii( "</title>\r\n</head>\r\n" ); + aStr += CreateBodyTag(); + + aButton = String(SdResId(STR_HTMLEXP_OUTLINE)); + if(mnButtonThema != -1) + aButton = CreateImage(GetButtonName(BTN_MORE), aButton); + + aStr += CreateLink(String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.ExpandOutline()")), aButton); + aStr.AppendAscii( "</body>\r\n</html>" ); + + String aFileName( RTL_CONSTASCII_USTRINGPARAM("navbar3") ); + + bOk = WriteHtml( aFileName, true, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + } + + // ... und jetzt Outliner aufgeklappt + if( bOk ) + { + String aStr(maHTMLHeader); + aStr += WriteMetaCharset(); + aStr.AppendAscii( " <title>" ); + aStr += StringToHTMLString(*mpPageNames[0]); + aStr.AppendAscii( "</title>\r\n</head>\r\n" ); + aStr += CreateBodyTag(); + + aButton = String(SdResId(STR_HTMLEXP_NOOUTLINE)); + if(mnButtonThema != -1) + aButton = CreateImage(GetButtonName(BTN_LESS), aButton); + + aStr += CreateLink(String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.CollapseOutline()")), aButton); + aStr.AppendAscii( "</body>\r\n</html>" ); + + String aFileName( RTL_CONSTASCII_USTRINGPARAM("navbar4") ); + bOk = WriteHtml( aFileName, true, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + + } + + return bOk; +} + +// ==================================================================== +// Buttonleiste fuer Standard ausgeben +// ==================================================================== +String HtmlExport::CreateNavBar( USHORT nSdPage, bool bIsText ) const +{ + // Navigationsleiste vorbereiten + String aStrNavFirst( SdResId(STR_HTMLEXP_FIRSTPAGE) ); + String aStrNavPrev( SdResId(STR_PUBLISH_BACK) ); + String aStrNavNext( SdResId(STR_PUBLISH_NEXT) ); + String aStrNavLast( SdResId(STR_HTMLEXP_LASTPAGE) ); + String aStrNavContent( SdResId(STR_PUBLISH_OUTLINE) ); + String aStrNavText; + if( bIsText ) + { + aStrNavText = String( SdResId(STR_HTMLEXP_SETGRAPHIC) ); + } + else + { + aStrNavText = String( SdResId(STR_HTMLEXP_SETTEXT) ); + } + + if(!bIsText && mnButtonThema != -1) + { + if(nSdPage<1 || mnSdPageCount == 1) + { + aStrNavFirst = CreateImage(GetButtonName(BTN_FIRST_0), aStrNavFirst); + aStrNavPrev = CreateImage(GetButtonName(BTN_PREV_0), aStrNavPrev); + } + else + { + aStrNavFirst = CreateImage(GetButtonName(BTN_FIRST_1), aStrNavFirst); + aStrNavPrev = CreateImage(GetButtonName(BTN_PREV_1), aStrNavPrev); + } + + if(nSdPage == mnSdPageCount-1 || mnSdPageCount == 1) + { + aStrNavNext = CreateImage(GetButtonName(BTN_NEXT_0), aStrNavNext); + aStrNavLast = CreateImage(GetButtonName(BTN_LAST_0), aStrNavLast); + } + else + { + aStrNavNext = CreateImage(GetButtonName(BTN_NEXT_1), aStrNavNext); + aStrNavLast = CreateImage(GetButtonName(BTN_LAST_1), aStrNavLast); + } + + aStrNavContent = CreateImage(GetButtonName(BTN_INDEX), aStrNavContent); + aStrNavText = CreateImage(GetButtonName(BTN_TEXT), aStrNavText); + } + + String aStr( RTL_CONSTASCII_USTRINGPARAM("<center>\r\n")); //<table><tr>\r\n"); + + // erste Seite + if(nSdPage > 0) + aStr += CreateLink(bIsText?*mpTextFiles[0]:*mpHTMLFiles[0],aStrNavFirst); + else + aStr += aStrNavFirst; + aStr.Append(sal_Unicode(' ')); + + // to Previous page + if(nSdPage > 0) + aStr += CreateLink( bIsText?*mpTextFiles[nSdPage-1]: + *mpHTMLFiles[nSdPage-1], aStrNavPrev); + else + aStr += aStrNavPrev; + aStr.Append(sal_Unicode(' ')); + + // to Next page + if(nSdPage < mnSdPageCount-1) + aStr += CreateLink( bIsText?*mpTextFiles[nSdPage+1]: + *mpHTMLFiles[nSdPage+1], aStrNavNext); + else + aStr += aStrNavNext; + aStr.Append(sal_Unicode(' ')); + + // to Last page + if(nSdPage < mnSdPageCount-1) + aStr += CreateLink( bIsText?*mpTextFiles[mnSdPageCount-1]: + *mpHTMLFiles[mnSdPageCount-1], + aStrNavLast ); + else + aStr += aStrNavLast; + aStr.Append(sal_Unicode(' ')); + + // to Index page + if (mbContentsPage) + { + aStr += CreateLink(maIndex, aStrNavContent); + aStr.Append(sal_Unicode(' ')); + } + + // Text/Graphics + if(mbImpress) + { + aStr += CreateLink( bIsText?(mbFrames?maFramePage:*mpHTMLFiles[nSdPage]): + *mpTextFiles[nSdPage], aStrNavText); + + } + + aStr.AppendAscii( "</center><br>\r\n" ); + + return aStr; +} + +/** export navigation graphics from button set */ +bool HtmlExport::CreateBitmaps() +{ + if(mnButtonThema != -1 && mpButtonSet.get() ) + { + for( int nButton = 0; nButton < NUM_BUTTONS; nButton++ ) + { + if(!mbFrames && (nButton == BTN_MORE || nButton == BTN_LESS)) + continue; + + if(!mbImpress && (nButton == BTN_TEXT || nButton == BTN_MORE || nButton == BTN_LESS )) + continue; + + OUString aFull(maExportPath); + aFull += GetButtonName(nButton); + mpButtonSet->exportButton( mnButtonThema, aFull, GetButtonName(nButton) ); + } + } + return true; +} + +// ===================================================================== +// Erzeugt den <body> Tag, inkl. der eingestellten Farbattribute +// ===================================================================== +String HtmlExport::CreateBodyTag() const +{ + String aStr( RTL_CONSTASCII_USTRINGPARAM("<body") ); + + if( mbUserAttr || mbDocColors ) + { + Color aTextColor( maTextColor ); + if( (aTextColor == COL_AUTO) && (!maBackColor.IsDark()) ) + aTextColor = COL_BLACK; + + aStr.AppendAscii( " text=\"" ); + aStr += ColorToHTMLString( aTextColor ); + aStr.AppendAscii( "\" bgcolor=\"" ); + aStr += ColorToHTMLString( maBackColor ); + aStr.AppendAscii( "\" link=\"" ); + aStr += ColorToHTMLString( maLinkColor ); + aStr.AppendAscii( "\" vlink=\"" ); + aStr += ColorToHTMLString( maVLinkColor ); + aStr.AppendAscii( "\" alink=\"" ); + aStr += ColorToHTMLString( maALinkColor ); + aStr.AppendAscii( "\"" ); + } + + aStr.AppendAscii( ">\r\n" ); + + return aStr; +} + +// ===================================================================== +// Erzeugt einen Hyperlink +// ===================================================================== +String HtmlExport::CreateLink( const String& aLink, + const String& aText, + const String& aTarget ) const +{ + String aStr( RTL_CONSTASCII_USTRINGPARAM("<a href=\"")); + aStr += StringToURL(aLink); + if(aTarget.Len()) + { + aStr.AppendAscii( "\" target=\"" ); + aStr += aTarget; + } + aStr.AppendAscii( "\">" ); + aStr += aText; + aStr.AppendAscii( "</a>" ); + + return aStr; +} + +// ===================================================================== +// Erzeugt ein Image-tag +// ===================================================================== +String HtmlExport::CreateImage( const String& aImage, const String& aAltText, + INT16 nWidth, + INT16 nHeight ) const +{ + String aStr( RTL_CONSTASCII_USTRINGPARAM("<img src=\"")); + aStr += StringToURL(aImage); + aStr.AppendAscii( "\" border=0" ); + + if( aAltText.Len()) + { + aStr.AppendAscii( " alt=\"" ); + aStr += aAltText; + aStr.Append(sal_Unicode('"')); + } + else + { + // Agerskov: HTML 4.01 has to have an alt attribut even if it is an empty string + aStr.AppendAscii( " alt=\"\"" ); + } + + if(nWidth > -1) + { + aStr.AppendAscii( " width=" ); + aStr += String::CreateFromInt32(nWidth); + } + + if(nHeight > -1) + { + aStr.AppendAscii( " height=" ); + aStr += String::CreateFromInt32(nHeight); + } + + aStr.Append(sal_Unicode('>')); + + return aStr; +} + +// ===================================================================== +// Area fuer Kreis erzeugen; es werden Pixelkoordinaten erwartet +// ===================================================================== +String HtmlExport::ColorToHTMLString( Color aColor ) +{ + static char hex[] = "0123456789ABCDEF"; + String aStr( RTL_CONSTASCII_USTRINGPARAM("#xxxxxx")); + aStr.SetChar(1, hex[(aColor.GetRed() >> 4) & 0xf] ); + aStr.SetChar(2, hex[aColor.GetRed() & 0xf] ); + aStr.SetChar(3, hex[(aColor.GetGreen() >> 4) & 0xf] ); + aStr.SetChar(4, hex[aColor.GetGreen() & 0xf] ); + aStr.SetChar(5, hex[(aColor.GetBlue() >> 4) & 0xf] ); + aStr.SetChar(6, hex[aColor.GetBlue() & 0xf] ); + + return aStr; +} + +// ===================================================================== +// Area fuer Kreis erzeugen; es werden Pixelkoordinaten erwartet +// ===================================================================== +String HtmlExport::CreateHTMLCircleArea( ULONG nRadius, + ULONG nCenterX, + ULONG nCenterY, + const String& rHRef ) const +{ + String aStr( RTL_CONSTASCII_USTRINGPARAM("<area shape=\"circle\" alt=\"\" coords=\"" )); + + aStr += String::CreateFromInt32(nCenterX); + aStr.Append(sal_Unicode(',')); + aStr += String::CreateFromInt32(nCenterY); + aStr.Append(sal_Unicode(',')); + aStr += String::CreateFromInt32(nRadius); + aStr.AppendAscii( "\" href=\"" ); + aStr += StringToURL(rHRef); + aStr.AppendAscii( "\">\n" ); + + return aStr; +} + + +// ===================================================================== +// Area fuer Polygon erzeugen; es werden Pixelkoordinaten erwartet +// ===================================================================== +String HtmlExport::CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPolygon, + Size aShift, double fFactor, const String& rHRef ) const +{ + String aStr; + const sal_uInt32 nNoOfPolygons(rPolyPolygon.count()); + + for ( sal_uInt32 nXPoly = 0L; nXPoly < nNoOfPolygons; nXPoly++ ) + { + const ::basegfx::B2DPolygon& aPolygon = rPolyPolygon.getB2DPolygon(nXPoly); + const sal_uInt32 nNoOfPoints(aPolygon.count()); + + aStr.AppendAscii( "<area shape=\"polygon\" alt=\"\" coords=\"" ); + + for ( sal_uInt32 nPoint = 0L; nPoint < nNoOfPoints; nPoint++ ) + { + const ::basegfx::B2DPoint aB2DPoint(aPolygon.getB2DPoint(nPoint)); + Point aPnt(FRound(aB2DPoint.getX()), FRound(aB2DPoint.getY())); + // das Koordinaten beziehen sich auf den + // physikalischen Seitenursprung, nicht auf den + // Koordinatenursprung + aPnt.Move(aShift.Width(), aShift.Height()); + + aPnt.X() = (long)(aPnt.X() * fFactor); + aPnt.Y() = (long)(aPnt.Y() * fFactor); + aStr += String::CreateFromInt32(aPnt.X()); + aStr.Append(sal_Unicode(',')); + aStr += String::CreateFromInt32(aPnt.Y()); + + if (nPoint < nNoOfPoints - 1) + aStr.Append( sal_Unicode(',') ); + } + aStr.AppendAscii( "\" href=\"" ); + aStr += StringToURL(rHRef); + aStr.AppendAscii( "\">\n" ); + } + + return aStr; +} + +// ===================================================================== +// Area fuer Rechteck erzeugen; es werden Pixelkoordinaten erwartet +// ===================================================================== +String HtmlExport::CreateHTMLRectArea( const Rectangle& rRect, + const String& rHRef ) const +{ + String aStr( RTL_CONSTASCII_USTRINGPARAM("<area shape=\"rect\" alt=\"\" coords=\"") ); + + aStr += String::CreateFromInt32(rRect.Left()); + aStr.Append(sal_Unicode(',')); + aStr += String::CreateFromInt32(rRect.Top()); + aStr.Append(sal_Unicode(',')); + aStr += String::CreateFromInt32(rRect.Right()); + aStr.Append(sal_Unicode(',')); + aStr += String::CreateFromInt32(rRect.Bottom()); + aStr.AppendAscii( "\" href=\"" ); + aStr += StringToURL(rHRef); + aStr.AppendAscii( "\">\n" ); + + return aStr; +} + +// ===================================================================== +// StringToHTMLString, konvertiert einen String in +// seine HTML-Repraesentation (Umlaute etc.) +// ===================================================================== +String HtmlExport::StringToHTMLString( const String& rString ) +{ + SvMemoryStream aMemStm; + HTMLOutFuncs::Out_String( aMemStm, rString, RTL_TEXTENCODING_UTF8 ); + aMemStm << (char) 0; + return String( (char*)aMemStm.GetData(), RTL_TEXTENCODING_UTF8 ); +} + +// ===================================================================== +// Erzeugt die URL einer bestimmten Seite +// ===================================================================== +String HtmlExport::CreatePageURL( USHORT nPgNum ) +{ + if(mbFrames) + { + String aUrl( RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateAbs(")); + aUrl += String::CreateFromInt32(nPgNum); + aUrl.Append(sal_Unicode(')')); + return aUrl; + } + else + return *mpHTMLFiles[nPgNum]; +} + +bool HtmlExport::CopyScript( const String& rPath, const String& rSource, const String& rDest, bool bUnix /* = false */ ) +{ + INetURLObject aURL( SvtPathOptions().GetConfigPath() ); + String aScript; + + aURL.Append( String( RTL_CONSTASCII_USTRINGPARAM("webcast") ) ); + aURL.Append( rSource ); + + meEC.SetContext( STR_HTMLEXP_ERROR_OPEN_FILE, rSource ); + + ULONG nErr = 0; + SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); + + if( pIStm ) + { + ByteString aLine; + + while( pIStm->ReadLine( aLine ) ) + { + aScript.AppendAscii( aLine.GetBuffer() ); + if( bUnix ) + { + aScript.AppendAscii( "\n" ); + } + else + { + aScript.AppendAscii( "\r\n" ); + } + } + + nErr = pIStm->GetError(); + delete pIStm; + } + + if( nErr != 0 ) + { + ErrorHandler::HandleError( nErr ); + return (bool) nErr; + } + + + aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$1")), getDocumentTitle() ); + + const String aSaveStr( RESTOHTML( STR_WEBVIEW_SAVE )); + aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$2")), aSaveStr ); + + aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$3")), maCGIPath ); + + aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$4")), String::CreateFromInt32(mnWidthPixel) ); + aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$5")), String::CreateFromInt32(mnHeightPixel) ); + + + String aDest( rPath ); + aDest += rDest; + + meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, rDest ); + // write script file + { + EasyFile aFile; + SvStream* pStr; + nErr = aFile.createStream(aDest, pStr); + if(nErr == 0) + { + ByteString aStr( aScript, RTL_TEXTENCODING_UTF8 ); + *pStr << aStr.GetBuffer(); + + nErr = aFile.close(); + } + } + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + + if( nErr != 0 ) + ErrorHandler::HandleError( nErr ); + + return nErr == 0; +} + +static const char * ASP_Scripts[] = { "common.inc", "webcast.asp", "show.asp", "savepic.asp", "poll.asp", "editpic.asp" }; + +/** erzeugt und speichert die f�r WebShow ben�tigte ASP Scripte */ +bool HtmlExport::CreateASPScripts() +{ + for( USHORT n = 0; n < (sizeof( ASP_Scripts ) / sizeof(char *)); n++ ) + { + String aScript; + + aScript.AssignAscii( ASP_Scripts[n] ); + if(!CopyScript(maExportPath, aScript, aScript)) + return false; + } + + if(!CopyScript(maExportPath, String(RTL_CONSTASCII_USTRINGPARAM("edit.asp")), maIndex )) + return false; + + return true; +} + + +static const char *PERL_Scripts[] = { "webcast.pl", "common.pl", "editpic.pl", "poll.pl", "savepic.pl", "show.pl" }; + +/** erzeugt und speichert die f�r WebShow ben�tigte PERL Scripte */ +bool HtmlExport::CreatePERLScripts() +{ + for( USHORT n = 0; n < (sizeof( PERL_Scripts ) / sizeof(char *)); n++ ) + { + String aScript; + aScript.AssignAscii( PERL_Scripts[n] ); + if(!CopyScript(maExportPath, aScript, aScript, true)) + return false; + } + + if(!CopyScript(maExportPath, String( RTL_CONSTASCII_USTRINGPARAM("edit.pl")), maIndex, true )) + return false; + + if(!CopyScript(maExportPath, String( RTL_CONSTASCII_USTRINGPARAM("index.pl")), maIndexUrl, true )) + return false; + + return true; +} + +/** Erzeugt eine Liste mit den Namen der gespeicherten Images */ +bool HtmlExport::CreateImageFileList() +{ + String aStr; + for( USHORT nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++) + { + aStr += String::CreateFromInt32( nSdPage + 1 ); + aStr.Append(sal_Unicode(';')); + aStr += maURLPath; + aStr += *mpImageFiles[nSdPage]; + aStr.AppendAscii( "\r\n" ); + } + + String aFileName( RTL_CONSTASCII_USTRINGPARAM("picture.txt") ); + bool bOk = WriteHtml( aFileName, false, aStr ); + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + + return bOk; +} + +/** Erzeugt das File mit der aktuellen Seitennumer */ +bool HtmlExport::CreateImageNumberFile() +{ + String aFull( maExportPath ); + String aFileName( RTL_CONSTASCII_USTRINGPARAM("currpic.txt") ); + aFull += aFileName; + + meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, aFileName ); + EasyFile aFile; + SvStream* pStr; + ULONG nErr = aFile.createStream(aFull, pStr); + if(nErr == 0) + { + *pStr << (const char *)"1"; + nErr = aFile.close(); + } + + if (mpProgress) + mpProgress->SetState(++mnPagesWritten); + + if( nErr != 0 ) + ErrorHandler::HandleError( nErr ); + + return nErr == 0; +} + +// ===================================================================== + +String HtmlExport::InsertSound( const String& rSoundFile ) +{ + if( rSoundFile.Len() == 0 ) + return rSoundFile; + + String aStr( RTL_CONSTASCII_USTRINGPARAM("<embed src=\"") ); + INetURLObject aURL( rSoundFile ); + + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + aStr += String(aURL.getName()); + aStr.AppendAscii( "\" hidden=\"true\" autostart=\"true\">" ); + + CopyFile( rSoundFile, maExportPath ); + + return aStr; +} + +// ===================================================================== + +bool HtmlExport::CopyFile( const String& rSourceFile, const String& rDestPath ) +{ + DirEntry aSourceEntry( rSourceFile ); + DirEntry aDestEntry( rDestPath ); + + meEC.SetContext( STR_HTMLEXP_ERROR_COPY_FILE, aSourceEntry.GetName(), rDestPath ); + FSysError nError = aSourceEntry.CopyTo( aDestEntry, FSYS_ACTION_COPYFILE ); + + if( nError != FSYS_ERR_OK ) + { + ErrorHandler::HandleError(nError); + return false; + } + else + { + return true; + } +} + +// ===================================================================== + +bool HtmlExport::checkFileExists( Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, String const & aFileName ) +{ + try + { + OUString url( maExportPath ); + url += aFileName; + return xFileAccess->exists( url ); + } + catch( com::sun::star::uno::Exception& e ) + { + (void)e; + DBG_ERROR((OString("sd::HtmlExport::checkFileExists(), exception caught: ") + + rtl::OUStringToOString( comphelper::anyToString( cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 )).getStr() ); + } + + return false; +} + +// --------------------------------------------------------------------- + +bool HtmlExport::checkForExistingFiles() +{ + bool bFound = false; + + try + { + Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() ); + Reference< ::com::sun::star::ucb::XSimpleFileAccess > xFA( xMsf->createInstance( + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), UNO_QUERY_THROW ); + + sal_uInt16 nSdPage; + for( nSdPage = 0; !bFound && (nSdPage < mnSdPageCount); nSdPage++) + { + if( (mpImageFiles[nSdPage] && checkFileExists( xFA, *mpImageFiles[nSdPage] )) || + (mpHTMLFiles[nSdPage] && checkFileExists( xFA, *mpHTMLFiles[nSdPage] )) || + (mpPageNames[nSdPage] && checkFileExists( xFA, *mpPageNames[nSdPage] )) || + (mpTextFiles[nSdPage] && checkFileExists( xFA, *mpTextFiles[nSdPage] )) ) + { + bFound = true; + } + } + + if( !bFound && mbDownload ) + bFound = checkFileExists( xFA, maDocFileName ); + + if( !bFound && mbFrames ) + bFound = checkFileExists( xFA, maFramePage ); + + if( bFound ) + { + ResMgr *pResMgr = CREATERESMGR( dbw ); + if( pResMgr ) + { + ResId aResId( 4077, *pResMgr ); + String aMsg( aResId ); + + OUString aSystemPath; + osl::FileBase::getSystemPathFromFileURL( maExportPath, aSystemPath ); + aMsg.SearchAndReplaceAscii( "%FILENAME", aSystemPath ); + WarningBox aWarning( 0, WB_YES_NO | WB_DEF_YES, aMsg ); + aWarning.SetImage( WarningBox::GetStandardImage() ); + bFound = ( RET_NO == aWarning.Execute() ); + + delete pResMgr; + } + else + { + bFound = false; + } + } + } + catch( Exception& e ) + { + (void)e; + DBG_ERROR((OString("sd::HtmlExport::checkForExistingFiles(), exception caught: ") + + rtl::OUStringToOString( comphelper::anyToString( cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 )).getStr() ); + bFound = false; + } + + return bFound; +} + +// --------------------------------------------------------------------- + +String HtmlExport::StringToURL( const String& rURL ) +{ + return rURL; +/* + return StringToHTMLString(rURL); + OUString aURL( StringToHTMLString(rURL) ); + + aURL = Uri::encode( aURL, rtl_UriCharClassUric, rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8); + return String( aURL ); +*/ +} + +String HtmlExport::GetButtonName( int nButton ) const +{ + String aName; + aName.AssignAscii( pButtonNames[nButton] ); + return aName; +} + +// ===================================================================== +EasyFile::EasyFile() +{ + pMedium = NULL; + pOStm = NULL; + bOpen = false; +} + +// ===================================================================== +EasyFile::~EasyFile() +{ + if( bOpen ) + close(); +} + +// ===================================================================== +ULONG EasyFile::createStream( const String& rUrl, SvStream* &rpStr ) +{ + ULONG nErr = 0; + + if(bOpen) + nErr = close(); + + String aFileName; + + if( nErr == 0 ) + nErr = createFileName( rUrl, aFileName ); + + if( nErr == 0 ) + { + pOStm = ::utl::UcbStreamHelper::CreateStream( aFileName, STREAM_WRITE | STREAM_TRUNC ); + if( pOStm ) + { + bOpen = true; + nErr = pOStm->GetError(); + } + else + { + nErr = ERRCODE_SFX_CANTCREATECONTENT; + } + } + + if( nErr != 0 ) + { + bOpen = false; + delete pMedium; + delete pOStm; + pOStm = NULL; + } + + rpStr = pOStm; + + return nErr; +} + +// ===================================================================== +ULONG EasyFile::createFileName( const String& rURL, String& rFileName ) +{ + ULONG nErr = 0; + + if( bOpen ) + nErr = close(); + + if( nErr == 0 ) + { + INetURLObject aURL( rURL ); + + if( aURL.GetProtocol() == INET_PROT_NOT_VALID ) + { + String aURLStr; + ::utl::LocalFileHelper::ConvertPhysicalNameToURL( rURL, aURLStr ); + aURL = INetURLObject( aURLStr ); + } + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + rFileName = aURL.GetMainURL( INetURLObject::NO_DECODE ); + } + + return nErr; +} + +// ===================================================================== +ULONG EasyFile::close() +{ + ULONG nErr = 0; + + delete pOStm; + pOStm = NULL; + + bOpen = false; + + if( pMedium ) + { + // uebertragen + pMedium->Close(); + pMedium->Commit(); + + nErr = pMedium->GetError(); + + delete pMedium; + pMedium = NULL; + } + + return nErr; +} + +// ===================================================================== +// This class helps reporting errors during file i/o +// ===================================================================== + +HtmlErrorContext::HtmlErrorContext(Window *_pWin) +: ErrorContext(_pWin) +{ + mnResId = 0; +} + +// ===================================================================== + +BOOL HtmlErrorContext::GetString( ULONG, String& rCtxStr ) +{ + DBG_ASSERT( mnResId != 0, "No error context set" ); + if( mnResId == 0 ) + return false; + + rCtxStr = String( SdResId( mnResId ) ); + + rCtxStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM("$(URL1)")), maURL1 ); + rCtxStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM("$(URL2)")), maURL2 ); + + return true; +} + +// ===================================================================== + +void HtmlErrorContext::SetContext( USHORT nResId, const String& rURL ) +{ + mnResId = nResId; + maURL1 = rURL; + maURL2.Erase(); +} + +// ===================================================================== + +void HtmlErrorContext::SetContext( USHORT nResId, const String& rURL1, const String& rURL2 ) +{ + mnResId = nResId; + maURL1 = rURL1; + maURL2 = rURL2; +} + +// ===================================================================== + + diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx new file mode 100755 index 000000000000..43bc12419f84 --- /dev/null +++ b/sd/source/filter/html/htmlex.hxx @@ -0,0 +1,239 @@ +/************************************************************************* + * + * 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 _SD_HTMLEX_HXX +#define _SD_HTMLEX_HXX + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <vcl/gdimtf.hxx> +#include <svl/itemset.hxx> +#include "resltn.hxx" // enum PublishingResolution +#include <svtools/colrdlg.hxx> +#include <svtools/ehdl.hxx> + +#include "strings.hrc" +#include "DrawDocShell.hxx" +#include "Window.hxx" +#include "ViewShell.hxx" +#include "assclass.hxx" + +#ifndef _SD_RESID_HXX +#include "sdresid.hxx" +#endif +#include "pubdlg.hxx" + +#include <vector> +#include <boost/scoped_ptr.hpp> + +#define NUM_BUTTONS 12 + +#define PUB_LOWRES_WIDTH 640 +#define PUB_LOWRES_HEIGHT 480 +#define PUB_MEDRES_WIDTH 800 +#define PUB_MEDRES_HEIGHT 600 +#define PUB_HIGHRES_WIDTH 1024 +#define PUB_HIGHRES_HEIGHT 768 + +#define HtmlButtonThemaStr = "private://gallery/hidden/HtmlExportButtons"; + +class List; +class SfxProgress; +class SdrOutliner; +class SdPage; +class HtmlState; +class SdrTextObj; +class SdrPage; +class SdDrawDocument; +class ButtonSet; + +namespace sd { +class View; +} + +class HtmlErrorContext : public ErrorContext +{ +private: + USHORT mnResId; + String maURL1; + String maURL2; + +public: + HtmlErrorContext(Window *pWin=0); + ~HtmlErrorContext() {}; + + virtual BOOL GetString( ULONG nErrId, String& rCtxStr ); + + void SetContext( USHORT nResId, const String& rURL ); + void SetContext( USHORT nResId, const String& rURL1, const String& rURL2 ); +}; + +// ===================================================================== +// this class exports an Impress Document as a HTML Presentation +// ===================================================================== +class HtmlExport +{ + std::vector< SdPage* > maPages; + std::vector< SdPage* > maNotesPages; + + String maPath; + + SdDrawDocument* mpDoc; + ::sd::DrawDocShell* mpDocSh; + + HtmlErrorContext meEC; + + HtmlPublishMode meMode; + SfxProgress* mpProgress; + bool mbImpress; + USHORT mnSdPageCount; + USHORT mnPagesWritten; + bool mbContentsPage; + INT16 mnButtonThema; + UINT16 mnWidthPixel; + UINT16 mnHeightPixel; + PublishingFormat meFormat; + bool mbHeader; + bool mbNotes; + bool mbFrames; + bool mbKiosk; + String maIndex; + String maEMail; + String maAuthor; + String maHomePage; + String maInfo; + INT16 mnCompression; + String maDocFileName; + String maFramePage; + String mDocTitle; + bool mbDownload; + + bool mbAutoSlide; + UINT32 mnSlideDuration; + bool mbSlideSound; + bool mbHiddenSlides; + bool mbEndless; + + bool mbUserAttr; // die folgenden Farben werden fuer das <body> + Color maTextColor; // tag genutzt, wenn mbUserAttr true ist + Color maBackColor; + Color maLinkColor; + Color maVLinkColor; + Color maALinkColor; + Color maFirstPageColor; + bool mbDocColors; + + String maHTMLExtension; + String** mpHTMLFiles; + String** mpImageFiles; + String** mpPageNames; + String** mpTextFiles; + + String maExportPath; // Das Ausgabeverzeichnes bzw. die URL + String maIndexUrl; + String maURLPath; + String maCGIPath; + PublishingScript meScript; + + const String maHTMLHeader; + + boost::scoped_ptr< ButtonSet > mpButtonSet; + + SdrTextObj* GetLayoutTextObject(SdrPage* pPage); + + void SetDocColors( SdPage* pPage = NULL ); + + bool CreateImagesForPresPages(); + bool CreateHtmlTextForPresPages(); + bool CreateHtmlForPresPages(); + bool CreateContentPage(); + void CreateFileNames(); + bool CreateBitmaps(); + bool CreateOutlinePages(); + bool CreateFrames(); + bool CreateNotesPages(); + bool CreateNavBarFrames(); + + bool CreateASPScripts(); + bool CreatePERLScripts(); + bool CreateImageFileList(); + bool CreateImageNumberFile(); + + bool checkForExistingFiles(); + bool checkFileExists( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, String const & aFileName ); + + String getDocumentTitle(); + bool SavePresentation(); + + String CreateLink( const String& aLink, const String& aText, + const String& aTarget = String()) const; + String CreateImage( const String& aImage, const String& aAltText, INT16 nWidth = -1, INT16 nHeight = -1 ) const; + String CreateNavBar( USHORT nSdPage, bool bIsText ) const; + String CreateBodyTag() const; + + String ParagraphToHTMLString( SdrOutliner* pOutliner, ULONG nPara, const Color& rBackgroundColor ); + String TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState, const Color& rBackgroundColor ); + + String CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor ); + String CreateTextForPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor ); + String CreateTextForNotesPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor ); + + String CreateHTMLCircleArea( ULONG nRadius, ULONG nCenterX, + ULONG nCenterY, const String& rHRef ) const; + String CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPoly, Size aShift, double fFactor, const String& rHRef ) const; + String CreateHTMLRectArea( const Rectangle& rRect, + const String& rHRef ) const; + + String CreatePageURL( USHORT nPgNum ); + + String InsertSound( const String& rSoundFile ); + bool CopyFile( const String& rSourceFile, const String& rDestPath ); + bool CopyScript( const String& rPath, const String& rSource, const String& rDest, bool bUnix = false ); + + void InitProgress( USHORT nProgrCount ); + void ResetProgress(); + + String WriteMetaCharset() const; + + void InitExportParameters( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rParams); + void ExportHtml(); + void ExportKiosk(); + void ExportWebCast(); + + bool WriteHtml( const String& rFileName, bool bAddExtension, const String& rHtmlData ); + String GetButtonName( int nButton ) const; + + public: + HtmlExport( rtl::OUString aPath, const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rParams, SdDrawDocument* pExpDoc, ::sd::DrawDocShell* pDocShell ); + virtual ~HtmlExport(); + + static String ColorToHTMLString( Color aColor ); + static String StringToHTMLString( const String& rString ); + static String StringToURL( const String& rURL ); +}; + +#endif // _SD_HTMLEX_HXX diff --git a/sd/source/filter/html/makefile.mk b/sd/source/filter/html/makefile.mk new file mode 100644 index 000000000000..dc228764323c --- /dev/null +++ b/sd/source/filter/html/makefile.mk @@ -0,0 +1,68 @@ +#************************************************************************* +# +# 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=sd +TARGET=html +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE; + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +INCPRE += ..$/..$/ui$/inc + +# --- Files -------------------------------------------------------- + +SLOFILES = $(SLO)$/HtmlOptionsDialog.obj\ + $(SLO)$/buttonset.obj \ + $(SLO)$/sdhtmlfilter.obj \ + $(SLO)$/htmlex.obj \ + $(SLO)$/htmlattr.obj \ + $(SLO)$/pubdlg.obj + +SRS1NAME=$(TARGET) +SRC1FILES = pubdlg.src + +LIB1TARGET= $(SLB)$/$(TARGET).lib +LIB1OBJFILES = \ + $(SLO)$/HtmlOptionsDialog.obj\ + $(SLO)$/sdhtmlfilter.obj \ + $(SLO)$/buttonset.obj \ + $(SLO)$/htmlex.obj + +LIB2TARGET= $(SLB)$/$(TARGET)_ui.lib +LIB2OBJFILES = \ + $(SLO)$/htmlattr.obj \ + $(SLO)$/buttonset.obj \ + $(SLO)$/pubdlg.obj + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx new file mode 100755 index 000000000000..8079238bc1dc --- /dev/null +++ b/sd/source/filter/html/pubdlg.cxx @@ -0,0 +1,1756 @@ +/************************************************************************* + * + * 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_sd.hxx" + +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif +#include <com/sun/star/beans/PropertyValue.hpp> +#include <unotools/ucbstreamhelper.hxx> +#include <vcl/lstbox.hxx> +#include <svtools/FilterConfigItem.hxx> +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#include <vcl/fixed.hxx> +#include <vcl/combobox.hxx> +#include <svtools/svmedit.hxx> +#include <svl/intitem.hxx> +#include <svl/aeitem.hxx> +#include <svl/itemset.hxx> +#include <svl/stritem.hxx> +#include <vcl/msgbox.hxx> +#include <svtools/valueset.hxx> +#include <vcl/graph.hxx> +#include <svl/eitem.hxx> +#include <svtools/colrdlg.hxx> +#include <editeng/colritem.hxx> +#include <tools/urlobj.hxx> +#include <tools/list.hxx> +#include <sdiocmpt.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/app.hxx> +#include <pres.hxx> +#include <unotools/useroptions.hxx> +#include <unotools/pathoptions.hxx> + +#include "sdresid.hxx" +#include "sdattr.hxx" +#include "pubdlg.hrc" +#include "htmlattr.hxx" +#include "htmlex.hxx" +#include "helpids.h" +#include "buttonset.hxx" + +using namespace std; +using namespace rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; + +extern void InterpolateFixedBitmap( FixedBitmap * pBitmap ); + +// Kennung fuer die Config Datei mit den Html Einstellungen +const UINT16 nMagic = (UINT16)0x1977; + +// Key fuer die soffice.ini +#define KEY_QUALITY "JPG-EXPORT-QUALITY" + +// Die Help Ids der einzelnen Seiten +ULONG aPageHelpIds[NOOFPAGES] = +{ + HID_SD_HTMLEXPORT_PAGE1, + HID_SD_HTMLEXPORT_PAGE2, + HID_SD_HTMLEXPORT_PAGE3, + HID_SD_HTMLEXPORT_PAGE4, + HID_SD_HTMLEXPORT_PAGE5, + HID_SD_HTMLEXPORT_PAGE6 +}; + +// ********************************************************************* +// Diese Klasse enthaelt alle Einstellungen des Html-Export Autopiloten +// ********************************************************************* +class SdPublishingDesign +{ +public: + String m_aDesignName; + + HtmlPublishMode m_eMode; + + // special WebCast options + PublishingScript m_eScript; + String m_aCGI; + String m_aURL; + + // special Kiosk options + BOOL m_bAutoSlide; + UINT32 m_nSlideDuration; + BOOL m_bEndless; + + // special HTML options + BOOL m_bContentPage; + BOOL m_bNotes; + + // misc options + UINT16 m_nResolution; + String m_aCompression; + PublishingFormat m_eFormat; + BOOL m_bSlideSound; + BOOL m_bHiddenSlides; + + // titel page information + String m_aAuthor; + String m_aEMail; + String m_aWWW; + String m_aMisc; + BOOL m_bDownload; + BOOL m_bCreated; // not used + + // buttons and colorscheme + INT16 m_nButtonThema; + BOOL m_bUserAttr; + Color m_aBackColor; + Color m_aTextColor; + Color m_aLinkColor; + Color m_aVLinkColor; + Color m_aALinkColor; + BOOL m_bUseAttribs; + BOOL m_bUseColor; + + SdPublishingDesign(); + + int operator ==(const SdPublishingDesign & rDesign) const; + friend SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign); + friend SvStream& operator << (SvStream& rOut, const SdPublishingDesign& rDesign); +}; + +// ===================================================================== +// Default Einstellungen erzeugen +// ===================================================================== +SdPublishingDesign::SdPublishingDesign() +{ + m_eMode = PUBLISH_HTML; + m_bContentPage = TRUE; + m_bNotes = TRUE; + + m_eFormat = FORMAT_PNG; + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/JPG" ) ); + FilterConfigItem aFilterConfigItem( aFilterConfigPath ); + sal_Int32 nCompression = aFilterConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), 75 ); + m_aCompression = UniString::CreateFromInt32( nCompression ); + m_aCompression.Append( sal_Unicode('%') ); + + SvtUserOptions aUserOptions; + + m_nResolution = PUB_LOWRES_WIDTH; + m_aAuthor = aUserOptions.GetFirstName(); + if( m_aAuthor.Len() && aUserOptions.GetLastName().getLength() ) + m_aAuthor += sal_Unicode(' '); + m_aAuthor += (String)aUserOptions.GetLastName(); + m_aEMail = aUserOptions.GetEmail(); + m_bDownload = FALSE; +//-/ m_bCreated = TRUE; + m_nButtonThema = -1; + + m_bUserAttr = FALSE; + m_bUseAttribs = TRUE; + m_bUseColor = TRUE; + + m_aBackColor = COL_WHITE; + m_aTextColor = COL_BLACK; + m_aLinkColor = COL_BLUE; + m_aVLinkColor = COL_LIGHTBLUE; + m_aALinkColor = COL_GRAY; + + m_eScript = SCRIPT_ASP; + + m_bAutoSlide = TRUE; + m_nSlideDuration = 15; + m_bEndless = TRUE; + + m_bSlideSound = TRUE; + m_bHiddenSlides = FALSE; +} + +// ===================================================================== +// Vergleicht die Member ohne den Namen zu beachten +// ===================================================================== +int SdPublishingDesign::operator ==(const SdPublishingDesign & rDesign) const +{ + return + ( + m_eMode == rDesign.m_eMode && + m_nResolution == rDesign.m_nResolution && + m_aCompression == rDesign.m_aCompression && + m_eFormat == rDesign.m_eFormat && + m_bHiddenSlides == rDesign.m_bHiddenSlides && + ( // compare html options + (m_eMode != PUBLISH_HTML && m_eMode != PUBLISH_FRAMES) || + ( + m_bContentPage == rDesign.m_bContentPage && + m_bNotes == rDesign.m_bNotes && + m_aAuthor == rDesign.m_aAuthor && + m_aEMail == rDesign.m_aEMail && + m_aWWW == rDesign.m_aWWW && + m_aMisc == rDesign.m_aMisc && + m_bDownload == rDesign.m_bDownload && +//-/ m_bCreated == rDesign.m_bCreated && + m_nButtonThema == rDesign.m_nButtonThema && + m_bUserAttr == rDesign.m_bUserAttr && + m_aBackColor == rDesign.m_aBackColor && + m_aTextColor == rDesign.m_aTextColor && + m_aLinkColor == rDesign.m_aLinkColor && + m_aVLinkColor == rDesign.m_aVLinkColor && + m_aALinkColor == rDesign.m_aALinkColor && + m_bUseAttribs == rDesign.m_bUseAttribs && + m_bSlideSound == rDesign.m_bSlideSound && + m_bUseColor == rDesign.m_bUseColor + ) + ) && + ( // compare kiosk options + (m_eMode != PUBLISH_KIOSK) || + ( + m_bAutoSlide == rDesign.m_bAutoSlide && + m_bSlideSound == rDesign.m_bSlideSound && + ( + !m_bAutoSlide || + ( + m_nSlideDuration == rDesign.m_nSlideDuration && + m_bEndless == rDesign.m_bEndless + ) + ) + ) + ) && + ( // compare WebCast options + (m_eMode != PUBLISH_WEBCAST) || + ( + m_eScript == rDesign.m_eScript && + ( + m_eScript != SCRIPT_PERL || + ( + m_aURL == rDesign.m_aURL && + m_aCGI == rDesign.m_aCGI + ) + ) + ) + ) + ); +} + +// ===================================================================== +// Dieses Design aus Stream laden +// ===================================================================== +SvStream& operator >> (SvStream& rIn, SdPublishingDesign& rDesign) +{ + SdIOCompat aIO(rIn, STREAM_READ); + + UINT16 nTemp16; + + rIn.ReadByteString( rDesign.m_aDesignName, RTL_TEXTENCODING_UTF8 ); + rIn >> nTemp16; + rDesign.m_eMode = (HtmlPublishMode)nTemp16; + rIn >> rDesign.m_bContentPage; + rIn >> rDesign.m_bNotes; + rIn >> rDesign.m_nResolution; + rIn.ReadByteString( rDesign.m_aCompression, RTL_TEXTENCODING_UTF8 ); + rIn >> nTemp16; + rDesign.m_eFormat = (PublishingFormat)nTemp16; + rIn.ReadByteString( rDesign.m_aAuthor, RTL_TEXTENCODING_UTF8 ); + rIn.ReadByteString( rDesign.m_aEMail, RTL_TEXTENCODING_UTF8 ); + rIn.ReadByteString( rDesign.m_aWWW, RTL_TEXTENCODING_UTF8 ); + rIn.ReadByteString( rDesign.m_aMisc, RTL_TEXTENCODING_UTF8 ); + rIn >> rDesign.m_bDownload; + rIn >> rDesign.m_bCreated; // not used + rIn >> rDesign.m_nButtonThema; + rIn >> rDesign.m_bUserAttr; + rIn >> rDesign.m_aBackColor; + rIn >> rDesign.m_aTextColor; + rIn >> rDesign.m_aLinkColor; + rIn >> rDesign.m_aVLinkColor; + rIn >> rDesign.m_aALinkColor; + rIn >> rDesign.m_bUseAttribs; + rIn >> rDesign.m_bUseColor; + + rIn >> nTemp16; + rDesign.m_eScript = (PublishingScript)nTemp16; + rIn.ReadByteString( rDesign.m_aURL, RTL_TEXTENCODING_UTF8 ); + rIn.ReadByteString( rDesign.m_aCGI, RTL_TEXTENCODING_UTF8 ); + + rIn >> rDesign.m_bAutoSlide; + rIn >> rDesign.m_nSlideDuration; + rIn >> rDesign.m_bEndless; + rIn >> rDesign.m_bSlideSound; + rIn >> rDesign.m_bHiddenSlides; + + return rIn; +} + +// ===================================================================== +// Dieses Design in Stream speichern +// ===================================================================== +SvStream& operator << (SvStream& rOut, const SdPublishingDesign& rDesign) +{ + // Letzter Parameter ist die aktuelle Versionsnummer des Codes + SdIOCompat aIO(rOut, STREAM_WRITE, 0); + + // Name + rOut.WriteByteString( rDesign.m_aDesignName, RTL_TEXTENCODING_UTF8 ); + + rOut << (UINT16)rDesign.m_eMode; + rOut << rDesign.m_bContentPage; + rOut << rDesign.m_bNotes; + rOut << rDesign.m_nResolution; + rOut.WriteByteString( rDesign.m_aCompression, RTL_TEXTENCODING_UTF8 ); + rOut << (UINT16)rDesign.m_eFormat; + rOut.WriteByteString( rDesign.m_aAuthor, RTL_TEXTENCODING_UTF8 ); + rOut.WriteByteString( rDesign.m_aEMail, RTL_TEXTENCODING_UTF8 ); + rOut.WriteByteString( rDesign.m_aWWW, RTL_TEXTENCODING_UTF8 ); + rOut.WriteByteString( rDesign.m_aMisc, RTL_TEXTENCODING_UTF8 ); + rOut << rDesign.m_bDownload; + rOut << rDesign.m_bCreated; // not used + rOut << rDesign.m_nButtonThema; + rOut << rDesign.m_bUserAttr; + rOut << rDesign.m_aBackColor; + rOut << rDesign.m_aTextColor; + rOut << rDesign.m_aLinkColor; + rOut << rDesign.m_aVLinkColor; + rOut << rDesign.m_aALinkColor; + rOut << rDesign.m_bUseAttribs; + rOut << rDesign.m_bUseColor; + + rOut << (UINT16)rDesign.m_eScript; + rOut.WriteByteString( rDesign.m_aURL, RTL_TEXTENCODING_UTF8 ); + rOut.WriteByteString( rDesign.m_aCGI, RTL_TEXTENCODING_UTF8 ); + + rOut << rDesign.m_bAutoSlide; + rOut << rDesign.m_nSlideDuration; + rOut << rDesign.m_bEndless; + rOut << rDesign.m_bSlideSound; + rOut << rDesign.m_bHiddenSlides; + + return rOut; +} + +// ********************************************************************* +// Dialog zur eingabe eines Namens fuer ein Design +// ********************************************************************* +class SdDesignNameDlg : public ModalDialog +{ +private: + Edit m_aEdit; + OKButton m_aBtnOK; + CancelButton m_aBtnCancel; + +public: + SdDesignNameDlg(Window* pWindow, const String& aName ); + + String GetDesignName(); + DECL_LINK( ModifyHdl, Edit* ); +}; + +// ********************************************************************* +// SdPublishingDlg Methoden +// ********************************************************************* + +// ===================================================================== +// Konstruktor des Dialogs +// ===================================================================== +SdPublishingDlg::SdPublishingDlg(Window* pWindow, DocumentType eDocType) +: ModalDialog(pWindow, SdResId( DLG_PUBLISHING )) +, mpButtonSet( new ButtonSet() ) +, aBottomLine( this, SdResId( BOTTOM_LINE ) ) +, aHelpButton(this,SdResId(BUT_HELP)) +, aCancelButton(this,SdResId(BUT_CANCEL)) +, aLastPageButton(this,SdResId(BUT_LAST)) +, aNextPageButton(this,SdResId(BUT_NEXT)) +, aFinishButton(this,SdResId(BUT_FINISH)) +, aAssistentFunc(NOOFPAGES) +, m_bButtonsDirty(TRUE) +, m_bDesignListDirty(FALSE) +, m_pDesign(NULL) +{ + m_bImpress = eDocType == DOCUMENT_TYPE_IMPRESS; + + CreatePages(); + Load(); + + //setzt die Ausgangsseite + aAssistentFunc.GotoPage(1); + aLastPageButton.Disable(); + + //Buttonbelegung + aFinishButton.SetClickHdl(LINK(this,SdPublishingDlg,FinishHdl)); + aLastPageButton.SetClickHdl(LINK(this,SdPublishingDlg,LastPageHdl)); + aNextPageButton.SetClickHdl(LINK(this,SdPublishingDlg,NextPageHdl)); + + pPage1_NewDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl)); + pPage1_OldDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignHdl)); + pPage1_Designs->SetSelectHdl(LINK(this,SdPublishingDlg,DesignSelectHdl)); + pPage1_DelDesign->SetClickHdl(LINK(this,SdPublishingDlg,DesignDeleteHdl)); + + pPage2_Standard->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl)); + pPage2_Standard_FB->SetBorderStyle(WINDOW_BORDER_MONO); + pPage2_Frames->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl)); + pPage2_Frames_FB->SetBorderStyle(WINDOW_BORDER_MONO); + pPage2_Kiosk->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl)); + pPage2_Kiosk_FB->SetBorderStyle(WINDOW_BORDER_MONO); + pPage2_WebCast->SetClickHdl(LINK(this,SdPublishingDlg,BaseHdl)); + pPage2_WebCast_FB->SetBorderStyle(WINDOW_BORDER_MONO); + + pPage2_Content->SetClickHdl(LINK(this,SdPublishingDlg,ContentHdl)); + + pPage2_ASP->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl)); + pPage2_PERL->SetClickHdl(LINK(this,SdPublishingDlg,WebServerHdl)); + String aText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("index")) ); + aText += String(SdResId(STR_HTMLEXP_DEFAULT_EXTENSION)); + pPage2_Index->SetText(aText); + pPage2_CGI->SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "/cgi-bin/" ) ) ); + + pPage3_Png->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl)); + pPage3_Gif->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl)); + pPage3_Jpg->SetClickHdl(LINK(this,SdPublishingDlg, GfxFormatHdl)); + pPage3_Quality->Enable(FALSE); + + pPage3_Resolution_1->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl )); + pPage3_Resolution_2->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl )); + pPage3_Resolution_3->SetClickHdl(LINK(this,SdPublishingDlg, ResolutionHdl )); + + pPage2_ChgDefault->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl)); + pPage2_ChgAuto->SetClickHdl(LINK(this,SdPublishingDlg, SlideChgHdl)); + pPage2_Duration->SetFormat( TIMEF_SEC ); + + pPage5_Buttons->SetSelectHdl(LINK(this,SdPublishingDlg, ButtonsHdl )); + pPage5_Buttons->SetStyle( pPage5_Buttons->GetStyle() | WB_VSCROLL ); + + pPage6_Back->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl )); + pPage6_Text->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl )); + pPage6_Link->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl )); + pPage6_VLink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl )); + pPage6_ALink->SetClickHdl(LINK(this,SdPublishingDlg, ColorHdl )); + + pPage6_DocColors->Check(); + + FreeResource(); + + pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "25%" ) ) ); + pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "50%" ) ) ); + pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "75%" ) ) ); + pPage3_Quality->InsertEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "100%" ) ) ); + + pPage5_Buttons->SetColCount( 1 ); + pPage5_Buttons->SetLineCount( 4 ); + pPage5_Buttons->SetExtraSpacing( 1 ); + + for( UINT16 nIndex = 0; nIndex < m_pDesignList->Count(); nIndex++ ) + { + SdPublishingDesign *pDesign = (SdPublishingDesign*) + m_pDesignList->GetObject(nIndex); + + pPage1_Designs->InsertEntry(pDesign->m_aDesignName); + } + + pPage6_Preview->SetBorderStyle(WINDOW_BORDER_MONO); + + SetDefaults(); + + SetHelpId(aPageHelpIds[0]); + + aNextPageButton.GrabFocus(); +} + +// ===================================================================== +// Destruktor +// ===================================================================== +SdPublishingDlg::~SdPublishingDlg() +{ + if( m_pDesignList ) + { + for( UINT16 nIndex = 0; nIndex < m_pDesignList->Count(); nIndex++ ) + delete (SdPublishingDesign*)m_pDesignList->GetObject(nIndex); + } + + delete m_pDesignList; + RemovePages(); +} + +// ===================================================================== +// Dialog Controls erzeugen und in die Seiten des Assistenten einbinden +// ===================================================================== +void SdPublishingDlg::CreatePages() +{ + // Page 1 + aAssistentFunc.InsertControl(1, + pPage1_Bmp = new FixedBitmap(this,SdResId(PAGE1_BMP))); + aAssistentFunc.InsertControl(1, + pPage1_Titel = new FixedLine(this,SdResId(PAGE1_TITEL))); + aAssistentFunc.InsertControl(1, + pPage1_NewDesign = new RadioButton(this,SdResId(PAGE1_NEW_DESIGN))); + aAssistentFunc.InsertControl(1, + pPage1_OldDesign = new RadioButton(this,SdResId(PAGE1_OLD_DESIGN))); + aAssistentFunc.InsertControl(1, + pPage1_Designs = new ListBox(this,SdResId(PAGE1_DESIGNS))); + aAssistentFunc.InsertControl(1, + pPage1_DelDesign = new PushButton(this,SdResId(PAGE1_DEL_DESIGN))); + aAssistentFunc.InsertControl(1, + pPage1_Desc = new FixedText(this,SdResId(PAGE1_DESC))); + + + // Page 2 + aAssistentFunc.InsertControl(2, + pPage2_Bmp = new FixedBitmap(this,SdResId(PAGE2_BMP))); + aAssistentFunc.InsertControl(2, + pPage2_Titel = new FixedLine(this,SdResId(PAGE2_TITEL ))); + aAssistentFunc.InsertControl(2, + pPage2_Standard = new RadioButton(this,SdResId(PAGE2_STANDARD))); + aAssistentFunc.InsertControl(2, + pPage2_Frames = new RadioButton(this,SdResId(PAGE2_FRAMES))); + aAssistentFunc.InsertControl(2, + pPage2_Kiosk = new RadioButton(this,SdResId(PAGE2_KIOSK))); + aAssistentFunc.InsertControl(2, + pPage2_WebCast = new RadioButton(this,SdResId(PAGE2_WEBCAST))); + aAssistentFunc.InsertControl(2, + pPage2_Standard_FB = new FixedBitmap(this,SdResId(PAGE2_NOFRAMES_FB))); + aAssistentFunc.InsertControl(2, + pPage2_Frames_FB = new FixedBitmap(this,SdResId(PAGE2_FRAMES_FB))); + aAssistentFunc.InsertControl(2, + pPage2_Kiosk_FB = new FixedBitmap(this,SdResId(PAGE2_KIOSK_FB))); + aAssistentFunc.InsertControl(2, + pPage2_WebCast_FB = new FixedBitmap(this,SdResId(PAGE2_WEBCAST_FB))); + + aAssistentFunc.InsertControl(2, + pPage2_Titel_Html = new FixedLine(this,SdResId(PAGE2_TITEL_HTML))); + aAssistentFunc.InsertControl(2, + pPage2_Content = new CheckBox(this,SdResId(PAGE2_CONTENT))); + if(m_bImpress) + aAssistentFunc.InsertControl(2, + pPage2_Notes = new CheckBox(this,SdResId(PAGE2_NOTES))); + + aAssistentFunc.InsertControl(2, + pPage2_Titel_WebCast = new FixedLine(this,SdResId(PAGE2_TITEL_WEBCAST))); + aAssistentFunc.InsertControl(2, + pPage2_Index_txt = new FixedText(this,SdResId(PAGE2_INDEX_TXT))); + aAssistentFunc.InsertControl(2, + pPage2_Index = new Edit(this,SdResId(PAGE2_INDEX))); + aAssistentFunc.InsertControl(2, + pPage2_ASP = new RadioButton(this,SdResId(PAGE2_ASP))); + aAssistentFunc.InsertControl(2, + pPage2_PERL = new RadioButton(this,SdResId(PAGE2_PERL))); + aAssistentFunc.InsertControl(2, + pPage2_URL_txt = new FixedText(this,SdResId(PAGE2_URL_TXT))); + aAssistentFunc.InsertControl(2, + pPage2_URL = new Edit(this,SdResId(PAGE2_URL))); + aAssistentFunc.InsertControl(2, + pPage2_CGI_txt = new FixedText(this,SdResId(PAGE2_CGI_TXT))); + aAssistentFunc.InsertControl(2, + pPage2_CGI = new Edit(this,SdResId(PAGE2_CGI))); + aAssistentFunc.InsertControl(2, + pPage2_Vert = new FixedLine( this,SdResId( PAGE2_VERT ))); + aAssistentFunc.InsertControl(2, + pPage2_Titel_Kiosk = new FixedLine(this,SdResId(PAGE2_TITEL_KIOSK))); + aAssistentFunc.InsertControl(2, + pPage2_ChgDefault = new RadioButton(this,SdResId(PAGE2_CHG_DEFAULT))); + aAssistentFunc.InsertControl(2, + pPage2_ChgAuto = new RadioButton(this,SdResId(PAGE2_CHG_AUTO))); + aAssistentFunc.InsertControl(2, + pPage2_Duration_txt = new FixedText(this,SdResId(PAGE2_DURATION_TXT))); + aAssistentFunc.InsertControl(2, + pPage2_Duration = new TimeField(this,SdResId(PAGE2_DURATION_TMF))); + aAssistentFunc.InsertControl(2, + pPage2_Endless = new CheckBox(this,SdResId(PAGE2_ENDLESS))); + + // Page 3 + aAssistentFunc.InsertControl(3, + pPage3_Bmp = new FixedBitmap(this,SdResId(PAGE3_BMP))); + aAssistentFunc.InsertControl(3, + pPage3_Titel1 = new FixedLine(this,SdResId(PAGE3_TITEL_1))); + aAssistentFunc.InsertControl(3, + pPage3_Png = new RadioButton(this,SdResId(PAGE3_PNG))); + aAssistentFunc.InsertControl(3, + pPage3_Gif = new RadioButton(this,SdResId(PAGE3_GIF))); + aAssistentFunc.InsertControl(3, + pPage3_Jpg = new RadioButton(this,SdResId(PAGE3_JPG))); + aAssistentFunc.InsertControl(3, + pPage3_Quality_txt = new FixedText(this,SdResId(PAGE3_QUALITY_TXT))); + aAssistentFunc.InsertControl(3, + pPage3_Quality = new ComboBox(this,SdResId(PAGE3_QUALITY))); + aAssistentFunc.InsertControl(3, + pPage3_Vert = new FixedLine( this,SdResId( PAGE3_VERT ))); + aAssistentFunc.InsertControl(3, + pPage3_Titel2 = new FixedLine(this,SdResId(PAGE3_TITEL_2))); + aAssistentFunc.InsertControl(3, + pPage3_Resolution_1 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_1))); + aAssistentFunc.InsertControl(3, + pPage3_Resolution_2 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_2))); + aAssistentFunc.InsertControl(3, + pPage3_Resolution_3 = new RadioButton(this,SdResId(PAGE3_RESOLUTION_3))); + aAssistentFunc.InsertControl(3, + pPage3_Titel3 = new FixedLine(this,SdResId(PAGE3_TITEL_3))); + aAssistentFunc.InsertControl(3, + pPage3_SldSound = new CheckBox(this,SdResId(PAGE3_SLD_SOUND))); + aAssistentFunc.InsertControl(3, + pPage3_HiddenSlides = new CheckBox(this,SdResId(PAGE3_HIDDEN_SLIDES))); + + // Seite 4 + aAssistentFunc.InsertControl(4, + pPage4_Bmp = new FixedBitmap(this,SdResId(PAGE4_BMP))); + aAssistentFunc.InsertControl(4, + pPage4_Titel1 = new FixedLine(this,SdResId(PAGE4_TITEL_1))); + aAssistentFunc.InsertControl(4, + pPage4_Author_txt = new FixedText(this,SdResId(PAGE4_AUTHOR_TXT))); + aAssistentFunc.InsertControl(4, + pPage4_Author = new Edit(this,SdResId(PAGE4_AUTHOR))); + aAssistentFunc.InsertControl(4, + pPage4_Email_txt = new FixedText(this,SdResId(PAGE4_EMAIL_TXT))); + aAssistentFunc.InsertControl(4, + pPage4_Email = new Edit(this,SdResId(PAGE4_EMAIL_EDIT))); + aAssistentFunc.InsertControl(4, + pPage4_WWW_txt = new FixedText(this,SdResId(PAGE4_WWW_TXT))); + aAssistentFunc.InsertControl(4, + pPage4_WWW = new Edit(this,SdResId(PAGE4_WWW_EDIT))); + aAssistentFunc.InsertControl(4, + pPage4_Titel2 = new FixedText(this,SdResId(PAGE4_TITEL_2))); + aAssistentFunc.InsertControl(4, + pPage4_Misc = new MultiLineEdit(this,SdResId(PAGE4_MISC))); + if(m_bImpress) + aAssistentFunc.InsertControl(4, + pPage4_Download = new CheckBox(this,SdResId(PAGE4_DOWNLOAD))); +//-/ aAssistentFunc.InsertControl(4, +//-/ pPage4_Created = new CheckBox(this,SdResId(PAGE4_CREATED))); + + // Seite 5 + aAssistentFunc.InsertControl(5, + pPage5_Bmp = new FixedBitmap(this,SdResId(PAGE5_BMP))); + aAssistentFunc.InsertControl(5, + pPage5_Titel = new FixedLine(this,SdResId(PAGE5_TITEL))); + aAssistentFunc.InsertControl(5, + pPage5_TextOnly = new CheckBox(this, SdResId(PAGE5_TEXTONLY))); + aAssistentFunc.InsertControl(5, + pPage5_Buttons = new ValueSet(this,SdResId(PAGE5_BUTTONS))); + + // Seite 6 + aAssistentFunc.InsertControl(6, + pPage6_Bmp = new FixedBitmap(this,SdResId(PAGE6_BMP))); + aAssistentFunc.InsertControl(6, + pPage6_Titel = new FixedLine(this,SdResId(PAGE6_TITEL))); + aAssistentFunc.InsertControl(6, + pPage6_DocColors = new RadioButton(this,SdResId(PAGE6_DOCCOLORS))); + aAssistentFunc.InsertControl(6, + pPage6_Default = new RadioButton(this,SdResId(PAGE6_DEFAULT))); + aAssistentFunc.InsertControl(6, + pPage6_User = new RadioButton(this,SdResId(PAGE6_USER))); + aAssistentFunc.InsertControl(6, + pPage6_Text = new PushButton(this,SdResId(PAGE6_TEXT))); + aAssistentFunc.InsertControl(6, + pPage6_Link = new PushButton(this,SdResId(PAGE6_LINK))); + aAssistentFunc.InsertControl(6, + pPage6_ALink = new PushButton(this,SdResId(PAGE6_ALINK))); + aAssistentFunc.InsertControl(6, + pPage6_VLink = new PushButton(this,SdResId(PAGE6_VLINK))); + aAssistentFunc.InsertControl(6, + pPage6_Back = new PushButton(this,SdResId(PAGE6_BACK))); + aAssistentFunc.InsertControl(6, + pPage6_Preview = new SdHtmlAttrPreview(this,SdResId(PAGE6_PREVIEW))); + + InterpolateFixedBitmap(pPage1_Bmp); + + InterpolateFixedBitmap(pPage2_Bmp); + InterpolateFixedBitmap(pPage2_Standard_FB); + InterpolateFixedBitmap(pPage2_Frames_FB); + InterpolateFixedBitmap(pPage2_Kiosk_FB); + InterpolateFixedBitmap(pPage2_WebCast_FB); + + InterpolateFixedBitmap(pPage3_Bmp); + InterpolateFixedBitmap(pPage4_Bmp); + + InterpolateFixedBitmap(pPage5_Bmp); + InterpolateFixedBitmap(pPage6_Bmp); +} + +// ===================================================================== +// Dialog Controls wieder entfernen +// ===================================================================== +void SdPublishingDlg::RemovePages() +{ + delete pPage1_Bmp; + delete pPage1_Titel; + delete pPage1_NewDesign; + delete pPage1_OldDesign; + delete pPage1_Designs; + delete pPage1_DelDesign; + delete pPage1_Desc; + + delete pPage2_Bmp; + delete pPage2_Titel; + delete pPage2_Standard; + delete pPage2_Frames; + delete pPage2_Kiosk; + delete pPage2_WebCast; + delete pPage2_Standard_FB; + delete pPage2_Frames_FB; + delete pPage2_Kiosk_FB; + delete pPage2_WebCast_FB; + + delete pPage2_Titel_Html; + delete pPage2_Content; + if(m_bImpress) + delete pPage2_Notes; + + delete pPage2_Vert; + delete pPage2_Titel_WebCast; + delete pPage2_Index_txt; + delete pPage2_Index; + delete pPage2_ASP; + delete pPage2_PERL; + delete pPage2_URL_txt; + delete pPage2_URL; + delete pPage2_CGI_txt; + delete pPage2_CGI; + + delete pPage2_Titel_Kiosk; + delete pPage2_ChgDefault; + delete pPage2_ChgAuto; + delete pPage2_Duration_txt; + delete pPage2_Duration; + delete pPage2_Endless; + + delete pPage3_Bmp; + delete pPage3_Titel1; + delete pPage3_Png; + delete pPage3_Gif; + delete pPage3_Jpg; + delete pPage3_Quality_txt; + delete pPage3_Quality; + delete pPage3_Vert; + delete pPage3_Titel2; + delete pPage3_Resolution_1; + delete pPage3_Resolution_2; + delete pPage3_Resolution_3; + delete pPage3_Titel3; + delete pPage3_SldSound; + delete pPage3_HiddenSlides; + + delete pPage4_Bmp; + delete pPage4_Titel1; + delete pPage4_Author_txt; + delete pPage4_Author; + delete pPage4_Email_txt; + delete pPage4_Email; + delete pPage4_WWW_txt; + delete pPage4_WWW; + delete pPage4_Titel2; + delete pPage4_Misc; + if(m_bImpress) + delete pPage4_Download; +//-/ delete pPage4_Created; + + delete pPage5_Bmp; + delete pPage5_Titel; + delete pPage5_TextOnly; + delete pPage5_Buttons; + + delete pPage6_Bmp; + delete pPage6_Titel; + delete pPage6_Default; + delete pPage6_User; + delete pPage6_Back; + delete pPage6_Text; + delete pPage6_Link; + delete pPage6_VLink; + delete pPage6_ALink; + delete pPage6_DocColors; + delete pPage6_Preview; +} + +// ===================================================================== +// Dialog mit defaultwerten initialisieren +// ===================================================================== +void SdPublishingDlg::SetDefaults() +{ + SdPublishingDesign aDefault; + SetDesign(&aDefault); + + pPage1_NewDesign->Check(TRUE); + pPage1_OldDesign->Check(FALSE); + UpdatePage(); +} + +// ===================================================================== +// Das SfxItemSet mit den Einstellungen des Dialogs fuettern +// ===================================================================== +void SdPublishingDlg::GetParameterSequence( Sequence< PropertyValue >& rParams ) +{ + std::vector< PropertyValue > aProps; + + PropertyValue aValue; + + + // Page 2 + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PublishMode" ) ); + aValue.Value <<= (sal_Int32)(pPage2_Standard->IsChecked()?PUBLISH_HTML: + pPage2_Frames->IsChecked()?PUBLISH_FRAMES: + pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK:PUBLISH_WEBCAST); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsExportContentsPage" ) ); + aValue.Value <<= (sal_Bool)pPage2_Content->IsChecked(); + aProps.push_back( aValue ); + + if(m_bImpress) + { + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsExportNotes" ) ); + aValue.Value <<= (sal_Bool)pPage2_Notes->IsChecked(); + aProps.push_back( aValue ); + } + + if( pPage2_WebCast->IsChecked() ) + { + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WebCastScriptLanguage" ) ); + if( pPage2_ASP->IsChecked() ) + aValue.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "asp" ) ); + else + aValue.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "perl" ) ); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WebCastCGIURL" ) ); + aValue.Value <<= OUString( pPage2_CGI->GetText() ); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WebCastTargetURL" ) ); + aValue.Value <<= OUString( pPage2_URL->GetText() ); + aProps.push_back( aValue ); + } + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IndexURL" ) ); + aValue.Value <<= OUString( pPage2_Index->GetText() ); + aProps.push_back( aValue ); + + + if( pPage2_Kiosk->IsChecked() && pPage2_ChgAuto->IsChecked() ) + { + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "KioskSlideDuration" ) ); + aValue.Value <<= (sal_uInt32)pPage2_Duration->GetTime().GetMSFromTime() / 1000; + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "KioskEndless" ) ); + aValue.Value <<= (sal_Bool)pPage2_Endless->IsChecked(); + aProps.push_back( aValue ); + } + + // Page 3 + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ); + sal_Int32 nTmpWidth = 512; + if( pPage3_Resolution_2->IsChecked() ) + nTmpWidth = 640; + else if( pPage3_Resolution_3->IsChecked() ) + nTmpWidth = 800; + + aValue.Value <<= nTmpWidth; + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ); + aValue.Value <<= OUString( pPage3_Quality->GetText() ); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Format" ) ); + sal_Int32 nFormat; + if( pPage3_Png->IsChecked() ) + nFormat = static_cast<sal_Int32>(FORMAT_PNG); + else if( pPage3_Gif->IsChecked() ) + nFormat = static_cast<sal_Int32>(FORMAT_GIF); + else + nFormat = static_cast<sal_Int32>(FORMAT_JPG); + aValue.Value <<= nFormat; + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SlideSound" ) ); + aValue.Value <<= pPage3_SldSound->IsChecked() ? sal_True : sal_False; + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "HiddenSlides" ) ); + aValue.Value <<= pPage3_HiddenSlides->IsChecked() ? sal_True : sal_False; + aProps.push_back( aValue ); + + // Page 4 + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ); + aValue.Value <<= OUString( pPage4_Author->GetText() ); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EMail" ) ); + aValue.Value <<= OUString( pPage4_Email->GetText() ); + aProps.push_back( aValue ); + + // #92433# try to guess protocol for user's homepage + INetURLObject aHomeURL( pPage4_WWW->GetText(), + INET_PROT_HTTP, // default proto is HTTP + INetURLObject::ENCODE_ALL ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "HomepageURL" ) ); + aValue.Value <<= OUString( aHomeURL.GetMainURL( INetURLObject::NO_DECODE ) ); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UserText" ) ); + aValue.Value <<= OUString( pPage4_Misc->GetText() ); + aProps.push_back( aValue ); + + if( m_bImpress ) + { + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableDownload" ) ); + aValue.Value <<= (sal_Bool)pPage4_Download->IsChecked(); + aProps.push_back( aValue ); + } + + // Page 5 + if( !pPage5_TextOnly->IsChecked() ) + { + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UseButtonSet" ) ); + aValue.Value <<= (sal_Int32)(pPage5_Buttons->GetSelectItemId() - 1); + aProps.push_back( aValue ); + } + + // Page 6 + if( pPage6_User->IsChecked() ) + { + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "BackColor" ) ); + aValue.Value <<= (sal_Int32)m_aBackColor.GetColor(); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ); + aValue.Value <<= (sal_Int32)m_aTextColor.GetColor(); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "LinkColor" ) ); + aValue.Value <<= (sal_Int32)m_aLinkColor.GetColor(); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "VLinkColor" ) ); + aValue.Value <<= (sal_Int32)m_aVLinkColor.GetColor(); + aProps.push_back( aValue ); + + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ALinkColor" ) ); + aValue.Value <<= (sal_Int32)m_aALinkColor.GetColor(); + aProps.push_back( aValue ); + } + + if( pPage6_DocColors->IsChecked() ) + { + aValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsUseDocumentColors" ) ); + aValue.Value <<= (sal_Bool)sal_True; + aProps.push_back( aValue ); + } + + // Seite 6 +// aSet.Put(SfxBoolItem(ATTR_PUBLISH_SLIDESOUND,pPage6_Sound->IsChecked())); + + + rParams.realloc( aProps.size() ); + PropertyValue* pParams = rParams.getArray(); + + for( std::vector< PropertyValue >::iterator i = aProps.begin(); i != aProps.end(); i++ ) + { + *pParams++ = (*i); + } +} + +// ===================================================================== +// Clickhandler fuer die Radiobuttons zur Designauswahl +// ===================================================================== +IMPL_LINK( SdPublishingDlg, DesignHdl, RadioButton *, pButton ) +{ + if(pButton == pPage1_NewDesign) + { + pPage1_NewDesign->Check(TRUE); // wegen DesignDeleteHdl + pPage1_OldDesign->Check(FALSE); + pPage1_Designs->Disable(); + pPage1_DelDesign->Disable(); + m_pDesign = NULL; + + SdPublishingDesign aDefault; + SetDesign(&aDefault); + } + else + { + pPage1_NewDesign->Check(FALSE); + pPage1_Designs->Enable(); + pPage1_DelDesign->Enable(); + + if(pPage1_Designs->GetSelectEntryCount() == 0) + pPage1_Designs->SelectEntryPos(0); + + USHORT nPos = pPage1_Designs->GetSelectEntryPos(); + m_pDesign = (SdPublishingDesign*)m_pDesignList->GetObject(nPos); + DBG_ASSERT(m_pDesign, "Kein Design? Das darf nicht sein! (CL)"); + + if(m_pDesign) + SetDesign(m_pDesign); + } + + return 0; +} + +// ===================================================================== +// Clickhandler fuer die auswahl eines Designs +// ===================================================================== +IMPL_LINK( SdPublishingDlg, DesignSelectHdl, ListBox *, EMPTYARG ) +{ + USHORT nPos = pPage1_Designs->GetSelectEntryPos(); + m_pDesign = (SdPublishingDesign*)m_pDesignList->GetObject(nPos); + DBG_ASSERT(m_pDesign, "Kein Design? Das darf nicht sein! (CL)"); + + if(m_pDesign) + SetDesign(m_pDesign); + + UpdatePage(); + + return 0; +} + +// ===================================================================== +// Clickhandler fuer das loeschen eines Designs +// ===================================================================== +IMPL_LINK( SdPublishingDlg, DesignDeleteHdl, PushButton *, EMPTYARG ) +{ + USHORT nPos = pPage1_Designs->GetSelectEntryPos(); + SdPublishingDesign* pDesign = (SdPublishingDesign*) + m_pDesignList->GetObject(nPos); + DBG_ASSERT(pDesign, "Kein Design? Das darf nicht sein! (CL)"); + + if(pDesign) + { + m_pDesignList->Remove(pDesign); + pPage1_Designs->RemoveEntry(nPos); + } + + if(m_pDesign == pDesign) + DesignHdl( pPage1_NewDesign ); + + delete pDesign; + + m_bDesignListDirty = TRUE; + + UpdatePage(); + + return 0; +} + +// ===================================================================== +// Clickhandler fuer das ändern des Servertyps +// ===================================================================== +IMPL_LINK( SdPublishingDlg, WebServerHdl, RadioButton *, pButton ) +{ + BOOL bASP = pButton == pPage2_ASP; + + pPage2_ASP->Check( bASP ); + pPage2_PERL->Check( !bASP ); + UpdatePage(); + + return 0; +} + +// ===================================================================== +// Clickhandler fuer die Radiobuttons der Auswahl des Grafikformates +// ===================================================================== +IMPL_LINK( SdPublishingDlg, GfxFormatHdl, RadioButton *, pButton ) +{ + pPage3_Png->Check( pButton == pPage3_Png ); + pPage3_Gif->Check( pButton == pPage3_Gif ); + pPage3_Jpg->Check( pButton == pPage3_Jpg ); + pPage3_Quality->Enable(pButton == pPage3_Jpg); + return 0; +} + +// ===================================================================== +// Clickhandler fuer die Radiobuttons Stanrard/Frames +// ===================================================================== +IMPL_LINK( SdPublishingDlg, BaseHdl, RadioButton *, EMPTYARG ) +{ +/* + if(pButton == pPage3_Standard) + pPage3_Frames->Check( pButton == pPage3 ); + else + pPage3_Standard->Check(FALSE); +*/ + UpdatePage(); + + return 0; +} + +// ===================================================================== +// Clickhandler fuer die CheckBox der Titelseite +// ===================================================================== +IMPL_LINK( SdPublishingDlg, ContentHdl, RadioButton *, EMPTYARG ) +{ + if(pPage2_Content->IsChecked()) + { + if(!aAssistentFunc.IsEnabled(4)) + { + aAssistentFunc.EnablePage(4); + UpdatePage(); + } + } + else + { + if(aAssistentFunc.IsEnabled(4)) + { + aAssistentFunc.DisablePage(4); + UpdatePage(); + } + } + return 0; +} + +// ===================================================================== +// Clickhandler fuer die Radiobuttons Aufloesung +// ===================================================================== +IMPL_LINK( SdPublishingDlg, ResolutionHdl, RadioButton *, pButton ) +{ + pPage3_Resolution_1->Check(pButton == pPage3_Resolution_1); + pPage3_Resolution_2->Check(pButton == pPage3_Resolution_2); + pPage3_Resolution_3->Check(pButton == pPage3_Resolution_3); + + return 0; +} + +// ===================================================================== +// Clickhandler fuer das ValueSet mit den Bitmap Schaltflaechen +// ===================================================================== +IMPL_LINK( SdPublishingDlg, ButtonsHdl, ValueSet *, EMPTYARG ) +{ + // wird eine Bitmap Schaltflaeche gewaehlt, TexOnly ausschalten + pPage5_TextOnly->Check(FALSE); + return 0; +} + +// ===================================================================== +// Das SfxItemSet mit den Einstellungen des Dialogs fuettern +// ===================================================================== +IMPL_LINK( SdPublishingDlg, ColorHdl, PushButton *, pButton) +{ + SvColorDialog aDlg(this); + + if(pButton == pPage6_Back) + { + aDlg.SetColor( m_aBackColor ); + if(aDlg.Execute() == RET_OK ) + m_aBackColor = aDlg.GetColor(); + } + else if(pButton == pPage6_Text) + { + aDlg.SetColor( m_aTextColor ); + if(aDlg.Execute() == RET_OK ) + m_aTextColor = aDlg.GetColor(); + } + else if(pButton == pPage6_Link) + { + aDlg.SetColor( m_aLinkColor ); + if(aDlg.Execute() == RET_OK ) + m_aLinkColor = aDlg.GetColor(); + } + else if(pButton == pPage6_VLink) + { + aDlg.SetColor( m_aVLinkColor ); + if(aDlg.Execute() == RET_OK ) + m_aVLinkColor = aDlg.GetColor(); + } + else if(pButton == pPage6_ALink) + { + aDlg.SetColor( m_aALinkColor ); + if(aDlg.Execute() == RET_OK ) + m_aALinkColor = aDlg.GetColor(); + } + + pPage6_User->Check(TRUE); + pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor, + m_aVLinkColor, m_aALinkColor ); + pPage6_Preview->Invalidate(); + return 0; +} + +IMPL_LINK( SdPublishingDlg, SlideChgHdl, RadioButton*, EMPTYARG ) +{ + UpdatePage(); + return 0; +} + +// ===================================================================== +// Clickhandler fuer den Ok Button +// ===================================================================== +IMPL_LINK( SdPublishingDlg, FinishHdl, OKButton *, EMPTYARG ) +{ + //Ende + SdPublishingDesign* pDesign = new SdPublishingDesign(); + GetDesign(pDesign); + + BOOL bSave = FALSE; + + if(pPage1_OldDesign->IsChecked() && m_pDesign) + { + // aenderungen?? + if(!(*pDesign == *m_pDesign)) + bSave = TRUE; + } + else + { + SdPublishingDesign aDefaultDesign; + if(!(aDefaultDesign == *pDesign)) + bSave = TRUE; + } + + if(bSave) + { + String aName; + if(m_pDesign) + aName = m_pDesign->m_aDesignName; + + BOOL bRetry; + do + { + bRetry = FALSE; + + SdDesignNameDlg aDlg(this, aName ); + + if ( aDlg.Execute() == RET_OK ) + { + pDesign->m_aDesignName = aDlg.GetDesignName(); + + SdPublishingDesign* pSameNameDes = NULL; + UINT16 nIndex; + for( nIndex = 0; nIndex < m_pDesignList->Count(); nIndex++ ) + { + pSameNameDes = (SdPublishingDesign*) + m_pDesignList->GetObject(nIndex); + if(pSameNameDes->m_aDesignName == pDesign->m_aDesignName) + break; + } + + if(nIndex < m_pDesignList->Count()) + { + ErrorBox aErrorBox(this, WB_YES_NO, + String(SdResId(STR_PUBDLG_SAMENAME))); + bRetry = aErrorBox.Execute() == RET_NO; + + if(!bRetry) + { + m_pDesignList->Remove(pSameNameDes); + delete pSameNameDes; + } + } + + if(!bRetry) + { + m_pDesignList->Insert(pDesign); + m_bDesignListDirty = TRUE; + pDesign = NULL; + } + } + } + while(bRetry); + } + + delete pDesign; + + if(m_bDesignListDirty) + Save(); + + EndDialog(RET_OK); + return 0; +} + +// ===================================================================== +// Refresh des Dialogs beim wechsel der Seite +// ===================================================================== +void SdPublishingDlg::ChangePage() +{ + int nPage = aAssistentFunc.GetCurrentPage(); + SetHelpId(aPageHelpIds[nPage-1]); + + UpdatePage(); + + if( aNextPageButton.IsEnabled() ) + aNextPageButton.GrabFocus(); + else + aFinishButton.GrabFocus(); +} + +void SdPublishingDlg::UpdatePage() +{ + aNextPageButton.Enable(!aAssistentFunc.IsLastPage()); + aLastPageButton.Enable(!aAssistentFunc.IsFirstPage()); + + int nPage = aAssistentFunc.GetCurrentPage(); + + switch( nPage ) + { + case 1: + if(pPage1_NewDesign->IsChecked()) + { + pPage1_Designs->Disable(); + pPage1_DelDesign->Disable(); + } + + if(m_pDesignList && m_pDesignList->Count() == 0) + pPage1_OldDesign->Disable(); + break; + case 2: + pPage2_Frames_FB->Show(pPage2_Frames->IsChecked()); + pPage2_Standard_FB->Show(pPage2_Standard->IsChecked()); + pPage2_Kiosk_FB->Show(pPage2_Kiosk->IsChecked()); + pPage2_WebCast_FB->Show(pPage2_WebCast->IsChecked()); + + if( pPage2_WebCast->IsChecked() ) + { + pPage2_Titel_WebCast->Show(); + pPage2_ASP->Show(); + pPage2_PERL->Show(); + pPage2_URL_txt->Show(); + pPage2_URL->Show(); + pPage2_CGI_txt->Show(); + pPage2_CGI->Show(); + pPage2_Index_txt->Show(); + pPage2_Index->Show(); + + BOOL bPerl = pPage2_PERL->IsChecked(); + pPage2_Index->Enable(bPerl); + pPage2_Index_txt->Enable(bPerl); + pPage2_URL_txt->Enable(bPerl); + pPage2_URL->Enable(bPerl); + pPage2_CGI_txt->Enable(bPerl); + pPage2_CGI->Enable(bPerl); + } + else + { + pPage2_Titel_WebCast->Hide(); + pPage2_ASP->Hide(); + pPage2_PERL->Hide(); + pPage2_URL_txt->Hide(); + pPage2_URL->Hide(); + pPage2_CGI_txt->Hide(); + pPage2_CGI->Hide(); + pPage2_Index->Hide(); + pPage2_Index_txt->Hide(); + } + + if( pPage2_Kiosk->IsChecked() ) + { + pPage2_Titel_Kiosk->Show(); + pPage2_ChgDefault->Show(); + pPage2_ChgAuto->Show(); + pPage2_Duration_txt->Show(); + pPage2_Duration->Show(); + pPage2_Endless->Show(); + BOOL bAuto = pPage2_ChgAuto->IsChecked(); + pPage2_Duration->Enable(bAuto); + pPage2_Endless->Enable(bAuto); + } + else + { + pPage2_Titel_Kiosk->Hide(); + pPage2_ChgDefault->Hide(); + pPage2_ChgAuto->Hide(); + pPage2_Duration->Hide(); + pPage2_Duration_txt->Hide(); + pPage2_Endless->Hide(); + } + + if( pPage2_Standard->IsChecked() || pPage2_Frames->IsChecked() ) + { + pPage2_Titel_Html->Show(); + pPage2_Content->Show(); + if(m_bImpress) + pPage2_Notes->Show(); + } + else + { + pPage2_Titel_Html->Hide(); + pPage2_Content->Hide(); + if(m_bImpress) + pPage2_Notes->Hide(); + } + break; + case 3: + if( pPage2_Kiosk->IsChecked() || pPage2_WebCast->IsChecked() ) + aNextPageButton.Disable(); + + if( pPage2_WebCast->IsChecked() ) + pPage3_SldSound->Disable(); + + pPage3_Quality->Enable(pPage3_Jpg->IsChecked()); + + break; + case 5: + if( m_bButtonsDirty ) + LoadPreviewButtons(); + break; + } +} + +/** loads the html buttons from the button sets, creates a preview and fills the + itemset for page 5 + */ +void SdPublishingDlg::LoadPreviewButtons() +{ + if( mpButtonSet.get() ) + { + const int nButtonCount = 8; + static const char *pButtonNames[nButtonCount] = + { + "first.png", + "left.png", + "right.png", + "last.png", + "home.png", + "text.png", + "expand.png", + "collapse.png", + }; + + std::vector< rtl::OUString > aButtonNames; + for( int i = 0; i < nButtonCount; ++i ) + aButtonNames.push_back( rtl::OUString::createFromAscii( pButtonNames[i] ) ); + + int nSetCount = mpButtonSet->getCount(); + + int nHeight = 32; + Image aImage; + for( int nSet = 0; nSet < nSetCount; ++nSet ) + { + if( mpButtonSet->getPreview( nSet, aButtonNames, aImage ) ) + { + pPage5_Buttons->InsertItem( (USHORT)nSet+1, aImage ); + if( nHeight < aImage.GetSizePixel().Height() ) + nHeight = aImage.GetSizePixel().Height(); + } + } + + pPage5_Buttons->SetItemHeight( nHeight ); + m_bButtonsDirty = FALSE; + } +} + +// ===================================================================== +// Clickhandler fuer den Weiter Button +// ===================================================================== +IMPL_LINK( SdPublishingDlg, NextPageHdl, PushButton *, EMPTYARG ) +{ + aAssistentFunc.NextPage(); + ChangePage(); + return 0; +} + +// ===================================================================== +// Setzt die Controlls im Dialog gemaess den Einstellungen im Design +// ===================================================================== +void SdPublishingDlg::SetDesign( SdPublishingDesign* pDesign ) +{ + if(!pDesign) + return; + + pPage2_Standard->Check(pDesign->m_eMode == PUBLISH_HTML); + pPage2_Frames->Check(pDesign->m_eMode == PUBLISH_FRAMES); + pPage2_Kiosk->Check(pDesign->m_eMode == PUBLISH_KIOSK ); + pPage2_WebCast->Check(pDesign->m_eMode == PUBLISH_WEBCAST ); + + pPage2_Content->Check(pDesign->m_bContentPage); + if(pDesign->m_bContentPage) + aAssistentFunc.EnablePage(4); + else + aAssistentFunc.DisablePage(4); + + if(m_bImpress) + pPage2_Notes->Check(pDesign->m_bNotes); + + pPage2_ASP->Check(pDesign->m_eScript == SCRIPT_ASP); + pPage2_PERL->Check(pDesign->m_eScript == SCRIPT_PERL); + pPage2_CGI->SetText(pDesign->m_aCGI); + pPage2_URL->SetText(pDesign->m_aURL); + + pPage2_ChgDefault->Check( !pDesign->m_bAutoSlide ); + pPage2_ChgAuto->Check( pDesign->m_bAutoSlide ); + + Time aTime; + aTime.MakeTimeFromMS( pDesign->m_nSlideDuration * 1000 ); + pPage2_Duration->SetTime( aTime ); + + pPage2_Endless->Check( pDesign->m_bEndless ); + + pPage3_Png->Check(pDesign->m_eFormat == FORMAT_PNG); + pPage3_Gif->Check(pDesign->m_eFormat == FORMAT_GIF); + pPage3_Jpg->Check(pDesign->m_eFormat == FORMAT_JPG); + pPage3_Quality->Enable(pDesign->m_eFormat == FORMAT_JPG); + + pPage3_Quality->SetText(pDesign->m_aCompression); + pPage3_Resolution_1->Check(pDesign->m_nResolution == PUB_LOWRES_WIDTH); + pPage3_Resolution_2->Check(pDesign->m_nResolution == PUB_MEDRES_WIDTH); + pPage3_Resolution_3->Check(pDesign->m_nResolution == PUB_HIGHRES_WIDTH); + + pPage3_SldSound->Check( pDesign->m_bSlideSound ); + pPage3_HiddenSlides->Check( pDesign->m_bHiddenSlides ); + + pPage4_Author->SetText(pDesign->m_aAuthor); + pPage4_Email->SetText(pDesign->m_aEMail); + pPage4_WWW->SetText(pDesign->m_aWWW); + pPage4_Misc->SetText(pDesign->m_aMisc); + if(m_bImpress) + pPage4_Download->Check(pDesign->m_bDownload); +//-/ pPage4_Created->Check(pDesign->m_bCreated); + + pPage5_TextOnly->Check(pDesign->m_nButtonThema == -1); + if(pDesign->m_nButtonThema != -1) + { + if(m_bButtonsDirty) + LoadPreviewButtons(); + pPage5_Buttons->SelectItem(pDesign->m_nButtonThema + 1); + } + else + pPage5_Buttons->SetNoSelection(); + + pPage6_User->Check(pDesign->m_bUserAttr); + m_aBackColor = pDesign->m_aBackColor; + m_aTextColor = pDesign->m_aTextColor; + m_aLinkColor = pDesign->m_aLinkColor; + m_aVLinkColor = pDesign->m_aVLinkColor; + m_aALinkColor = pDesign->m_aALinkColor; + + pPage6_DocColors->Check(pDesign->m_bUseColor); + + pPage6_Preview->SetColors( m_aBackColor, m_aTextColor, m_aLinkColor, + m_aVLinkColor, m_aALinkColor ); + pPage6_Preview->Invalidate(); + + UpdatePage(); +} + +// ===================================================================== +// Uebertraegt den Status der Dialog Controlls in das Design +// ===================================================================== +void SdPublishingDlg::GetDesign( SdPublishingDesign* pDesign ) +{ + if(!pDesign) + return; + + pDesign->m_eMode = pPage2_Standard->IsChecked()?PUBLISH_HTML: + pPage2_Frames->IsChecked()?PUBLISH_FRAMES: + pPage2_Kiosk->IsChecked()?PUBLISH_KIOSK: + PUBLISH_WEBCAST; + + pDesign->m_bContentPage = pPage2_Content->IsChecked(); + if(m_bImpress) + pDesign->m_bNotes = pPage2_Notes->IsChecked(); + + if( pPage3_Gif->IsChecked() ) + pDesign->m_eFormat = FORMAT_GIF; + else if( pPage3_Jpg->IsChecked() ) + pDesign->m_eFormat = FORMAT_JPG; + else + pDesign->m_eFormat = FORMAT_PNG; + + pDesign->m_aCompression = pPage3_Quality->GetText(); + + pDesign->m_nResolution = pPage3_Resolution_1->IsChecked()?PUB_LOWRES_WIDTH: + (pPage3_Resolution_2->IsChecked()?PUB_MEDRES_WIDTH:PUB_HIGHRES_WIDTH); + + pDesign->m_bSlideSound = pPage3_SldSound->IsChecked(); + pDesign->m_bHiddenSlides = pPage3_HiddenSlides->IsChecked(); + + pDesign->m_aAuthor = pPage4_Author->GetText(); + pDesign->m_aEMail = pPage4_Email->GetText(); + pDesign->m_aWWW = pPage4_WWW->GetText(); + pDesign->m_aMisc = pPage4_Misc->GetText(); + pDesign->m_bDownload = m_bImpress?pPage4_Download->IsChecked():FALSE; +//-/ pDesign->m_bCreated = pPage4_Created->IsChecked(); + + if(pPage5_TextOnly->IsChecked()) + pDesign->m_nButtonThema = -1; + else + pDesign->m_nButtonThema = pPage5_Buttons->GetSelectItemId() - 1; + + pDesign->m_bUserAttr = pPage6_User->IsChecked(); + pDesign->m_aBackColor = m_aBackColor; + pDesign->m_aTextColor = m_aTextColor; + pDesign->m_aLinkColor = m_aLinkColor; + pDesign->m_aVLinkColor = m_aVLinkColor; + pDesign->m_aALinkColor = m_aALinkColor; + pDesign->m_bUseColor = pPage6_DocColors->IsChecked(); + + + pDesign->m_eScript = pPage2_ASP->IsChecked()?SCRIPT_ASP:SCRIPT_PERL; + pDesign->m_aCGI = pPage2_CGI->GetText(); + pDesign->m_aURL = pPage2_URL->GetText(); + + pDesign->m_bAutoSlide = pPage2_ChgAuto->IsChecked(); + pDesign->m_nSlideDuration = (UINT32)pPage2_Duration->GetTime().GetMSFromTime() / 1000; + pDesign->m_bEndless = pPage2_Endless->IsChecked(); +} + +// ===================================================================== +// Clickhandler fuer den Zurueck Button +// ===================================================================== +IMPL_LINK( SdPublishingDlg, LastPageHdl, PushButton *, EMPTYARG ) +{ + aAssistentFunc.PreviousPage(); + ChangePage(); + return 0; +} + +// ===================================================================== +// Designs laden +// ===================================================================== +BOOL SdPublishingDlg::Load() +{ + m_bDesignListDirty = FALSE; + + m_pDesignList = new List(); + + INetURLObject aURL( SvtPathOptions().GetUserConfigPath() ); + aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "designs.sod" ) ) ); + + // check if file exists, SfxMedium shows an errorbox else + { + com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler; + SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, xHandler ); + + sal_Bool bOk = pIStm && ( pIStm->GetError() == 0); + + if( pIStm ) + delete pIStm; + + if( !bOk ) + return sal_False; + } + + SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ | STREAM_NOCREATE, TRUE ); + + SvStream* pStream = aMedium.GetInStream(); + + if( !pStream ) + return( FALSE ); + + UINT16 aCheck; + *pStream >> aCheck; + + if(aCheck != nMagic) + return FALSE; + + SdIOCompat aIO(*pStream, STREAM_READ); + + UINT16 nDesigns; + *pStream >> nDesigns; + + for( UINT16 nIndex = 0; + pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns; + nIndex++ ) + { + SdPublishingDesign* pDesign = new SdPublishingDesign(); + *pStream >> *pDesign; + + m_pDesignList->Insert(pDesign); + } + + return( pStream->GetError() == SVSTREAM_OK ); +} + +// ===================================================================== +// Designs speichern +// ===================================================================== +BOOL SdPublishingDlg::Save() +{ + INetURLObject aURL( SvtPathOptions().GetUserConfigPath() ); + aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "designs.sod" ) ) ); + SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC, FALSE ); + aMedium.IsRemote(); + + SvStream* pStream = aMedium.GetOutStream(); + + if( !pStream ) + return( FALSE ); + + UINT16 aCheck = nMagic; + *pStream << aCheck; + + // damit SdIOCompat vor dem Stream destruiert wird + { + SdIOCompat aIO(*pStream, STREAM_WRITE, 0); + + UINT16 nDesigns = (UINT16) m_pDesignList->Count(); + *pStream << nDesigns; + + for( UINT16 nIndex = 0; + pStream->GetError() == SVSTREAM_OK && nIndex < nDesigns; + nIndex++ ) + { + SdPublishingDesign* pDesign = (SdPublishingDesign*) + m_pDesignList->GetObject(nIndex); + *pStream << *pDesign; + } + } + + aMedium.Close(); + aMedium.Commit(); + + return( aMedium.GetError() == 0 ); +} + +// ********************************************************************* +// SdDesignNameDlg Methoden +// ********************************************************************* + +// ===================================================================== +// +// ===================================================================== +SdDesignNameDlg::SdDesignNameDlg(Window* pWindow, const String& aName): + ModalDialog (pWindow, SdResId( DLG_DESIGNNAME )), + m_aEdit (this, SdResId(EDT_NAME)), + m_aBtnOK (this, SdResId(BTN_SAVE)), + m_aBtnCancel (this, SdResId(BTN_NOSAVE)) +{ + FreeResource(); + m_aEdit.SetModifyHdl(LINK(this, SdDesignNameDlg, ModifyHdl )); + m_aEdit.SetText(aName); + m_aBtnOK.Enable(aName.Len() != 0); +} + +// ===================================================================== +// +// ===================================================================== +String SdDesignNameDlg::GetDesignName() +{ + return m_aEdit.GetText(); +} + +// ===================================================================== +// +// ===================================================================== +IMPL_LINK( SdDesignNameDlg, ModifyHdl, Edit*, EMPTYARG ) +{ + m_aBtnOK.Enable(m_aEdit.GetText().Len() != 0); + + return 0; +} + + + diff --git a/sd/source/filter/html/pubdlg.src b/sd/source/filter/html/pubdlg.src new file mode 100644 index 000000000000..00e9b4af75e4 --- /dev/null +++ b/sd/source/filter/html/pubdlg.src @@ -0,0 +1,817 @@ + /************************************************************************* + * + * 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 "helpids.h" +#include "pubdlg.hrc" + +ModalDialog DLG_PUBLISHING +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 272 , 190 ) ; + Text [ en-US ] = "HTML Export" ; + Moveable = TRUE ; + + ///////////////////////////// + // Page 1, choose a design // + ///////////////////////////// + + FixedBitmap PAGE1_BMP + { + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 256 , 29 ) ; + Fixed = Bitmap { File = "pubdlg1.bmp" ; }; + }; + + FixedLine PAGE1_TITEL + { + Pos = MAP_APPFONT ( 6 , 38 ) ; + Size = MAP_APPFONT ( 258 , 8 ) ; + Text [ en-US ] = "Assign design"; + }; + + RadioButton PAGE1_NEW_DESIGN + { + Pos = MAP_APPFONT( 12, 50 ); + Size = MAP_APPFONT( 153, 10 ); + Text [ en-US ] = "New design"; + }; + + RadioButton PAGE1_OLD_DESIGN + { + Pos = MAP_APPFONT( 12, 63 ); + Size = MAP_APPFONT( 153, 10 ); + Text [ en-US ] = "Existing design"; + }; + + ListBox PAGE1_DESIGNS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 21 , 75 ) ; + Size = MAP_APPFONT ( 144 , 63 ) ; + TabStop = TRUE ; + VScroll = TRUE ; + }; + + PushButton PAGE1_DEL_DESIGN + { + Pos = MAP_APPFONT ( 168 , 75 ) ; + Size = MAP_APPFONT ( 92 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + Text [ en-US ] = "Delete Selected Design"; + }; + + FixedText PAGE1_DESC + { + Pos = MAP_APPFONT ( 12 , 142 ) ; + Size = MAP_APPFONT ( 258 , 8 ) ; + Text [ en-US ] = "Select an existing design or create a new one"; + }; + + + //////////////////////////////// + // Page 2, type of publishing // + //////////////////////////////// + + FixedBitmap PAGE2_BMP + { + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 256 , 29 ) ; + Fixed = Bitmap { File = "pubdlg1.bmp" ; }; + }; + + FixedLine PAGE2_TITEL + { + Pos = MAP_APPFONT ( 6, 38 ) ; + Size = MAP_APPFONT ( 124, 8 ) ; + Text [ en-US ] = "Publication type"; + }; + + RadioButton PAGE2_STANDARD + { + Pos = MAP_APPFONT( 12, 50 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "Standard H~TML format"; + }; + + RadioButton PAGE2_FRAMES + { + Pos = MAP_APPFONT( 12, 63 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "Standard HTML with ~frames"; + }; + + RadioButton PAGE2_KIOSK + { + Pos = MAP_APPFONT( 12, 76 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "~Automatic"; + }; + + RadioButton PAGE2_WEBCAST + { + Pos = MAP_APPFONT( 12, 89 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "~WebCast"; + }; + + FixedBitmap PAGE2_NOFRAMES_FB + { + Pos = MAP_APPFONT( 21, 102 ); + Scale = TRUE; + Size = MAP_APPFONT( 60, 50 ); + Fixed = Bitmap { File = "pubdes.bmp"; }; + OutputSize = TRUE ; + Border = TRUE; + }; + + FixedBitmap PAGE2_FRAMES_FB + { + Pos = MAP_APPFONT( 21, 102 ); + Scale = TRUE; + Size = MAP_APPFONT( 60, 50 ); + Fixed = Bitmap { File = "pubdes2.bmp"; }; + OutputSize = TRUE ; + Border = TRUE; + }; + + FixedBitmap PAGE2_KIOSK_FB + { + Pos = MAP_APPFONT( 21, 102 ); + Scale = TRUE; + Size = MAP_APPFONT( 60, 50 ); + Fixed = Bitmap { File = "pubdes3.bmp"; }; + OutputSize = TRUE ; + Border = TRUE; + }; + + FixedBitmap PAGE2_WEBCAST_FB + { + Pos = MAP_APPFONT( 21, 102 ); + Scale = TRUE; + Size = MAP_APPFONT( 60, 50 ); + Fixed = Bitmap { File = "pubdes4.bmp"; }; + OutputSize = TRUE ; + Border = TRUE; + }; + + ////////////////////////////// + // Special options for html // + ////////////////////////////// + + FixedLine PAGE2_TITEL_HTML + { + Pos = MAP_APPFONT( 138, 38 ); + Size = MAP_APPFONT( 128, 8 ); + Text [ en-US ] = "Options"; + }; + + CheckBox PAGE2_CONTENT + { + Pos = MAP_APPFONT( 144, 49 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "Create title page"; + }; + + FixedLine PAGE2_VERT + { + Pos = MAP_APPFONT ( 132 , 49 ) ; + Size = MAP_APPFONT ( 4, 109 ) ; + Vert = TRUE; + }; + + CheckBox PAGE2_NOTES + { + Pos = MAP_APPFONT( 144, 63 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "Show notes"; + }; + + /////////////////////////////// + // Special options for kiosk // + /////////////////////////////// + + FixedLine PAGE2_TITEL_KIOSK + { + Pos = MAP_APPFONT( 138, 38 ); + Size = MAP_APPFONT( 128, 8 ); + Text [ en-US ] = "Advance slides" ; + }; + + RadioButton PAGE2_CHG_DEFAULT + { + Pos = MAP_APPFONT ( 144 , 49 ) ; + Size = MAP_APPFONT ( 116 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~As stated in document" ; + }; + + RadioButton PAGE2_CHG_AUTO + { + Pos = MAP_APPFONT ( 144 , 63 ) ; + Size = MAP_APPFONT ( 116 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Automatic" ; + }; + + FixedText PAGE2_DURATION_TXT + { + Pos = MAP_APPFONT ( 154, 77 ) ; + Size = MAP_APPFONT ( 40, 10 ) ; + Text [ en-US ] = "~Slide view time:" ; + }; + + TimeField PAGE2_DURATION_TMF + { + Pos = MAP_APPFONT ( 196, 76 ) ; + Size = MAP_APPFONT ( 48, 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Duration = TRUE ; + StrictFormat = TRUE ; + Maximum = Time + { + Hour = 23 ; + Minute = 59 ; + Second = 59 ; + }; + Last = Time + { + Hour = 23 ; + Minute = 59 ; + Second = 59 ; + }; + QuickHelpText [ en-US ] = "~Duration of page"; + }; + + CheckBox PAGE2_ENDLESS + { + Pos = MAP_APPFONT ( 154, 91 ); + Size = MAP_APPFONT ( 108, 10 ); + Text [ en-US ] = "~Endless" ; + }; + + ///////////////////////////////// + // Special options for WebCast // + ///////////////////////////////// + + FixedLine PAGE2_TITEL_WEBCAST + { + Pos = MAP_APPFONT( 138, 38 ); + Size = MAP_APPFONT( 128, 8 ); + Text [ en-US ] = "WebCast" ; + }; + + RadioButton PAGE2_ASP + { + Pos = MAP_APPFONT( 144, 49 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "~Active Server Pages (ASP)"; + }; + + RadioButton PAGE2_PERL + { + Pos = MAP_APPFONT( 144, 63 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "Perl" ; + }; + + FixedText PAGE2_INDEX_TXT + { + Pos = MAP_APPFONT( 154, 76 ); + Size = MAP_APPFONT( 105, 10 ); + Text [ en-US ] = "~URL for listeners"; + }; + + Edit PAGE2_INDEX + { + BORDER = TRUE; + Pos = MAP_APPFONT( 154, 88 ); + Size = MAP_APPFONT( 105, 12 ); + Left = TRUE; + }; + + FixedText PAGE2_URL_TXT + { + Pos = MAP_APPFONT( 154, 104 ); + Size = MAP_APPFONT( 105, 10 ); + Text [ en-US ] = "URL for ~presentation:"; + }; + + Edit PAGE2_URL + { + BORDER = TRUE; + Pos = MAP_APPFONT( 154, 116 ); + Size = MAP_APPFONT( 105, 12 ); + LEFT = TRUE; + }; + + FixedText PAGE2_CGI_TXT + { + Pos = MAP_APPFONT( 154, 132 ); + Size = MAP_APPFONT( 105, 10 ); + Text [ en-US ] = "URL for ~Perl scripts:"; + }; + + Edit PAGE2_CGI + { + BORDER = TRUE; + Pos = MAP_APPFONT( 154, 144 ); + Size = MAP_APPFONT( 105, 12 ); + LEFT = TRUE; + }; + + + ///////////////////////////////////////////////////////// + // Page 3, Misc Options, Picture Format and Resolution // + ///////////////////////////////////////////////////////// + + FixedBitmap PAGE3_BMP + { + OutputSize = TRUE ; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 256 , 29 ) ; + Scale = TRUE; + Fixed = Bitmap { File = "pubdlg2.bmp" ; }; + }; + + //////////////////// + // Picture Format // + //////////////////// + + FixedLine PAGE3_TITEL_1 + { + Pos = MAP_APPFONT ( 6, 38 ) ; + Size = MAP_APPFONT ( 124, 8 ) ; + Text [ en-US ] = "Save graphics as"; + }; + + RadioButton PAGE3_PNG + { + Pos = MAP_APPFONT( 12, 49 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "~PNG"; + }; + + RadioButton PAGE3_GIF + { + Pos = MAP_APPFONT( 12, 63 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "~GIF"; + }; + + RadioButton PAGE3_JPG + { + Pos = MAP_APPFONT( 12, 77 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "~JPG"; + }; + + ComboBox PAGE3_QUALITY + { + Pos = MAP_APPFONT( 18, 91 ); + Size = MAP_APPFONT( 28, 70 ); + TabStop = TRUE ; + DropDown = TRUE ; + }; + + FixedText PAGE3_QUALITY_TXT + { + Pos = MAP_APPFONT( 49, 93 ); + Size = MAP_APPFONT( 79, 10 ); + Text [ en-US ] = "Quality"; + }; + + FixedLine PAGE3_VERT + { + Pos = MAP_APPFONT ( 132 , 49 ) ; + Size = MAP_APPFONT ( 4, 65 ) ; + Vert = TRUE; + }; + + //////////////// + // Resolution // + //////////////// + + FixedLine PAGE3_TITEL_2 + { + Pos = MAP_APPFONT( 138, 38 ); + Size = MAP_APPFONT( 128, 8 ); + Text [ en-US ] = "Monitor resolution"; + }; + + RadioButton PAGE3_RESOLUTION_1 + { + Pos = MAP_APPFONT( 144, 49 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "Low resolution (~640x480 pixels)"; + }; + + RadioButton PAGE3_RESOLUTION_2 + { + Pos = MAP_APPFONT( 144, 63 ); + Size = MAP_APPFONT( 116, 10 ); + Text [ en-US ] = "Medium resolution (~800x600 pixels)"; + }; + + RadioButton PAGE3_RESOLUTION_3 + { + Pos = MAP_APPFONT ( 144, 77 ) ; + Size = MAP_APPFONT ( 116 , 10 ) ; + Text [ en-US ] = "High resolution (~1024x768 pixels)"; + }; + + //////////////// + // Resolution // + //////////////// + + FixedLine PAGE3_TITEL_3 + { + Pos = MAP_APPFONT( 6, 114 ); + Size = MAP_APPFONT( 258, 8 ); + Text [ en-US ] = "Effects"; + }; + + CheckBox PAGE3_SLD_SOUND + { + Pos = MAP_APPFONT ( 12, 125 ); + Size = MAP_APPFONT ( 252, 10 ); + Text [ en-US ] = "~Export sounds when slide advances" ; + }; + + CheckBox PAGE3_HIDDEN_SLIDES + { + Pos = MAP_APPFONT ( 12, 138 ); + Size = MAP_APPFONT ( 252, 10 ); + Text [ en-US ] = "Export ~hidden slides" ; + }; + + //////////////////////////////////////// + // Page 4, information for titel page // + //////////////////////////////////////// + + FixedBitmap PAGE4_BMP + { + OutputSize = TRUE ; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 256 , 29 ) ; + Fixed = Bitmap { File = "pubdlg3.bmp" ; }; + }; + + FixedLine PAGE4_TITEL_1 + { + Pos = MAP_APPFONT ( 6 , 38 ) ; + Size = MAP_APPFONT ( 258 , 8 ) ; + Text [ en-US ] = "Information for the title page"; + }; + + FixedText PAGE4_AUTHOR_TXT + { + Pos = MAP_APPFONT ( 12, 51 ); + Size = MAP_APPFONT ( 121, 8 ); + Text [ en-US ] = "~Author"; + }; + + Edit PAGE4_AUTHOR + { + BORDER = TRUE ; + Pos = MAP_APPFONT ( 136, 49 ); + Size = MAP_APPFONT ( 128, 12 ); + LEFT = TRUE; + }; + + FixedText PAGE4_EMAIL_TXT + { + Pos = MAP_APPFONT ( 12, 67 ); + Size = MAP_APPFONT ( 121, 8 ); + Text [ en-US ] = "E-~mail address"; + }; + + Edit PAGE4_EMAIL_EDIT + { + BORDER = TRUE ; + Pos = MAP_APPFONT ( 136 , 65 ) ; + Size = MAP_APPFONT ( 128 , 12 ) ; + LEFT = TRUE ; + }; + + FixedText PAGE4_WWW_TXT + { + Pos = MAP_APPFONT ( 12, 83 ); + Size = MAP_APPFONT ( 121, 8 ); + Text [ en-US ] = "Your hom~epage"; + }; + + Edit PAGE4_WWW_EDIT + { + BORDER = TRUE ; + Pos = MAP_APPFONT ( 136, 81 ) ; + Size = MAP_APPFONT ( 128, 12 ) ; + LEFT = TRUE ; + }; + + FixedText PAGE4_TITEL_2 + { + Pos = MAP_APPFONT ( 12 , 99 ) ; + Size = MAP_APPFONT ( 121 , 8 ) ; + Text [ en-US ] = "Additional ~information"; + }; + + MultiLineEdit PAGE4_MISC + { + Border = TRUE ; + Pos = MAP_APPFONT ( 136, 97 ) ; + Size = MAP_APPFONT ( 128 , 45 ) ; + TabStop = TRUE ; + VScroll = TRUE ; + IgnoreTab = TRUE ; + }; + + CheckBox PAGE4_DOWNLOAD + { + Pos = MAP_APPFONT ( 12 , 149 ) ; + Size = MAP_APPFONT ( 252 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Link to a copy of the ~original presentation"; + }; + + CheckBox PAGE4_CREATED + { + Pos = MAP_APPFONT ( 12 , 152 ) ; + Size = MAP_APPFONT ( 252 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Note: 'Created with %PRODUCTNAME'"; + }; + + ///////////////////// + // Page 5, Buttons // + ///////////////////// + + FixedBitmap PAGE5_BMP + { + OutputSize = TRUE ; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 256 , 29 ) ; + Fixed = Bitmap { File = "pubdlg4.bmp" ; }; + }; + + FixedLine PAGE5_TITEL + { + Pos = MAP_APPFONT ( 6 , 38 ) ; + Size = MAP_APPFONT ( 258 , 8 ) ; + Text [ en-US ] = "Select button style"; + }; + + CheckBox PAGE5_TEXTONLY + { + Pos = MAP_APPFONT ( 12, 50 ); + Size = MAP_APPFONT ( 243, 10 ); + Text [ en-US ] = "~Text only"; + }; + + Control PAGE5_BUTTONS + { + Border = TRUE ; + TabStop = TRUE; + Pos = MAP_APPFONT ( 12, 63 ) ; + Size = MAP_APPFONT ( 243, 95 ) ; + }; + + ///////////////////////// + // Page 6, colorscheme // + ///////////////////////// + + FixedBitmap PAGE6_BMP + { + OutputSize = TRUE ; + Border = TRUE; + Pos = MAP_APPFONT ( 6 , 4 ) ; + Size = MAP_APPFONT ( 256 , 29 ) ; + Fixed = Bitmap { File = "pubdlg5.bmp" ; }; + }; + + FixedLine PAGE6_TITEL + { + Pos = MAP_APPFONT ( 6 , 38 ) ; + Size = MAP_APPFONT ( 258 , 8 ) ; + Text [ en-US ] = "Select color scheme"; + }; + + RadioButton PAGE6_DOCCOLORS + { + Pos = MAP_APPFONT( 12, 50 ); + Size = MAP_APPFONT( 246, 10 ); + Text [ en-US ] = "~Apply color scheme from document"; + }; + + RadioButton PAGE6_DEFAULT + { + Pos = MAP_APPFONT( 12, 63 ); + Size = MAP_APPFONT( 246, 10 ); + Text [ en-US ] = "Use ~browser colors"; + }; + + RadioButton PAGE6_USER + { + Pos = MAP_APPFONT( 12, 76 ); + Size = MAP_APPFONT( 246, 10 ); + Text [ en-US ] = "~Use custom color scheme"; + }; + + PushButton PAGE6_TEXT + { + Pos = MAP_APPFONT( 21, 89 ); + Size = MAP_APPFONT( 72, 14 ); + Text [ en-US ] = "Text"; + }; + + PushButton PAGE6_LINK + { + Pos = MAP_APPFONT( 21, 106 ); + Size = MAP_APPFONT( 72, 14 ); + Text [ en-US ] = "Hyper~link"; + }; + + PushButton PAGE6_ALINK + { + Pos = MAP_APPFONT( 21, 123 ); + Size = MAP_APPFONT( 72, 14 ); + Text [ en-US ] = "Active Li~nk"; + }; + + PushButton PAGE6_VLINK + { + Pos = MAP_APPFONT( 21, 140 ); + Size = MAP_APPFONT( 72, 14 ); + Text [ en-US ] = "~Visited Link"; + }; + + Control PAGE6_PREVIEW + { + Pos = MAP_APPFONT( 96, 89 ); + Size = MAP_APPFONT( 100, 64 ); + Border = TRUE; + }; + + PushButton PAGE6_BACK + { + Pos = MAP_APPFONT( 199, 89 ); + Size = MAP_APPFONT( 60, 14 ); + Text [ en-US ] = "Bac~kground"; + }; + + // generell + + FixedLine BOTTOM_LINE + { + Pos = MAP_APPFONT ( 1 , 162 ) ; + Size = MAP_APPFONT ( 272, 4) ; + }; + + PushButton BUT_LAST + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 112 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "<< Back" ; + }; + + PushButton BUT_NEXT + { + DefButton = TRUE ; + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 165 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Next >>" ; + }; + + OKButton BUT_FINISH + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 218 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Create" ; + }; + + CancelButton BUT_CANCEL + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 59 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BUT_HELP + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; +}; + +ModalDialog DLG_DESIGNNAME +{ + HelpID = HID_SD_HTMLEXPORT_DLG_DNAME; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 160 , 40 ) ; + Moveable = TRUE ; + + Edit EDT_NAME + { + BORDER = TRUE ; + Pos = MAP_APPFONT ( 4, 4 ); + Size = MAP_APPFONT ( 152, 14 ); + LEFT = TRUE; + }; + + OKButton BTN_SAVE + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 25 , 22 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + TabStop = TRUE ; + Text [ en-US ] = "~Save"; + }; + + CancelButton BTN_NOSAVE + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 80 , 22 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Do Not Save"; + }; + Text [ en-US ] = "Name HTML Design"; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sd/source/filter/html/sdhtmlfilter.cxx b/sd/source/filter/html/sdhtmlfilter.cxx new file mode 100644 index 000000000000..f447e2039c70 --- /dev/null +++ b/sd/source/filter/html/sdhtmlfilter.cxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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_sd.hxx" + +#include <unotools/localfilehelper.hxx> +#include <tools/errinf.hxx> +#include <tools/urlobj.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/metaact.hxx> +#include <vcl/virdev.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/frame.hxx> +#include <svx/svdograf.hxx> +#include <svx/svdpagv.hxx> +#include <svx/xoutbmp.hxx> +#include <osl/file.hxx> + +#include "sdpage.hxx" +#include "drawdoc.hxx" +#include "sdresid.hxx" +#include "sdattr.hxx" +#include "htmlex.hxx" +#include "sdhtmlfilter.hxx" + +// --------------- +// - SdPPTFilter - +// --------------- + +SdHTMLFilter::SdHTMLFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress ) : + SdFilter( rMedium, rDocShell, bShowProgress ) +{ +} + +// ----------------------------------------------------------------------------- + +SdHTMLFilter::~SdHTMLFilter() +{ +} + +// ----------------------------------------------------------------------------- + +sal_Bool SdHTMLFilter::Export() +{ + mrMedium.Close(); + mrMedium.Commit(); + + SfxItemSet *pSet = mrMedium.GetItemSet(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aParams; + + const SfxPoolItem* pItem; + if ( pSet->GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) + ((SfxUnoAnyItem*)pItem)->GetValue() >>= aParams; + + delete( new HtmlExport( mrMedium.GetName(), aParams, &mrDocument, &mrDocShell ) ); + + return true; +} |