summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorsj <sj@openoffice.org>2010-06-04 22:30:37 +0200
committersj <sj@openoffice.org>2010-06-04 22:30:37 +0200
commit7463d92b208ad23a175aba3a361fd4d4798e7bed (patch)
tree7d20243742cdb52e8672f3390b560bec06bde523 /filter
parentf8a226ebeb998080394cf662bd5fee542d6d1691 (diff)
parent53017497738e9edd88b480cfaf31a11d1701835d (diff)
impress190: merge with dev300_m80
Diffstat (limited to 'filter')
-rw-r--r--filter/inc/filter/msfilter/msvbahelper.hxx55
-rw-r--r--filter/inc/filter/msfilter/svxmsbas.hxx4
-rw-r--r--filter/prj/build.lst2
-rw-r--r--filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu2
-rwxr-xr-xfilter/source/config/tools/merge/pyAltFCFGMerge2
-rw-r--r--filter/source/msfilter/makefile.mk4
-rw-r--r--filter/source/msfilter/msvbahelper.cxx382
-rw-r--r--filter/source/msfilter/msvbasic.cxx18
-rw-r--r--filter/source/msfilter/msvbasic.hxx14
-rw-r--r--filter/source/msfilter/svxmsbas.cxx130
-rw-r--r--filter/source/pdf/impdialog.cxx21
-rw-r--r--filter/source/pdf/impdialog.hrc2
-rw-r--r--filter/source/pdf/impdialog.hxx3
-rw-r--r--filter/source/pdf/impdialog.src11
-rw-r--r--filter/source/pdf/pdfexport.cxx4
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/body.xsl4821
16 files changed, 3036 insertions, 2439 deletions
diff --git a/filter/inc/filter/msfilter/msvbahelper.hxx b/filter/inc/filter/msfilter/msvbahelper.hxx
new file mode 100644
index 000000000000..540097c054dc
--- /dev/null
+++ b/filter/inc/filter/msfilter/msvbahelper.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MSVBAHELPER_HXX
+#define _MSVBAHELPER_HXX
+
+#include <sfx2/objsh.hxx>
+#include "filter/msfilter/msfilterdllapi.h"
+
+namespace ooo { namespace vba
+{
+ class MSFILTER_DLLPUBLIC VBAMacroResolvedInfo
+ {
+ SfxObjectShell* mpDocContext;
+ bool mbFound;
+ String msResolvedMacro;
+ public:
+ VBAMacroResolvedInfo() : mpDocContext(NULL), mbFound( false ){}
+ void SetResolved( bool bRes ) { mbFound = bRes; }
+ bool IsResolved() { return mbFound; }
+ void SetMacroDocContext(SfxObjectShell* pShell ) { mpDocContext = pShell; }
+ SfxObjectShell* MacroDocContext() { return mpDocContext; }
+ String ResolvedMacro() { return msResolvedMacro; }
+ void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; }
+ };
+
+ MSFILTER_DLLPUBLIC String makeMacroURL( const String& sMacroName );
+ MSFILTER_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false );
+ MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller );
+} }
+
+#endif
diff --git a/filter/inc/filter/msfilter/svxmsbas.hxx b/filter/inc/filter/msfilter/svxmsbas.hxx
index f488017e4804..716c6788989c 100644
--- a/filter/inc/filter/msfilter/svxmsbas.hxx
+++ b/filter/inc/filter/msfilter/svxmsbas.hxx
@@ -64,6 +64,9 @@ public:
// bit 1 = 1 -> the VBA - storage is copy to the ObjectShell storage
int Import( const String& rStorageName, const String &rSubStorageName,
BOOL bAsComment=TRUE, BOOL bStripped=TRUE );
+ int Import( const String& rStorageName, const String &rSubStorageName,
+ const std::vector< String >& codeNames,
+ BOOL bAsComment=TRUE, BOOL bStripped=TRUE );
// only for the export - copy or delete the saved VBA-macro-storage
// form the ObjectShell
@@ -84,6 +87,7 @@ private:
MSFILTER_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
const String &rSubStorageName,
+ const std::vector< String >& codeNames,
BOOL bAsComment, BOOL bStripped);
MSFILTER_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName,
const String &rSubStorageName);
diff --git a/filter/prj/build.lst b/filter/prj/build.lst
index b4be1c83e63e..bed99e401b7f 100644
--- a/filter/prj/build.lst
+++ b/filter/prj/build.lst
@@ -1,4 +1,4 @@
-fl filter : vbahelper l10n svtools unotools xmloff cppu tools cppuhelper sal svx javaunohelper XPDF:xpdf jvmaccess canvas SAXON:saxon LIBXSLT:libxslt NULL
+fl filter : l10n svtools unotools xmloff cppu tools cppuhelper sal svx javaunohelper XPDF:xpdf jvmaccess canvas SAXON:saxon LIBXSLT:libxslt NULL
fl filter usr1 - all fl_mkout NULL
fl filter\prj get - all fl_prj NULL
fl filter\inc nmake - all fl_inc NULL
diff --git a/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu b/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu
index 8b2c25903438..708717263917 100644
--- a/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu
+++ b/filter/source/config/fragments/types/calc_Text_txt_csv_StarCalc.xcu
@@ -1,7 +1,7 @@
<node oor:name="calc_Text_txt_csv_StarCalc" oor:op="replace" >
<prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop>
<prop oor:name="URLPattern"/>
- <prop oor:name="Extensions"><value>csv txt xls</value></prop>
+ <prop oor:name="Extensions"><value>csv txt</value></prop>
<prop oor:name="MediaType"><value>text/plain</value></prop>
<prop oor:name="Preferred"><value>false</value></prop>
<prop oor:name="PreferredFilter"><value>Text - txt - csv (StarCalc)</value></prop>
diff --git a/filter/source/config/tools/merge/pyAltFCFGMerge b/filter/source/config/tools/merge/pyAltFCFGMerge
index faf9b9c34cb7..d9a974eb9fec 100755
--- a/filter/source/config/tools/merge/pyAltFCFGMerge
+++ b/filter/source/config/tools/merge/pyAltFCFGMerge
@@ -11,7 +11,7 @@
import sys, string, os.path
-CFGFILE = "../../../../transex3/source/filter/merge/FCFGMerge.cfg"
+CFGFILE = "../../../../l10ntools/source/filter/merge/FCFGMerge.cfg"
PROP_XMLVERSION = "xmlversion" # // <= global cfg file
PROP_XMLENCODING = "xmlencoding" # // <= global cfg file
diff --git a/filter/source/msfilter/makefile.mk b/filter/source/msfilter/makefile.mk
index 6056213ddecf..7780529b5580 100644
--- a/filter/source/msfilter/makefile.mk
+++ b/filter/source/msfilter/makefile.mk
@@ -51,7 +51,8 @@ SLOFILES= \
$(SLO)$/mscodec.obj \
$(SLO)$/msfiltertracer.obj \
$(SLO)$/svdfppt.obj \
- $(SLO)$/svxmsbas2.obj
+ $(SLO)$/svxmsbas2.obj \
+ $(SLO)$/msvbahelper.obj \
SHL1TARGET= msfilter$(DLLPOSTFIX)
SHL1IMPLIB= i$(TARGET)
@@ -59,7 +60,6 @@ SHL1OBJS= $(SLOFILES)
SHL1USE_EXPORTS=name
SHL1STDLIBS= \
$(EDITENGLIB) \
- $(VBAHELPERLIB) \
$(SVXCORELIB) \
$(SFX2LIB) \
$(XMLOFFLIB) \
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
new file mode 100644
index 000000000000..97529c22eae6
--- /dev/null
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -0,0 +1,382 @@
+/*************************************************************************
+ *
+ * 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_filter.hxx"
+
+#include <filter/msfilter/msvbahelper.hxx>
+#include <basic/sbx.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/basmgr.hxx>
+#include <basic/sbmod.hxx>
+#include <basic/sbmeth.hxx>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
+#include <tools/urlobj.hxx>
+#include <osl/file.hxx>
+
+using namespace ::com::sun::star;
+
+const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
+
+namespace ooo { namespace vba {
+
+String makeMacroURL( const String& sMacroName )
+{
+ return sUrlPart0.concat( sMacroName ).concat( sUrlPart1 ) ;
+}
+
+SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath )
+{
+ SfxObjectShell* pFoundShell=NULL;
+ SfxObjectShell* pShell = SfxObjectShell::GetFirst();
+ INetURLObject aObj;
+ aObj.SetURL( sMacroURLOrPath );
+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
+ rtl::OUString aURL;
+ if ( bIsURL )
+ aURL = sMacroURLOrPath;
+ else
+ {
+ osl::FileBase::getFileURLFromSystemPath( sMacroURLOrPath, aURL );
+ aObj.SetURL( aURL );
+ }
+ OSL_TRACE("Trying to find shell for url %s", rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+ while ( pShell )
+ {
+
+ uno::Reference< frame::XModel > xModel = pShell->GetModel();
+ // are we searching for a template? if so we have to cater for the
+ // fact that in openoffice a document opened from a template is always
+ // a new document :/
+ if ( xModel.is() )
+ {
+ OSL_TRACE("shell 0x%x has model with url %s and we look for %s", pShell
+ , rtl::OUStringToOString( xModel->getURL(), RTL_TEXTENCODING_UTF8 ).getStr()
+ , rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr()
+ );
+ if ( sMacroURLOrPath.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) )
+ {
+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( xModel, uno::UNO_QUERY );
+ if( xDocInfoSupp.is() )
+ {
+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
+ rtl::OUString sCurrName = xDocProps->getTemplateName();
+ if( sMacroURLOrPath.lastIndexOf( sCurrName ) >= 0 )
+ {
+ pFoundShell = pShell;
+ break;
+ }
+ }
+ }
+ else
+ {
+ if ( aURL.equals( xModel->getURL() ) )
+ {
+ pFoundShell = pShell;
+ break;
+ }
+ }
+ }
+ pShell = SfxObjectShell::GetNext( *pShell );
+ }
+ return pFoundShell;
+}
+
+// sMod can be empty ( but we really need the library to search in )
+// if sMod is empty and a macro is found then sMod is updated
+bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, const String& sMacro )
+{
+ bool bFound = false;
+ if ( sLibrary.Len() && sMacro.Len() )
+ {
+ OSL_TRACE("** Searching for %s.%s in library %s"
+ ,rtl::OUStringToOString( sMod, RTL_TEXTENCODING_UTF8 ).getStr()
+ ,rtl::OUStringToOString( sMacro, RTL_TEXTENCODING_UTF8 ).getStr()
+ ,rtl::OUStringToOString( sLibrary, RTL_TEXTENCODING_UTF8 ).getStr() );
+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
+ if ( pBasicMgr )
+ {
+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
+ if ( !pBasic )
+ {
+ USHORT nId = pBasicMgr->GetLibId( sLibrary );
+ pBasicMgr->LoadLib( nId );
+ pBasic = pBasicMgr->GetLib( sLibrary );
+ }
+ if ( pBasic )
+ {
+ if ( sMod.Len() ) // we wish to find the macro is a specific module
+ {
+ SbModule* pModule = pBasic->FindModule( sMod );
+ if ( pModule )
+ {
+ SbxArray* pMethods = pModule->GetMethods();
+ if ( pMethods )
+ {
+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
+ if ( pMethod )
+ bFound = true;
+ }
+ }
+ }
+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
+ {
+ if( SbModule* pModule = pMethod->GetModule() )
+ {
+ sMod = pModule->GetName();
+ bFound = true;
+ }
+ }
+ }
+ }
+ }
+ return bFound;
+}
+void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModule, String& sProcedure )
+{
+ sal_Int32 nMacroDot = sMacro.lastIndexOf( '.' );
+
+ if ( nMacroDot != -1 )
+ {
+ sProcedure = sMacro.copy( nMacroDot + 1 );
+
+ sal_Int32 nContainerDot = sMacro.lastIndexOf( '.', nMacroDot - 1 );
+ if ( nContainerDot != -1 )
+ {
+ sModule = sMacro.copy( nContainerDot + 1, nMacroDot - nContainerDot - 1 );
+ sContainer = sMacro.copy( 0, nContainerDot );
+ }
+ else
+ sModule = sMacro.copy( 0, nMacroDot );
+ }
+ else
+ sProcedure = sMacro;
+}
+
+VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& MacroName, bool bSearchGlobalTemplates )
+{
+ VBAMacroResolvedInfo aRes;
+ if ( !pShell )
+ return aRes;
+ aRes.SetMacroDocContext( pShell );
+ // parse the macro name
+ sal_Int32 nDocSepIndex = MacroName.indexOfAsciiL( "!", 1 );
+ String sMacroUrl = MacroName;
+
+ String sContainer;
+ String sModule;
+ String sProcedure;
+
+ if( nDocSepIndex > 0 )
+ {
+ // macro specified by document name
+ // find document shell for document name and call ourselves
+ // recursively
+
+ // assume for now that the document name is *this* document
+ String sDocUrlOrPath = MacroName.copy( 0, nDocSepIndex );
+ sMacroUrl = MacroName.copy( nDocSepIndex + 1 );
+ OSL_TRACE("doc search, current shell is 0x%x", pShell );
+ SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath );
+ OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
+ aRes = resolveVBAMacro( pFoundShell, sMacroUrl );
+ }
+ else
+ {
+ // macro is contained in 'this' document ( or code imported from a template
+ // where that template is a global template or perhaps the template this
+ // document is created from )
+
+ // macro format = Container.Module.Procedure
+ parseMacro( MacroName, sContainer, sModule, sProcedure );
+ uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY);
+ uno::Reference< container::XNameContainer > xPrjNameCache;
+ if ( xSF.is() )
+ xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
+
+ std::vector< rtl::OUString > sSearchList;
+
+ if ( sContainer.Len() > 0 )
+ {
+ // get the Project associated with the Container
+ if ( xPrjNameCache.is() )
+ {
+ if ( xPrjNameCache->hasByName( sContainer ) )
+ {
+ rtl::OUString sProject;
+ xPrjNameCache->getByName( sContainer ) >>= sProject;
+ sContainer = sProject;
+ }
+ }
+ sSearchList.push_back( sContainer ); // First Lib to search
+ }
+ else
+ {
+ // Ok, if we have no Container specified then we need to search them in order, this document, template this document created from, global templates,
+ // get the name of Project/Library for 'this' document
+ rtl::OUString sThisProject;
+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
+ if ( pBasicMgr )
+ {
+ if ( pBasicMgr->GetName().Len() )
+ sThisProject = pBasicMgr->GetName();
+ else // cater for the case where VBA is not enabled
+ sThisProject = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+ }
+ sSearchList.push_back( sThisProject ); // First Lib to search
+ if ( xPrjNameCache.is() )
+ {
+ // is this document created from a template?
+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( pShell->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
+
+ rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
+ if ( sCreatedFrom.getLength() )
+ {
+ INetURLObject aObj;
+ aObj.SetURL( sCreatedFrom );
+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
+ rtl::OUString aURL;
+ if ( bIsURL )
+ aURL = sCreatedFrom;
+ else
+ {
+ osl::FileBase::getFileURLFromSystemPath( sCreatedFrom, aURL );
+ aObj.SetURL( aURL );
+ }
+ sCreatedFrom = aObj.GetLastName();
+ }
+
+ sal_Int32 nIndex = sCreatedFrom.lastIndexOf( '.' );
+ if ( nIndex != -1 )
+ sCreatedFrom = sCreatedFrom.copy( 0, nIndex );
+
+ rtl::OUString sPrj;
+ if ( sCreatedFrom.getLength() && xPrjNameCache->hasByName( sCreatedFrom ) )
+ {
+ xPrjNameCache->getByName( sCreatedFrom ) >>= sPrj;
+ // Make sure we don't double up with this project
+ if ( !sPrj.equals( sThisProject ) )
+ sSearchList.push_back( sPrj );
+ }
+
+ // get list of global template Names
+ uno::Sequence< rtl::OUString > sTemplateNames = xPrjNameCache->getElementNames();
+ sal_Int32 nLen = sTemplateNames.getLength();
+ for ( sal_Int32 index = 0; ( bSearchGlobalTemplates && index < nLen ); ++index )
+ {
+
+ if ( !sCreatedFrom.equals( sTemplateNames[ index ] ) )
+ {
+ if ( xPrjNameCache->hasByName( sTemplateNames[ index ] ) )
+ {
+ xPrjNameCache->getByName( sTemplateNames[ index ] ) >>= sPrj;
+ // Make sure we don't double up with this project
+ if ( !sPrj.equals( sThisProject ) )
+ sSearchList.push_back( sPrj );
+ }
+ }
+
+ }
+ }
+ }
+ std::vector< rtl::OUString >::iterator it_end = sSearchList.end();
+ for ( std::vector< rtl::OUString >::iterator it = sSearchList.begin(); it != it_end; ++it )
+ {
+ bool bRes = hasMacro( pShell, *it, sModule, sProcedure );
+ if ( bRes )
+ {
+ aRes.SetResolved( true );
+ aRes.SetMacroDocContext( pShell );
+ sContainer = *it;
+ break;
+ }
+ }
+ }
+ aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) );
+
+ return aRes;
+}
+
+// Treat the args as possible inouts ( convertion at bottom of method )
+sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& /*aRet*/, const uno::Any& aCaller )
+{
+ sal_Bool bRes = sal_False;
+ if ( !pShell )
+ return bRes;
+ rtl::OUString sUrl = makeMacroURL( sMacroName );
+
+ uno::Sequence< sal_Int16 > aOutArgsIndex;
+ uno::Sequence< uno::Any > aOutArgs;
+
+ try
+ {
+ uno::Reference< script::provider::XScriptProvider > xScriptProvider;
+ uno::Reference< script::provider::XScriptProviderSupplier > xSPS( pShell->GetModel(), uno::UNO_QUERY_THROW );
+
+ xScriptProvider.set( xSPS->getScriptProvider(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< script::provider::XScript > xScript( xScriptProvider->getScript( sUrl ), uno::UNO_QUERY_THROW );
+
+ if ( aCaller.hasValue() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
+ if ( xProps.is() )
+ {
+ uno::Sequence< uno::Any > aCallerHack(1);
+ aCallerHack[ 0 ] = aCaller;
+ xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
+ }
+ }
+
+
+ xScript->invoke( aArgs, aOutArgsIndex, aOutArgs );
+
+ sal_Int32 nLen = aOutArgs.getLength();
+ // convert any out params to seem like they were inouts
+ if ( nLen )
+ {
+ for ( sal_Int32 index=0; index < nLen; ++index )
+ {
+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
+ aArgs[ nOutIndex ] = aOutArgs[ index ];
+ }
+ }
+
+ bRes = sal_True;
+ }
+ catch ( uno::Exception& e )
+ {
+ bRes = sal_False;
+ }
+ return bRes;
+}
+} } // vba // ooo
diff --git a/filter/source/msfilter/msvbasic.cxx b/filter/source/msfilter/msvbasic.cxx
index 91348043b75f..be8ee6bd30e5 100644
--- a/filter/source/msfilter/msvbasic.cxx
+++ b/filter/source/msfilter/msvbasic.cxx
@@ -38,6 +38,10 @@
#include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
#include "msvbasic.hxx"
+#include <com/sun/star/script/ModuleType.hpp>
+
+using namespace ::com::sun::star::script;
+
/*
A few urls which may in the future be of some use
http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
@@ -429,7 +433,7 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage)
*
*/
-ModuleType VBA_Impl::GetModuleType( const UniString& rModuleName )
+ModType VBA_Impl::GetModuleType( const UniString& rModuleName )
{
ModuleTypeHash::iterator iter = mhModHash.find( rModuleName );
ModuleTypeHash::iterator iterEnd = mhModHash.end();
@@ -437,7 +441,7 @@ ModuleType VBA_Impl::GetModuleType( const UniString& rModuleName )
{
return iter->second;
}
- return Unknown;
+ return ModuleType::UNKNOWN;
}
bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
@@ -480,7 +484,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
static const String sClass( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
static const String sBaseClass( RTL_CONSTASCII_USTRINGPARAM( "BaseClass" ) );
static const String sDocument( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
- mhModHash[ sThisDoc ] = Class;
+ mhModHash[ sThisDoc ] = ModuleType::CLASS;
while ( pStp->ReadByteStringLine( tmp, meCharSet ) )
{
xub_StrLen index = tmp.Search( '=' );
@@ -490,14 +494,14 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
String value = tmp.Copy( index + 1 );
if ( key == sClass )
{
- mhModHash[ value ] = Class;
+ mhModHash[ value ] = ModuleType::CLASS;
OSL_TRACE("Module %s is of type Class",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
}
else if ( key == sBaseClass )
{
- mhModHash[ value ] = Form;
+ mhModHash[ value ] = ModuleType::FORM;
OSL_TRACE("Module %s is of type Form",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
@@ -510,14 +514,14 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
// value is of form <name>/&H<identifier>, strip the identifier
value.Erase( value.Search( '/' ) );
- mhModHash[ value ] = Document;
+ mhModHash[ value ] = ModuleType::DOCUMENT;
OSL_TRACE("Module %s is of type Document VBA",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
}
else if ( key == sModule )
{
- mhModHash[ value ] = Normal;
+ mhModHash[ value ] = ModuleType::NORMAL;
OSL_TRACE("Module %s is of type Normal VBA",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
diff --git a/filter/source/msfilter/msvbasic.hxx b/filter/source/msfilter/msvbasic.hxx
index 5b361518c0f5..171671e8cd5c 100644
--- a/filter/source/msfilter/msvbasic.hxx
+++ b/filter/source/msfilter/msvbasic.hxx
@@ -30,16 +30,12 @@
#ifndef _MSVBASIC_HXX
#define _MSVBASIC_HXX
-#ifdef _SOLAR_H
#include <tools/solar.h>
-#endif
#include <tools/debug.hxx>
#include <sot/storage.hxx>
#include <tools/dynary.hxx>
-#ifndef __SGI_STL_VECTOR
#include <vector>
-#endif
-#include<map>
+#include <map>
/* class VBA:
* The VBA class provides a set of methods to handle Visual Basic For
@@ -63,13 +59,12 @@ DECLARE_DYNARRAY(StringArray,String *)
// #117718# define internal types to distinguish between
// module types, form, class & normal
// #i37965# DR 2004-12-03: add "Document", used in Excel for macros attached to sheet
-enum ModuleType { Unknown = 0, Normal, Class, Form, Document };
// #117718# define map to hold types of module
//
-
+typedef sal_Int32 ModType;
typedef ::std::map< UniString,
- ModuleType > ModuleTypeHash;
+ ModType > ModuleTypeHash;
class VBA_Impl
{
@@ -90,8 +85,7 @@ public:
void Output(int len, const sal_uInt8 *data);
//
// #117718# member map of module names to types of module
- ModuleType GetModuleType( const UniString& rModuleName );
-
+ ModType GetModuleType( const UniString& rModuleName );
std::vector<String> maReferences;
private:
struct VBAOffset_Impl
diff --git a/filter/source/msfilter/svxmsbas.cxx b/filter/source/msfilter/svxmsbas.cxx
index e4305c2e4e65..55465850d8c8 100644
--- a/filter/source/msfilter/svxmsbas.cxx
+++ b/filter/source/msfilter/svxmsbas.cxx
@@ -50,6 +50,11 @@ using namespace com::sun::star::awt;
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
+
using namespace com::sun::star::container;
using namespace com::sun::star::script;
using namespace com::sun::star::uno;
@@ -58,12 +63,23 @@ using namespace com::sun::star;
using rtl::OUString;
+static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
+
+int SvxImportMSVBasic::Import( const String& rStorageName,
+ const String &rSubStorageName,
+ BOOL bAsComment, BOOL bStripped )
+{
+ std::vector< String > codeNames;
+ return Import( rStorageName, rSubStorageName, codeNames, bAsComment, bStripped );
+}
+
int SvxImportMSVBasic::Import( const String& rStorageName,
const String &rSubStorageName,
+ const std::vector< String >& codeNames,
BOOL bAsComment, BOOL bStripped )
{
int nRet = 0;
- if( bImport && ImportCode_Impl( rStorageName, rSubStorageName,
+ if( bImport && ImportCode_Impl( rStorageName, rSubStorageName, codeNames,
bAsComment, bStripped ))
nRet |= 1;
@@ -225,6 +241,7 @@ BOOL SvxImportMSVBasic::CopyStorage_Impl( const String& rStorageName,
BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
const String &rSubStorageName,
+ const std::vector< String >& codeNames,
BOOL bAsComment, BOOL bStripped )
{
BOOL bRet = FALSE;
@@ -233,13 +250,18 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
{
SFX_APP()->EnterBasicCall();
Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
+ Reference<XVBACompat> xVBACompat( xLibContainer, UNO_QUERY );
+
+ if ( xVBACompat.is() && !bAsComment )
+ xVBACompat->setVBACompatModeOn( sal_True );
+
DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
UINT16 nStreamCount = aVBA.GetNoStreams();
Reference<XNameContainer> xLib;
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
if( xLibContainer.is() && nStreamCount )
{
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
if( !xLibContainer->hasByName( aLibName ) )
xLibContainer->createLibrary( aLibName );
@@ -248,6 +270,28 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
}
if( xLib.is() )
{
+ Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
+ Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
+ if ( !bAsComment )
+ {
+ Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
+ if ( xSF.is() )
+ {
+ try
+ {
+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), UNO_QUERY );
+ }
+ catch( Exception& ) { }
+ }
+ }
+ typedef std::hash_map< rtl::OUString, uno::Any, ::rtl::OUStringHash,
+::std::equal_to< ::rtl::OUString > > NameModuleDataHash;
+ typedef std::hash_map< rtl::OUString, script::ModuleInfo, ::rtl::OUStringHash,
+::std::equal_to< ::rtl::OUString > > NameModuleInfoHash;
+
+ NameModuleDataHash moduleData;
+ NameModuleInfoHash moduleInfos;
+
for( UINT16 i=0; i<nStreamCount;i++)
{
StringArray aDecompressed = aVBA.Decompress(i);
@@ -281,7 +325,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
// is the same as the encoding for the names
// that are keys in the map used by GetModuleType method
const String &sOrigVBAModName = aVBA.GetStreamName( i );
- ModuleType mType = aVBA.GetModuleType( sOrigVBAModName );
+ ModType mType = aVBA.GetModuleType( sOrigVBAModName );
rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
@@ -289,23 +333,23 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
switch( mType )
{
- case Class:
+ case ModuleType::CLASS:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
break;
- case Form:
+ case ModuleType::FORM:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
break;
- case Document:
+ case ModuleType::DOCUMENT:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
break;
- case Normal:
+ case ModuleType::NORMAL:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
break;
- case Unknown:
+ case ModuleType::UNKNOWN:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
break;
@@ -313,12 +357,11 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
DBG_ERRORFILE( "SvxImportMSVBasic::ImportCode_Impl - unknown module type" );
break;
}
- static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
if ( !bAsComment )
{
modeTypeComment = modeTypeComment + sVBAOption;
- if ( mType == Class )
+ if ( mType == ModuleType::CLASS )
modeTypeComment = modeTypeComment + sClassOption;
}
@@ -380,20 +423,69 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
aSource += rtl::OUString::createFromAscii("\nEnd Sub");
}
::rtl::OUString aModName( sModule );
- if ( aSource.getLength() )
- {
- aSource = modeTypeComment + aSource;
+ aSource = modeTypeComment + aSource;
- Any aSourceAny;
+ Any aSourceAny;
+ OSL_TRACE("erm %d", mType );
aSourceAny <<= aSource;
- if( xLib->hasByName( aModName ) )
- xLib->replaceByName( aModName, aSourceAny );
- else
- xLib->insertByName( aModName, aSourceAny );
+ if ( !bAsComment )
+ {
+ OSL_TRACE("vba processing %d", mType );
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleType = mType;
+ moduleInfos[ aModName ] = sModuleInfo;
+ }
+ moduleData[ aModName ] = aSourceAny;
+ }
+ // Hack for missing codenames ( only know to happen in excel but... )
+ // only makes sense to do this if we are importing non-commented basic
+ if ( !bAsComment )
+ {
+ for ( std::vector< String >::const_iterator it = codeNames.begin(); it != codeNames.end(); ++it )
+ {
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleType = ModuleType::DOCUMENT;
+ moduleInfos[ *it ] = sModuleInfo;
+ moduleData[ *it ] = uno::makeAny( sVBAOption );
+ }
+ }
+ NameModuleDataHash::iterator it_end = moduleData.end();
+ for ( NameModuleDataHash::iterator it = moduleData.begin(); it != it_end; ++it )
+ {
+ NameModuleInfoHash::iterator it_info = moduleInfos.find( it->first );
+ if ( it_info != moduleInfos.end() )
+ {
+ ModuleInfo& sModuleInfo = it_info->second;
+ if ( sModuleInfo.ModuleType == ModuleType::FORM )
+ // hack, the module ( imo document basic should...
+ // know the XModel... ) but it doesn't
+ sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
+ // document modules, we should be able to access
+ // the api objects at this time
+ else if ( sModuleInfo.ModuleType == ModuleType::DOCUMENT )
+ {
+ if ( xVBACodeNamedObjectAccess.is() )
+ {
+ try
+ {
+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( it->first ), uno::UNO_QUERY );
+ OSL_TRACE("** Straight up creation of Module");
+ }
+ catch(uno::Exception& e)
+ {
+ OSL_TRACE("Failed to get documument object for %s", rtl::OUStringToOString( it->first, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+ }
+ xVBAModuleInfo->insertModuleInfo( it->first, sModuleInfo );
}
- bRet = true;
+ if( xLib->hasByName( it->first ) )
+ xLib->replaceByName( it->first, it->second );
+ else
+ xLib->insertByName( it->first, it->second );
}
+ bRet = true;
}
SFX_APP()->LeaveBasicCall();
}
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 68c449dd7353..bb125bd37a47 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -86,6 +86,8 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
mbExportNotesPages( sal_False ),
mbUseTransitionEffects( sal_False ),
mbIsSkipEmptyPages( sal_True ),
+ mbAddStream( sal_False ),
+ mbEmbedStandardFonts( sal_False ),
mnFormsType( 0 ),
mbExportFormFields( sal_True ),
mbAllowDuplicateFieldNames( sal_False ),
@@ -195,6 +197,7 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
mbUseTransitionEffects = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), sal_True );
mbIsSkipEmptyPages = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), sal_False );
mbAddStream = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ), sal_False );
+ mbEmbedStandardFonts = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ), sal_False );
mnFormsType = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 );
mbExportFormFields = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), sal_True );
@@ -332,6 +335,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), mbUseTransitionEffects );
maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), mbIsSkipEmptyPages );
maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ), mbAddStream );
+ maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ), mbEmbedStandardFonts );
/*
* FIXME: the entries are only implicitly defined by the resource file. Should there
@@ -435,6 +439,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
maCbExportFormFields( this, PDFFilterResId( CB_EXPORTFORMFIELDS ) ),
mbExportFormFieldsUserSelection( sal_False ),
+ mbEmbedStandardFontsUserSelection( sal_False ),
maFtFormsFormat( this, PDFFilterResId( FT_FORMSFORMAT ) ),
maLbFormsFormat( this, PDFFilterResId( LB_FORMSFORMAT ) ),
maCbAllowDuplicateFieldNames( this, PDFFilterResId( CB_ALLOWDUPLICATEFIELDNAMES ) ),
@@ -444,6 +449,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
maCbExportNotesPages( this, PDFFilterResId( CB_EXPORTNOTESPAGES ) ),
maCbExportEmptyPages( this, PDFFilterResId( CB_EXPORTEMPTYPAGES ) ),
maCbAddStream( this, PDFFilterResId( CB_ADDSTREAM ) ),
+ maCbEmbedStandardFonts( this, PDFFilterResId( CB_EMBEDSTANDARDFONTS ) ),
mbIsPresentation( sal_False ),
mbIsWriter( sal_False),
mpaParent( 0 )
@@ -461,7 +467,11 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
Point aNewPos = maCbAddStream.GetPosPixel();
aNewPos.Y() -= nDelta;
maCbAddStream.SetPosPixel( aNewPos );
+ aNewPos = maCbEmbedStandardFonts.GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ maCbEmbedStandardFonts.SetPosPixel( aNewPos );
}
+ maCbExportEmptyPages.SetStyle( maCbExportEmptyPages.GetStyle() | WB_VCENTER );
}
// -----------------------------------------------------------------------------
@@ -524,11 +534,13 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent
// get the form values, for use with PDF/A-1 selection interface
mbTaggedPDFUserSelection = paParent->mbUseTaggedPDF;
mbExportFormFieldsUserSelection = paParent->mbExportFormFields;
+ mbEmbedStandardFontsUserSelection = paParent->mbEmbedStandardFonts;
if( !maCbPDFA1b.IsChecked() )
{// the value for PDF/A set by the ToggleExportPDFAHdl method called before
maCbTaggedPDF.Check( mbTaggedPDFUserSelection );
maCbExportFormFields.Check( mbExportFormFieldsUserSelection );
+ maCbEmbedStandardFonts.Check( mbEmbedStandardFontsUserSelection );
}
maLbFormsFormat.SelectEntryPos( (sal_uInt16)paParent->mnFormsType );
@@ -554,6 +566,8 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent
maCbExportEmptyPages.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
aPos = maCbAddStream.GetPosPixel();
maCbAddStream.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
+ aPos = maCbEmbedStandardFonts.GetPosPixel();
+ maCbEmbedStandardFonts.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
maCbExportNotesPages.Show( FALSE );
maCbExportNotesPages.Check( FALSE );
}
@@ -614,11 +628,13 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
paParent->mnPDFTypeSelection = 1;
paParent->mbUseTaggedPDF = mbTaggedPDFUserSelection;
paParent->mbExportFormFields = mbExportFormFieldsUserSelection;
+ paParent->mbEmbedStandardFonts = mbEmbedStandardFontsUserSelection;
}
else
{
paParent->mbUseTaggedPDF = maCbTaggedPDF.IsChecked();
paParent->mbExportFormFields = maCbExportFormFields.IsChecked();
+ paParent->mbEmbedStandardFonts = maCbEmbedStandardFonts.IsChecked();
}
/*
@@ -711,6 +727,9 @@ IMPL_LINK( ImpPDFTabGeneralPage, ToggleExportPDFAHdl, void*, EMPTYARG )
mbExportFormFieldsUserSelection = maCbExportFormFields.IsChecked();
maCbExportFormFields.Check( sal_False );
maCbExportFormFields.Enable( sal_False );
+ mbEmbedStandardFontsUserSelection = maCbEmbedStandardFonts.IsChecked();
+ maCbEmbedStandardFonts.Check( sal_True );
+ maCbEmbedStandardFonts.Enable( sal_False );
}
else
{
@@ -719,6 +738,8 @@ IMPL_LINK( ImpPDFTabGeneralPage, ToggleExportPDFAHdl, void*, EMPTYARG )
maCbTaggedPDF.Check( mbTaggedPDFUserSelection );
maCbExportFormFields.Check( mbExportFormFieldsUserSelection );
maCbExportFormFields.Enable();
+ maCbEmbedStandardFonts.Check( mbEmbedStandardFontsUserSelection );
+ maCbEmbedStandardFonts.Enable();
}
// PDF/A-1 doesn't allow launch action, so enable/disable the selection on
// Link page
diff --git a/filter/source/pdf/impdialog.hrc b/filter/source/pdf/impdialog.hrc
index 6a010120e3bd..cc438255650f 100644
--- a/filter/source/pdf/impdialog.hrc
+++ b/filter/source/pdf/impdialog.hrc
@@ -83,9 +83,9 @@
#define CB_ALLOWDUPLICATEFIELDNAMES 23
#define CB_EXPORTEMPTYPAGES 24
#define CB_ADDSTREAM 25
-
#define CB_PDFA_1B_SELECT 26
#define CB_EXPORTNOTESPAGES 27
+#define CB_EMBEDSTANDARDFONTS 28
#define FL_OLD_PAGES 51
#define RB_OLD_ALL 52
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 050aeee4caf5..38da273c2fbd 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -103,6 +103,7 @@ protected:
sal_Bool mbUseTransitionEffects;
sal_Bool mbIsSkipEmptyPages;
sal_Bool mbAddStream;
+ sal_Bool mbEmbedStandardFonts;
sal_Int32 mnFormsType;
sal_Bool mbExportFormFields;
sal_Bool mbAllowDuplicateFieldNames;
@@ -193,6 +194,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
CheckBox maCbExportFormFields;
sal_Bool mbExportFormFieldsUserSelection;
+ sal_Bool mbEmbedStandardFontsUserSelection;
FixedText maFtFormsFormat;
ListBox maLbFormsFormat;
CheckBox maCbAllowDuplicateFieldNames;
@@ -203,6 +205,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
CheckBox maCbExportEmptyPages;
CheckBox maCbAddStream;
+ CheckBox maCbEmbedStandardFonts;
sal_Bool mbIsPresentation;
sal_Bool mbIsWriter;
diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src
index 34f788495674..76e64e87c173 100644
--- a/filter/source/pdf/impdialog.src
+++ b/filter/source/pdf/impdialog.src
@@ -27,7 +27,7 @@
#include "impdialog.hrc"
-#define TAB_PDF_SIZE Size = MAP_APPFONT ( 176, 255 )
+#define TAB_PDF_SIZE Size = MAP_APPFONT ( 176, 268 )
//string for TabDialog standard buttons
String STR_PDF_EXPORT
{
@@ -229,11 +229,18 @@ TabPage RID_PDF_TAB_GENER
WordBreak = TRUE ;
Text[ en-US ] = "Exp~ort automatically inserted blank pages";
};
- CheckBox CB_ADDSTREAM
+ CheckBox CB_EMBEDSTANDARDFONTS
{
Pos = MAP_APPFONT ( 12 , 248 ) ;
Size = MAP_APPFONT ( 158 , 10 ) ;
TabStop = TRUE ;
+ Text[ en-US ] = "E~mbed standard fonts";
+ };
+ CheckBox CB_ADDSTREAM
+ {
+ Pos = MAP_APPFONT ( 12 , 261 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ TabStop = TRUE ;
Text[ en-US ] = "Create ~hybrid file";
};
};
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 793503abf9ba..c868a3ec3157 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -430,8 +430,8 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue
rFilterData[ nData ].Value >>= mbExportNotes;
else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ) )
rFilterData[ nData ].Value >>= mbExportNotesPages;
-// else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ) )
-// rFilterData[ nData ].Value >>= mbEmbedStandardFonts;
+ else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ) )
+ rFilterData[ nData ].Value >>= mbEmbedStandardFonts;
else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ) )
rFilterData[ nData ].Value >>= mbUseTransitionEffects;
else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ) )
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 6cfeb35eb50e..6229544cf02f 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -2,23 +2,23 @@
<!--
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>
@@ -34,177 +34,177 @@
<!--+++++ INCLUDED XSL MODULES +++++-->
<!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
- <xsl:import href="../../common/measure_conversion.xsl"/>
+ <xsl:import href="../../common/measure_conversion.xsl"/>
<!-- common office body element handling -->
- <xsl:import href="../common/body.xsl"/>
+ <xsl:import href="../common/body.xsl"/>
<!-- common table handling -->
- <xsl:import href="../common/table/table.xsl"/>
+ <xsl:import href="../common/table/table.xsl"/>
<!-- xhtml table handling -->
- <xsl:include href="table.xsl"/>
+ <xsl:include href="table.xsl"/>
<!-- Useful in case of 'style:map', conditional formatting, where a style references to another -->
- <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name"/>
+ <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name"/>
<!-- ************ -->
<!-- *** body *** -->
<!-- ************ -->
- <xsl:key match="style:style/@style:master-page-name" name="masterPage" use="'count'"/>
- <xsl:key match="style:master-page" name="masterPageElements" use="@style:name"/>
- <xsl:key match="style:page-layout" name="pageLayoutElements" use="@style:name"/>
- <xsl:key name="writingModeStyles" match="/*/office:styles/style:style/style:paragraph-properties/@style:writing-mode | /*/office:automatic-styles/style:style/style:paragraph-properties/@style:writing-mode" use="'test'"/>
- <xsl:template name="create-body">
- <xsl:param name="globalData"/>
+ <xsl:key match="style:style/@style:master-page-name" name="masterPage" use="'count'"/>
+ <xsl:key match="style:master-page" name="masterPageElements" use="@style:name"/>
+ <xsl:key match="style:page-layout" name="pageLayoutElements" use="@style:name"/>
+ <xsl:key name="writingModeStyles" match="/*/office:styles/style:style/style:paragraph-properties/@style:writing-mode | /*/office:automatic-styles/style:style/style:paragraph-properties/@style:writing-mode" use="'test'"/>
+ <xsl:template name="create-body">
+ <xsl:param name="globalData"/>
<!-- approximation to find the correct master page style (with page dimensions) -->
- <xsl:variable name="masterPageNames">
+ <xsl:variable name="masterPageNames">
<!-- Loop over every style:style containing a @style:master-page-name attribute -->
- <xsl:for-each select="key('masterPage','count')">
- <!-- Check if this style is being used in the body -->
- <xsl:if test="key('elementUsingStyle', ../@style:name)">
- <!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
- <xsl:if test="string-length(../@style:master-page-name) &gt; 0">
- <xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
- </xsl:if>
- </xsl:for-each>
- </xsl:variable>
-
+ <xsl:for-each select="key('masterPage','count')">
+ <!-- Check if this style is being used in the body -->
+ <xsl:if test="key('elementUsingStyle', ../@style:name)">
+ <!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
+ <xsl:if test="string-length(../@style:master-page-name) &gt; 0">
+ <xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
<!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
- <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
- <xsl:variable name="pageProperties">
- <xsl:choose>
- <xsl:when test="not($pageLayoutName) or $pageLayoutName = ''">
- <xsl:copy-of select="$globalData/styles-file/*/office:automatic-styles/style:page-layout[1]/style:page-layout-properties"/>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
+ <xsl:variable name="pageProperties">
+ <xsl:choose>
+ <xsl:when test="not($pageLayoutName) or $pageLayoutName = ''">
+ <xsl:copy-of select="$globalData/styles-file/*/office:automatic-styles/style:page-layout[1]/style:page-layout-properties"/>
+ </xsl:when>
+ <xsl:otherwise>
<!-- Find the according style:page-layout and store the properties in a variable -->
- <xsl:copy-of select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="body">
+ <xsl:copy-of select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="body">
<!-- direction of text flow -->
- <xsl:variable name="writingMode" select="$pageProperties/style:page-layout-properties/@style:writing-mode"/>
- <xsl:choose>
- <xsl:when test="$writingMode">
- <xsl:choose>
- <xsl:when test="contains($writingMode, 'lr')">
- <xsl:attribute name="dir">ltr</xsl:attribute>
- </xsl:when>
- <xsl:when test="contains($writingMode, 'rl')">
- <xsl:attribute name="dir">rtl</xsl:attribute>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <!-- As CSS writing-mode is not implemented by all browsers, a heuristic is done -->
- <xsl:variable name="writingMode" select="key('writingModeStyles', 'test')"/>
- <xsl:if test="contains($writingMode, 'rl')">
- <xsl:attribute name="dir">rtl</xsl:attribute>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:variable name="writingMode" select="$pageProperties/style:page-layout-properties/@style:writing-mode"/>
+ <xsl:choose>
+ <xsl:when test="$writingMode">
+ <xsl:choose>
+ <xsl:when test="contains($writingMode, 'lr')">
+ <xsl:attribute name="dir">ltr</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($writingMode, 'rl')">
+ <xsl:attribute name="dir">rtl</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- As CSS writing-mode is not implemented by all browsers, a heuristic is done -->
+ <xsl:variable name="writingMode" select="key('writingModeStyles', 'test')"/>
+ <xsl:if test="contains($writingMode, 'rl')">
+ <xsl:attribute name="dir">rtl</xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
<!-- adapt page size -->
- <xsl:variable name="pageWidth" select="$pageProperties/style:page-layout-properties/@fo:page-width"/>
+ <xsl:variable name="pageWidth" select="$pageProperties/style:page-layout-properties/@fo:page-width"/>
<!-- multiple backgroundimages for different page styles (never used in html) -->
- <xsl:variable name="backgroundImage" select="$pageProperties/style:page-layout-properties/style:background-image"/>
+ <xsl:variable name="backgroundImage" select="$pageProperties/style:page-layout-properties/style:background-image"/>
<!-- page margins & background image -->
- <xsl:if test="$pageWidth or $pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
- <xsl:attribute name="style">
- <xsl:if test="$pageWidth">
- <xsl:text>max-width:</xsl:text>
- <xsl:value-of select="$pageWidth"/>
- <xsl:text>;</xsl:text>
- </xsl:if>
- <xsl:if test="$pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
- <xsl:apply-templates select="$pageProperties/style:page-layout-properties/@fo:*"/>
- <xsl:if test="$backgroundImage/@xlink:href">
- <xsl:text>background-image:url(</xsl:text>
- <xsl:call-template name="create-href">
- <xsl:with-param name="href" select="$backgroundImage/@xlink:href"/>
- </xsl:call-template>
- <xsl:text>);</xsl:text>
-
- <xsl:if test="$backgroundImage/@style:repeat">
- <xsl:choose>
- <xsl:when test="$backgroundImage/@style:repeat = 'no-repeat'">
- <xsl:text>background-repeat:no-repeat;</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>background-repeat:repeat;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <xsl:if test="$backgroundImage/@style:position">
- <xsl:text>background-position:</xsl:text>
- <xsl:value-of select="$backgroundImage/@style:position"/>
- <xsl:text>;</xsl:text>
- </xsl:if>
- </xsl:if>
- </xsl:if>
- </xsl:attribute>
- </xsl:if>
- <!-- processing the content of the OpenDocument content file -->
- <xsl:apply-templates select="/*/office:body/*">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
-
- </xsl:element>
- </xsl:template>
-
- <!-- processing the content of the OpenDocument content file -->
- <xsl:template match="office:body/*">
- <xsl:param name="globalData"/>
+ <xsl:if test="$pageWidth or $pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
+ <xsl:attribute name="style">
+ <xsl:if test="$pageWidth">
+ <xsl:text>max-width:</xsl:text>
+ <xsl:value-of select="$pageWidth"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ <xsl:if test="$pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
+ <xsl:apply-templates select="$pageProperties/style:page-layout-properties/@fo:*"/>
+ <xsl:if test="$backgroundImage/@xlink:href">
+ <xsl:text>background-image:url(</xsl:text>
+ <xsl:call-template name="create-href">
+ <xsl:with-param name="href" select="$backgroundImage/@xlink:href"/>
+ </xsl:call-template>
+ <xsl:text>);</xsl:text>
+
+ <xsl:if test="$backgroundImage/@style:repeat">
+ <xsl:choose>
+ <xsl:when test="$backgroundImage/@style:repeat = 'no-repeat'">
+ <xsl:text>background-repeat:no-repeat;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>background-repeat:repeat;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$backgroundImage/@style:position">
+ <xsl:text>background-position:</xsl:text>
+ <xsl:value-of select="$backgroundImage/@style:position"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- processing the content of the OpenDocument content file -->
+ <xsl:apply-templates select="/*/office:body/*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ </xsl:element>
+ </xsl:template>
+
+ <!-- processing the content of the OpenDocument content file -->
+ <xsl:template match="office:body/*">
+ <xsl:param name="globalData"/>
<!-- not using of 'apply-styles-and-content' as the content table information migth have been added to 'globalData' variable -->
- <xsl:apply-templates select="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name -->
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
-
- <xsl:apply-templates>
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
+ <xsl:apply-templates select="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name -->
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
<!-- writing the footer- and endnotes beyond the body -->
- <xsl:call-template name="write-text-nodes">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:template>
+ <xsl:call-template name="write-text-nodes">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:template>
<!-- ******************************* -->
<!-- *** User Field Declarations *** -->
<!-- ******************************* -->
- <xsl:template match="text:user-field-get | text:user-field-input">
- <xsl:param name="globalData"/>
+ <xsl:template match="text:user-field-get | text:user-field-input">
+ <xsl:param name="globalData"/>
- <xsl:value-of select="."/>
- </xsl:template>
+ <xsl:value-of select="."/>
+ </xsl:template>
- <xsl:template match="text:conditional-text">
- <xsl:param name="globalData"/>
+ <xsl:template match="text:conditional-text">
+ <xsl:param name="globalData"/>
- <xsl:value-of select="."/>
- </xsl:template>
+ <xsl:value-of select="."/>
+ </xsl:template>
<!-- ODF text fields -->
- <xsl:template match="text:author-initials | text:author-name | text:chapter | text:character-count | text:creation-date | text:creation-time | text:creator | text:date | text:description | text:editing-cycles | text:editing-duration | text:file-name | text:image-count | text:initial-creator | text:keywords | text:modification-date | text:modification-time | text:object-count | text:page-continuation | text:page-count | text:page-number | text:paragraph-count | text:print-date | text:print-time | text:printed-by | text:sender-city | text:sender-company | text:sender-country | text:sender-email | text:sender-fax | text:sender-firstname | text:sender-initials | text:sender-lastname | text:sender-phone-private | text:sender-phone-work | text:sender-position | text:sender-postal-code | text:sender-state-or-province | text:sender-street | text:sender-title | text:sheet-name | text:subject | text:table-count | text:time | text:title | text:user-defined | text:word-count">
- <xsl:param name="globalData"/>
-
- <xsl:element name="span">
- <xsl:attribute name="title">
- <xsl:value-of select="local-name()"/>
- </xsl:attribute>
- <xsl:apply-templates>
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:element>
- </xsl:template>
+ <xsl:template match="text:author-initials | text:author-name | text:chapter | text:character-count | text:creation-date | text:creation-time | text:creator | text:date | text:description | text:editing-cycles | text:editing-duration | text:file-name | text:image-count | text:initial-creator | text:keywords | text:modification-date | text:modification-time | text:object-count | text:page-continuation | text:page-count | text:page-number | text:paragraph-count | text:print-date | text:print-time | text:printed-by | text:sender-city | text:sender-company | text:sender-country | text:sender-email | text:sender-fax | text:sender-firstname | text:sender-initials | text:sender-lastname | text:sender-phone-private | text:sender-phone-work | text:sender-position | text:sender-postal-code | text:sender-state-or-province | text:sender-street | text:sender-title | text:sheet-name | text:subject | text:table-count | text:time | text:title | text:user-defined | text:word-count">
+ <xsl:param name="globalData"/>
+
+ <xsl:element name="span">
+ <xsl:attribute name="title">
+ <xsl:value-of select="local-name()"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
@@ -212,83 +212,83 @@
<!-- *** Textbox *** -->
<!-- *************** -->
- <xsl:template match="draw:text-box">
- <xsl:param name="globalData"/>
-
- <xsl:comment>Next 'div' was a 'draw:text-box'.</xsl:comment>
- <xsl:element name="div">
- <xsl:variable name="dimension">
- <xsl:apply-templates select="@fo:min-width"/>
- <xsl:apply-templates select="@fo:max-width"/>
- <xsl:apply-templates select="@fo:min-height"/>
- <xsl:apply-templates select="@fo:max-height"/>
- </xsl:variable>
- <xsl:if test="$dimension">
- <xsl:attribute name="style">
- <xsl:value-of select="$dimension"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="@draw:name">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
-
- <xsl:apply-templates select="node()">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="@fo:min-width">
- <xsl:text>min-width:</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>;</xsl:text>
- </xsl:template>
- <xsl:template match="@fo:max-width">
- <xsl:text>max-width:</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>;</xsl:text>
- </xsl:template>
- <xsl:template match="@fo:min-height">
- <xsl:text>min-height:</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>;</xsl:text>
- </xsl:template>
- <xsl:template match="@fo:max-height">
- <xsl:text>max-height:</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>;</xsl:text>
- </xsl:template>
+ <xsl:template match="draw:text-box">
+ <xsl:param name="globalData"/>
+
+ <xsl:comment>Next 'div' was a 'draw:text-box'.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:variable name="dimension">
+ <xsl:apply-templates select="@fo:min-width"/>
+ <xsl:apply-templates select="@fo:max-width"/>
+ <xsl:apply-templates select="@fo:min-height"/>
+ <xsl:apply-templates select="@fo:max-height"/>
+ </xsl:variable>
+ <xsl:if test="$dimension">
+ <xsl:attribute name="style">
+ <xsl:value-of select="$dimension"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="@draw:name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:apply-templates select="node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="@fo:min-width">
+ <xsl:text>min-width:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+ <xsl:template match="@fo:max-width">
+ <xsl:text>max-width:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+ <xsl:template match="@fo:min-height">
+ <xsl:text>min-height:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+ <xsl:template match="@fo:max-height">
+ <xsl:text>max-height:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
<!-- inline style helper for the 'div' boxes -->
- <xsl:template name="svg:height">
- <xsl:text>height:</xsl:text>
- <xsl:choose>
+ <xsl:template name="svg:height">
+ <xsl:text>height:</xsl:text>
+ <xsl:choose>
<!-- changing the distance measure: inch to in -->
- <xsl:when test="contains(@svg:height, 'inch')">
- <xsl:value-of select="substring-before(@svg:height, 'ch')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@svg:height"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>;</xsl:text>
- </xsl:template>
+ <xsl:when test="contains(@svg:height, 'inch')">
+ <xsl:value-of select="substring-before(@svg:height, 'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@svg:height"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
<!-- inline style helper for the 'div' boxes -->
- <xsl:template name="svg:width">
- <xsl:text>width:</xsl:text>
- <xsl:choose>
+ <xsl:template name="svg:width">
+ <xsl:text>width:</xsl:text>
+ <xsl:choose>
<!-- changing the distance measure: inch to in -->
- <xsl:when test="contains(@svg:width, 'inch')">
- <xsl:value-of select="substring-before(@svg:width, 'ch')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@svg:width"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>;</xsl:text>
- </xsl:template>
+ <xsl:when test="contains(@svg:width, 'inch')">
+ <xsl:value-of select="substring-before(@svg:width, 'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@svg:width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
@@ -296,146 +296,165 @@
<!-- *** Paragraphs *** -->
<!-- ****************** -->
- <xsl:template match="text:p | draw:page">
- <xsl:param name="globalData"/>
+ <xsl:template match="text:p | draw:page">
+ <xsl:param name="globalData"/>
<!-- The footnote symbol is the prefix for a footnote in the footer -->
- <xsl:param name="footnotePrefix"/>
- <!-- 1) In ODF sometimes the followig children are nested
- <text:p>
- <draw:frame>
- <draw:text-box>
- <text:p>
- Which results in a paragraphs (the last text:p) having a paragraph as its anchestor.
- In HTML a 'p' can only have inline documents (no other 'p' as children'),
+ <xsl:param name="footnotePrefix"/>
+ <!-- 1) In ODF sometimes the followig children are nested
+ <text:p>
+ <draw:frame>
+ <draw:text-box>
+ <text:p>
+ Which results in a paragraphs (the last text:p) having a paragraph as its anchestor.
+ In HTML a 'p' can only have inline documents (no other 'p' as children'),
a 'div' will be given for the ancestors instead.
2) ODF images are embedded in a paragraph, but CSS is not able to express a horizontal alignment for an HTML image (text:align is only valid for block elements).
A surrounding 'div' element taking over the image style solves that problem, but the div is invalid as child of a paragraph
- Therefore the paragraph has to be exchanged with a HTML div element
+ Therefore the paragraph has to be exchanged with a HTML div element
-->
- <!-- 2DO page alignment fix - PART1 -->
- <xsl:choose>
- <xsl:when test="draw:frame and ((normalize-space(text()) != '') or (count(*) &gt; 1 and (not(text:soft-page-break) and count(*) = 2)))">
- <!-- Create a div, if there is a 'draw:frame' child with either text (not being whitespace alone) and more than the draw:frame alone and
- not the draw:frame and a soft-page-break alone (which is quite often) -->
-
+ <!-- 2DO page alignment fix - PART1 -->
+ <xsl:variable name="childText"><xsl:apply-templates mode="getAllTextChildren"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="name() = 'text:p' and not(*) and (normalize-space($childText) = '')">
+ <!-- WorkAround: Test if the empty paragraph was added after an image, which OOO often does -->
+ <xsl:variable name="isFollowingImage">
+ <xsl:call-template name="follows-empty-paragraphs-and-image">
+ <xsl:with-param name="precedingElement" select="preceding-sibling::node()[1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$isFollowingImage = 'no'">
+ <xsl:call-template name="create-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:if>
+
+ </xsl:when>
+ <xsl:when test="draw:frame and ((normalize-space($childText) != '') or (((count(*) - count(text:soft-page-break)) &gt; 1)))">
+ <!-- If there is a 'draw:frame' child with text (not being whitespace alone) and more than the draw:frame alone and
+ not the draw:frame and a soft-page-break alone (which is quite often) -->
+
<!-- If there is a frame within the text:p or draw:page, its siblings are surrounded as well by a div and are floating (CSS float) -->
- <!-- But it makes no sense to create floating if the frame is alone or only together with a soft-page-break not usable for HTML -->
- <!-- The paragraph is written as DIV as there might be nested paragraphs (see above choose block) -->
- <xsl:choose>
- <xsl:when test="name() = 'text:p'">
- <xsl:comment>Next 'div' was a 'text:p'.</xsl:comment>
- </xsl:when>
- <xsl:otherwise>
- <xsl:comment>Next 'div' was a 'draw:page'.</xsl:comment>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:element name="div">
- <xsl:apply-templates select="@*">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
+ <!-- But it makes no sense to create floating if the frame is alone or only together with a soft-page-break not usable for HTML -->
+ <!-- The paragraph is written as DIV as there might be nested paragraphs (see above choose block) -->
+ <xsl:choose>
+ <xsl:when test="name() = 'text:p'">
+ <xsl:comment>Next 'div' was a 'text:p'.</xsl:comment>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>Next 'div' was a 'draw:page'.</xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="div">
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
<!-- the footnote symbol is the prefix for a footnote in the footer -->
- <xsl:copy-of select="$footnotePrefix"/>
-
+ <xsl:copy-of select="$footnotePrefix"/>
<!-- start floating of frame (and siblings) -->
- <xsl:apply-templates select="node()[1]" mode="frameFloating">
- <xsl:with-param name="globalData" select="$globalData" />
- <xsl:with-param name="previousFrameWidths" select="0"/>
- <xsl:with-param name="previousFrameHeights" select="0"/>
- <!-- 2DO for me (Svante) - Not used, uncertain 4now..
- <xsl:with-param name="pageMarginLeft">
- <xsl:call-template name="getPageMarginLeft"/>
- </xsl:with-param>-->
- </xsl:apply-templates>
- </xsl:element>
- <!-- after the last draw:frame sibling the CSS float is disabled
- &#160; is an unbreakable whitespace to give conent to the element and force a browser not to ignore the element -->
- <div style="clear:both; line-height:0; width:0; height:0; margin:0; padding:0;">&#160;</div>
- </xsl:when>
- <xsl:when test="text:tab">
+ <xsl:apply-templates select="node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="previousFrameWidths" select="0"/>
+ <xsl:with-param name="previousFrameHeights" select="0"/>
+ <!-- 2DO for me (Svante) - Not used, uncertain 4now..
+ <xsl:with-param name="pageMarginLeft">
+ <xsl:call-template name="getPageMarginLeft"/>
+ </xsl:with-param>-->
+ </xsl:apply-templates>
+ </xsl:element>
+ <!-- after the last draw:frame sibling the CSS float is disabled
+ &#160; is an unbreakable whitespace to give conent to the element and force a browser not to ignore the element -->
+ <div style="clear:both; line-height:0; width:0; height:0; margin:0; padding:0;">&#160;</div>
+ </xsl:when>
+ <xsl:when test="text:tab">
<!-- If there is a tabulator (ie. text:tab) within a paragraph, a heuristic for ODF tabulators creates a
span for every text:tab embracing the following text nodes aligning them according to the tabulator.
A line break or another text:tab starts a new text:span, line break even the tab counter for the line.
-->
- <xsl:element name="p">
- <xsl:apply-templates select="@*">
- <xsl:with-param name="globalData" select="$globalData" />
- </xsl:apply-templates>
+ <xsl:element name="p">
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
<!-- start with first child of the paragraph -->
- <xsl:variable name="firstChildNode" select="node()[1]" />
- <xsl:apply-templates select="$firstChildNode" mode="tabHandling">
- <xsl:with-param name="globalData" select="$globalData" />
- <xsl:with-param name="tabStops" select="$globalData/all-doc-styles/style[@style:name = current()/@text:style-name]/*/style:tab-stops"/>
- <xsl:with-param name="parentMarginLeft">
+ <xsl:variable name="firstChildNode" select="node()[1]" />
+ <xsl:apply-templates select="$firstChildNode" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="tabStops" select="$globalData/all-doc-styles/style[@style:name = current()/@text:style-name]/*/style:tab-stops"/>
+ <xsl:with-param name="parentMarginLeft">
<!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
- <xsl:variable name="paragraphName" select="@text:style-name" />
- <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paragraphName]/final-properties"/>
+ <xsl:variable name="paragraphName" select="@text:style-name" />
+ <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paragraphName]/final-properties"/>
<!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
<!-- 2DO: left-margin in order with bidirectional -->
- <xsl:choose>
- <xsl:when test="contains($imageParagraphStyle, 'margin-left:')">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($imageParagraphStyle, 'margin-left:'), ';'))"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="pageMarginLeft">
- <xsl:call-template name="getPageMarginLeft"/>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains($imageParagraphStyle, 'margin-left:')">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($imageParagraphStyle, 'margin-left:'), ';'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pageMarginLeft">
+ <xsl:call-template name="getPageMarginLeft"/>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
<!-- !!Check if paragraph is empty!!
OOo writes out empty paragraphs layouted behind an image (= draw:image within draw:frame)
those have to be neglected in HTML -->
- <xsl:when test="name() = 'text:p' and not(text()) and not(*)">
- <xsl:variable name="isFollowingImage">
- <xsl:call-template name="follows-empty-paragraphs-and-image">
- <xsl:with-param name="precedingElement" select="preceding-sibling::node()[1]"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="$isFollowingImage = 'yes'">
- <xsl:call-template name="create-paragraph">
- <xsl:with-param name="globalData" select="$globalData" />
- <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
- </xsl:call-template>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="create-paragraph">
- <xsl:with-param name="globalData" select="$globalData" />
- <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+ <xsl:when test="name() = 'text:p' and not($childText) and not(*)">
+ <xsl:variable name="isFollowingImage">
+ <xsl:call-template name="follows-empty-paragraphs-and-image">
+ <xsl:with-param name="precedingElement" select="preceding-sibling::node()[1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$isFollowingImage = 'no'">
+ <xsl:call-template name="create-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- Return the text -->
+ <xsl:template match="text()" mode="getAllTextChildren">
+ <xsl:value-of select="."/>
+ </xsl:template>
<!-- A span will be created for every text:tab embracing the following text nodes.
A line break or another text:tab starts a new text:span -->
- <xsl:template match="* | text()" mode="tabHandling">
- <xsl:param name="globalData"/>
- <xsl:param name="tabStops"/>
+ <xsl:template match="* | text()" mode="tabHandling">
+ <xsl:param name="globalData"/>
+ <xsl:param name="tabStops"/>
<!-- there can be multiple tabs in one line, tabNo guesses the one to apply. By default the first i.e. "1" -->
- <xsl:param name="tabCount" select="0"/>
- <xsl:param name="parentMarginLeft" />
- <xsl:param name="pageMarginLeft" />
-
+ <xsl:param name="tabCount" select="0"/>
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="pageMarginLeft" />
+
<!-- 2DO: EXCHANGE FOLLOING SIBLING BY VARIABLE -->
- <xsl:variable name="followingSiblingNode" select="following-sibling::node()[1]"/>
+ <xsl:variable name="followingSiblingNode" select="following-sibling::node()[1]"/>
+
+
+ <!--
+ Every tabulator indents its following content, encapuslated in a span
+ element.
-
- <!--
- Every tabulator indents its following content, encapuslated in a span
- element.
-
This template have two modes:
-
+
1) Before the first tabulator it will match as usually paragraph content
to HTML.
2) After the first paragraph it will always triggers two recursions.
@@ -444,604 +463,621 @@
The other calls this template and will now ignore anything else than
TAB and LINE-BREAK.
-
+
The tabulators and linebreaks are being iterated, one by one to keep track of the tab number
-->
- <xsl:choose>
- <xsl:when test="name() = 'text:tab'">
+ <xsl:choose>
+ <xsl:when test="name() = 'text:tab'">
<!-- every frame sibling have to be incapuslated within a div with left indent -->
- <xsl:element name="span">
- <xsl:choose>
- <xsl:when test="count($tabStops/style:tab-stop) &lt; 3">
+ <xsl:element name="span">
+ <xsl:choose>
+ <xsl:when test="count($tabStops/style:tab-stop) &lt; 3">
<!-- only allow the heuristic when the style has less than 3 TABS -->
- <xsl:attribute name="style">
- <xsl:call-template name="createTabIndent">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="tabStops" select="$tabStops"/>
- <xsl:with-param name="tabCount" select="$tabCount + 1"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
- <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
- </xsl:call-template>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:attribute name="style">
+ <xsl:call-template name="createTabIndent">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="$tabCount + 1"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
<!-- if there are more than 3 TABS in the style, create a none-breakable-space as whitespace -->
- <xsl:text>&#160;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates select="following-sibling::node()[1]" mode="tabContentHandling">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:element>
- <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="tabStops" select="$tabStops"/>
- <xsl:with-param name="tabCount" select="$tabCount + 1"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
- <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="name() = 'text:line-break'">
+ <xsl:text>&#160;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabContentHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="$tabCount + 1"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="name() = 'text:line-break'">
<!-- A line-break resets the tabCount to '0' -->
- <br/>
- <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="tabStops" select="$tabStops"/>
- <xsl:with-param name="tabCount" select="0"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
- <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
+ <br/>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="0"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
<!-- only before the first tab all content is written out -->
- <xsl:if test="$tabCount = 0">
- <xsl:apply-templates select=".">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="tabStops" select="$tabStops"/>
- <xsl:with-param name="tabCount" select="$tabCount"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
- <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- This recursion creates the content of a tab (i.e. following siblings
+ <xsl:if test="$tabCount = 0">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="$tabCount"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ This recursion creates the content of a tab (i.e. following siblings
till next TAB or LINE BREAK) and ends with the next
- TAB, LINE-BREAK or with the end of the paragraph.
+ TAB, LINE-BREAK or with the end of the paragraph.
-->
- <xsl:template match="* | text()" mode="tabContentHandling">
- <xsl:param name="globalData"/>
+ <xsl:template match="* | text()" mode="tabContentHandling">
+ <xsl:param name="globalData"/>
- <xsl:if test="(name() != 'text:tab') and (name() != 'text:line-break')">
+ <xsl:if test="(name() != 'text:tab') and (name() != 'text:line-break')">
<!-- Write out content -->
- <xsl:apply-templates select=".">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
<!-- Apply for the next node -->
- <xsl:apply-templates select="following-sibling::node()[1]" mode="tabContentHandling">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="createTabIndent">
- <xsl:param name="globalData"/>
- <xsl:param name="tabStops"/>
- <xsl:param name="tabCount"/>
- <xsl:param name="parentMarginLeft" />
- <xsl:param name="pageMarginLeft" />
-
- <xsl:text>position:absolute;left:</xsl:text>
- <xsl:variable name="tabPosition">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="$tabStops/style:tab-stop[$tabCount]/@style:position"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="tabIndent">
- <xsl:choose>
- <xsl:when test="$tabStops/style:tab-stop[$tabCount]/@style:type = 'center'">
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabContentHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="createTabIndent">
+ <xsl:param name="globalData"/>
+ <xsl:param name="tabStops"/>
+ <xsl:param name="tabCount"/>
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="pageMarginLeft" />
+
+ <xsl:text>position:absolute;left:</xsl:text>
+ <xsl:variable name="tabPosition">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$tabStops/style:tab-stop[$tabCount]/@style:position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="tabIndent">
+ <xsl:choose>
+ <xsl:when test="$tabStops/style:tab-stop[$tabCount]/@style:type = 'center'">
<!-- in case of style:type 'center' the text is even before the tab stop,
centered around the beginning. As I see currently no way in mapping this,
therefore I do some HEURISTIC (minus -2.5cm) -->
- <xsl:value-of select="$tabPosition + $parentMarginLeft + $pageMarginLeft - 2.5"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$tabPosition + $parentMarginLeft + $pageMarginLeft"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$tabIndent='NaN'">
- <xsl:variable name="tabPosition">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="$tabStops/style:tab-stop[last()]/@style:position"/>
- </xsl:call-template>
- </xsl:variable>
+ <xsl:value-of select="$tabPosition + $parentMarginLeft + $pageMarginLeft - 2.5"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabPosition + $parentMarginLeft + $pageMarginLeft"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$tabIndent='NaN'">
+ <xsl:variable name="tabPosition">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$tabStops/style:tab-stop[last()]/@style:position"/>
+ </xsl:call-template>
+ </xsl:variable>
<!-- Heuristic: for every tab that is more than specified give a further 1 cm -->
- <xsl:value-of select="$parentMarginLeft + $tabPosition + count($tabStops/style:tab-stop) - $tabCount"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$tabIndent"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>cm;</xsl:text>
- <xsl:apply-templates select="$tabStops/style:tab-stop[$tabCount]/@style:type"/>
- </xsl:template>
-
+ <xsl:value-of select="$parentMarginLeft + $tabPosition + count($tabStops/style:tab-stop) - $tabCount"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabIndent"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>cm;</xsl:text>
+ <xsl:apply-templates select="$tabStops/style:tab-stop[$tabCount]/@style:type"/>
+ </xsl:template>
+
<!-- OOo writes out empty paragraphs layouted behind an image,
those have to be neglected in HTML
This method checks if an empty paragraph is of that kind! -->
- <xsl:template name="follows-empty-paragraphs-and-image">
- <xsl:param name="precedingElement" />
- <xsl:param name="elementToCheck" select="1"/>
-
- <xsl:choose>
+ <xsl:template name="follows-empty-paragraphs-and-image">
+ <xsl:param name="precedingElement" />
+ <xsl:param name="elementToCheck" select="1"/>
+ <xsl:choose>
<!-- OOo writes out empty paragraphs layouted behind the image,
- those have to be neglected in HTML -->
- <xsl:when test="name($precedingElement) = 'text:p' and not($precedingElement/text()) and not($precedingElement/*)">
- <xsl:call-template name="follows-empty-paragraphs-and-image">
- <xsl:with-param name="precedingElement" select="preceding-sibling::*[$elementToCheck]"/>
- <xsl:with-param name="elementToCheck" select="$elementToCheck +1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$precedingElement/draw:frame">no</xsl:when>
- <xsl:otherwise>yes</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="create-paragraph">
- <xsl:param name="globalData"/>
+ those have to be neglected in HTML
+ <xsl:when test="name() = 'text:p' and (normalize-space($childText) = '')"> -->
+ <!-- WorkAround: Test if the empty paragraph was added after an image, which OOO often does -->
+ <xsl:when test="(name($precedingElement) = 'text:p' and not($precedingElement/text()) and not($precedingElement/*))">
+ <xsl:call-template name="follows-empty-paragraphs-and-image">
+ <xsl:with-param name="precedingElement" select="preceding-sibling::*[$elementToCheck]"/>
+ <xsl:with-param name="elementToCheck" select="$elementToCheck +1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$precedingElement/draw:frame">yes</xsl:when>
+ <xsl:otherwise>no</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="create-paragraph">
+ <xsl:param name="globalData"/>
<!-- the footnote symbol is the prefix for a footnote in the footer -->
- <xsl:param name="footnotePrefix"/>
-
- <!-- xhtml:p may only contain inline elements.
- If there is one frame beyond, div must be used! -->
- <xsl:variable name="elementName">
- <xsl:choose>
- <xsl:when test="descendant::draw:frame[1] or descendant::text:p[1]">div</xsl:when>
- <xsl:otherwise>p</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:element name="{$elementName}">
- <xsl:choose>
+ <xsl:param name="footnotePrefix"/>
+
+ <!-- xhtml:p may only contain inline elements.
+ If there is one frame beyond, div must be used! -->
+ <xsl:variable name="elementName">
+ <xsl:choose>
+ <xsl:when test="descendant::draw:frame[1] or descendant::text:p[1]">div</xsl:when>
+ <xsl:otherwise>p</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$elementName}">
+ <xsl:choose>
<!-- in ODF borders of paragraphs will be merged by default. Merging means the adjactend paragraphs are building a unit,
where only the first and the last will have have a border to the surrounding (top / bottom border)
<xsl:variable name="precedingParagraphStyle" select="preceding-sibling::*[1][name() = 'text:p']/@text:style-name"/>
<xsl:variable name="followingParagraphStyle" select="following-sibling::*[1][name() = 'text:p']/@text:style-name"/>
-->
- <xsl:when test="$globalData/all-styles/style[@style:name = current()/@text:style-name]/@mergedBorders">
- <xsl:variable name="precedingParagraphStyle" select="preceding-sibling::*[1][name() = 'text:p']/@text:style-name"/>
- <xsl:variable name="followingParagraphStyle" select="following-sibling::*[1][name() = 'text:p']/@text:style-name"/>
- <xsl:choose>
- <xsl:when test="$precedingParagraphStyle or $followingParagraphStyle">
- <xsl:variable name="isPrecedingBorderParagraph" select="$globalData/all-styles/style[@style:name = $precedingParagraphStyle]/@mergedBorders"/>
- <xsl:variable name="isFollowingBorderParagraph" select="$globalData/all-styles/style[@style:name = $followingParagraphStyle]/@mergedBorders"/>
- <xsl:choose>
- <xsl:when test="not($isPrecedingBorderParagraph) and $isFollowingBorderParagraph">
- <xsl:attribute name="class">
- <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderStart')"/>
- </xsl:attribute>
- <xsl:apply-templates>
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="$isPrecedingBorderParagraph and not($isFollowingBorderParagraph)">
- <xsl:attribute name="class">
- <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderEnd')"/>
- </xsl:attribute>
- <xsl:apply-templates>
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="class">
- <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
- </xsl:attribute>
- <xsl:apply-templates>
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="write-paragraph">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="write-paragraph">
- <xsl:with-param name="globalData" select="$globalData" />
- <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:template>
-
- <xsl:template name="write-paragraph">
- <xsl:param name="globalData"/>
+ <xsl:when test="$globalData/all-styles/style[@style:name = current()/@text:style-name]/@mergedBorders">
+ <xsl:variable name="precedingParagraphStyle" select="preceding-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ <xsl:variable name="followingParagraphStyle" select="following-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ <xsl:choose>
+ <xsl:when test="$precedingParagraphStyle or $followingParagraphStyle">
+ <xsl:variable name="isPrecedingBorderParagraph" select="$globalData/all-styles/style[@style:name = $precedingParagraphStyle]/@mergedBorders"/>
+ <xsl:variable name="isFollowingBorderParagraph" select="$globalData/all-styles/style[@style:name = $followingParagraphStyle]/@mergedBorders"/>
+ <xsl:choose>
+ <xsl:when test="not($isPrecedingBorderParagraph) and $isFollowingBorderParagraph">
+ <xsl:attribute name="class">
+ <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderStart')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$isPrecedingBorderParagraph and not($isFollowingBorderParagraph)">
+ <xsl:attribute name="class">
+ <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderEnd')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-paragraph">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="write-paragraph">
+ <xsl:param name="globalData"/>
<!-- the footnote symbol is the prefix for a footnote in the footer -->
- <xsl:param name="footnotePrefix" />
+ <xsl:param name="footnotePrefix" />
<!-- empty paragraph tags does not provoke an carridge return,
therefore an non breakable space (&nbsp) have been inserted.-->
- <xsl:choose>
- <xsl:when test="node()">
- <xsl:call-template name="apply-styles-and-content">
- <xsl:with-param name="globalData" select="$globalData" />
- <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="apply-styles-and-content">
- <xsl:with-param name="globalData" select="$globalData" />
- <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
- </xsl:call-template>
- <xsl:text>&#160;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="style:tab-stop/@style:type">
- <xsl:text>text-align:</xsl:text>
- <xsl:choose>
- <xsl:when test=". = 'left'">left</xsl:when>
- <xsl:when test=". = 'right'">right</xsl:when>
- <xsl:when test=". = 'center'">center</xsl:when>
- <xsl:otherwise>justify</xsl:otherwise>
- </xsl:choose>
- <xsl:text>;</xsl:text>
- </xsl:template>
-
- <!-- As soon a frame is within a paragraph (text:p) or page:frame, every element floating (CSS) and worked out in sequence.
+ <xsl:choose>
+ <xsl:when test="node()">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="style:tab-stop/@style:type">
+ <xsl:text>text-align:</xsl:text>
+ <xsl:choose>
+ <xsl:when test=". = 'left'">left</xsl:when>
+ <xsl:when test=". = 'right'">right</xsl:when>
+ <xsl:when test=". = 'center'">center</xsl:when>
+ <xsl:otherwise>justify</xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+
+ <!-- As soon a frame is within a paragraph (text:p) or page:frame, every child element is floating (CSS) and worked out in sequence.
Accumulating prior frame width and adding parent's left margin -->
-
- <!-- Matching all elements and text beyond a paragraph/text:page which are sibling of a draw:frame -->
- <xsl:template match="* | text()" mode="frameFloating">
- <xsl:param name="globalData"/>
- <xsl:param name="previousFrameWidths" select="0"/>
- <xsl:param name="previousFrameHeights" select="0" />
+ <!-- Matching all elements and text beyond a paragraph/text:page which are sibling of a draw:frame -->
+ <xsl:template match="* | text()" mode="frameFloating">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
<!-- it becomes true for siblings after a draw:frame -->
- <xsl:param name="createDiv" select="false()"/>
- <xsl:param name="noDivBefore" select="true()"/>
- <xsl:param name="leftPosition" />
- <xsl:param name="parentMarginLeft" />
- <xsl:param name="frameAlignedToParagraphWithSvgY" />
-
- <xsl:choose>
- <xsl:when test="name() = 'draw:frame'">
- <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
-
- <!-- if the first node is a draw:frame create a div -->
- <xsl:call-template name="createDrawFrame">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
- <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
- </xsl:call-template>
- <!-- next elements will be called after the creation with the new indent (plus width of frame) -->
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="nextSiblingIsFrame" select="name(following-sibling::node()[1]) = 'draw:frame'"/>
- <xsl:choose>
- <xsl:when test="$createDiv and normalize-space(.) != ''">
+ <xsl:param name="createDiv" select="false()"/>
+ <xsl:param name="noDivBefore" select="true()"/>
+ <xsl:param name="leftPosition" />
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="frameAlignedToParagraphWithSvgY" />
+
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:frame'">
+ <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
+
+ <!-- if the first node is a draw:frame create a div -->
+ <xsl:call-template name="createDrawFrame">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ </xsl:call-template>
+ <!-- next elements will be called after the creation with the new indent (plus width of frame) -->
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="nextSiblingIsFrame" select="name(following-sibling::node()[1]) = 'draw:frame'"/>
+ <xsl:choose>
+ <xsl:when test="$createDiv and normalize-space(.) != ''">
<!-- every following frame sibling till the next draw:frame
- have to be incapuslated within a div with left indent.
- To be moved alltogether arcording the indent (usually right) -->
- <xsl:comment>Next 'div' added for floating.</xsl:comment>
- <xsl:element name="div">
- <xsl:attribute name="style">
- <xsl:text>position:relative; left:</xsl:text>
- <xsl:value-of select="$leftPosition"/>
- <xsl:text>cm;</xsl:text>
- </xsl:attribute>
- <xsl:apply-templates select=".">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
+ have to be incapuslated within a div with left indent.
+ To be moved alltogether arcording the indent (usually right) -->
+ <xsl:comment>Next 'div' added for floating.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:attribute name="style">
+ <xsl:text>position:relative; left:</xsl:text>
+ <xsl:value-of select="$leftPosition"/>
+ <xsl:text>cm;</xsl:text>
+ </xsl:attribute>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
<!-- if it is a frame sibling it will be NOT incapuslated within the div (as already within one) -->
- <xsl:if test="not($nextSiblingIsFrame)">
- <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
- <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
- <xsl:with-param name="leftPosition" select="$leftPosition"/>
- <xsl:with-param name="createDiv" select="false()"/>
- <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
- <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
- </xsl:apply-templates>
- </xsl:if>
- </xsl:element>
- <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
-
- <!-- Other draw:frame will be created outside of the div element -->
- <xsl:apply-templates select="following-sibling::draw:frame[1]" mode="frameFloating">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
- <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
- <xsl:with-param name="leftPosition" select="$leftPosition"/>
- <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:when test="not($createDiv)">
- <xsl:apply-templates select=".">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
- </xsl:apply-templates>
- <xsl:if test="not($nextSiblingIsFrame) or $noDivBefore">
- <xsl:variable name="followingSibling" select="following-sibling::node()[1]"/>
- <xsl:choose>
- <xsl:when test="normalize-space($followingSibling) != ''">
- <xsl:apply-templates select="$followingSibling" mode="frameFloating">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
- <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
- <xsl:with-param name="leftPosition" select="$leftPosition"/>
- <xsl:with-param name="createDiv" select="false()"/>
- <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
- <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:when>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+ <xsl:if test="not($nextSiblingIsFrame)">
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="false()"/>
+ <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:element>
+ <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
+
+ <!-- Other draw:frame will be created outside of the div element -->
+ <xsl:apply-templates select="following-sibling::draw:frame[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="not($createDiv)">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ <xsl:if test="not($nextSiblingIsFrame) or $noDivBefore">
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="false()"/>
+ <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- A XML node other than text or element (e.g. commment) should not stop the recursion -->
+ <xsl:template match="comment()" mode="frameFloating">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+ <!-- it becomes true for siblings after a draw:frame -->
+ <xsl:param name="createDiv" select="false()"/>
+ <xsl:param name="noDivBefore" select="true()"/>
+ <xsl:param name="leftPosition" />
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="frameAlignedToParagraphWithSvgY" />
+
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="$createDiv"/>
+ <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
<!-- As draw:fame may occure within more elements than in text:p and draw:page -->
- <xsl:template match="draw:frame">
- <xsl:param name="globalData"/>
- <xsl:param name="previousFrameWidths" select="0"/>
- <xsl:param name="previousFrameHeights" select="0" />
-
- <xsl:call-template name="createDrawFrame">
- <xsl:with-param name="globalData" select="$globalData" />
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
- <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
- </xsl:call-template>
- <!-- after the last draw:frame sibling the CSS float is disabled -->
- <div style="clear:both; line-height:0; width:0; height:0; margin:0; padding:0;">&#160;</div>
- </xsl:template>
-
- <xsl:template name="getPageMarginLeft">
+ <xsl:template match="draw:frame">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+
+ <xsl:call-template name="createDrawFrame">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ </xsl:call-template>
+ <!-- after the last draw:frame sibling the CSS float is disabled -->
+ <div style="clear:both; line-height:0; width:0; height:0; margin:0; padding:0;">&#160;</div>
+ </xsl:template>
+
+ <xsl:template name="getPageMarginLeft">
<!-- approximation to find the correct master page style (with page dimensions) -->
- <xsl:variable name="masterPageNames">
+ <xsl:variable name="masterPageNames">
<!-- Loop over every style:style containing a @style:master-page-name attribute -->
- <xsl:for-each select="key('masterPage','count')">
+ <xsl:for-each select="key('masterPage','count')">
<!-- Check if this style is being used in the body -->
- <xsl:if test="key('elementUsingStyle', ../@style:name)">
+ <xsl:if test="key('elementUsingStyle', ../@style:name)">
<!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
- <xsl:if test="string-length(../@style:master-page-name) &gt; 0">
- <xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
- </xsl:if>
- </xsl:for-each>
- </xsl:variable>
+ <xsl:if test="string-length(../@style:master-page-name) &gt; 0">
+ <xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
<!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
- <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
+ <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
<!-- Find the according style:page-layout and store the properties in a variable -->
- <xsl:variable name="pageMarginLeftAttr" select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties/@fo:margin-left"/>
- <xsl:choose>
- <xsl:when test="$pageMarginLeftAttr">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="$pageMarginLeftAttr"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+ <xsl:variable name="pageMarginLeftAttr" select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties/@fo:margin-left"/>
+ <xsl:choose>
+ <xsl:when test="$pageMarginLeftAttr">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$pageMarginLeftAttr"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
<!-- Elements and text aside of a draw:frame are floating, here a div is being created.
- Either for a draw:frame or for text and other elements floating aside -->
- <xsl:template name="createDrawFrame">
- <xsl:param name="globalData"/>
- <xsl:param name="previousFrameWidths" select="0"/>
- <xsl:param name="previousFrameHeights" select="0" />
- <xsl:param name="parentMarginLeft"/>
-
- <xsl:variable name="parentMarginLeftNew">
- <xsl:choose>
- <xsl:when test="string-length(normalize-space($parentMarginLeft)) &lt; 1">
+ Either for a draw:frame or for text and other elements floating aside -->
+ <xsl:template name="createDrawFrame">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+ <xsl:param name="parentMarginLeft"/>
+
+ <xsl:variable name="parentMarginLeftNew">
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($parentMarginLeft)) &lt; 1">
<!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
- <xsl:variable name="paragraphName" select="parent::*/@text:style-name" />
- <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paragraphName]/final-properties"/>
+ <xsl:variable name="paragraphName" select="parent::*/@text:style-name" />
+ <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paragraphName]/final-properties"/>
<!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
- <xsl:choose>
- <xsl:when test="contains($imageParagraphStyle, 'margin-left:')">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($imageParagraphStyle, 'margin-left:'), ';'))"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$parentMarginLeft"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="svgWidth">
- <xsl:choose>
- <xsl:when test="@svg:width">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="@svg:width"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="svgX">
- <xsl:choose>
- <xsl:when test="@svg:x">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="@svg:x"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="leftPosition" select="$svgX - $parentMarginLeftNew - $previousFrameWidths"/>
- <xsl:variable name="svgY">
- <xsl:choose>
- <xsl:when test="@svg:y">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="@svg:y"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- if the frame is anchored on a paragraph -->
- <xsl:if test="@text:anchor-type='paragraph'">
- <xsl:comment>Next 'div' is emulating the top hight of a draw:frame.</xsl:comment>
- <!-- When the svg:y is set relativ to the paragraph content, the best way to emulate a positive height,
- is to add an invisbile division inbetween with a height.
- Often text will flow into this 'gap', which is handled separately!
- -->
- <xsl:if test="$svgY &gt; 0">
- <xsl:element name="div">
- <xsl:attribute name="style">
- <xsl:text>height:</xsl:text>
- <xsl:value-of select="$svgY"/>
- <xsl:text>cm;</xsl:text>
- </xsl:attribute>
- <xsl:text>&#160;</xsl:text>
- </xsl:element>
- </xsl:if>
- </xsl:if>
-
-
- <xsl:variable name="followingSibling" select="following-sibling::node()[1]"/>
- <!--
- <xsl:choose>
- HEURISTIC: if the frame is anchored on a paragraph and the above gab is big enough to hold a text line,
- move it behind the text
- <xsl:when test="@text:anchor-type='paragraph' and
- (
- ($svgY &gt; 0.5) or
- ($svgX &gt; 4)
- ) and normalize-space($followingSibling) != ''">
- <xsl:apply-templates select="$followingSibling" mode="frameFloating">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeftNew"/>
- <xsl:with-param name="leftPosition" select="$leftPosition"/>
- <xsl:with-param name="createDiv" select="true()"/>
- <xsl:with-param name="noDivBefore" select="false()"/>
- <xsl:with-param name="frameAlignedToParagraphWithSvgY">
- <xsl:call-template name="createDrawFrame2">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
- <xsl:with-param name="parentMarginLeftNew" select="$parentMarginLeftNew"/>
- <xsl:with-param name="leftPosition" select="$leftPosition"/>
- <xsl:with-param name="svgY" select="$svgY"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>-->
- <xsl:call-template name="createDrawFrame2">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
- <xsl:with-param name="parentMarginLeftNew" select="$parentMarginLeftNew"/>
- <xsl:with-param name="leftPosition" select="$leftPosition"/>
- <xsl:with-param name="svgY" select="$svgY"/>
- </xsl:call-template>
- <!-- <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeftNew"/>
- <xsl:with-param name="leftPosition" select="$leftPosition"/>
- <xsl:with-param name="createDiv" select="true()"/>
- <xsl:with-param name="noDivBefore" select="false()"/>
- </xsl:apply-templates>
-
- </xsl:otherwise>
- </xsl:choose> -->
- </xsl:template>
-
- <xsl:template name="createDrawFrame2">
- <xsl:param name="globalData"/>
- <xsl:param name="previousFrameWidths" />
- <xsl:param name="parentMarginLeftNew"/>
- <xsl:param name="leftPosition" />
- <xsl:param name="svgY" />
-
- <xsl:comment>Next 'div' is a draw:frame.</xsl:comment>
- <xsl:element name="div">
- <xsl:attribute name="style">
- <xsl:call-template name="widthAndHeight"/>
+ <xsl:choose>
+ <xsl:when test="contains($imageParagraphStyle, 'margin-left:')">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($imageParagraphStyle, 'margin-left:'), ';'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$parentMarginLeft"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="svgWidth">
+ <xsl:choose>
+ <xsl:when test="@svg:width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="@svg:width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="svgX">
+ <xsl:choose>
+ <xsl:when test="@svg:x">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="@svg:x"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="leftPosition" select="$svgX - $parentMarginLeftNew - $previousFrameWidths"/>
+ <xsl:variable name="svgY">
+ <xsl:choose>
+ <xsl:when test="@svg:y">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="@svg:y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- if the frame is anchored on a paragraph -->
+ <xsl:if test="@text:anchor-type='paragraph'">
+ <xsl:comment>Next 'div' is emulating the top hight of a draw:frame.</xsl:comment>
+ <!-- When the svg:y is set relativ to the paragraph content, the best way to emulate a positive height,
+ is to add an invisbile division inbetween with a height.
+ Often text will flow into this 'gap', which is handled separately!
+ -->
+ <xsl:if test="$svgY &gt; 0">
+ <xsl:element name="div">
+ <xsl:attribute name="style">
+ <xsl:text>height:</xsl:text>
+ <xsl:value-of select="$svgY"/>
+ <xsl:text>cm;</xsl:text>
+ </xsl:attribute>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+
+
+ <!--
+ <xsl:variable name="followingSibling" select="following-sibling::node()[1]"/>
+ <xsl:choose>
+ HEURISTIC: if the frame is anchored on a paragraph and the above gab is big enough to hold a text line,
+ move it behind the text
+ <xsl:when test="@text:anchor-type='paragraph' and
+ (
+ ($svgY &gt; 0.5) or
+ ($svgX &gt; 4)
+ ) and normalize-space($followingSibling) != ''">
+ <xsl:apply-templates select="$followingSibling" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="true()"/>
+ <xsl:with-param name="noDivBefore" select="false()"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY">
+ <xsl:call-template name="createDrawFrame2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeftNew" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="svgY" select="$svgY"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>-->
+ <xsl:call-template name="createDrawFrame2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeftNew" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="svgY" select="$svgY"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="true()"/>
+ <xsl:with-param name="noDivBefore" select="false()"/>
+ </xsl:apply-templates>
+ <!--
+
+ </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:template>
+
+ <xsl:template name="createDrawFrame2">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" />
+ <xsl:param name="parentMarginLeftNew"/>
+ <xsl:param name="leftPosition" />
+ <xsl:param name="svgY" />
+
+ <xsl:comment>Next 'div' is a draw:frame.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:attribute name="style">
+ <xsl:call-template name="widthAndHeight"/>
<!-- all images float (CSS float reltaive) with a left position calculated by svg:x - parentMarginLeft - previousFrameWidths -->
- <xsl:text> float:left; padding:0; position:relative; left:</xsl:text>
- <xsl:value-of select="$leftPosition"/>
- <xsl:text>cm; </xsl:text>
- <!-- if the frame is anchored on a char -->
- <xsl:if test="@text:anchor-type='char'">
- <xsl:text>top:</xsl:text>
- <xsl:value-of select="$svgY"/>
- <xsl:text>cm; </xsl:text>
- </xsl:if>
- </xsl:attribute>
- <xsl:apply-templates select="@*">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- <xsl:apply-templates select="node()">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:element>
- </xsl:template>
-
- <xsl:template name="widthAndHeight">
- <xsl:if test="@svg:height | @svg:width">
- <xsl:choose>
- <xsl:when test="not(@svg:width)">
- <xsl:call-template name="svg:height"/>
- </xsl:when>
- <xsl:when test="not(@svg:height)">
- <xsl:call-template name="svg:width"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="svg:height"/>
- <xsl:call-template name="svg:width"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
+ <xsl:text> float:left; padding:0; position:relative; left:</xsl:text>
+ <xsl:value-of select="$leftPosition"/>
+ <xsl:text>cm; </xsl:text>
+ <!-- if the frame is anchored on a char -->
+ <xsl:if test="@text:anchor-type='char'">
+ <xsl:text>top:</xsl:text>
+ <xsl:value-of select="$svgY"/>
+ <xsl:text>cm; </xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="widthAndHeight">
+ <xsl:if test="@svg:height | @svg:width">
+ <xsl:choose>
+ <xsl:when test="not(@svg:width)">
+ <xsl:call-template name="svg:height"/>
+ </xsl:when>
+ <xsl:when test="not(@svg:height)">
+ <xsl:call-template name="svg:width"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="svg:height"/>
+ <xsl:call-template name="svg:width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
<!-- ***************** -->
<!-- *** Text Span *** -->
<!-- ***************** -->
- <xsl:template match="text:span">
- <xsl:param name="globalData"/>
+ <xsl:template match="text:span">
+ <xsl:param name="globalData"/>
<xsl:choose>
<xsl:when test="draw:frame">
- <!-- sometimes an ODF image is anchored as character and the
+ <!-- sometimes an ODF image is anchored as character and the
image frame appears within a span (which is not valid for HTML)
Heuristic: Neglecting the span assuming no text content aside
of frame within span -->
<xsl:apply-templates>
<xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
+ </xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:element name="span">
@@ -1051,7 +1087,7 @@
</xsl:element>
</xsl:otherwise>
</xsl:choose>
- </xsl:template>
+ </xsl:template>
@@ -1059,156 +1095,156 @@
<!-- *** Headings *** -->
<!-- **************** -->
- <xsl:template match="text:h">
- <xsl:param name="globalData"/>
+ <xsl:template match="text:h">
+ <xsl:param name="globalData"/>
<!-- no creation of empty headings (without text content) -->
- <xsl:if test="text() or descendant::text()">
+ <xsl:if test="text() or descendant::text()">
<!-- The URL linking of an table-of-content is due to a bug (cp. bug id# 102311) not mapped as URL in the XML.
Linking of the table-of-content can therefore only be archieved by a work-around in HTML -->
- <xsl:call-template name="create-heading">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
+ <xsl:call-template name="create-heading">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
<!-- default matching for header elements -->
- <xsl:template name="create-heading">
- <xsl:param name="globalData"/>
-
- <xsl:variable name="headingLevel">
- <xsl:choose>
- <xsl:when test="@text:outline-level &lt; 6">
- <xsl:value-of select="@text:outline-level"/>
- </xsl:when>
- <xsl:otherwise>6</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="headertyp" select="concat('h', $headingLevel)"/>
- <xsl:element name="{$headertyp}">
+ <xsl:template name="create-heading">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="headingLevel">
+ <xsl:choose>
+ <xsl:when test="@text:outline-level &lt; 6">
+ <xsl:value-of select="@text:outline-level"/>
+ </xsl:when>
+ <xsl:otherwise>6</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="headertyp" select="concat('h', $headingLevel)"/>
+ <xsl:element name="{$headertyp}">
<!-- outline style 'text:min-label-width' is interpreted as a CSS 'margin-right' attribute
NOTE: Should be handled as CSS style in style header -->
- <xsl:variable name="min-label" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
- <xsl:attribute name="class">
- <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
- </xsl:attribute>
-
- <xsl:call-template name="create-heading-anchor">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
-
- <xsl:apply-templates>
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:element>
-
- </xsl:template>
-
- <xsl:template name="create-heading-anchor">
- <xsl:param name="globalData"/>
-
- <!-- writing out a heading number if desired.-->
- <!-- if a corresponding 'text:outline-style' exist or is not empty -->
- <xsl:choose>
- <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-format != ''">
-
- <!-- Every heading element will get an unique anchor for its file, from its hiearchy level and name:
- For example: The heading title 'My favorite heading' might get <a name="1_2_2_My_favorite_heading" /> -->
- <!-- creating an anchor for referencing the heading (e.g. from content table) -->
- <xsl:variable name="headingNumber">
- <xsl:call-template name="get-heading-number">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:call-template name="create-heading-anchor2">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="headingNumber" select="$headingNumber"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="create-heading-anchor2">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <xsl:template name="get-heading-number">
- <xsl:param name="globalData"/>
-
- <!-- write number prefix -->
- <xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-prefix"/>
- <xsl:call-template name="write-heading-number">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- <!-- write number suffix -->
- <xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-suffix"/>
- </xsl:template>
+ <xsl:variable name="min-label" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+
+ <xsl:call-template name="create-heading-anchor">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+
+ </xsl:template>
+
+ <xsl:template name="create-heading-anchor">
+ <xsl:param name="globalData"/>
+
+ <!-- writing out a heading number if desired.-->
+ <!-- if a corresponding 'text:outline-style' exist or is not empty -->
+ <xsl:choose>
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-format != ''">
+
+ <!-- Every heading element will get an unique anchor for its file, from its hiearchy level and name:
+ For example: The heading title 'My favorite heading' might get <a name="1_2_2_My_favorite_heading" /> -->
+ <!-- creating an anchor for referencing the heading (e.g. from content table) -->
+ <xsl:variable name="headingNumber">
+ <xsl:call-template name="get-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-heading-anchor2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="headingNumber" select="$headingNumber"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-heading-anchor2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="get-heading-number">
+ <xsl:param name="globalData"/>
+
+ <!-- write number prefix -->
+ <xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-prefix"/>
+ <xsl:call-template name="write-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ <!-- write number suffix -->
+ <xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-suffix"/>
+ </xsl:template>
<!-- creating an anchor for referencing the heading -->
- <xsl:template name="create-heading-anchor2">
- <xsl:param name="globalData"/>
- <xsl:param name="headingNumber" />
-
- <xsl:variable name="title">
- <xsl:apply-templates mode="concatenate"/>
- </xsl:variable>
- <!-- REFERENCE HANDLING - ANCHOR -->
- <xsl:element namespace="{$namespace}" name="a">
- <xsl:attribute name="id">
- <xsl:value-of select="translate(concat('a_',$headingNumber, '_', normalize-space($title)), '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
- </xsl:attribute>
-
- <xsl:element name="span">
+ <xsl:template name="create-heading-anchor2">
+ <xsl:param name="globalData"/>
+ <xsl:param name="headingNumber" />
+
+ <xsl:variable name="title">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:variable>
+ <!-- REFERENCE HANDLING - ANCHOR -->
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="id">
+ <xsl:value-of select="translate(concat('a_',$headingNumber, '_', normalize-space($title)), '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:attribute>
+
+ <xsl:element name="span">
<!-- outline style 'text:min-label-distance' is interpreted as a CSS 'margin-right' attribute
NOTE: Should be handled as CSS style in style header -->
- <xsl:variable name="minLabelDistance" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-distance"/>
- <xsl:variable name="minLabelWidth" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
-
- <xsl:if test="$minLabelDistance | $minLabelWidth">
- <xsl:attribute name="style">
- <xsl:if test="$minLabelDistance">
- <xsl:text>margin-right:</xsl:text>
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="$minLabelDistance"/>
- </xsl:call-template>
- <xsl:text>cm;</xsl:text>
- </xsl:if>
- <xsl:if test="$minLabelWidth">
- <xsl:text>min-width:</xsl:text>
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="$minLabelWidth"/>
- </xsl:call-template>
- <xsl:text>cm;</xsl:text>
- </xsl:if>
- </xsl:attribute>
- </xsl:if>
- <xsl:copy-of select="$headingNumber"/>
- </xsl:element>
- </xsl:element>
- </xsl:template>
-
- <xsl:template name="write-heading-number">
- <xsl:param name="globalData"/>
+ <xsl:variable name="minLabelDistance" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-distance"/>
+ <xsl:variable name="minLabelWidth" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
+
+ <xsl:if test="$minLabelDistance | $minLabelWidth">
+ <xsl:attribute name="style">
+ <xsl:if test="$minLabelDistance">
+ <xsl:text>margin-right:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$minLabelDistance"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ <xsl:if test="$minLabelWidth">
+ <xsl:text>min-width:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$minLabelWidth"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:copy-of select="$headingNumber"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="write-heading-number">
+ <xsl:param name="globalData"/>
<!-- By default heading start with '1', the parameter 'textStartValue' will only be set, if the attribute @text:start-value exist -->
- <xsl:choose>
- <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value">
- <xsl:call-template name="calc-heading-number">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="outlineLevel" select="@text:outline-level"/>
- <xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="calc-heading-number">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="outlineLevel" select="@text:outline-level"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+ <xsl:choose>
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value">
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="@text:outline-level"/>
+ <xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="@text:outline-level"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
<!--
Find the correct heading no., which is the sum of 'text:start-value'
@@ -1216,149 +1252,149 @@
If the 'text:start-value is not set the default value of '1' has to be taken.
If a heading number is found (e.g. text:outline-level='3') all heading numbers
for the higher levels have to be written out -->
- <xsl:template name="calc-heading-number">
- <xsl:param name="globalData"/>
- <xsl:param name="outlineLevel"/><!-- text level of the heading -->
- <xsl:param name="iOutlineLevel" select="1"/><!-- iterator, counts from 1 to the text level of the heading -->
- <xsl:param name="textStartValue" select="1"/><!-- text level to start with, default is '1' -->
+ <xsl:template name="calc-heading-number">
+ <xsl:param name="globalData"/>
+ <xsl:param name="outlineLevel"/><!-- text level of the heading -->
+ <xsl:param name="iOutlineLevel" select="1"/><!-- iterator, counts from 1 to the text level of the heading -->
+ <xsl:param name="textStartValue" select="1"/><!-- text level to start with, default is '1' -->
- <xsl:choose>
+ <xsl:choose>
<!-- iText levels counts up from '1' to outlineLevel
Which means writing a heading number from left to right -->
- <xsl:when test="$iOutlineLevel &lt; $outlineLevel">
+ <xsl:when test="$iOutlineLevel &lt; $outlineLevel">
<!-- Write preceding heading numbers -->
- <xsl:call-template name="writeNumber">
- <xsl:with-param name="numberDigit">
- <xsl:call-template name="calc-heading-digit">
- <xsl:with-param name="value" select="0"/>
- <xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($outlineLevel)]/@style:num-format"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value">
- <xsl:call-template name="calc-heading-number">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
- <xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
- <xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="calc-heading-number">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
- <xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:call-template name="writeNumber">
+ <xsl:with-param name="numberDigit">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="0"/>
+ <xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($outlineLevel)]/@style:num-format"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value">
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
+ <xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
+ <xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
+ <xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
<!-- Write preceding heading numbers -->
- <xsl:call-template name="writeNumber">
- <xsl:with-param name="numberDigit">
- <xsl:call-template name="calc-heading-digit">
- <xsl:with-param name="value" select="$textStartValue"/>
- <xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = $outlineLevel]/@style:num-format"/>
- <xsl:with-param name="last" select="true()"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="writeNumber">
- <xsl:param name="numberDigit"/>
- <xsl:param name="numberFormat"/>
- <xsl:param name="last"/>
-
- <xsl:choose>
- <xsl:when test="not($numberFormat)">
- <xsl:number value="$numberDigit" format="1."/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$last">
- <xsl:number value="$numberDigit" format="{$numberFormat}"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:number value="$numberDigit" format="{$numberFormat}."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="calc-heading-digit">
- <xsl:param name="value"/>
- <xsl:param name="currentoutlineLevel"/>
- <xsl:param name="i" select="1"/>
-
- <xsl:variable name="precedingoutlineLevel" select="preceding-sibling::text:h[$i]/@text:outline-level"/>
- <xsl:choose>
- <xsl:when test="$currentoutlineLevel = $precedingoutlineLevel">
- <xsl:call-template name="calc-heading-digit">
- <xsl:with-param name="value" select="$value + 1"/>
- <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
- <xsl:with-param name="i" select="$i + 1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$currentoutlineLevel &lt; $precedingoutlineLevel">
- <xsl:call-template name="calc-heading-digit">
- <xsl:with-param name="value" select="$value"/>
- <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
- <xsl:with-param name="i" select="$i + 1"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+ <xsl:call-template name="writeNumber">
+ <xsl:with-param name="numberDigit">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$textStartValue"/>
+ <xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = $outlineLevel]/@style:num-format"/>
+ <xsl:with-param name="last" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="writeNumber">
+ <xsl:param name="numberDigit"/>
+ <xsl:param name="numberFormat"/>
+ <xsl:param name="last"/>
+
+ <xsl:choose>
+ <xsl:when test="not($numberFormat)">
+ <xsl:number value="$numberDigit" format="1."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$last">
+ <xsl:number value="$numberDigit" format="{$numberFormat}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:number value="$numberDigit" format="{$numberFormat}."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="calc-heading-digit">
+ <xsl:param name="value"/>
+ <xsl:param name="currentoutlineLevel"/>
+ <xsl:param name="i" select="1"/>
+
+ <xsl:variable name="precedingoutlineLevel" select="preceding-sibling::text:h[$i]/@text:outline-level"/>
+ <xsl:choose>
+ <xsl:when test="$currentoutlineLevel = $precedingoutlineLevel">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$value + 1"/>
+ <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
+ <xsl:with-param name="i" select="$i + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$currentoutlineLevel &lt; $precedingoutlineLevel">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$value"/>
+ <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
+ <xsl:with-param name="i" select="$i + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
<!-- Neglect Annotations -->
- <xsl:template match="office:annotation" mode="concatenate"/>
+ <xsl:template match="office:annotation" mode="concatenate"/>
<!-- Match text:placeholder child nodes (e.g. text) -->
- <xsl:template match="text:placeholder">
- <xsl:param name="globalData"/>
+ <xsl:template match="text:placeholder">
+ <xsl:param name="globalData"/>
- <xsl:call-template name="apply-styles-and-content">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:template>
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:template>
<!-- ************* -->
<!-- *** Link *** -->
<!-- ************* -->
- <xsl:template match="text:a | draw:a">
- <xsl:param name="globalData"/>
+ <xsl:template match="text:a | draw:a">
+ <xsl:param name="globalData"/>
- <xsl:call-template name="create-common-anchor-link">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:template>
+ <xsl:call-template name="create-common-anchor-link">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:template>
- <xsl:template name="create-common-anchor-link">
- <xsl:param name="globalData"/>
+ <xsl:template name="create-common-anchor-link">
+ <xsl:param name="globalData"/>
- <xsl:element name="a">
- <xsl:attribute name="href">
- <xsl:call-template name="create-href">
- <xsl:with-param name="href" select="@xlink:href"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="apply-styles-and-content">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:element>
- </xsl:template>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:call-template name="create-href">
+ <xsl:with-param name="href" select="@xlink:href"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
@@ -1367,80 +1403,80 @@
<!-- ******************* -->
<!-- currently suggesting that all draw:object-ole elements are images -->
- <xsl:template match="draw:image | draw:object-ole">
- <xsl:param name="globalData"/>
+ <xsl:template match="draw:image | draw:object-ole">
+ <xsl:param name="globalData"/>
- <xsl:choose>
- <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base">
+ <xsl:choose>
+ <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base">
<!-- XHTML does not allow the mapped elements to contain paragraphs -->
- <xsl:call-template name="create-image-element">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:call-template name="create-image-element">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
<!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself.
A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph -->
- <xsl:element name="p">
- <xsl:apply-templates select="@draw:style-name">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
-
- <xsl:call-template name="create-image-element">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="create-image-element">
- <xsl:param name="globalData"/>
-
- <xsl:element name="img">
- <xsl:if test="../@svg:width or ../@svg:height">
- <xsl:attribute name="style">
- <xsl:if test="../@svg:height">
- <xsl:text>height:</xsl:text>
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="../@svg:height"/>
- </xsl:call-template>
- <xsl:text>cm;</xsl:text>
- </xsl:if>
- <xsl:if test="../@svg:width">
- <xsl:text>width:</xsl:text>
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="../@svg:width"/>
- </xsl:call-template>
- <xsl:text>cm;</xsl:text>
- </xsl:if>
- </xsl:attribute>
- </xsl:if>
- <xsl:attribute name="alt">
- <xsl:choose>
- <xsl:when test="../svg:desc">
- <xsl:value-of select="../svg:desc"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>
+ <xsl:element name="p">
+ <xsl:apply-templates select="@draw:style-name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:call-template name="create-image-element">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="create-image-element">
+ <xsl:param name="globalData"/>
+
+ <xsl:element name="img">
+ <xsl:if test="../@svg:width or ../@svg:height">
+ <xsl:attribute name="style">
+ <xsl:if test="../@svg:height">
+ <xsl:text>height:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="../@svg:height"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ <xsl:if test="../@svg:width">
+ <xsl:text>width:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="../@svg:width"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="alt">
+ <xsl:choose>
+ <xsl:when test="../svg:desc">
+ <xsl:value-of select="../svg:desc"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
Accessibility Warning:
No alternate text ('svg:desc' element) set for
image '<xsl:value-of select="@xlink:href"/>'!</xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
- <xsl:attribute name="src">
- <xsl:call-template name="create-href">
- <xsl:with-param name="href" select="@xlink:href"/>
- </xsl:call-template>
- </xsl:attribute>
+ <xsl:attribute name="src">
+ <xsl:call-template name="create-href">
+ <xsl:with-param name="href" select="@xlink:href"/>
+ </xsl:call-template>
+ </xsl:attribute>
<!-- style interpretation only, as no subelements are allowed for img in XHTML -->
- <xsl:apply-templates select="@draw:style-name">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:element>
- </xsl:template>
+ <xsl:apply-templates select="@draw:style-name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
<!-- ************ -->
<!-- *** list *** -->
@@ -1487,212 +1523,212 @@
Further details beyond text:list-list..
-->
- <xsl:key name="listStyles" match=" /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style | /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style" use="@style:name"/>
+ <xsl:key name="listStyles" match=" /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style | /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style" use="@style:name"/>
<!--
A text list may only have text:list-item and text:list-header as children.
-->
- <xsl:template match="text:list">
- <xsl:param name="globalData"/>
- <xsl:param name="isListNumberingReset"/>
- <xsl:param name="isNextLevelNumberingReset"/>
- <xsl:param name="listLevel" select="1"/>
- <xsl:param name="listRestart" select="false()"/>
- <xsl:param name="itemLabel" select="''"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName" select="@text:style-name"/>
+ <xsl:template match="text:list">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="listLevel" select="1"/>
+ <xsl:param name="listRestart" select="false()"/>
+ <xsl:param name="itemLabel" select="''"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName" select="@text:style-name"/>
<!-- To choose list type - get the list style, with the same 'text:style-name' and same 'text:level' >-->
- <xsl:variable name="listStyleRTF">
- <xsl:variable name="listStyleInContentFile" select="key('listStyles', $listStyleName)"/>
- <xsl:choose>
- <xsl:when test="$listStyleInContentFile">
- <xsl:copy-of select="$listStyleInContentFile"/>
- </xsl:when>
- <xsl:when test="$globalData/office:styles/text:list-style[@style:name = $listStyleName]">
- <xsl:copy-of select="$globalData/office:styles/text:list-style[@style:name = $listStyleName]"/>
- </xsl:when>
- <xsl:when test="$globalData/office:styles/style:graphic-properties/text:list-style[@style:name = $listStyleName]">
- <xsl:copy-of select="$globalData/office:styles/style:graphic-properties/text:list-style[@style:name = $listStyleName]"/>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="function-available('common:node-set')">
- <xsl:call-template name="create-list-type">
- <xsl:with-param name="listStyle" select="common:node-set($listStyleRTF)" />
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listRestart" select="$listRestart"/>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="listStyleName" select="$listStyleName" />
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="function-available('xalan:nodeset')">
- <xsl:call-template name="create-list-type">
- <xsl:with-param name="listStyle" select="xalan:nodeset($listStyleRTF)" />
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listRestart" select="$listRestart"/>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="listStyleName" select="$listStyleName" />
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="function-available('xt:node-set')">
- <xsl:call-template name="create-list-type">
- <xsl:with-param name="listStyle" select="xt:node-set($listStyleRTF)" />
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listRestart" select="$listRestart"/>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="listStyleName" select="$listStyleName" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="create-list-type">
- <xsl:param name="globalData"/>
- <xsl:param name="isListNumberingReset"/>
- <xsl:param name="isNextLevelNumberingReset"/>
- <xsl:param name="listLevel" />
- <xsl:param name="listRestart" />
- <xsl:param name="itemLabel"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName" />
-
- <!-- $globalData/styles-file/*/office:styles/ -->
- <xsl:variable name="listLevelStyle" select="$listStyle/*/*[@text:level = number($listLevel)]"/>
- <xsl:variable name="listIndent">
- <xsl:call-template name="getListIndent">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="firstPara" select="*[1]/*[name() = 'text:p' or name() = 'text:h'][1]"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="isEmptyList" select="not(*[1]/*[name() = 'text:h' or name() = 'text:p' or name() = 'text:name'])"/>
- <xsl:variable name="listType">
- <xsl:choose>
+ <xsl:variable name="listStyleRTF">
+ <xsl:variable name="listStyleInContentFile" select="key('listStyles', $listStyleName)"/>
+ <xsl:choose>
+ <xsl:when test="$listStyleInContentFile">
+ <xsl:copy-of select="$listStyleInContentFile"/>
+ </xsl:when>
+ <xsl:when test="$globalData/office:styles/text:list-style[@style:name = $listStyleName]">
+ <xsl:copy-of select="$globalData/office:styles/text:list-style[@style:name = $listStyleName]"/>
+ </xsl:when>
+ <xsl:when test="$globalData/office:styles/style:graphic-properties/text:list-style[@style:name = $listStyleName]">
+ <xsl:copy-of select="$globalData/office:styles/style:graphic-properties/text:list-style[@style:name = $listStyleName]"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-list-type">
+ <xsl:with-param name="listStyle" select="common:node-set($listStyleRTF)" />
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-list-type">
+ <xsl:with-param name="listStyle" select="xalan:nodeset($listStyleRTF)" />
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-list-type">
+ <xsl:with-param name="listStyle" select="xt:node-set($listStyleRTF)" />
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="create-list-type">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="listLevel" />
+ <xsl:param name="listRestart" />
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName" />
+
+ <!-- $globalData/styles-file/*/office:styles/ -->
+ <xsl:variable name="listLevelStyle" select="$listStyle/*/*[@text:level = number($listLevel)]"/>
+ <xsl:variable name="listIndent">
+ <xsl:call-template name="getListIndent">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="firstPara" select="*[1]/*[name() = 'text:p' or name() = 'text:h'][1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="isEmptyList" select="not(*[1]/*[name() = 'text:h' or name() = 'text:p' or name() = 'text:name'])"/>
+ <xsl:variable name="listType">
+ <xsl:choose>
<!-- ordered list -->
- <xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
- <xsl:text>ol</xsl:text>
- </xsl:when>
+ <xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
+ <xsl:text>ol</xsl:text>
+ </xsl:when>
<!-- unordered list (bullet or image) -->
- <xsl:otherwise>
- <xsl:text>ul</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:element name="{$listType}">
- <xsl:apply-templates select="*[1]" mode="listItemSibling">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
- <xsl:with-param name="isListNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset">
- <xsl:choose>
- <xsl:when test="$isListNumberingReset">
- <xsl:value-of select="true()"/>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:otherwise>
+ <xsl:text>ul</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$listType}">
+ <xsl:apply-templates select="*[1]" mode="listItemSibling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset">
+ <xsl:choose>
+ <xsl:when test="$isListNumberingReset">
+ <xsl:value-of select="true()"/>
+ </xsl:when>
+ <xsl:otherwise>
<!-- A list is empty if a text:list does not have a text:list-header or text:list-item (wildcard as only those can exist beyond a text:list), which contains a text:h or text:p -->
- <xsl:value-of select="not($isEmptyList)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listRestart">
- <xsl:choose>
- <xsl:when test="$listRestart">
- <xsl:value-of select="$listRestart"/>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:value-of select="not($isEmptyList)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listRestart">
+ <xsl:choose>
+ <xsl:when test="$listRestart">
+ <xsl:value-of select="$listRestart"/>
+ </xsl:when>
+ <xsl:otherwise>
<!-- descdendants restart their list numbering, when an ancestor is not empty -->
- <xsl:value-of select="not($isEmptyList)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="minLabelDist">
- <xsl:choose>
- <xsl:when test="$listLevelStyle/*/@text:min-label-distance">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-distance"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="minLabelWidth">
- <xsl:choose>
- <xsl:when test="$listLevelStyle/*/@text:min-label-width">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-width"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:apply-templates>
- </xsl:element>
- </xsl:template>
+ <xsl:value-of select="not($isEmptyList)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="minLabelDist">
+ <xsl:choose>
+ <xsl:when test="$listLevelStyle/*/@text:min-label-distance">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-distance"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="minLabelWidth">
+ <xsl:choose>
+ <xsl:when test="$listLevelStyle/*/@text:min-label-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
<!-- See comment before text:list template -->
- <xsl:template name="getListIndent">
- <xsl:param name="globalData"/>
- <xsl:param name="listLevelStyle"/>
+ <xsl:template name="getListIndent">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLevelStyle"/>
<!-- The first paragraph of the list item (heading is special paragraph in ODF) -->
- <xsl:param name="firstPara" />
+ <xsl:param name="firstPara" />
<!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
- <xsl:variable name="firstParaStyles" select="$globalData/all-styles/style[@style:name = $firstPara/@text:style-name]/final-properties"/>
+ <xsl:variable name="firstParaStyles" select="$globalData/all-styles/style[@style:name = $firstPara/@text:style-name]/final-properties"/>
<!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
- <xsl:variable name="firstParaLeftMargin">
- <xsl:choose>
- <xsl:when test="contains($firstParaStyles, 'margin-left:')">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($firstParaStyles, 'margin-left:'), ';'))"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="spaceBefore">
- <xsl:choose>
- <xsl:when test="$listLevelStyle/*/@text:space-before">
- <xsl:call-template name="convert2cm">
- <xsl:with-param name="value" select="$listLevelStyle/*/@text:space-before"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
+ <xsl:variable name="firstParaLeftMargin">
+ <xsl:choose>
+ <xsl:when test="contains($firstParaStyles, 'margin-left:')">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($firstParaStyles, 'margin-left:'), ';'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="spaceBefore">
+ <xsl:choose>
+ <xsl:when test="$listLevelStyle/*/@text:space-before">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$listLevelStyle/*/@text:space-before"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<!-- Only if the left-margin of the first paragraph is positive the sum
text:space-before and fo:left-margin is taken as list indent -->
- <xsl:choose>
- <xsl:when test="$firstParaLeftMargin &gt; 0">
- <xsl:value-of select="$firstParaLeftMargin + $spaceBefore"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$spaceBefore"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+ <xsl:choose>
+ <xsl:when test="$firstParaLeftMargin &gt; 0">
+ <xsl:value-of select="$firstParaLeftMargin + $spaceBefore"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$spaceBefore"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
<!-- ****************** -->
<!-- *** list item *** -->
@@ -1714,105 +1750,105 @@
only used, when text does not fit in text:min-label-width (ignored)
-->
- <xsl:template match="text:list-item | text:list-header" mode="listItemSibling">
- <xsl:param name="globalData"/>
- <xsl:param name="firstitemLabelWidth"/>
- <xsl:param name="isEmptyList" select="not(*[name() = 'text:h' or name() = 'text:p' or name() = 'text:name'])"/>
- <xsl:param name="isListNumberingReset"/>
- <xsl:param name="isNextLevelNumberingReset"/>
- <xsl:param name="itemNumber"/>
- <xsl:param name="itemLabel"/>
- <xsl:param name="listLevel"/>
- <xsl:param name="listLevelStyle"/>
- <xsl:param name="listRestart"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName"/>
- <xsl:param name="minLabelDist"/>
- <xsl:param name="minLabelWidth"/>
- <xsl:param name="listIndent" />
-
-
- <xsl:variable name="listIndentNew">
- <xsl:choose>
- <xsl:when test="$listIndent">
- <xsl:value-of select="$listIndent"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="getListIndent">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="firstPara" select="*[name() = 'text:p' or name() = 'text:h'][1]" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="itemNumberNew">
- <xsl:if test="$listStyle/text:list-style/text:list-level-style-number">
- <xsl:choose>
- <xsl:when test="$isEmptyList">
+ <xsl:template match="text:list-item | text:list-header" mode="listItemSibling">
+ <xsl:param name="globalData"/>
+ <xsl:param name="firstitemLabelWidth"/>
+ <xsl:param name="isEmptyList" select="not(*[name() = 'text:h' or name() = 'text:p' or name() = 'text:name'])"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelDist"/>
+ <xsl:param name="minLabelWidth"/>
+ <xsl:param name="listIndent" />
+
+
+ <xsl:variable name="listIndentNew">
+ <xsl:choose>
+ <xsl:when test="$listIndent">
+ <xsl:value-of select="$listIndent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getListIndent">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="firstPara" select="*[name() = 'text:p' or name() = 'text:h'][1]" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="itemNumberNew">
+ <xsl:if test="$listStyle/text:list-style/text:list-level-style-number">
+ <xsl:choose>
+ <xsl:when test="$isEmptyList">
<!-- An empty list item (no text:h/text:p as child), will not count as item and does not increment the count. -->
- <xsl:variable name="tempItemNumber">
- <xsl:choose>
+ <xsl:variable name="tempItemNumber">
+ <xsl:choose>
<!-- siblings will be incremented by one -->
- <xsl:when test="$itemNumber">
- <xsl:value-of select="$itemNumber + 1"/>
- </xsl:when>
+ <xsl:when test="$itemNumber">
+ <xsl:value-of select="$itemNumber + 1"/>
+ </xsl:when>
<!-- if a higher list level had content the numbering starts with 1 -->
- <xsl:when test="$isListNumberingReset and $listLevel &gt; 1">
- <xsl:value-of select="1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="getItemNumber">
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
+ <xsl:when test="$isListNumberingReset and $listLevel &gt; 1">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getItemNumber">
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
<!-- in case the empty list-item is the first list-item in document -->
- <xsl:when test="$tempItemNumber = 1">
- <xsl:value-of select="1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$tempItemNumber - 1"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="@text:start-value">
- <xsl:value-of select="@text:start-value"/>
- </xsl:when>
+ <xsl:when test="$tempItemNumber = 1">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tempItemNumber - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@text:start-value">
+ <xsl:value-of select="@text:start-value"/>
+ </xsl:when>
<!-- text:start-value from list level style will only be taken on the first list-item of a list -->
- <xsl:when test="$listLevelStyle/@text:start-value and count(preceding-sibling::text:list-item) = 0">
- <xsl:value-of select="$listLevelStyle/@text:start-value"/>
- </xsl:when>
+ <xsl:when test="$listLevelStyle/@text:start-value and count(preceding-sibling::text:list-item) = 0">
+ <xsl:value-of select="$listLevelStyle/@text:start-value"/>
+ </xsl:when>
<!-- siblings will be incremented by one -->
- <xsl:when test="$itemNumber">
- <xsl:value-of select="$itemNumber + 1"/>
- </xsl:when>
+ <xsl:when test="$itemNumber">
+ <xsl:value-of select="$itemNumber + 1"/>
+ </xsl:when>
<!-- if a higher list level had content the numbering starts with 1 -->
- <xsl:when test="$isListNumberingReset and $listLevel &gt; 1">
- <xsl:value-of select="1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="getItemNumber">
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="itemLabelNew">
- <xsl:if test="$listStyle/text:list-style/text:list-level-style-number">
+ <xsl:when test="$isListNumberingReset and $listLevel &gt; 1">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getItemNumber">
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="itemLabelNew">
+ <xsl:if test="$listStyle/text:list-style/text:list-level-style-number">
<!--
A numbered label (e.g. 2.C.III) is created for every text:list-item/header.
Above list levels are listed in the label, if the list-style requires this. Levels are separated by a '.'
@@ -1821,1017 +1857,1016 @@
The prefix/suffix (as well list level dependent) comes before and after the complete label (after truncation)
-->
<!-- Numbered label will be generated -->
- <xsl:call-template name="createItemLabel">
- <xsl:with-param name="itemNumber" select="$itemNumberNew"/>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="listLevelsToDisplay">
- <xsl:variable name="display" select="$listLevelStyle/@text:display-levels"/>
- <xsl:choose>
- <xsl:when test="$display">
- <xsl:value-of select="$display"/>
- </xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
- <xsl:element name="li">
- <xsl:choose>
- <xsl:when test="$isEmptyList">
- <xsl:apply-templates>
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="itemLabel" select="$itemLabelNew"/>
- <xsl:with-param name="listLevel" select="$listLevel + 1"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:call-template name="createItemLabel">
+ <xsl:with-param name="itemNumber" select="$itemNumberNew"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevelsToDisplay">
+ <xsl:variable name="display" select="$listLevelStyle/@text:display-levels"/>
+ <xsl:choose>
+ <xsl:when test="$display">
+ <xsl:value-of select="$display"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:element name="li">
+ <xsl:choose>
+ <xsl:when test="$isEmptyList">
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="itemLabel" select="$itemLabelNew"/>
+ <xsl:with-param name="listLevel" select="$listLevel + 1"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
<!-- Possible following children are text:h, text:p, list:text, text:soft-page-break -->
- <xsl:apply-templates mode="list-item-children" select="*[1]">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:apply-templates mode="list-item-children" select="*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
<!-- The new created label is given to the children -->
- <xsl:with-param name="itemLabel" select="$itemLabelNew"/>
- <xsl:with-param name="listLabelElement">
- <xsl:choose>
- <xsl:when test="name() = 'text:list-header'"/>
- <xsl:otherwise>
- <xsl:variable name="listLabelWidth">
- <xsl:choose>
- <xsl:when test="$minLabelWidth &gt; $minLabelDist">
- <xsl:value-of select="$minLabelWidth"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$minLabelDist"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
+ <xsl:with-param name="itemLabel" select="$itemLabelNew"/>
+ <xsl:with-param name="listLabelElement">
+ <xsl:choose>
+ <xsl:when test="name() = 'text:list-header'"/>
+ <xsl:otherwise>
+ <xsl:variable name="listLabelWidth">
+ <xsl:choose>
+ <xsl:when test="$minLabelWidth &gt; $minLabelDist">
+ <xsl:value-of select="$minLabelWidth"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$minLabelDist"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<!-- Numbering is being done by this transformation creating a HTML span representing the number label
The html:span represents the list item/header label (e.g. 1.A.III)
As the html:span is usually a inline element is formated by CSS as block element to use width upon it,
to disable the caridge return float:left is used and later neglected -->
- <xsl:element name="span">
- <xsl:if test="$listLevelStyle/@text:style-name">
- <xsl:attribute name="class">
- <xsl:value-of select="$listLevelStyle/@text:style-name"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:attribute name="style">
- <xsl:text>display:block;float:</xsl:text>
+ <xsl:element name="span">
+ <xsl:if test="$listLevelStyle/@text:style-name">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$listLevelStyle/@text:style-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:text>display:block;float:</xsl:text>
<!-- 2DO: Svante - copy this functionality for other used margin:left (in western country 'left') -->
- <xsl:call-template name="getOppositeWritingDirection">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
- </xsl:call-template>
- <xsl:text>;min-width:</xsl:text>
- <xsl:value-of select="$listLabelWidth"/>
- <xsl:text>cm</xsl:text>
- </xsl:attribute>
- <xsl:variable name="labelContent">
- <xsl:choose>
- <xsl:when test="text:number">
- <xsl:apply-templates select="text:number" mode="listnumber"/>
- </xsl:when>
- <xsl:when test="name($listLevelStyle) = 'text:list-level-style-bullet'">
- <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
- <xsl:value-of select="$listLevelStyle/@text:bullet-char"/>
- <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
- </xsl:when>
- <xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
- <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
- <xsl:value-of select="$itemLabelNew"/>
- <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:call-template name="getOppositeWritingDirection">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
+ </xsl:call-template>
+ <xsl:text>;min-width:</xsl:text>
+ <xsl:value-of select="$listLabelWidth"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:variable name="labelContent">
+ <xsl:choose>
+ <xsl:when test="text:number">
+ <xsl:apply-templates select="text:number" mode="listnumber"/>
+ </xsl:when>
+ <xsl:when test="name($listLevelStyle) = 'text:list-level-style-bullet'">
+ <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
+ <xsl:value-of select="$listLevelStyle/@text:bullet-char"/>
+ <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
+ </xsl:when>
+ <xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
+ <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
+ <xsl:value-of select="$itemLabelNew"/>
+ <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
+ </xsl:when>
+ <xsl:otherwise>
<!-- Listing with image as bullets, taken from the list style's href -->
- <xsl:value-of select="$listLevelStyle/@xlink:href"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- Some browsers have problem with stand-alone elements (e.g. <span/>)
- Therefore a comment is being inserted into an empty label -->
- <xsl:choose>
- <xsl:when test="$labelContent != ''">
- <xsl:value-of select="$labelContent"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:comment>&#160;</xsl:comment>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="listLabelEmptyElement">
- <xsl:variable name="listLabelWidth">
- <xsl:choose>
- <xsl:when test="$minLabelWidth &gt; $minLabelDist">
- <xsl:value-of select="$minLabelWidth"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$minLabelDist"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="span">
- <xsl:if test="$listLevelStyle/@text:style-name">
- <xsl:attribute name="class">
- <xsl:value-of select="$listLevelStyle/@text:style-name"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:attribute name="style">
- <xsl:text>display:block;float:</xsl:text>
- <xsl:call-template name="getOppositeWritingDirection">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
- </xsl:call-template>
- <xsl:text>;min-width:</xsl:text>
- <xsl:value-of select="$listLabelWidth"/>
- <xsl:text>cm</xsl:text>
- </xsl:attribute>
- <xsl:comment>&#160;</xsl:comment>
- </xsl:element>
- </xsl:with-param>
- <xsl:with-param name="listLevel" select="$listLevel + 1"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listRestart" select="$listRestart"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="listIndent" select="$listIndentNew"/>
- <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- <xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="itemNumber" select="$itemNumberNew"/>
- <xsl:with-param name="listIndent">
- <xsl:choose>
- <xsl:when test="not($isEmptyList)">
- <xsl:value-of select="$listIndentNew"/>
- </xsl:when>
- </xsl:choose>
- </xsl:with-param>
+ <xsl:value-of select="$listLevelStyle/@xlink:href"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Some browsers have problem with stand-alone elements (e.g. <span/>)
+ Therefore a comment is being inserted into an empty label -->
+ <xsl:choose>
+ <xsl:when test="$labelContent != ''">
+ <xsl:value-of select="$labelContent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>&#160;</xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="listLabelEmptyElement">
+ <xsl:variable name="listLabelWidth">
+ <xsl:choose>
+ <xsl:when test="$minLabelWidth &gt; $minLabelDist">
+ <xsl:value-of select="$minLabelWidth"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$minLabelDist"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="span">
+ <xsl:if test="$listLevelStyle/@text:style-name">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$listLevelStyle/@text:style-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:text>display:block;float:</xsl:text>
+ <xsl:call-template name="getOppositeWritingDirection">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
+ </xsl:call-template>
+ <xsl:text>;min-width:</xsl:text>
+ <xsl:value-of select="$listLabelWidth"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:comment>&#160;</xsl:comment>
+ </xsl:element>
+ </xsl:with-param>
+ <xsl:with-param name="listLevel" select="$listLevel + 1"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndentNew"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemNumber" select="$itemNumberNew"/>
+ <xsl:with-param name="listIndent">
+ <xsl:choose>
+ <xsl:when test="not($isEmptyList)">
+ <xsl:value-of select="$listIndentNew"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
<!-- Receives the same parent label -->
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="minLabelDist" select="$minLabelDist"/>
- <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template name="getOppositeWritingDirection">
- <xsl:param name="globalData"/>
- <xsl:param name="paraStyleName"/>
-
- <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paraStyleName]/final-properties"/>
-
- <xsl:choose>
- <xsl:when test="contains($imageParagraphStyle, 'writing-mode:')">
- <xsl:choose>
- <xsl:when test="contains(substring-before(substring-after($imageParagraphStyle, 'writing-mode:'), ';'), 'rl')">right</xsl:when>
- <xsl:otherwise>left</xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>left</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="text:number" mode="listnumber">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="text:number" mode="list-item-children">
- <xsl:param name="globalData"/>
- <xsl:param name="listLabelElement"/>
- <xsl:param name="listLabelEmptyElement"/>
- <xsl:param name="isEmptyList"/>
- <xsl:param name="isListNumberingReset"/>
- <xsl:param name="isNextLevelNumberingReset"/>
- <xsl:param name="itemLabel"/>
- <xsl:param name="itemNumber"/>
- <xsl:param name="listIndent"/>
- <xsl:param name="listLevel"/>
- <xsl:param name="listLevelStyle" />
- <xsl:param name="listRestart"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName"/>
- <xsl:param name="minLabelWidth"/>
-
- <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="listLabelElement" select="$listLabelElement"/>
- <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listRestart" select="$listRestart"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
- <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
- </xsl:apply-templates>
- </xsl:template>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="minLabelDist" select="$minLabelDist"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template name="getOppositeWritingDirection">
+ <xsl:param name="globalData"/>
+ <xsl:param name="paraStyleName"/>
+
+ <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paraStyleName]/final-properties"/>
+
+ <xsl:choose>
+ <xsl:when test="contains($imageParagraphStyle, 'writing-mode:')">
+ <xsl:choose>
+ <xsl:when test="contains(substring-before(substring-after($imageParagraphStyle, 'writing-mode:'), ';'), 'rl')">right</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="text:number" mode="listnumber">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="text:number" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLabelElement"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle" />
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLabelElement" select="$listLabelElement"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
<!-- Each key element holds the set of all text:list-item/text:list-header of a certain level and a certain style -->
- <xsl:key name="getListItemsByLevelAndStyle" use="concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)" match="text:list-item | text:list-header"/>
+ <xsl:key name="getListItemsByLevelAndStyle" use="concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)" match="text:list-item | text:list-header"/>
<!-- Each key element holds the set of all text:list-item/text:list-header of a certain style -->
- <xsl:key name="getListItemsByStyle" use="ancestor::text:list/@text:style-name" match="text:list-item | text:list-header"/>
+ <xsl:key name="getListItemsByStyle" use="ancestor::text:list/@text:style-name" match="text:list-item | text:list-header"/>
<!-- The Numbering start value (or offset from regular counteing) is used at the first item of offset,
but have to be reused on following item/headers with no text:start-value -->
- <xsl:template name="getItemNumber">
- <xsl:param name="listLevel"/>
- <xsl:param name="listLevelStyle"/>
- <xsl:param name="listStyleName"/>
- <xsl:param name="listStyle"/>
-
- <xsl:call-template name="countListItemTillStartValue">
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="preceding::text:list-item[generate-id(key('getListItemsByLevelAndStyle', concat($listLevel, $listStyleName))) = generate-id(key('getListItemsByLevelAndStyle', concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)))]"/>
-
- <xsl:with-param name="precedingListItemsOfSameStyle" select="preceding::text:list-item[generate-id(key('getListItemsByStyle', $listStyleName)) = generate-id(key('getListItemsByStyle', ancestor::text:list/@text:style-name))]"/>
- </xsl:call-template>
- </xsl:template>
+ <xsl:template name="getItemNumber">
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="listStyle"/>
+
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="preceding::text:list-item[generate-id(key('getListItemsByLevelAndStyle', concat($listLevel, $listStyleName))) = generate-id(key('getListItemsByLevelAndStyle', concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)))]"/>
+
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="preceding::text:list-item[generate-id(key('getListItemsByStyle', $listStyleName)) = generate-id(key('getListItemsByStyle', ancestor::text:list/@text:style-name))]"/>
+ </xsl:call-template>
+ </xsl:template>
<!-- When there is a text:start-value the last have to be found and added to the number -->
- <xsl:template name="countListItemTillStartValue">
- <xsl:param name="IteratorSameLevelAndStyle" select="1"/>
- <xsl:param name="IteratorSameStyle" select="1"/>
- <xsl:param name="itemNumber" select="1"/>
- <xsl:param name="listLevel"/>
- <xsl:param name="listLevelStyle"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName"/>
- <xsl:param name="precedingListItemsOfSameLevelAndStyle" />
- <xsl:param name="precedingListItemsOfSameLevelAndStyleCount" select="count($precedingListItemsOfSameLevelAndStyle)"/>
- <xsl:param name="precedingListItemsOfSameStyle" />
- <xsl:param name="precedingListItemsOfSameStyleCount" select="count($precedingListItemsOfSameStyle)"/>
+ <xsl:template name="countListItemTillStartValue">
+ <xsl:param name="IteratorSameLevelAndStyle" select="1"/>
+ <xsl:param name="IteratorSameStyle" select="1"/>
+ <xsl:param name="itemNumber" select="1"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="precedingListItemsOfSameLevelAndStyle" />
+ <xsl:param name="precedingListItemsOfSameLevelAndStyleCount" select="count($precedingListItemsOfSameLevelAndStyle)"/>
+ <xsl:param name="precedingListItemsOfSameStyle" />
+ <xsl:param name="precedingListItemsOfSameStyleCount" select="count($precedingListItemsOfSameStyle)"/>
<!-- E.g.: If a list level 2 number is searched, a level 3 with content found with only a level 1 parent with content,
the level 3 gets a 'pseudoLevel' -->
- <xsl:param name="pseudoLevel" select="0" />
+ <xsl:param name="pseudoLevel" select="0" />
<!-- set the next of preceding list items. Starting from the current to the next previous text:list-item -->
- <xsl:variable name="precedingListItemOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle[$precedingListItemsOfSameLevelAndStyleCount - $IteratorSameLevelAndStyle + 1]"/>
- <xsl:variable name="precedingListItemOfSameStyle" select="$precedingListItemsOfSameStyle[$precedingListItemsOfSameStyleCount - $IteratorSameStyle + 1]"/>
- <xsl:choose>
- <xsl:when test="($precedingListItemOfSameStyle and $precedingListItemOfSameLevelAndStyle) or ($precedingListItemOfSameStyle and $listStyle/text:list-style/@text:consecutive-numbering)">
- <xsl:for-each select="$precedingListItemOfSameStyle">
- <xsl:choose>
+ <xsl:variable name="precedingListItemOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle[$precedingListItemsOfSameLevelAndStyleCount - $IteratorSameLevelAndStyle + 1]"/>
+ <xsl:variable name="precedingListItemOfSameStyle" select="$precedingListItemsOfSameStyle[$precedingListItemsOfSameStyleCount - $IteratorSameStyle + 1]"/>
+ <xsl:choose>
+ <xsl:when test="($precedingListItemOfSameStyle and $precedingListItemOfSameLevelAndStyle) or ($precedingListItemOfSameStyle and $listStyle/text:list-style/@text:consecutive-numbering)">
+ <xsl:for-each select="$precedingListItemOfSameStyle">
+ <xsl:choose>
<!-- if it is a higher list level element -->
- <xsl:when test="$listStyle/text:list-style/@text:consecutive-numbering">
-
- <xsl:call-template name="countListItem">
- <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
- <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
- <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
- <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
- <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:when test="$listStyle/text:list-style/@text:consecutive-numbering">
+
+ <xsl:call-template name="countListItem">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
<!-- NOT CONSECUTIVE NUMBERING -->
- <xsl:variable name="currentListLevel" select="count(ancestor::text:list)"/>
- <xsl:choose>
+ <xsl:variable name="currentListLevel" select="count(ancestor::text:list)"/>
+ <xsl:choose>
<!-- IF IT IS A HIGHER LIST LEVEL ELEMENT -->
- <xsl:when test="$currentListLevel &lt; $listLevel">
- <xsl:choose>
+ <xsl:when test="$currentListLevel &lt; $listLevel">
+ <xsl:choose>
<!-- if it has content the counting is ended -->
- <xsl:when test="*[name() = 'text:h' or name() = 'text:p']">
+ <xsl:when test="*[name() = 'text:h' or name() = 'text:p']">
<!-- 2DO: Perhaps the children still have to be processed -->
- <xsl:value-of select="$itemNumber + $pseudoLevel"/>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:value-of select="$itemNumber + $pseudoLevel"/>
+ </xsl:when>
+ <xsl:otherwise>
<!-- if it is empty the counting continues -->
- <xsl:call-template name="countListItemTillStartValue">
- <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
- <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
- <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
- <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
- <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
<!-- IF IT IS A LIST LEVEL ELEMENT OF THE COUNTING LEVEL -->
- <xsl:when test="$currentListLevel = $listLevel">
- <xsl:call-template name="countListItem">
- <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
- <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
- <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
- <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
- <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:when test="$currentListLevel = $listLevel">
+ <xsl:call-template name="countListItem">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
<!-- list item below the current level does not count -->
- <xsl:call-template name="countListItemTillStartValue">
- <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
- <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
- <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
- <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
- <xsl:with-param name="pseudoLevel">
- <xsl:choose>
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel">
+ <xsl:choose>
<!-- empty list item does not count -->
- <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
- <xsl:value-of select="$pseudoLevel"/>
- </xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$itemNumber"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="countListItem">
- <xsl:param name="IteratorSameLevelAndStyle"/>
- <xsl:param name="IteratorSameStyle"/>
- <xsl:param name="itemNumber"/>
- <xsl:param name="listLevel"/>
- <xsl:param name="listLevelStyle"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName"/>
- <xsl:param name="precedingListItemsOfSameLevelAndStyle"/>
- <xsl:param name="precedingListItemsOfSameLevelAndStyleCount"/>
- <xsl:param name="precedingListItemsOfSameStyle"/>
- <xsl:param name="precedingListItemsOfSameStyleCount"/>
- <xsl:param name="pseudoLevel" />
-
- <xsl:choose>
- <xsl:when test="@text:start-value">
- <xsl:choose>
- <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <xsl:value-of select="$pseudoLevel"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$itemNumber"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="countListItem">
+ <xsl:param name="IteratorSameLevelAndStyle"/>
+ <xsl:param name="IteratorSameStyle"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:param name="precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:param name="precedingListItemsOfSameStyle"/>
+ <xsl:param name="precedingListItemsOfSameStyleCount"/>
+ <xsl:param name="pseudoLevel" />
+
+ <xsl:choose>
+ <xsl:when test="@text:start-value">
+ <xsl:choose>
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
<!-- empty list item does not count -->
- <xsl:call-template name="countListItemTillStartValue">
- <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
- <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
- <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
- <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
- <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$itemNumber + @text:start-value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$listLevelStyle/@text:start-value">
- <xsl:choose>
- <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$itemNumber + @text:start-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$listLevelStyle/@text:start-value">
+ <xsl:choose>
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
<!-- empty list item does not count -->
- <xsl:call-template name="countListItemTillStartValue">
- <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
- <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
- <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
- <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
- <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$itemNumber + $listLevelStyle/@text:start-value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$itemNumber + $listLevelStyle/@text:start-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
<!-- empty list item does not count -->
- <xsl:call-template name="countListItemTillStartValue">
- <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
- <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
- <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
- <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
- <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
<!-- count on till you find a start-value or the end is reached -->
- <xsl:call-template name="countListItemTillStartValue">
- <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
- <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
- <xsl:with-param name="itemNumber" select="$itemNumber + 1"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
- <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
- <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
- <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
- <xsl:with-param name="pseudoLevel" select="0" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber + 1"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="0" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
<!-- Creates the list label containing the number, which is separated by '.' between the levels.
Depending on the levels to display (listLevelsToDisplay) -->
- <xsl:template name="createItemLabel">
- <xsl:param name="itemLabel" select="''"/>
- <xsl:param name="itemNumber" />
- <xsl:param name="listLevel" />
- <xsl:param name="listLevelStyle" />
- <xsl:param name="listLevelsToDisplay" />
-
- <xsl:choose>
- <xsl:when test="$listLevelsToDisplay &lt; $listLevel">
- <xsl:call-template name="truncLabel">
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="itemNumber" select="$itemNumber" />
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle" />
- <xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="numberedSymbol">
- <xsl:comment>&#160;</xsl:comment>
- <!-- only give out a number when number format is not empty -->
- <xsl:if test="$listLevelStyle/@style:num-format != ''">
- <xsl:number value="$itemNumber" format="{$listLevelStyle/@style:num-format}"/>
- </xsl:if>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$listLevelsToDisplay != 1">
- <xsl:value-of select="concat($itemLabel, '.' , $numberedSymbol)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$numberedSymbol"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="truncLabel">
- <xsl:param name="itemLabel" />
- <xsl:param name="itemNumber" />
- <xsl:param name="listLevel" />
- <xsl:param name="listLevelStyle" />
- <xsl:param name="listLevelsToDisplay" />
- <xsl:param name="listStyle" />
- <xsl:param name="listStyleName" />
-
- <xsl:call-template name="createItemLabel">
- <xsl:with-param name="itemLabel">
- <xsl:if test="contains($itemLabel, '.')">
- <xsl:value-of select="substring-after($itemLabel, '.')"/>
- </xsl:if>
- </xsl:with-param>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLevel" select="$listLevel - 1"/>
- <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
- <xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
- </xsl:call-template>
- </xsl:template>
-
-
- <xsl:template match="text:p" mode="list-item-children">
- <xsl:param name="globalData"/>
- <xsl:param name="listLabelElement"/>
- <xsl:param name="listLabelEmptyElement"/>
- <xsl:param name="isEmptyList"/>
- <xsl:param name="isListNumberingReset"/>
- <xsl:param name="isNextLevelNumberingReset"/>
- <xsl:param name="itemLabel"/>
- <xsl:param name="itemNumber"/>
- <xsl:param name="listIndent"/>
- <xsl:param name="listLevel"/>
- <xsl:param name="listRestart"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName"/>
- <xsl:param name="minLabelWidth"/>
-
- <!-- 2DO page alignment fix - PART1 -->
-
- <!-- xhtml:p may only contain inline elements.
- If there is one frame beyond, div must be used! -->
- <xsl:variable name="elementName">
- <xsl:choose>
- <xsl:when test="descendant::draw:frame[1] or descendant::text:p[1]">div</xsl:when>
- <xsl:otherwise>p</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$elementName}">
- <xsl:call-template name="create-list-style">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
- <xsl:with-param name="styleName" select="@text:style-name"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="$listLabelElement">
- <xsl:copy-of select="$listLabelElement"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="$listLabelEmptyElement"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates>
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="listIndent" select="$minLabelWidth"/>
- </xsl:apply-templates>
+ <xsl:template name="createItemLabel">
+ <xsl:param name="itemLabel" select="''"/>
+ <xsl:param name="itemNumber" />
+ <xsl:param name="listLevel" />
+ <xsl:param name="listLevelStyle" />
+ <xsl:param name="listLevelsToDisplay" />
+
+ <xsl:choose>
+ <xsl:when test="$listLevelsToDisplay &lt; $listLevel">
+ <xsl:call-template name="truncLabel">
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber" />
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle" />
+ <xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="numberedSymbol">
+ <xsl:comment>&#160;</xsl:comment>
+ <!-- only give out a number when number format is not empty -->
+ <xsl:if test="$listLevelStyle/@style:num-format != ''">
+ <xsl:number value="$itemNumber" format="{$listLevelStyle/@style:num-format}"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$listLevelsToDisplay != 1">
+ <xsl:value-of select="concat($itemLabel, '.' , $numberedSymbol)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$numberedSymbol"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="truncLabel">
+ <xsl:param name="itemLabel" />
+ <xsl:param name="itemNumber" />
+ <xsl:param name="listLevel" />
+ <xsl:param name="listLevelStyle" />
+ <xsl:param name="listLevelsToDisplay" />
+ <xsl:param name="listStyle" />
+ <xsl:param name="listStyleName" />
+
+ <xsl:call-template name="createItemLabel">
+ <xsl:with-param name="itemLabel">
+ <xsl:if test="contains($itemLabel, '.')">
+ <xsl:value-of select="substring-after($itemLabel, '.')"/>
+ </xsl:if>
+ </xsl:with-param>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel - 1"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <xsl:template match="text:p" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLabelElement"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <!-- 2DO page alignment fix - PART1 -->
+
+ <!-- xhtml:p may only contain inline elements.
+ If there is one frame beyond, div must be used! -->
+ <xsl:variable name="elementName">
+ <xsl:choose>
+ <xsl:when test="descendant::draw:frame[1] or descendant::text:p[1]">div</xsl:when>
+ <xsl:otherwise>p</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$elementName}">
+ <xsl:call-template name="create-list-style">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="$listLabelElement">
+ <xsl:copy-of select="$listLabelElement"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$listLabelEmptyElement"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$minLabelWidth"/>
+ </xsl:apply-templates>
<!-- this span disables the float necessary to bring two block elements on one line. It contains a space as IE6 bug workaround -->
- <span class="odfLiEnd"></span>
- <xsl:text>&#160;</xsl:text>
- </xsl:element>
-
- <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listRestart" select="$listRestart"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
- <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
- </xsl:apply-templates>
- </xsl:template>
+ <span class="odfLiEnd"></span>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:element>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
<!-- Neglecting the left margin behavior for headings for now -->
- <xsl:template match="text:h" mode="list-item-children">
- <xsl:param name="globalData"/>
- <xsl:param name="listLabelElement"/>
- <xsl:param name="listLabelEmptyElement"/>
- <xsl:param name="isEmptyList"/>
- <xsl:param name="isListNumberingReset"/>
- <xsl:param name="isNextLevelNumberingReset"/>
- <xsl:param name="itemLabel"/>
- <xsl:param name="itemNumber"/>
- <xsl:param name="listIndent"/>
- <xsl:param name="listLevel"/>
- <xsl:param name="listRestart"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName"/>
- <xsl:param name="minLabelWidth"/>
-
- <xsl:element name="h">
- <xsl:call-template name="create-list-style">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
- <xsl:with-param name="styleName" select="@text:style-name"/>
- </xsl:call-template>
- <xsl:variable name="title">
- <xsl:apply-templates mode="concatenate"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$listLabelElement">
- <xsl:copy-of select="$listLabelElement"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="$listLabelEmptyElement"/>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- REFERENCE HANDLING - ANCHOR -->
- <xsl:element namespace="{$namespace}" name="a">
- <xsl:attribute name="id">
- <xsl:value-of select="translate(concat('a_',$listLabelElement, '_', normalize-space($title)), '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
- </xsl:attribute>
- <xsl:apply-templates>
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="listIndent" select="$minLabelWidth"/>
- </xsl:apply-templates>
- </xsl:element>
+ <xsl:template match="text:h" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLabelElement"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <xsl:element name="h">
+ <xsl:call-template name="create-list-style">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ </xsl:call-template>
+ <xsl:variable name="title">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$listLabelElement">
+ <xsl:copy-of select="$listLabelElement"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$listLabelEmptyElement"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- REFERENCE HANDLING - ANCHOR -->
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="id">
+ <xsl:value-of select="translate(concat('a_',$listLabelElement, '_', normalize-space($title)), '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:element>
<!-- this span disables the float necessary to bring two block elements on one line. It contains a space as IE6 bug workaround -->
- <span class="odfLiEnd"></span>
- <xsl:text>&#160;</xsl:text>
- </xsl:element>
-
- <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listRestart" select="$listRestart"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
- <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
- </xsl:apply-templates>
- </xsl:template>
-
-
- <xsl:template match="*" mode="list-item-children">
- <xsl:param name="globalData"/>
- <xsl:param name="isEmptyList"/>
- <xsl:param name="listLabelEmptyElement"/>
- <xsl:param name="isListNumberingReset"/>
- <xsl:param name="isNextLevelNumberingReset"/>
- <xsl:param name="itemLabel"/>
- <xsl:param name="itemNumber"/>
- <xsl:param name="listIndent"/>
- <xsl:param name="listLevel"/>
- <xsl:param name="listRestart"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName"/>
- <xsl:param name="minLabelWidth"/>
-
- <xsl:apply-templates select="self::*">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listRestart" select="$listRestart"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- </xsl:apply-templates>
-
- <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listRestart" select="$listRestart"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
- <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match="*" mode="listItemSibling">
- <xsl:param name="globalData"/>
- <xsl:param name="isEmptyList"/>
- <xsl:param name="isListNumberingReset"/>
- <xsl:param name="isNextLevelNumberingReset"/>
- <xsl:param name="itemLabel"/>
- <xsl:param name="itemNumber"/>
- <xsl:param name="listIndent"/>
- <xsl:param name="listLevel"/>
- <xsl:param name="listRestart"/>
- <xsl:param name="listStyle"/>
- <xsl:param name="listStyleName"/>
-
- <xsl:apply-templates select="self::*">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
+ <span class="odfLiEnd"></span>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:element>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <xsl:template match="*" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <xsl:apply-templates select="self::*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="*" mode="listItemSibling">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+
+ <xsl:apply-templates select="self::*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
<!-- receives the same parent label, only with a different itemNumber -->
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- </xsl:apply-templates>
- <xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
- <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
- <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
- <xsl:with-param name="itemNumber" select="$itemNumber"/>
- <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
<!-- receives the same parent label, only with a different itemNumber -->
- <xsl:with-param name="itemLabel" select="$itemLabel"/>
- <xsl:with-param name="listLevel" select="$listLevel"/>
- <xsl:with-param name="listStyle" select="$listStyle"/>
- <xsl:with-param name="listStyleName" select="$listStyleName"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match="text()" mode="list-item-children">
- <xsl:value-of select="."/>
- </xsl:template>
-
-
- <xsl:template name="create-list-style">
- <xsl:param name="globalData"/>
- <xsl:param name="listIndent" select="0"/>
- <xsl:param name="styleName"/>
-
- <xsl:if test="$styleName">
- <xsl:attribute name="class">
- <xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:attribute name="style">
- <xsl:text>margin-</xsl:text>
- <xsl:call-template name="getOppositeWritingDirection">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
- </xsl:call-template>
- <xsl:text>:</xsl:text>
- <xsl:value-of select="$listIndent"/>
- <xsl:text>cm;</xsl:text>
- </xsl:attribute>
- </xsl:template>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="text()" mode="list-item-children">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+
+ <xsl:template name="create-list-style">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listIndent" select="0"/>
+ <xsl:param name="styleName"/>
+
+ <xsl:if test="$styleName">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:text>margin-</xsl:text>
+ <xsl:call-template name="getOppositeWritingDirection">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
+ </xsl:call-template>
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="$listIndent"/>
+ <xsl:text>cm;</xsl:text>
+ </xsl:attribute>
+ </xsl:template>
<!-- ********************************************** -->
<!-- *** Text Section (contains: draw:text-box) *** -->
<!-- ********************************************** -->
- <xsl:template match="text:section">
- <xsl:param name="globalData"/>
+ <xsl:template match="text:section">
+ <xsl:param name="globalData"/>
- <xsl:if test="not(contains(@text:display, 'none'))">
- <xsl:comment>Next 'div' was a 'text:section'.</xsl:comment>
- <xsl:element name="div">
- <xsl:call-template name="apply-styles-and-content">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:call-template>
- </xsl:element>
- </xsl:if>
- </xsl:template>
+ <xsl:if test="not(contains(@text:display, 'none'))">
+ <xsl:comment>Next 'div' was a 'text:section'.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
<!-- Hidden text dependend on Office variables:
The text is not shown, if condition is 'true'.
Implemented solely for conditons as '<VARIABLE>==0' or '<VARIABLE>==1'
-->
- <xsl:key match="text:variable-set" name="varSet" use="@text:name"/>
- <xsl:template match="text:hidden-text">
- <xsl:param name="globalData"/>
-
- <xsl:variable name="varName" select="substring-before(@text:condition, '==')"/>
- <xsl:variable name="varValue" select="substring-after(@text:condition, '==')"/>
- <xsl:choose>
- <xsl:when test="key('varSet', $varName)/@text:value != $varValue">
- <xsl:value-of select="@text:string-value"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:comment>
- <xsl:value-of select="$varName"/>
- <xsl:value-of select="@text:string-value"/>
- <xsl:value-of select="$varName"/>
- </xsl:comment>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name-->
- <xsl:param name="globalData"/>
-
- <xsl:attribute name="class">
- <xsl:value-of select="translate(., '.,;: %()[]/\+', '_____________')"/>
- </xsl:attribute>
- </xsl:template>
+ <xsl:key match="text:variable-set" name="varSet" use="@text:name"/>
+ <xsl:template match="text:hidden-text">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="varName" select="substring-before(@text:condition, '==')"/>
+ <xsl:variable name="varValue" select="substring-after(@text:condition, '==')"/>
+ <xsl:choose>
+ <xsl:when test="key('varSet', $varName)/@text:value != $varValue">
+ <xsl:value-of select="@text:string-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>
+ <xsl:value-of select="$varName"/>
+ <xsl:value-of select="@text:string-value"/>
+ <xsl:value-of select="$varName"/>
+ </xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name-->
+ <xsl:param name="globalData"/>
+
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(., '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:template>
<!-- ***************** -->
<!-- *** Footnotes *** -->
<!-- ***************** -->
- <xsl:template match="text:note">
- <xsl:param name="globalData"/>
+ <xsl:template match="text:note">
+ <xsl:param name="globalData"/>
<!-- get style configuration -->
- <xsl:variable name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
-
- <xsl:variable name="titlePrefix">
- <xsl:choose>
- <xsl:when test="@text:note-class = 'footnote'">
- <xsl:text>Footnote: </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>Endnote: </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
+ <xsl:variable name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
+
+ <xsl:variable name="titlePrefix">
+ <xsl:choose>
+ <xsl:when test="@text:note-class = 'footnote'">
+ <xsl:text>Footnote: </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Endnote: </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<!-- write anchor -->
- <xsl:element name="span">
- <xsl:attribute name="class">
- <xsl:value-of select="$footnoteConfig/@text:citation-body-style-name"/>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:value-of select="$titlePrefix"/>
- <xsl:apply-templates mode="textOnly" select="text:note-body"/>
- </xsl:attribute>
- <xsl:element name="a">
- <xsl:attribute name="href">
- <xsl:value-of select="concat('#', @text:id)"/>
- </xsl:attribute>
- <xsl:attribute name="id">
- <xsl:value-of select="concat('body_', @text:id)"/>
- </xsl:attribute>
- <xsl:apply-templates mode="textOnly" select="text:note-citation"/>
- </xsl:element>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="*" mode="textOnly">
- <xsl:apply-templates select="* | text()" mode="textOnly" />
- </xsl:template>
-
- <xsl:template match="text()" mode="textOnly">
- <xsl:value-of select="."/>
- </xsl:template>
+ <xsl:element name="span">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$footnoteConfig/@text:citation-body-style-name"/>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:value-of select="$titlePrefix"/>
+ <xsl:apply-templates mode="textOnly" select="text:note-body"/>
+ </xsl:attribute>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#', @text:id)"/>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="concat('body_', @text:id)"/>
+ </xsl:attribute>
+ <xsl:apply-templates mode="textOnly" select="text:note-citation"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="*" mode="textOnly">
+ <xsl:apply-templates select="* | text()" mode="textOnly" />
+ </xsl:template>
+
+ <xsl:template match="text()" mode="textOnly">
+ <xsl:value-of select="."/>
+ </xsl:template>
<!-- Useful in case of 'style:map', conditional formatting, where a style references to another -->
- <xsl:key name="textNotes" match="text:note" use="@text:note-class"/>
+ <xsl:key name="textNotes" match="text:note" use="@text:note-class"/>
<!-- writing the footer- and endnotes beyond the body -->
- <xsl:template name="write-text-nodes">
- <xsl:param name="globalData"/>
+ <xsl:template name="write-text-nodes">
+ <xsl:param name="globalData"/>
<!-- write footnote body -->
- <xsl:for-each select="key('textNotes', 'footnote')">
- <xsl:call-template name="write-text-node">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
- </xsl:call-template>
- </xsl:for-each>
+ <xsl:for-each select="key('textNotes', 'footnote')">
+ <xsl:call-template name="write-text-node">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
+ </xsl:call-template>
+ </xsl:for-each>
<!-- write endnote body -->
- <xsl:for-each select="key('textNotes', 'endnote')">
- <xsl:call-template name="write-text-node">
-
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
- </xsl:call-template>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="write-text-node">
- <xsl:param name="globalData"/>
- <xsl:param name="footnoteConfig"/>
-
- <xsl:apply-templates select="text:note-body/*[1]">
- <xsl:with-param name="globalData" select="$globalData" />
- <xsl:with-param name="footnotePrefix">
- <xsl:element name="span">
- <xsl:attribute name="class">footnodeNumber</xsl:attribute>
- <xsl:element name="a">
- <xsl:attribute name="class">
- <xsl:value-of select="$footnoteConfig/@text:citation-style-name"/>
- </xsl:attribute>
- <xsl:attribute name="id">
- <xsl:value-of select="@text:id"/>
- </xsl:attribute>
- <xsl:attribute name="href">
- <xsl:value-of select="concat('#body_', @text:id)"/>
- </xsl:attribute>
- <xsl:apply-templates mode="textOnly" select="text:note-citation"/>
- </xsl:element>
- </xsl:element>
- </xsl:with-param>
- </xsl:apply-templates>
- <xsl:apply-templates select="text:note-body/*[position()&gt;1]">
- <xsl:with-param name="globalData" select="$globalData" />
- </xsl:apply-templates>
- </xsl:template>
-
- <!-- DISABLING this tab handling as the tab width is only relative
- <xsl:template match="text:tab">
- <xsl:param name="globalData"/>
-
- <xsl:variable name="tabNo">
- <xsl:choose>
- <xsl:when test="preceding-sibling::text:line-break">
- <xsl:call-template name="countTextTab"/>
- </xsl:when>
- <xsl:when test="preceding-sibling::text:tab">
- <xsl:value-of select="count(preceding-sibling::text:tab)"/>
- </xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:element name="span">
- <xsl:attribute name="style">margin-left:<xsl:value-of select="$globalData/all-doc-styles/style[@style:name = current()/parent::*/@text:style-name]/*/style:tab-stops/style:tab-stop[$tabNo]/@style:position"/>;</xsl:attribute>
+ <xsl:for-each select="key('textNotes', 'endnote')">
+ <xsl:call-template name="write-text-node">
+
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="write-text-node">
+ <xsl:param name="globalData"/>
+ <xsl:param name="footnoteConfig"/>
+
+ <xsl:apply-templates select="text:note-body/*[1]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix">
+ <xsl:element name="span">
+ <xsl:attribute name="class">footnodeNumber</xsl:attribute>
+ <xsl:element name="a">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$footnoteConfig/@text:citation-style-name"/>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="@text:id"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#body_', @text:id)"/>
+ </xsl:attribute>
+ <xsl:apply-templates mode="textOnly" select="text:note-citation"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="text:note-body/*[position()&gt;1]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <!-- DISABLING this tab handling as the tab width is only relative
+ <xsl:template match="text:tab">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="tabNo">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::text:line-break">
+ <xsl:call-template name="countTextTab"/>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::text:tab">
+ <xsl:value-of select="count(preceding-sibling::text:tab)"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="span">
+ <xsl:attribute name="style">margin-left:<xsl:value-of select="$globalData/all-doc-styles/style[@style:name = current()/parent::*/@text:style-name]/*/style:tab-stops/style:tab-stop[$tabNo]/@style:position"/>;</xsl:attribute>
</xsl:element>
- </xsl:template>
-
- <xsl:template name="countTextTab">
- <xsl:param name="tabCount" select="1"/>
- <xsl:param name="context" select="."/>
-
- <xsl:choose>
- <xsl:when test="preceding-sibling::*[1]">
- <xsl:for-each select="preceding-sibling::*[1]">
- <xsl:call-template name="countTextTab">
- <xsl:with-param name="tabCout">
- <xsl:choose>
- <xsl:when test="name(.) = 'text:tab'">
- <xsl:value-of select="$tabCount + 1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$tabCount"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="context" select="preceding-sibling::*[1]" />
- </xsl:call-template>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$tabCount"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+ </xsl:template>
+
+ <xsl:template name="countTextTab">
+ <xsl:param name="tabCount" select="1"/>
+ <xsl:param name="context" select="."/>
+
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::*[1]">
+ <xsl:for-each select="preceding-sibling::*[1]">
+ <xsl:call-template name="countTextTab">
+ <xsl:with-param name="tabCout">
+ <xsl:choose>
+ <xsl:when test="name(.) = 'text:tab'">
+ <xsl:value-of select="$tabCount + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="context" select="preceding-sibling::*[1]" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
-->
<!-- MathML -->
- <xsl:template match="draw:object[math:math]">
- <math xmlns="http://www.w3.org/1998/Math/MathML">
- <xsl:apply-templates select="math:math/math:semantics/*" mode="math"/>
- </math>
- </xsl:template>
-
- <xsl:template match="*" mode="math">
- <xsl:element name="{local-name()}" namespace="http://www.w3.org/1998/Math/MathML">
- <xsl:apply-templates select="@*|node()" mode="math"/>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="@*" mode="math">
- <xsl:attribute name="{local-name()}">
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:template>
-
- <xsl:template match="math:annotation" mode="math"/>
-
-
-</xsl:stylesheet> \ No newline at end of file
+ <xsl:template match="draw:object[math:math]">
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <xsl:apply-templates select="math:math/math:semantics/*" mode="math"/>
+ </math>
+ </xsl:template>
+
+ <xsl:template match="*" mode="math">
+ <xsl:element name="{local-name()}" namespace="http://www.w3.org/1998/Math/MathML">
+ <xsl:apply-templates select="@*|node()" mode="math"/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="@*" mode="math">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="math:annotation" mode="math"/>
+
+</xsl:stylesheet>