Hi,
The following files seem to be unused:
impress/sd/source/filter/eppt/eppt.cxx
impress/sd/source/filter/html/htmlex.cxx
With the attached patch, I could succesfully complete a build. Howewer,
I'm not 100% sure these files have no purpose whatsoever.
Could someone knowledgeable in this part of the tree confirm if it is
safe to remove them (or not) ?
In the meantime, please do not commit the attached patch.
Thanks,
--
Francois Tigeot
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 99f51e4..3c23b98 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -131,7 +131,6 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/filter/cgm/sdcgmfilter \
sd/source/filter/grf/sdgrffilter \
sd/source/filter/html/buttonset \
- sd/source/filter/html/htmlex \
sd/source/filter/html/HtmlOptionsDialog \
sd/source/filter/html/sdhtmlfilter \
sd/source/filter/sdfilter \
diff --git a/sd/Library_sdfilt.mk b/sd/Library_sdfilt.mk
index 97fe6b6..9a97375 100644
--- a/sd/Library_sdfilt.mk
+++ b/sd/Library_sdfilt.mk
@@ -79,7 +79,6 @@ $(eval $(call gb_Library_add_linked_libs,sdfilt,\
$(eval $(call gb_Library_set_componentfile,sdfilt,sd/util/sdfilt))
$(eval $(call gb_Library_add_exception_objects,sdfilt,\
- sd/source/filter/eppt/eppt \
sd/source/filter/eppt/escherex \
sd/source/filter/eppt/pptexanimations \
sd/source/filter/eppt/pptexsoundcollection \
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
deleted file mode 100644
index b996d20..0000000
--- a/sd/source/filter/eppt/eppt.cxx
+++ /dev/null
@@ -1,1534 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-#include <eppt.hxx>
-#include "epptdef.hxx"
-#include <tools/globname.hxx>
-#include <tools/datetime.hxx>
-#include <tools/poly.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/bmpacc.hxx>
-#include <vcl/gradient.hxx>
-#include <rtl/ustring.hxx>
-#include <tools/stream.hxx>
-#include <svtools/fltcall.hxx>
-#include <sfx2/docfile.hxx>
-#include <svx/unoapi.hxx>
-#include <svx/svdobj.hxx>
-#include <svx/svdoole2.hxx>
-#include <svx/svdmodel.hxx>
-#include <svx/svdpage.hxx>
-#include <com/sun/star/view/PaperOrientation.hpp>
-#include <com/sun/star/view/PaperFormat.hpp>
-#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-#include <com/sun/star/office/XAnnotation.hpp>
-#include <com/sun/star/office/XAnnotationAccess.hpp>
-#include <com/sun/star/office/XAnnotationEnumeration.hpp>
-#include <com/sun/star/geometry/RealPoint2D.hpp>
-#include <com/sun/star/util/DateTime.hpp>
-#include <tools/zcodec.hxx>
-#include <editeng/svxenum.hxx>
-#include <sot/storinfo.hxx>
-#include <filter/msfilter/msoleexp.hxx>
-#include <vcl/virdev.hxx>
-#include <svtools/wmf.hxx>
-#include <filter/msfilter/msdffimp.hxx>
-#include <filter/msfilter/svxmsbas.hxx>
-#include <editeng/flditem.hxx>
-#include <sfx2/docinf.hxx>
-#include <oox/export/utils.hxx>
-
-using namespace com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::presentation;
-
-using ::com::sun::star::beans::XPropertySet;
-
-//============================ PPTWriter ==================================
-
-PPTWriter::PPTWriter( SvStorageRef& rSvStorage,
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
- ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > &
rXStatInd,
- SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ) :
- PPTWriterBase ( rXModel, rXStatInd ),
- mnCnvrtFlags ( nCnvrtFlags ),
- mbStatus ( sal_False ),
- mbUseNewAnimations ( sal_True ),
- mnLatestStatValue ( 0 ),
- mrStg ( rSvStorage ),
- mpCurUserStrm ( NULL ),
- mpStrm ( NULL ),
- mpPicStrm ( NULL ),
- mpPptEscherEx ( NULL ),
- mnVBAOleOfs ( 0 ),
- mpVBA ( pVBA ),
- mnExEmbed ( 0 ),
- mpExEmbed ( new SvMemoryStream ),
- mnPagesWritten ( 0 ),
- mnTxId ( 0x7a2f64 )
-{
-}
-
-void PPTWriter::exportPPTPre()
-{
- if ( !mrStg.Is() )
- return;
-
- // MasterPages + Slides und Notizen + NotesMasterPage
- mnDrawings = mnMasterPages + ( mnPages << 1 ) + 1;
-
- if ( mXStatusIndicator.is() )
- {
- mbStatusIndicator = sal_True;
- mnStatMaxValue = ( mnPages + mnMasterPages ) * 5;
- mXStatusIndicator->start( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Export" ) ),
- mnStatMaxValue + ( mnStatMaxValue >> 3 ) );
- }
-
- SvGlobalName aGName( 0x64818d10L, 0x4f9b, 0x11cf, 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29,
0xe8 );
- mrStg->SetClass( aGName, 0, String( RTL_CONSTASCII_USTRINGPARAM( "MS PowerPoint 97" ) ) );
-
- if ( !ImplCreateCurrentUserStream() )
- return;
-
- mpStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Document" ) )
);
- if ( !mpStrm )
- return;
-
- if ( !mpPicStrm )
- mpPicStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) );
-
- mpPptEscherEx = new PptEscherEx( *mpStrm );
-}
-
-void PPTWriter::exportPPTPost( )
-{
- if ( !ImplCloseDocument() )
- return;
-
- if ( mbStatusIndicator )
- {
- mXStatusIndicator->setText( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Export" ) ) );
- sal_uInt32 nValue = mnStatMaxValue + ( mnStatMaxValue >> 3 );
- if ( nValue > mnLatestStatValue )
- {
- mXStatusIndicator->setValue( nValue );
- mnLatestStatValue = nValue;
- }
- }
-
- ImplWriteOLE();
-
- ImplWriteVBA();
-
- if ( !ImplWriteAtomEnding() )
- return;
-
- if ( !ImplCreateDocumentSummaryInformation() )
- return;
-
- mbStatus = sal_True;
-};
-
-// ---------------------------------------------------------------------------------------------
-
-void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStream&
rBinaryTagData10Atom );
-
-void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
- sal_Bool bHasBackground, Reference< XPropertySet >
aXBackgroundPropSet )
-{
- Any aAny;
-
- const PHLayout& rLayout = GetLayout( mXPagePropSet );
- mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() );
- mpPptEscherEx->OpenContainer( EPP_Slide );
- mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
- *mpStrm << rLayout.nLayout;
- mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs ( 8Stueck )
- *mpStrm << (sal_uInt32)(nMasterNum | 0x80000000)// master ID ( ist gleich 0x80000000 bei einer
masterpage )
- << (sal_uInt32)nPageNum + 0x100 // notes ID ( ist gleich null wenn keine
notizen vorhanden )
- << nMode
- << (sal_uInt16)0; // padword
-
- mnDiaMode = 0;
- sal_Bool bVisible = sal_True;
- ::com::sun::star::presentation::FadeEffect eFe =
::com::sun::star::presentation::FadeEffect_NONE;
-
- if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) )
) )
- aAny >>= bVisible;
- if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Change" ) )
) )
- {
- switch ( *(sal_Int32*)aAny.getValue() )
- {
- case 1 : // automatisch
- mnDiaMode++;
- case 2 : // halbautomatisch
- mnDiaMode++;
- default :
- case 0 : // manuell
- break;
- }
- }
- if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) )
) )
- aAny >>= eFe;
-
- sal_uInt32 nSoundRef = 0;
- sal_Bool bIsSound = sal_False;
- sal_Bool bStopSound = sal_False;
- sal_Bool bLoopSound = sal_False;
-
- if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) )
)
- {
- rtl::OUString aSoundURL;
- if ( aAny >>= aSoundURL )
- {
- nSoundRef = maSoundCollection.GetId( aSoundURL );
- bIsSound = sal_True;
- }
- else
- aAny >>= bStopSound;
- }
- if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" )
) ) )
- aAny >>= bLoopSound;
-
- sal_Bool bNeedsSSSlideInfoAtom = ( bVisible == sal_False )
- || ( mnDiaMode == 2 )
- || ( bIsSound )
- || ( bStopSound )
- || ( eFe != ::com::sun::star::presentation::FadeEffect_NONE );
- if ( bNeedsSSSlideInfoAtom )
- {
- sal_uInt8 nDirection = 0;
- sal_uInt8 nTransitionType = 0;
- sal_uInt16 nBuildFlags = 1; // advange by mouseclick
- sal_Int32 nSlideTime = 0; // muss noch !!!
- sal_uInt8 nSpeed = 1;
-
- if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Speed" )
) ) )
- {
- ::com::sun::star::presentation::AnimationSpeed aAs;
- aAny >>= aAs;
- nSpeed = (sal_uInt8)aAs;
- }
- sal_Int16 nTT = 0;
- if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM(
"TransitionType" ) ) )
- && ( aAny >>= nTT ) )
- {
- sal_Int16 nTST = 0;
- if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM(
"TransitionSubtype" ) ) )
- && ( aAny >>= nTST ) )
- nTransitionType = GetTransition( nTT, nTST, eFe, nDirection );
-
- }
- if ( !nTransitionType )
- nTransitionType = GetTransition( eFe, nDirection );
- if ( mnDiaMode == 2 ) // automatic ?
- nBuildFlags |= 0x400;
- if ( bVisible == sal_False )
- nBuildFlags |= 4;
- if ( bIsSound )
- nBuildFlags |= 16;
- if ( bLoopSound )
- nBuildFlags |= 64;
- if ( bStopSound )
- nBuildFlags |= 256;
-
- if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM(
"Duration" ) ) ) )// duration of this slide
- nSlideTime = *(sal_Int32*)aAny.getValue() << 10; // in ticks
-
- mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom );
- *mpStrm << nSlideTime // standtime in ticks
- << nSoundRef
- << nDirection
- << nTransitionType
- << nBuildFlags
- << nSpeed
- << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0;
- }
-
- ImplCreateHeaderFooters( mXPagePropSet );
-
- EscherSolverContainer aSolverContainer;
- mpPptEscherEx->OpenContainer( EPP_PPDrawing );
- mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
- mpPptEscherEx->EnterGroup(0,0);
- ImplWritePage( rLayout, aSolverContainer, NORMAL, sal_False, nPageNum ); // Die Shapes der
Seite werden im PPT Dok. erzeugt
- mpPptEscherEx->LeaveGroup();
-
- if ( bHasBackground )
- ImplWriteBackground( aXBackgroundPropSet );
- else
- {
- mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
- mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags:
Connector | Background | HasSpt
- EscherPropertyContainer aPropOpt;
- aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
- aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) );
- aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
- aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
- aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
- aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is
the background shape
- aPropOpt.Commit( *mpStrm );
- mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
- }
-
- aSolverContainer.WriteSolver( *mpStrm );
-
- mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
- mpPptEscherEx->CloseContainer(); // EPP_Drawing
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
- *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 <<
(sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc <<
(sal_uInt32)0xb2b2b2;
-
- SvMemoryStream aBinaryTagData10Atom;
- ImplExportComments( mXDrawPage, aBinaryTagData10Atom );
- if ( mbUseNewAnimations )
- {
- SvMemoryStream amsofbtAnimGroup;
- ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection );
- aExporter.doexport( mXDrawPage, amsofbtAnimGroup );
- sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell();
- if ( nmsofbtAnimGroupSize )
- {
- {
- EscherExAtom aMagic2( aBinaryTagData10Atom, 0x2eeb );
- aBinaryTagData10Atom << (sal_uInt32)0x01c45df9
- << (sal_uInt32)0xe1471b30;
- }
- {
- EscherExAtom aMagic( aBinaryTagData10Atom, 0x2b00 );
- aBinaryTagData10Atom << (sal_uInt32)0;
- }
- aBinaryTagData10Atom.Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() );
- {
- EscherExContainer aMagic2( aBinaryTagData10Atom, 0x2b02 );
- }
- }
- }
- if ( aBinaryTagData10Atom.Tell() )
- {
- EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags );
- EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag );
- {
- EscherExAtom aCString( *mpStrm, EPP_CString );
- *mpStrm << (sal_uInt32)0x5f005f
- << (sal_uInt32)0x50005f
- << (sal_uInt32)0x540050
- << (sal_uInt16)0x31
- << (sal_uInt16)0x30;
- }
- {
- EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData );
- mpStrm->Write( aBinaryTagData10Atom.GetData(), aBinaryTagData10Atom.Tell() );
- }
- }
- mpPptEscherEx->CloseContainer(); // EPP_Slide
-}
-
-// ---------------------------------------------------------------------------------------------
-
-void PPTWriter::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertySet >
aXBackgroundPropSet )
-{
- mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() );
- mpPptEscherEx->OpenContainer( EPP_MainMaster );
- mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
- *mpStrm << (sal_Int32)EPP_LAYOUT_TITLEANDBODYSLIDE // slide layout -> title and body slide
- << (sal_uInt8)1 << (sal_uInt8)2 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 <<
(sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 // placeholderID
- << (sal_uInt32)0 // master ID ( ist gleich null bei einer masterpage )
- << (sal_uInt32)0 // notes ID ( ist gleich null wenn keine notizen vorhanden )
- << (sal_uInt16)0 // Bit 1: Follow master objects, Bit 2: Follow master scheme,
Bit 3: Follow master background
- << (sal_uInt16)0; // padword
-
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
- *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 <<
(sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc <<
(sal_uInt32)0xb2b2b2;
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
- *mpStrm << (sal_uInt32)0xff0000 << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 <<
(sal_uInt32)0x00ffff << (sal_uInt32)0x0099ff << (sal_uInt32)0xffff00 << (sal_uInt32)0x0000ff <<
(sal_uInt32)0x969696;
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
- *mpStrm << (sal_uInt32)0xccffff << (sal_uInt32)0x000000 << (sal_uInt32)0x336666 <<
(sal_uInt32)0x008080 << (sal_uInt32)0x339933 << (sal_uInt32)0x000080 << (sal_uInt32)0xcc3300 <<
(sal_uInt32)0x66ccff;
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
- *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x333333 <<
(sal_uInt32)0x000000 << (sal_uInt32)0xdddddd << (sal_uInt32)0x808080 << (sal_uInt32)0x4d4d4d <<
(sal_uInt32)0xeaeaea;
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
- *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 <<
(sal_uInt32)0x000000 << (sal_uInt32)0x66ccff << (sal_uInt32)0xff0000 << (sal_uInt32)0xcc00cc <<
(sal_uInt32)0xc0c0c0;
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
- *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 <<
(sal_uInt32)0x000000 << (sal_uInt32)0xc0c0c0 << (sal_uInt32)0xff6600 << (sal_uInt32)0x0000ff <<
(sal_uInt32)0x009900;
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
- *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 <<
(sal_uInt32)0x000000 << (sal_uInt32)0xff9933 << (sal_uInt32)0xccff99 << (sal_uInt32)0xcc00cc <<
(sal_uInt32)0xb2b2b2;
-
- for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
- {
- if ( nInstance == EPP_TEXTTYPE_notUsed )
- continue;
-
- // the auto color is dependent to the page background,so we have to set a page that is in
the right context
- if ( nInstance == EPP_TEXTTYPE_Notes )
- GetPageByIndex( 0, NOTICE );
- else
- GetPageByIndex( 0, MASTER );
-
- mpPptEscherEx->BeginAtom();
-
- sal_Bool bFirst = sal_True;
- sal_Bool bSimpleText = sal_False;
-
- *mpStrm << (sal_uInt16)5; // paragraph count
-
- for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ )
- {
- if ( nInstance >= EPP_TEXTTYPE_CenterBody )
- {
- bFirst = sal_False;
- bSimpleText = sal_True;
- *mpStrm << nLev;
- }
- mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst,
bSimpleText, mXPagePropSet );
- mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst,
bSimpleText, mXPagePropSet );
- bFirst = sal_False;
- }
- mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance );
- }
- GetPageByIndex( nPageNum, MASTER );
-
- EscherSolverContainer aSolverContainer;
-
- mpPptEscherEx->OpenContainer( EPP_PPDrawing );
- mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
-
- mpPptEscherEx->EnterGroup(0,0);
- ImplWritePage( GetLayout( 0 ), aSolverContainer, MASTER, sal_True ); // Die Shapes der
Seite werden im PPT Dok. erzeugt
- mpPptEscherEx->LeaveGroup();
-
- ImplWriteBackground( aXBackgroundPropSet );
-
- aSolverContainer.WriteSolver( *mpStrm );
-
- mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
- mpPptEscherEx->CloseContainer(); // EPP_Drawing
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
- *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 <<
(sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc <<
(sal_uInt32)0xb2b2b2;
-
- if ( aBuExMasterStream.Tell() )
- {
- ImplProgTagContainer( mpStrm, &aBuExMasterStream );
- }
- mpPptEscherEx->CloseContainer(); // EPP_MainMaster
-};
-
-// ---------------------------------------------------------------------------------------------
-
-PPTWriter::~PPTWriter()
-{
- void* pPtr;
- delete mpExEmbed;
- delete mpPptEscherEx;
- delete mpCurUserStrm;
- delete mpPicStrm;
- delete mpStrm;
-
-
-
- std::vector< PPTExStyleSheet* >::iterator aStyleSheetIter( maStyleSheetList.begin() );
- while( aStyleSheetIter < maStyleSheetList.end() )
- delete *aStyleSheetIter++;
-
- for ( pPtr = maHyperlink.First(); pPtr; pPtr = maHyperlink.Next() )
- delete (EPPTHyperlink*)pPtr;
- for ( pPtr = maExOleObj.First(); pPtr; pPtr = maExOleObj.Next() )
- delete (PPTExOleObjEntry*)pPtr;
-
- if ( mbStatusIndicator )
- mXStatusIndicator->end();
-}
-
-// ---------------------------------------------------------------------------------------------
-
-sal_Bool PPTWriter::ImplCreateCurrentUserStream()
-{
- mpCurUserStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Current User" ) )
);
- if ( !mpCurUserStrm )
- return sal_False;
- char pUserName[] = "Current User";
- sal_uInt32 nLenOfUserName = strlen( pUserName );
- sal_uInt32 nSizeOfRecord = 0x14 + ( ( nLenOfUserName + 4 ) & ~ 3 );
-
- *mpCurUserStrm << (sal_uInt16)0 << (sal_uInt16)EPP_CurrentUserAtom << nSizeOfRecord;
- *mpCurUserStrm << (sal_uInt32)0x14 // Len
- << (sal_uInt32)0xe391c05f; // Magic
-
- sal_uInt32 nEditPos = mpCurUserStrm->Tell();
- *mpCurUserStrm << (sal_uInt32)0x0 // OffsetToCurrentEdit;
- << (sal_uInt16)nLenOfUserName //
- << (sal_uInt16)0x3f4 // DocFileVersion
- << (sal_uInt8)3 // MajorVersion
- << (sal_uInt8)0 // MinorVersion
- << (sal_uInt16)0; // Pad Word
- pUserName[ nLenOfUserName ] = 8;
- mpCurUserStrm->Write( pUserName, nLenOfUserName + 1 );
- for ( sal_uInt32 i = 0x15 + nLenOfUserName; i < nSizeOfRecord; i++ )
- {
- *mpCurUserStrm << (sal_uInt8)0; // pad bytes
- };
- mpCurUserStrm->Seek( nEditPos );
- return sal_True;
-};
-
-// ---------------------------------------------------------------------------------------------
-
-sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation()
-{
- uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
- mXModel, uno::UNO_QUERY_THROW);
- uno::Reference<document::XDocumentProperties> xDocProps(
- xDPS->getDocumentProperties());
-
- if (xDocProps.is()) {
-
- // no idea what this is...
- static sal_uInt8 aGuid[ 0x52 ] =
- {
- 0x4e, 0x00, 0x00, 0x00,
- '{',0,'D',0,'B',0,'1',0,'A',0,'C',0,'9',0,'6',0,'4',0,'-',0,
- 'E',0,'3',0,'9',0,'C',0,'-',0,'1',0,'1',0,'D',0,'2',0,'-',0,
- 'A',0,'1',0,'E',0,'F',0,'-',0,'0',0,'0',0,'6',0,'0',0,'9',0,
- '7',0,'D',0,'A',0,'5',0,'6',0,'8',0,'9',0,'}',0
- };
- uno::Sequence<sal_uInt8> aGuidSeq(aGuid, 0x52);
-
- SvMemoryStream aHyperBlob;
- ImplCreateHyperBlob( aHyperBlob );
-
- uno::Sequence<sal_uInt8> aHyperSeq(aHyperBlob.Tell());
- const sal_uInt8* pBlob(
- static_cast<const sal_uInt8*>(aHyperBlob.GetData()));
- for (sal_Int32 j = 0; j < aHyperSeq.getLength(); ++j) {
- aHyperSeq[j] = pBlob[j];
- }
-
- if ( mnCnvrtFlags & 0x8000 )
- {
- uno::Sequence<sal_uInt8> aThumbSeq;
- if ( GetPageByIndex( 0, NORMAL ) &&
- ImplGetPropertyValue( mXPagePropSet,
- String( RTL_CONSTASCII_USTRINGPARAM( "PreviewBitmap" ) ) ) )
- {
- aThumbSeq =
- *static_cast<const uno::Sequence<sal_uInt8>*>(mAny.getValue());
- }
- sfx2::SaveOlePropertySet( xDocProps, mrStg,
- &aThumbSeq, &aGuidSeq, &aHyperSeq);
- }
- else
- {
- sfx2::SaveOlePropertySet( xDocProps, mrStg,
- NULL, &aGuidSeq, &aHyperSeq );
- }
- }
-
- return sal_True;
-}
-
-// ---------------------------------------------------------------------------------------------
-
-void PPTWriter::ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32
nInstance, sal_uInt32 nSlideId )
-{
- if ( rSt.Tell() )
- {
- aBuExOutlineStream << (sal_uInt32)( ( EPP_PST_ExtendedParagraphHeaderAtom << 16 )
- | ( nRef << 4 ) )
- << (sal_uInt32)8
- << (sal_uInt32)nSlideId
- << (sal_uInt32)nInstance;
- aBuExOutlineStream.Write( rSt.GetData(), rSt.Tell() );
- }
-}
-
-// ---------------------------------------------------------------------------------------------
-
-void PPTWriter::ImplCreateHeaderFooterStrings( SvStream& rStrm, ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >& rXPagePropSet )
-{
- if ( rXPagePropSet.is() )
- {
- rtl::OUString aString;
- ::com::sun::star::uno::Any aAny;
- if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String(
RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) ), sal_True ) )
- {
- if ( aAny >>= aString )
- PPTWriter::WriteCString( rStrm, aString, 1 );
- }
- if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String(
RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) ), sal_True ) )
- {
- if ( aAny >>= aString )
- PPTWriter::WriteCString( rStrm, aString, 2 );
- }
- if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String(
RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) ), sal_True ) )
- {
- if ( aAny >>= aString )
- PPTWriter::WriteCString( rStrm, aString, 0 );
- }
- }
-}
-
-// ---------------------------------------------------------------------------------------------
-
-void PPTWriter::ImplCreateHeaderFooters( ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >& rXPagePropSet )
-{
- if ( rXPagePropSet.is() )
- {
- sal_Bool bVal = sal_False;
- sal_uInt32 nVal = 0;
- ::com::sun::star::uno::Any aAny;
- if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String(
RTL_CONSTASCII_USTRINGPARAM( "IsHeaderVisible" ) ), sal_True ) )
- {
- if ( ( aAny >>= bVal ) && bVal )
- nVal |= 0x100000;
- }
- if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String(
RTL_CONSTASCII_USTRINGPARAM( "IsFooterVisible" ) ), sal_True ) )
- {
- if ( ( aAny >>= bVal ) && bVal )
- nVal |= 0x200000;
- }
- if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String(
RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeVisible" ) ), sal_True ) )
- {
- if ( ( aAny >>= bVal ) && bVal )
- nVal |= 0x010000;
- }
- if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String(
RTL_CONSTASCII_USTRINGPARAM( "IsPageNumberVisible" ) ), sal_True ) )
- {
- if ( ( aAny >>= bVal ) && bVal )
- nVal |= 0x080000;
- }
- if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String(
RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeFixed" ) ), sal_True ) )
- {
- if ( ( aAny >>= bVal ) && !bVal )
- nVal |= 0x20000;
- else
- nVal |= 0x40000;
- }
- if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String(
RTL_CONSTASCII_USTRINGPARAM( "DateTimeFormat" ) ), sal_True ) )
- {
- sal_Int32 nFormat = *(sal_Int32*)aAny.getValue();
- SvxDateFormat eDateFormat = (SvxDateFormat)( nFormat & 0xf );
- SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( nFormat >> 4 ) & 0xf );
- switch( eDateFormat )
- {
- case SVXDATEFORMAT_F :
- nFormat = 1;
- break;
- case SVXDATEFORMAT_D :
- nFormat = 2;
- break;
- case SVXDATEFORMAT_C :
- nFormat = 4;
- break;
- default:
- case SVXDATEFORMAT_A :
- nFormat = 0;
- }
- switch( eTimeFormat )
- {
- case SVXTIMEFORMAT_24_HM :
- nFormat = 9;
- break;
- case SVXTIMEFORMAT_12_HM :
- nFormat = 11;
- break;
- case SVXTIMEFORMAT_24_HMS :
- nFormat = 10;
- break;
- case SVXTIMEFORMAT_12_HMS :
- nFormat = 12;
- break;
- default:
- break;
- }
- nVal |= nFormat;
- }
-
- mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 0 );
- mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
- *mpStrm << nVal;
- ImplCreateHeaderFooterStrings( *mpStrm, rXPagePropSet );
- mpPptEscherEx->CloseContainer();
- }
-}
-
-// ---------------------------------------------------------------------------------------------
-
-sal_Bool PPTWriter::ImplCreateDocument()
-{
- sal_uInt32 i;
- sal_uInt16 nSlideType = EPP_SLIDESIZE_TYPECUSTOM;
-
- sal_uInt32 nWidth = maDestPageSize.Width;
- sal_uInt32 nHeight = maDestPageSize.Height;
-
- if ( ( nWidth == 0x1680 ) && ( nHeight == 0x10e0 ) )
- nSlideType = EPP_SLIDESIZE_TYPEONSCREEN;
- else if ( ( nWidth == 0x1200 ) && ( nHeight == 0x240 ) )
- nSlideType = EPP_SLIDESIZE_TYPEBANNER;
- else if ( ( nWidth == 0x1950 ) && ( nHeight == 0x10e0 ) )
- nSlideType = EPP_SLIDESIZE_TYPE35MM;
- else if ( ( nWidth == 0x1860 ) && ( nHeight == 0x10e0 ) )
- nSlideType = EPP_SLIDESIZE_TYPEA4PAPER;
-
- mpPptEscherEx->OpenContainer( EPP_Document );
- // CREATE DOCUMENT ATOM
- mpPptEscherEx->AddAtom( 40, EPP_DocumentAtom, 1 );
- *mpStrm << nWidth // Slide Size in Master coordinates X
- << nHeight // " " " " " Y
- << (sal_Int32)maNotesPageSize.Width // Notes Page Size X
- << (sal_Int32)maNotesPageSize.Height // " " " Y
- << (sal_Int32)1 << (sal_Int32)2; // the scale used when the Powerpoint
document is embedded. the default is 1:2
- mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, mpStrm->Tell() );
- *mpStrm << (sal_uInt32)0 // Reference to NotesMaster ( 0 if none );
- << (sal_uInt32)0 // Reference to HandoutMaster ( 0 if none );
- << (sal_Int16)1 // Number of the first slide;
- << nSlideType // Size of the document slides ( default:
EPP_SLIDESIZETYPEONSCREEN )
- << (sal_uInt8)0 // bool1 indicates if document was saved with
embedded true type fonts
- << (sal_uInt8)0 // bool1 indicates if the placeholders on the
title slide are omitted
- << (sal_uInt8)0 // bool1 right to left ( flag for Bidi version
)
- << (sal_uInt8)1; // bool1 visibility of comments shapes
-
- mpPptEscherEx->PtInsert( EPP_Persist_Document, mpStrm->Tell() );
-
- mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 3 ); //Master footer (default)
- mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
- *mpStrm << (sal_uInt32)0x25000d;
- if ( GetPageByIndex( 0, MASTER ) )
- ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
- mpPptEscherEx->CloseContainer();
- mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 4 ); //NotesMaster footer (default)
- mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
- *mpStrm << (sal_uInt32)0x3d000d;
- if ( GetPageByIndex( 0, NOTICE ) )
- ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
- mpPptEscherEx->CloseContainer();
-
- mpPptEscherEx->OpenContainer( EPP_SlideListWithText ); // Animation info fuer die Slides
-
- for ( i = 0; i < mnPages; i++ )
- {
- mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
- mpPptEscherEx->InsertPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, mpStrm->Tell() );
- *mpStrm << (sal_uInt32)0 // psrReference - logical
reference to the slide persist object ( EPP_MAINSLIDE_PERSIST_KEY )
- << (sal_uInt32)4 // flags - only bit 3 used, if set
then slide contains shapes other than placeholders
- << (sal_Int32)0 // numberTexts - number of
placeholder texts stored with the persist object. Allows to display outline view without loading
the slide persist objects
- << (sal_Int32)i + 0x100 // slideId - Unique slide
identifier, used for OLE link monikers for example
- << (sal_uInt32)0; // reserved, usualy 0
-
- if ( !GetPageByIndex( i, NORMAL ) ) // sehr aufregend: noch einmal
ueber alle seiten
- return sal_False;
- SetCurrentStyleSheet( GetMasterIndex( NORMAL ) );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed >
- aXName( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
-
- if ( aXName.is() )
- maSlideNameList.push_back( aXName->getName() );
- else
- maSlideNameList.push_back( ::rtl::OUString() );
- }
- mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
-
- mpPptEscherEx->OpenContainer( EPP_SlideListWithText, 2 ); // Animation info fuer die notes
- for( i = 0; i < mnPages; i++ )
- {
- mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
- mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, mpStrm->Tell() );
- *mpStrm << (sal_uInt32)0
- << (sal_uInt32)4
- << (sal_Int32)0
- << (sal_Int32)i + 0x100
- << (sal_uInt32)0;
- }
- mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
-
- ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentationSupplier >
- aXPresSupplier( mXModel, ::com::sun::star::uno::UNO_QUERY ); ;
- if ( aXPresSupplier.is() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentation >
- aXPresentation( aXPresSupplier->getPresentation() );
- if ( aXPresentation.is() )
- {
- mXPropSet = ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- ( aXPresentation, ::com::sun::star::uno::UNO_QUERY );
- if ( mXPropSet.is() )
- {
- ::rtl::OUString aCustomShow;
- sal_uInt32 nPenColor = 0x1000000;
- sal_Int32 nRestartTime = 0x7fffffff;
- sal_Int16 nStartSlide = 0;
- sal_Int16 nEndSlide = 0;
- sal_uInt32 nFlags = 0; // Bit 0: Auto advance
- // Bit 1 Skip builds ( do not allow slide
effects )
- // Bit 2 Use slide range
- // Bit 3 Use named show
- // Bit 4 Browse mode on
- // Bit 5 Kiosk mode on
- // Bit 7 loop continously
- // Bit ? show scrollbar
-
- if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ) )
)
- {
- aCustomShow = ( *(::rtl::OUString*)mAny.getValue() );
- if ( aCustomShow.getLength() )
- {
- nFlags |= 8;
- }
- }
- if ( ( nFlags & 8 ) == 0 )
- {
- if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" )
) ) )
- {
- ::rtl::OUString aSlideName( *(::rtl::OUString*)mAny.getValue() );
-
- std::vector<rtl::OUString>::const_iterator pIter = std::find(
- maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
-
- if (pIter != maSlideNameList.end())
- {
- nStartSlide = pIter - maSlideNameList.begin() + 1;
- nFlags |= 4;
- nEndSlide = (sal_uInt16)mnPages;
- }
- }
- }
-
- if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) )
) )
- {
- sal_Bool bBool = sal_False;
- mAny >>= bBool;
- if ( !bBool )
- nFlags |= 1;
- }
-
- if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) )
) // muesste eigendlich heissen IsNotEndless !=)"�()&
- {
- sal_Bool bBool = sal_False;
- mAny >>= bBool;
- if ( bBool )
- nFlags |= 0x80;
- }
- if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) )
) )
- {
- sal_Bool bBool = sal_False;
- mAny >>= bBool;
- if ( !bBool )
- nFlags |= 0x11;
- }
-
- mpPptEscherEx->AddAtom( 80, EPP_SSDocInfoAtom, 1 );
- *mpStrm << nPenColor << nRestartTime << nStartSlide << nEndSlide;
-
- sal_uInt32 nCustomShowNameLen = aCustomShow.getLength();
- if ( nCustomShowNameLen > 31 )
- nCustomShowNameLen = 31;
- if ( nCustomShowNameLen ) // named show identifier
- {
- const sal_Unicode* pCustomShow = aCustomShow.getStr();
- for ( i = 0; i < nCustomShowNameLen; i++ )
- {
- *mpStrm << (sal_uInt16)( pCustomShow[ i ] );
- }
- }
- for ( i = nCustomShowNameLen; i < 32; i++, *mpStrm << (sal_uInt16)0 ) ;
-
- *mpStrm << nFlags;
- ::com::sun::star::uno::Reference<
::com::sun::star::presentation::XCustomPresentationSupplier >
- aXCPSup( mXModel, ::com::sun::star::uno::UNO_QUERY );
- if ( aXCPSup.is() )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
- aXCont( aXCPSup->getCustomPresentations() );
- if ( aXCont.is() )
- {
- ::com::sun::star::uno::Sequence< ::rtl::OUString> aNameSeq(
aXCont->getElementNames() );
- const ::rtl::OUString* pUString = aNameSeq.getArray();
- sal_uInt32 nCount = aNameSeq.getLength();
- if ( nCount )
- {
- mpPptEscherEx->OpenContainer( EPP_NamedShows );
- sal_uInt32 nCustomShowIndex = 0;
- for( i = 0; i < nCount; i++ ) // Anzahl der Custom Shows
- {
- if ( pUString[ i ].getLength() )
- {
- mpPptEscherEx->OpenContainer( EPP_NamedShow,
nCustomShowIndex++ );
-
- sal_uInt32 nNamedShowLen = pUString[ i ].getLength();
- if ( nNamedShowLen > 31 )
- nNamedShowLen = 31;
- mpPptEscherEx->AddAtom( nNamedShowLen << 1, EPP_CString );
- const sal_Unicode* pCustomShowName = pUString[ i ].getStr();
- for ( sal_uInt32 k = 0; k < nNamedShowLen; *mpStrm <<
(sal_uInt16)( pCustomShowName[ k++ ] ) ) ;
- mAny = aXCont->getByName( pUString[ i ] );
- if ( mAny.getValue() )
- {
-
- ::com::sun::star::uno::Reference<
::com::sun::star::container::XIndexContainer > aXIC;
- if ( mAny >>= aXIC )
- {
- mpPptEscherEx->BeginAtom();
-
- sal_Int32 nSlideCount = aXIC->getCount();
- for ( sal_Int32 j = 0; j < nSlideCount; j++ ) //
Anzahl der Slides
- {
- mAny = aXIC->getByIndex( j );
- if ( mAny.getValue() )
- {
- ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XDrawPage >
aXDrawPage;
- if ( mAny >>= aXDrawPage )
- {
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNamed >
- aXName( aXDrawPage,
::com::sun::star::uno::UNO_QUERY );
- if ( aXName.is() )
- {
- ::rtl::OUString aSlideName(
aXName->getName() );
-
std::vector<rtl::OUString>::const_iterator pIter = std::find(
-
maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
-
- if (pIter != maSlideNameList.end())
- {
- sal_uInt32 nPageNumber = pIter -
maSlideNameList.begin();
- *mpStrm << (sal_uInt32)(
nPageNumber + 0x100 ); // unique slide id
- }
- }
- }
- }
- }
- mpPptEscherEx->EndAtom( EPP_NamedShowSlides );
- }
- }
- mpPptEscherEx->CloseContainer(); // EPP_NamedShow
- }
- }
- mpPptEscherEx->CloseContainer(); // EPP_NamedShows
- }
- }
- }
- }
- }
- }
- mpPptEscherEx->AddAtom( 0, EPP_EndDocument );
- mpPptEscherEx->CloseContainer(); // EPP_Document
- return sal_True;
-};
-
-// ---------------------------------------------------------------------------------------------
-
-sal_Bool PPTWriter::ImplCreateHyperBlob( SvMemoryStream& rStrm )
-{
- sal_uInt32 nCurrentOfs, nParaOfs, nParaCount = 0;
-
- nParaOfs = rStrm.Tell();
- rStrm << (sal_uInt32)0; // property size
- rStrm << (sal_uInt32)0; // property count
-
- for ( EPPTHyperlink* pLink = (EPPTHyperlink*)maHyperlink.First(); pLink; pLink =
(EPPTHyperlink*)maHyperlink.Next() )
- {
- nParaCount += 6;
- rStrm << (sal_uInt32)3 // Type VT_I4
- << (sal_uInt32)7 // (VTI4 - Private1)
- << (sal_uInt32)3 // Type VT_I4
- << (sal_uInt32)6 // (VTI4 - Private2)
- << (sal_uInt32)3 // Type VT_I4
- << (sal_uInt32)0; // (VTI4 - Private3)
-
- // INFO
- // HIWORD: = 0 : do not change anything
- // = 1 : replace the hyperlink with the target and subadress in the following two
VTLPWSTR
- // = 2 : delete the hyperlink
- // LOWORD: = 0 : graphic shown as background (link)
- // = 1 : graphic shown as shape (link)
- // = 2 : graphic is used to fill a shape
- // = 3 : graphic used to fill a shape outline (future use)
- // = 4 : hyperlink attached to a shape
- // = 5 : " " " " (Word) field
- // = 6 : " " " " (Excel) range
- // = 7 : " " " " (PPT) text range
- // = 8 : " " " " (Project) task
-
- sal_uInt32 nUrlLen = pLink->aURL.Len();
- const sal_Unicode* pUrl = pLink->aURL.GetBuffer();
-
- sal_uInt32 nInfo = 7;
-
- rStrm << (sal_uInt32)3 // Type VT_I4
- << nInfo; // Info
-
- switch( pLink->nType & 0xff )
- {
- case 1 : // click action to slidenumber
- {
- rStrm << (sal_uInt32)0x1f << (sal_uInt32)1 << (sal_uInt32)0; // path
- rStrm << (sal_uInt32)0x1f << (sal_uInt32)( nUrlLen + 1 );
- for ( sal_uInt32 i = 0; i < nUrlLen; i++ )
- {
- rStrm << pUrl[ i ];
- }
- rStrm << (sal_uInt16)0;
- }
- break;
- case 2 :
- {
- sal_uInt32 i;
-
- rStrm << (sal_uInt32)0x1f
- << (sal_uInt32)( nUrlLen + 1 );
- for ( i = 0; i < nUrlLen; i++ )
- {
- rStrm << pUrl[ i ];
- }
- if ( ! ( i & 1 ) )
- rStrm << (sal_uInt16)0;
- rStrm << (sal_uInt16)0
- << (sal_uInt32)0x1f
- << (sal_uInt32)1
- << (sal_uInt32)0;
- }
- break;
- }
- }
- nCurrentOfs = rStrm.Tell();
- rStrm.Seek( nParaOfs );
- rStrm << (sal_uInt32)( nCurrentOfs - ( nParaOfs + 4 ) );
- rStrm << nParaCount;
- rStrm.Seek( nCurrentOfs );
- return sal_True;
-}
-
-// ---------------------------------------------------------------------------------------------
-
-sal_Bool PPTWriter::ImplCreateMainNotes()
-{
- EscherSolverContainer aSolverContainer;
-
- mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainNotes, mpStrm->Tell() );
- mpPptEscherEx->OpenContainer( EPP_Notes );
- mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
- *mpStrm << (sal_uInt32)0x80000001 // Number that
identifies this slide
- << (sal_uInt32)0; // follow
nothing
- mpPptEscherEx->OpenContainer( EPP_PPDrawing );
- mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
- mpPptEscherEx->EnterGroup(0,0);
-
- ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, sal_True );
-
- mpPptEscherEx->LeaveGroup();
- mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
- mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );
- EscherPropertyContainer aPropOpt;
- aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock
valued fill color
- aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
- aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x68bdde );
- aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x8b9f8e );
- aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
- aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0 );
- aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
- aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true,
this is the background shape
- aPropOpt.Commit( *mpStrm );
- mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
-
- aSolverContainer.WriteSolver( *mpStrm );
-
- mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
- mpPptEscherEx->CloseContainer(); // EPP_Drawing
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
- *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 <<
(sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc <<
(sal_uInt32)0xb2b2b2;
- mpPptEscherEx->CloseContainer(); // EPP_Notes
- return sal_True;
-}
-
-// ---------------------------------------------------------------------------------------------
-
-static rtl::OUString getInitials( const rtl::OUString& rName )
-{
- rtl::OUString sInitials;
-
- const sal_Unicode * pStr = rName.getStr();
- sal_Int32 nLength = rName.getLength();
-
- while( nLength )
- {
- // skip whitespace
- while( nLength && (*pStr <= ' ') )
- {
- nLength--; pStr++;
- }
-
- // take letter
- if( nLength )
- {
- sInitials += rtl::OUString( *pStr );
- nLength--; pStr++;
- }
-
- // skip letters until whitespace
- while( nLength && (*pStr > ' ') )
- {
- nLength--; pStr++;
- }
- }
-
- return sInitials;
-}
-
-void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStream&
rBinaryTagData10Atom )
-{
- try
- {
- uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW
);
- uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration(
xAnnotationAccess->createAnnotationEnumeration() );
-
- sal_Int32 nIndex = 1;
-
- while( xAnnotationEnumeration->hasMoreElements() )
- {
- EscherExContainer aComment10( rBinaryTagData10Atom, EPP_Comment10 );
- {
- uno::Reference< office::XAnnotation > xAnnotation(
xAnnotationEnumeration->nextElement() );
-
- geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
- MapMode aMapDest( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) );
- Point aPoint( OutputDevice::LogicToLogic( Point( static_cast< sal_Int32 >(
aRealPoint2D.X * 100.0 ),
- static_cast< sal_Int32 >( aRealPoint2D.Y * 100.0 ) ), MAP_100TH_MM, aMapDest )
);
-
- rtl::OUString sAuthor( xAnnotation->getAuthor() );
- uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
- rtl::OUString sText( xText->getString() );
- rtl::OUString sInitials( getInitials( sAuthor ) );
- util::DateTime aDateTime( xAnnotation->getDateTime() );
- if ( sAuthor.getLength() )
- PPTWriter::WriteCString( rBinaryTagData10Atom, sAuthor, 0 );
- if ( sText.getLength() )
- PPTWriter::WriteCString( rBinaryTagData10Atom, sText, 1 );
- if ( sInitials.getLength() )
- PPTWriter::WriteCString( rBinaryTagData10Atom, sInitials, 2 );
-
- sal_Int16 nMilliSeconds = aDateTime.HundredthSeconds * 10;
- EscherExAtom aCommentAtom10( rBinaryTagData10Atom, EPP_CommentAtom10 );
- rBinaryTagData10Atom << nIndex++
- << aDateTime.Year
- << aDateTime.Month
- << aDateTime.Day // todo: day of week
- << aDateTime.Day
- << aDateTime.Hours
- << aDateTime.Minutes
- << aDateTime.Seconds
- << nMilliSeconds
- << static_cast< sal_Int32 >( aPoint.X() )
- << static_cast< sal_Int32 >( aPoint.Y() );
- }
- }
- }
- catch ( uno::Exception& )
- {
- }
-}
-
-// ---------------------------------------------------------------------------------------------
-
-void PPTWriter::ImplWriteNotes( sal_uInt32 nPageNum )
-{
- mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Notes | nPageNum, mpStrm->Tell() );
- mpPptEscherEx->OpenContainer( EPP_Notes );
- mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
- *mpStrm << (sal_uInt32)nPageNum + 0x100
- << (sal_uInt16)3 // follow master ....
- << (sal_uInt16)0;
-
- ImplCreateHeaderFooters( mXPagePropSet );
-
- EscherSolverContainer aSolverContainer;
-
- mpPptEscherEx->OpenContainer( EPP_PPDrawing );
- mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
- mpPptEscherEx->EnterGroup(0,0);
-
- ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, sal_False ); // Die Shapes der
Seite werden im PPT Dok. erzeugt
-
- mpPptEscherEx->LeaveGroup();
- mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
- mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background |
HasSpt
- EscherPropertyContainer aPropOpt;
- aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
- aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
- aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x8b9f8e );
- aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x68bdde );
- aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
- aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
- aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
- aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
- aPropOpt.Commit( *mpStrm );
- mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
-
- aSolverContainer.WriteSolver( *mpStrm );
-
- mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
- mpPptEscherEx->CloseContainer(); // EPP_Drawing
- mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
- *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 <<
(sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc <<
(sal_uInt32)0xb2b2b2;
- mpPptEscherEx->CloseContainer(); // EPP_Notes
-};
-
-void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > & rXPropSet )
-{
- //************************ ******
- //** DEFAULT BACKGROUND SHAPE **
- //******************************
-
- sal_uInt32 nFillColor = 0xffffff;
- sal_uInt32 nFillBackColor = 0;
-
- mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
- mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags:
Connector | Background | HasSpt
- Point aEmptyPoint = Point();
- Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
- EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
- aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
- ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
- if ( ImplGetPropertyValue( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
- mAny >>= aFS;
-
- switch( aFS )
- {
- case ::com::sun::star::drawing::FillStyle_GRADIENT :
- {
- aPropOpt.CreateGradientProperties( rXPropSet );
- aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x1f001e );
- aPropOpt.GetOpt( ESCHER_Prop_fillColor, nFillColor );
- aPropOpt.GetOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
- }
- break;
-
- case ::com::sun::star::drawing::FillStyle_BITMAP :
- aPropOpt.CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM(
"FillBitmapURL" ) ), sal_True );
- break;
-
- case ::com::sun::star::drawing::FillStyle_HATCH :
- aPropOpt.CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM(
"FillHatch" ) ), sal_True );
- break;
-
- case ::com::sun::star::drawing::FillStyle_SOLID :
- {
- if ( ImplGetPropertyValue( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor"
) ) ) )
- {
- nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) );
- nFillBackColor = nFillColor ^ 0xffffff;
- }
- } // PASSTHROUGH INTENDED
- case ::com::sun::star::drawing::FillStyle_NONE :
- default:
- aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
- break;
- }
- aPropOpt.AddOpt( ESCHER_Prop_fillColor, nFillColor );
- aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
- aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
- aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Height ) );
- aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
- aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_bwWhite );
- aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
- aPropOpt.Commit( *mpStrm );
- mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
-}
-
-void PPTWriter::ImplWriteVBA()
-{
- if ( mpVBA )
- {
- mpVBA->Seek( STREAM_SEEK_TO_END );
- sal_uInt32 nLen = mpVBA->Tell();
- if ( nLen > 8 )
- {
- nLen -= 8;
- mnVBAOleOfs = mpStrm->Tell();
- mpPptEscherEx->BeginAtom();
- mpStrm->Write( (sal_Int8*)mpVBA->GetData() + 8, nLen );
- mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
- }
- }
-}
-
-// ---------------------------------------------------------------------------------------------
-
-void PPTWriter::ImplWriteOLE( )
-{
- PPTExOleObjEntry* pPtr;
-
- SvxMSExportOLEObjects aOleExport( mnCnvrtFlags );
-
- for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr;
- pPtr = (PPTExOleObjEntry*)maExOleObj.Next() )
- {
- SvMemoryStream* pStrm = NULL;
- pPtr->nOfsB = mpStrm->Tell();
- switch ( pPtr->eType )
- {
- case NORMAL_OLE_OBJECT :
- {
- SdrObject* pSdrObj = GetSdrObjectFromXShape( pPtr->xShape );
- if ( pSdrObj && pSdrObj->ISA( SdrOle2Obj ) )
- {
- ::uno::Reference < embed::XEmbeddedObject > xObj( ( (SdrOle2Obj*) pSdrObj
)->GetObjRef() );
- if( xObj.is() )
- {
- SvStorageRef xTempStorage( new SvStorage( new SvMemoryStream(), sal_True )
);
- aOleExport.ExportOLEObject( xObj, *xTempStorage );
-
- //TODO/MBA: testing
- String aPersistStream( String::CreateFromAscii(
RTL_CONSTASCII_STRINGPARAM( SVEXT_PERSIST_STREAM ) ) );
- SvMemoryStream aStream;
- SvStorageRef xCleanStorage( new SvStorage( sal_False, aStream ) );
- xTempStorage->CopyTo( xCleanStorage );
- // create a dummy content stream, the dummy content is necessary for ppt,
but not for
- // doc files, so we can't share code.
- SotStorageStreamRef xStm = xCleanStorage->OpenSotStream( aPersistStream,
STREAM_STD_READWRITE );
- *xStm << (sal_uInt32)0 // no ClipboardId
- << (sal_uInt32)4 // no target device
- << (sal_uInt32)1 // aspect ratio
- << (sal_Int32)-1 // L-Index
- << (sal_uInt32)0 // Advanced Flags
- << (sal_uInt32)0 // compression
- << (sal_uInt32)0 // Size
- << (sal_uInt32)0 // "
- << (sal_uInt32)0;
- pStrm = xCleanStorage->CreateMemoryStream();
- }
- }
- }
- break;
-
- case OCX_CONTROL :
- {
- if ( pPtr->xControlModel.is() )
- {
- String aName;
- ::com::sun::star::awt::Size aSize;
- SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) );
- sal_Bool bOk = SvxMSConvertOCXControls::WriteOCXStream( xDest,
pPtr->xControlModel, aSize, aName );
- if ( bOk )
- pStrm = xDest->CreateMemoryStream();
- }
- }
- }
- if ( pStrm )
- {
- mpPptEscherEx->BeginAtom();
- pStrm->Seek( STREAM_SEEK_TO_END );
- sal_uInt32 npStrmSize = pStrm->Tell();
- *mpStrm << npStrmSize; // uncompressed size
-
- pStrm->Seek( 0 );
- ZCodec aZCodec( 0x8000, 0x8000 );
- aZCodec.BeginCompression();
- aZCodec.Compress( *pStrm, *mpStrm );
- aZCodec.EndCompression();
- delete pStrm;
- mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
- }
- }
-}
-
-// ---------------------------------------------------------------------------------------------
-// PersistantTable und UserEditAtom schreiben
-
-sal_Bool PPTWriter::ImplWriteAtomEnding()
-{
-
-#define EPP_LastViewTypeNone 0
-#define EPP_LastViewTypeSlideView 1
-#define EPP_LastViewTypeOutlineView 2
-#define EPP_LastViewTypeNotes 3
-
- sal_uInt32 i, nPos, nOfs, nPersistOfs = mpStrm->Tell();
- sal_uInt32 nPersistEntrys = 0;
- *mpStrm << (sal_uInt32)0 << (sal_uInt32)0 << (sal_uInt32)0; // Record Header und
ersten Eintrag ueberspringen
-
- // Document pesist schreiben
- nPersistEntrys++;
- *mpStrm << (sal_uInt32)0;
- // MasterPages persists schreiben
- for ( i = 0; i < mnMasterPages; i++ )
- {
- nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainMaster | i );
- if ( nOfs )
- {
- *mpStrm << nOfs;
- mpPptEscherEx->InsertAtPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, ++nPersistEntrys
);
- }
- }
- // MainNotesMaster persist schreiben
- nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainNotes );
- if ( nOfs )
- {
- *mpStrm << nOfs;
- mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, ++nPersistEntrys );
- }
- // Slide persists schreiben -> es gilt hier auch den EPP_SlidePersistAtome mit einem gueltigen
wert zu beschreiben
- for ( i = 0; i < mnPages; i++ )
- {
- nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Slide | i );
- if ( nOfs )
- {
- *mpStrm << nOfs;
- mpPptEscherEx->InsertAtPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, ++nPersistEntrys
);
- }
- }
- // Notes persists schreiben
- for ( i = 0; i < mnPages; i++ )
- {
- nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Notes | i );
- if ( nOfs )
- {
- *mpStrm << nOfs;
- mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, ++nPersistEntrys
);
- }
- }
- // Ole persists
- PPTExOleObjEntry* pPtr;
- for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr; pPtr =
(PPTExOleObjEntry*)maExOleObj.Next() )
- {
- nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_ExObj );
- if ( nOfs )
- {
- nPersistEntrys++;
- *mpStrm << pPtr->nOfsB;
- sal_uInt32 nOldPos, nPersOfs = nOfs + pPtr->nOfsA + 16 + 8; // 8 bytes atom
header, +16 to the persist entry
- nOldPos = mpStrm->Tell();
- mpStrm->Seek( nPersOfs );
- *mpStrm << nPersistEntrys;
- mpStrm->Seek( nOldPos );
- }
- }
- // VB persist
- if ( mnVBAOleOfs && mpVBA )
- {
- nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_VBAInfoAtom );
- if ( nOfs )
- {
- nPersistEntrys++;
- sal_uInt32 n1, n2;
-
- mpVBA->Seek( 0 );
- *mpVBA >> n1
- >> n2;
-
- *mpStrm << mnVBAOleOfs;
- sal_uInt32 nOldPos = mpStrm->Tell();
- mpStrm->Seek( nOfs ); // Fill the VBAInfoAtom with the correct index to
the persisttable
- *mpStrm << nPersistEntrys
- << n1
- << 2;
- mpStrm->Seek( nOldPos );
-
- }
- }
- nPos = mpStrm->Tell();
- mpStrm->Seek( nPersistOfs );
- mpPptEscherEx->AddAtom( ( nPersistEntrys + 1 ) << 2, EPP_PersistPtrIncrementalBlock ); //
Record Header eintragen
- *mpStrm << (sal_uInt32)( ( nPersistEntrys << 20 ) | 1 );
- mpStrm->Seek( nPos );
-
- *mpCurUserStrm << (sal_uInt32)nPos; // offset to current edit setzen
- mpPptEscherEx->AddAtom( 28, EPP_UserEditAtom );
- *mpStrm << (sal_Int32)0x100 // last slide ID
- << (sal_uInt32)0x03000dbc // minor and major app version that did the
save
- << (sal_uInt32)0 // offset last save, 0 after a full save
- << nPersistOfs // File offset to persist pointers for this save
operation
- << (sal_uInt32)1 // Persist reference to the document persist
object
- << (sal_uInt32)nPersistEntrys // max persists written, Seed value for
persist object id management
- << (sal_Int16)EPP_LastViewTypeSlideView // last view type
- << (sal_Int16)0x12; // padword
-
- return sal_True;
-}
-
-// ---------------------
-// - exported function -
-// ---------------------
-
-extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool __LOADONCALLAPI ExportPPT( SvStorageRef& rSvStorage,
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
- ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator
& rXStatInd,
- SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags )
-{
- PPTWriter* pPPTWriter;
- sal_Bool bStatus = sal_False;
-
- pPPTWriter = new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags );
- if ( pPPTWriter )
- {
- pPPTWriter->exportPPT();
- bStatus = ( pPPTWriter->IsValid() == sal_True );
- delete pPPTWriter;
- }
-
- return bStatus;
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool __LOADONCALLAPI SaveVBA( SfxObjectShell& rDocShell,
SvMemoryStream*& pBas )
-{
- SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) );
- SvxImportMSVBasic aMSVBas( rDocShell, *xDest, sal_False, sal_False );
- aMSVBas.SaveOrDelMSVBAStorage( sal_True, String(
RTL_CONSTASCII_USTRINGPARAM("_MS_VBA_Overhead") ) );
-
- SvStorageRef xOverhead = xDest->OpenSotStorage( String(
RTL_CONSTASCII_USTRINGPARAM("_MS_VBA_Overhead") ) );
- if ( xOverhead.Is() && ( xOverhead->GetError() == SVSTREAM_OK ) )
- {
- SvStorageRef xOverhead2 = xOverhead->OpenSotStorage( String(
RTL_CONSTASCII_USTRINGPARAM("_MS_VBA_Overhead") ) );
- if ( xOverhead2.Is() && ( xOverhead2->GetError() == SVSTREAM_OK ) )
- {
- SvStorageStreamRef xTemp = xOverhead2->OpenSotStream( String(
RTL_CONSTASCII_USTRINGPARAM("_MS_VBA_Overhead2") ) );
- if ( xTemp.Is() && ( xTemp->GetError() == SVSTREAM_OK ) )
- {
- sal_uInt32 nLen = xTemp->GetSize();
- if ( nLen )
- {
- char* pTemp = new char[ nLen ];
- if ( pTemp )
- {
- xTemp->Seek( STREAM_SEEK_TO_BEGIN );
- xTemp->Read( pTemp, nLen );
- pBas = new SvMemoryStream( pTemp, nLen, STREAM_READ );
- pBas->ObjectOwnsMemory( sal_True );
- return sal_True;
- }
- }
- }
- }
- }
-
- return sal_False;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
deleted file mode 100644
index dd5ffc6..0000000
--- a/sd/source/filter/html/htmlex.cxx
+++ /dev/null
@@ -1,3361 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_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>
-#include <unotools/ucbstreamhelper.hxx>
-#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();
-
- sal_uLong createStream( const String& rUrl, SvStream*& rpStr );
- sal_uLong createFileName( const String& rUrl, String& rFileName );
- sal_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, sal_uInt16 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_MEDRES_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),
- mpThumbnailFiles(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 && mpThumbnailFiles && mpPageNames && mpTextFiles )
- {
- for ( sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
- {
- delete mpImageFiles[nSdPage];
- delete mpHTMLFiles[nSdPage];
- delete mpThumbnailFiles[nSdPage];
- delete mpPageNames[nSdPage];
- delete mpTextFiles[nSdPage];
- }
- }
-
- delete[] mpImageFiles;
- delete[] mpHTMLFiles;
- delete[] mpThumbnailFiles;
- 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 = (sal_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
- {
- OSL_FAIL("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();
-
- mnHeightPixel = (sal_uInt16)(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 );
- for( sal_uInt16 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
- sal_uInt16 nSepPos = maDocFileName.Search( sal_Unicode('.') );
-
- if(nSepPos != STRING_NOTFOUND)
- maDocFileName.Erase(nSepPos);
-
- maDocFileName.AppendAscii( ".odp" );
- }
-
- //////
-
- sal_uInt16 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( mbContentsPage &&
- !CreateImagesForPresPages( true ) )
- 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,sal_True) == SFX_ITEM_ON)
- maTextColor = ((SvxColorItem*)rSet.GetItem(EE_CHAR_COLOR,sal_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( sal_uInt16 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( sal_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( bool bThumbnail)
-{
- 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)(bThumbnail ? PUB_THUMBNAIL_WIDTH : mnWidthPixel );
- aFilterData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PixelHeight") );
- aFilterData[1].Value <<= (sal_Int32)(bThumbnail ? PUB_THUMBNAIL_HEIGHT : 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 (sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
- {
- SdPage* pPage = maPages[ nSdPage ];
-
- OUString aFull(maExportPath);
- if (bThumbnail)
- aFull += *mpThumbnailFiles[nSdPage];
- else
- 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)
-{
- sal_uLong nObjectCount = pPage->GetObjCount();
- SdrObject* pObject = NULL;
- SdrTextObj* pResult = NULL;
-
- for (sal_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(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount && bOk; nSdPage++)
- {
- SdPage* pPage = maPages[ nSdPage ];
-
- if( mbDocColors )
- {
- SetDocColors( pPage );
- }
-
-// 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 )
-{
- sal_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 );
-
- sal_uLong nCount = pOutliner->GetParagraphCount();
-
- Paragraph* pPara = NULL;
- sal_Int16 nActDepth = -1;
-
- String aParaText;
- for (sal_uLong nPara = 0; nPara < nCount; nPara++)
- {
- pPara = pOutliner->GetParagraph(nPara);
- if(pPara == 0)
- continue;
-
- const sal_Int16 nDepth = (sal_uInt16) pOutliner->GetDepth( (sal_uInt16) 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 );
-
- sal_uLong nCount = pOutliner->GetParagraphCount();
- for (sal_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, sal_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(sal_True);
-
- Paragraph* pPara = pOutliner->GetParagraph(nPara);
- if(NULL == pPara)
- return aStr;
-
- HtmlState aState( (mbUserAttr || mbDocColors) ? maTextColor : Color(COL_BLACK) );
- SvUShorts aPortionList;
- rEditEngine.GetPortions( (sal_uInt16) nPara, aPortionList );
- sal_uInt16 nPortionCount = aPortionList.Count();
-
- sal_uInt16 nPos1 = 0;
- for( sal_uInt16 nPortion = 0; nPortion < nPortionCount; nPortion++ )
- {
- sal_uInt16 nPos2 = aPortionList.GetObject(nPortion);
-
- ESelection aSelection( (sal_uInt16) nPara, nPos1, (sal_uInt16) 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;
-
- std::vector<SdrObject*> aClickableObjects;
-
- for(sal_uInt16 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)
- {
- // sal_True = rueckwaerts
- SdrObjListIter aIter(*pPage, IM_DEEPWITHGROUPS, sal_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.push_back(pObject);
- }
-
- pObject = aIter.Next();
- }
- // jetzt zur Masterpage oder beenden
- if (!pPage->IsMasterPage())
- pPage = (SdPage*)(&(pPage->TRG_GetMasterPage()));
- else
- bMasterDone = true;
- }
-
-// 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 )
- {
- sal_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 (!aClickableObjects.empty())
- 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 (!aClickableObjects.empty())
- {
- aStr.AppendAscii( "<map name=\"map0\">\r\n" );
-
- for (sal_uInt32 nObject = 0, n = aClickableObjects.size(); nObject < n; nObject++)
- {
- SdrObject* pObject = aClickableObjects[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();
-
- sal_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();
- sal_uInt16 nAreaCount = rIMap.GetIMapObjectCount();
- for (sal_uInt16 nArea = 0; nArea < nAreaCount; nArea++)
- {
- IMapObject* pArea = rIMap.GetIMapObject(nArea);
- sal_uInt16 nType = pArea->GetType();
- String aURL( pArea->GetURL() );
-
- // ggfs. Seiten- oder Objektnamen umwandeln in den
- // Namen der entsprechenden HTML-Datei
- sal_Bool bIsMasterPage;
- sal_uInt16 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);
-
- sal_uLong nCircleRadius = (((IMapCircleObject*)pArea)->
- GetRadius(false));
- nCircleRadius = (sal_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:
- {
- sal_Bool bIsMasterPage;
- sal_uInt16 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:
- {
- sal_uLong nPage = nSdPage;
- if (nSdPage == 0)
- nPage = 0;
- else
- nPage = nSdPage - 1;
-
- aHRef = CreatePageURL( (sal_uInt16) nPage);
- }
- break;
-
- case presentation::ClickAction_NEXTPAGE:
- {
- sal_uLong nPage = nSdPage;
- if (nSdPage == mnSdPageCount - 1)
- nPage = mnSdPageCount - 1;
- else
- nPage = nSdPage + 1;
-
- aHRef = CreatePageURL( (sal_uInt16) 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>" );
-
- // 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=\"25%\">\r\n" );
- aStr.AppendAscii( "<h3>" );
- aStr += RESTOHTML(STR_HTMLEXP_CONTENTS);
- aStr.AppendAscii( "</h3>" );
-
- for(sal_uInt16 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\" align=\"left\" width=\"75%\">\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" );
- }
-
- for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
- {
- String aText;
-
- aText.AppendAscii( "<img src=\"" );
- aText += StringToURL( *mpThumbnailFiles[nSdPage] );
- aText.AppendAscii( "\" width=\"256\" height=\"192\" alt=\"" );
- aText += StringToHTMLString( *mpPageNames[nSdPage] );
- aText.AppendAscii( "\">" );
-
- aStr += CreateLink(*mpHTMLFiles[nSdPage], aText);
- aStr.AppendAscii( "\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( sal_uInt16 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(sal_uInt16 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];
- mpThumbnailFiles = new String*[mnSdPageCount];
- mpPageNames = new String*[mnSdPageCount];
- mpTextFiles = new String*[mnSdPageCount];
-
- mbHeader = false; // Ueberschrift auf Uebersichtsseite?
-
- for (sal_uInt16 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("thumb") );
- *pName += String::CreateFromInt32(nSdPage);
- if( meFormat!=FORMAT_JPG )
- pName->AppendAscii( ".png" );
- else
- pName->AppendAscii( ".jpg" );
-
- mpThumbnailFiles[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( sal_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( (sal_uInt16)nDot );
- }
- mbHeader = true;
- }
-
- return mDocTitle;
-}
-
-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( sal_uInt16 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,
- sal_Int16 nWidth,
- sal_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( sal_uLong nRadius,
- sal_uLong nCenterX,
- sal_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( sal_uInt16 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 );
-
- sal_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( sal_uInt16 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( sal_uInt16 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( sal_uInt16 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;
- sal_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;
- OSL_FAIL((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] )) ||
- (mpThumbnailFiles[nSdPage] && checkFileExists( xFA, *mpThumbnailFiles[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;
- OSL_FAIL((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;
-}
-
-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();
-}
-
-// =====================================================================
-sal_uLong EasyFile::createStream( const String& rUrl, SvStream* &rpStr )
-{
- sal_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;
-}
-
-// =====================================================================
-sal_uLong EasyFile::createFileName( const String& rURL, String& rFileName )
-{
- sal_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;
-}
-
-// =====================================================================
-sal_uLong EasyFile::close()
-{
- sal_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;
-}
-
-// =====================================================================
-
-sal_Bool HtmlErrorContext::GetString( sal_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( sal_uInt16 nResId, const String& rURL )
-{
- mnResId = nResId;
- maURL1 = rURL;
- maURL2.Erase();
-}
-
-// =====================================================================
-
-void HtmlErrorContext::SetContext( sal_uInt16 nResId, const String& rURL1, const String& rURL2 )
-{
- mnResId = nResId;
- maURL1 = rURL1;
- maURL2 = rURL2;
-}
-
-// =====================================================================
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Context
- [Libreoffice] Unused files in the impress repository · Francois Tigeot
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.