diff options
author | Christian Lippka <cl@openoffice.org> | 2001-02-15 16:35:27 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2001-02-15 16:35:27 +0000 |
commit | 2ad399d28cb4dbdbb5be0fb0a8aa93309aef4431 (patch) | |
tree | a5010d46a280c3452c8899404d55397e70b494fa | |
parent | 144c64b87eccaced203a4ff802f10642b77fb5c4 (diff) |
added presentation settings
-rw-r--r-- | xmloff/dtd/drawing.mod | 18 | ||||
-rw-r--r-- | xmloff/inc/xmlkywd.hxx | 17 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 209 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlexp_impl.hxx | 5 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlimp.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlimp_impl.hxx | 6 | ||||
-rw-r--r-- | xmloff/source/draw/shapeimport.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/draw/ximpbody.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshow.cxx | 159 |
9 files changed, 357 insertions, 74 deletions
diff --git a/xmloff/dtd/drawing.mod b/xmloff/dtd/drawing.mod index 6ead5e0c9400..176fa91467f6 100644 --- a/xmloff/dtd/drawing.mod +++ b/xmloff/dtd/drawing.mod @@ -1,5 +1,5 @@ <!-- - $Id: drawing.mod,v 1.36 2001-02-11 15:05:07 cl Exp $ + $Id: drawing.mod,v 1.37 2001-02-15 17:30:12 cl Exp $ The Contents of this file are made available subject to the terms of either of the following licenses @@ -441,7 +441,21 @@ <!ELEMENT presentation:show EMPTY> <!ATTLIST presentation:show presentation:name %styleName; #REQUIRED> <!ATTLIST presentation:show presentation:pages CDATA #REQUIRED> -<!ELEMENT presentation:shows (presentation:show)*> + +<!ELEMENT presentation:settings (presentation:show)*> +<!ATTLIST presentation:settings presentation:start-page %styleName #IMPLIED> +<!ATTLIST presentation:settings presentation:show %styleName #IMPLIED> +<!ATTLIST presentation:settings presentation:full-screen %boolean; "true"> +<!ATTLIST presentation:settings presentation:endless %boolean; "false"> +<!ATTLIST presentation:settings presentation:pause %timeDuration; #IMPLIED> +<!ATTLIST presentation:settings presentation:show-logo %boolean; "false"> +<!ATTLIST presentation:settings presentation:force-manual %boolean; "false"> +<!ATTLIST presentation:settings presentation:mouse-visible %boolean; "true"> +<!ATTLIST presentation:settings presentation:mouse-as-pen %boolean; "false"> +<!ATTLIST presentation:settings presentation:start-with-navigator %boolean; "false"> +<!ATTLIST presentation:settings presentation:animations (enabled|disabled) "enabled"> +<!ATTLIST presentation:settings presentation:stay-on-top %boolean; "false"> +<!ATTLIST presentation:settings presentation:transition-on-click (enabled|disabled) "enabled"> <!-- Drawing page --> <!ELEMENT draw:page (office:forms?,(%shapes;)*,presentation:animations?,presentation:notes?)> diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx index 9cfcfcacf4d7..3821824aa30c 100644 --- a/xmloff/inc/xmlkywd.hxx +++ b/xmloff/inc/xmlkywd.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlkywd.hxx,v $ * - * $Revision: 1.111 $ + * $Revision: 1.112 $ * - * last change: $Author: sab $ $Date: 2001-02-15 11:04:10 $ + * last change: $Author: cl $ $Date: 2001-02-15 17:31:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -593,6 +593,7 @@ XML_CONSTASCII_ACTION( sXML_end_row, "end-row" ); XML_CONSTASCII_ACTION( sXML_end_table, "end-table" ); XML_CONSTASCII_ACTION( sXML_end_x, "end-x" ); XML_CONSTASCII_ACTION( sXML_end_y, "end-y" ); +XML_CONSTASCII_ACTION( sXML_endless, "endless" ); XML_CONSTASCII_ACTION( sXML_endnote, "endnote" ); XML_CONSTASCII_ACTION( sXML_endnote_body, "endnote-body" ); XML_CONSTASCII_ACTION( sXML_endnote_citation, "endnote-citation" ); @@ -724,6 +725,7 @@ XML_CONSTASCII_ACTION( sXML_footnote_ref, "footnote-ref" ); XML_CONSTASCII_ACTION( sXML_footnotes_configuration, "footnotes-configuration"); XML_CONSTASCII_ACTION( sXML_footnotes_position, "footnotes-position" ); XML_CONSTASCII_ACTION( sXML_forall, "forall" ); +XML_CONSTASCII_ACTION( sXML_force_manual, "force-manual" ); XML_CONSTASCII_ACTION( sXML_foreground, "foreground" ); XML_CONSTASCII_ACTION( sXML_foreign_object, "foreign-object" ); XML_CONSTASCII_ACTION( sXML_format_change, "format-change" ); @@ -744,6 +746,7 @@ XML_CONSTASCII_ACTION( sXML_from_same_table, "from-same-table" ); XML_CONSTASCII_ACTION( sXML_from_top, "from-top" ); XML_CONSTASCII_ACTION( sXML_fuchsia, "fuchsia"); XML_CONSTASCII_ACTION( sXML_full, "full" ); +XML_CONSTASCII_ACTION( sXML_full_screen, "full-screen" ); XML_CONSTASCII_ACTION( sXML_function, "function"); XML_CONSTASCII_ACTION( sXML_g , "g" ); XML_CONSTASCII_ACTION( sXML_gamma , "gamma" ); @@ -1046,6 +1049,8 @@ XML_CONSTASCII_ACTION( sXML_move_from_top, "move-from-top" ); XML_CONSTASCII_ACTION( sXML_mover, "mover" ); XML_CONSTASCII_ACTION( sXML_movement, "movement" ); XML_CONSTASCII_ACTION( sXML_movement_cut_off, "movement-cut-off" ); +XML_CONSTASCII_ACTION( sXML_mouse_as_pen, "mouse-as-pen" ); +XML_CONSTASCII_ACTION( sXML_mouse_visible, "mouse-visible" ); XML_CONSTASCII_ACTION( sXML_mpadded, "mpadded"); XML_CONSTASCII_ACTION( sXML_mphantom, "mphantom"); XML_CONSTASCII_ACTION( sXML_mprescripts, "mprescripts"); @@ -1182,6 +1187,7 @@ XML_CONSTASCII_ACTION( sXML_parallel, "parallel" ); XML_CONSTASCII_ACTION( sXML_parent_style_name, "parent-style-name" ); XML_CONSTASCII_ACTION( sXML_parse_sql_statement, "parse-sql-statement"); XML_CONSTASCII_ACTION( sXML_parsed, "parsed" ); +XML_CONSTASCII_ACTION( sXML_pause, "pause" ); XML_CONSTASCII_ACTION( sXML_partialdiff, "partialdiff"); XML_CONSTASCII_ACTION( sXML_password, "password"); XML_CONSTASCII_ACTION( sXML_passwort, "passwort"); @@ -1380,6 +1386,7 @@ XML_CONSTASCII_ACTION( sXML_series, "series" ); XML_CONSTASCII_ACTION( sXML_server_map, "server-map" ); XML_CONSTASCII_ACTION( sXML_set, "set" ); XML_CONSTASCII_ACTION( sXML_setdiff, "setdiff" ); +XML_CONSTASCII_ACTION( sXML_settings, "settings" ); XML_CONSTASCII_ACTION( sXML_shade_mode, "shade-mode"); XML_CONSTASCII_ACTION( sXML_shadow, "shadow" ); XML_CONSTASCII_ACTION( sXML_shadow_color , "shadow-color" ); @@ -1396,6 +1403,7 @@ XML_CONSTASCII_ACTION( sXML_show, "show" ); XML_CONSTASCII_ACTION( sXML_show_accepted_changes, "show-accepted-changes" ); XML_CONSTASCII_ACTION( sXML_show_rejected_changes, "show-rejected-changes" ); XML_CONSTASCII_ACTION( sXML_show_changes, "show-changes" ); +XML_CONSTASCII_ACTION( sXML_show_logo, "show-logo" ); XML_CONSTASCII_ACTION( sXML_show_unit, "show-unit" ); XML_CONSTASCII_ACTION( sXML_shows, "shows" ); XML_CONSTASCII_ACTION( sXML_side_by_side, "side-by-side" ); @@ -1445,12 +1453,15 @@ XML_CONSTASCII_ACTION( sXML_start_color, "start-color" ); XML_CONSTASCII_ACTION( sXML_start_column, "start-column" ); XML_CONSTASCII_ACTION( sXML_start_intensity, "start-intensity" ); XML_CONSTASCII_ACTION( sXML_start_numbering_at, "start-numbering-at" ); +XML_CONSTASCII_ACTION( sXML_start_page, "start-page" ); XML_CONSTASCII_ACTION( sXML_start_position, "start-position" ); XML_CONSTASCII_ACTION( sXML_start_row, "start-row" ); XML_CONSTASCII_ACTION( sXML_start_table, "start-table" ); XML_CONSTASCII_ACTION( sXML_start_value, "start-value" ); +XML_CONSTASCII_ACTION( sXML_start_with_navigator, "start-with-navigator" ); XML_CONSTASCII_ACTION( sXML_statistics, "statistics" ); XML_CONSTASCII_ACTION( sXML_status, "status" ); +XML_CONSTASCII_ACTION( sXML_stay_on_top, "stay-on-top" ); XML_CONSTASCII_ACTION( sXML_stdev, "stdev" ); XML_CONSTASCII_ACTION( sXML_stdevp, "stdevp" ); XML_CONSTASCII_ACTION( sXML_steps, "steps" ); @@ -1582,6 +1593,7 @@ XML_CONSTASCII_ACTION( sXML_trace_errors, "trace-errors" ); XML_CONSTASCII_ACTION( sXML_trace_precedents, "trace-precedents" ); XML_CONSTASCII_ACTION( sXML_tracked_changes, "tracked-changes" ); XML_CONSTASCII_ACTION( sXML_transform , "transform" ); +XML_CONSTASCII_ACTION( sXML_transition_on_click, "transition-on-click" ); XML_CONSTASCII_ACTION( sXML_transparency, "transparency" ); XML_CONSTASCII_ACTION( sXML_transparency_name, "transparency-name" ); XML_CONSTASCII_ACTION( sXML_transparent, "transparent" ); @@ -1608,7 +1620,6 @@ XML_CONSTASCII_ACTION( sXML_underline_none, "none" ); XML_CONSTASCII_ACTION( sXML_underline_single, "single" ); XML_CONSTASCII_ACTION( sXML_underline_small_wave, "small-wave" ); XML_CONSTASCII_ACTION( sXML_underline_wave, "wave" ); -XML_CONSTASCII_ACTION( sXML_unformatted_text, "unformatted-text" ); XML_CONSTASCII_ACTION( sXML_union, "union" ); XML_CONSTASCII_ACTION( sXML_unit, "unit" ); XML_CONSTASCII_ACTION( sXML_unordered_list, "unordered-list" ); diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 74aa9068db09..e2dc93988c30 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sdxmlexp.cxx,v $ * - * $Revision: 1.46 $ + * $Revision: 1.47 $ * - * last change: $Author: cl $ $Date: 2001-02-08 14:45:42 $ + * last change: $Author: cl $ $Date: 2001-02-15 17:35:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,6 +85,10 @@ #include "xmlmetae.hxx" #endif +#ifndef _COM_SUN_STAR_PRESENTATION_XPRESENTATIONSUPPLIER_HPP_ +#include <com/sun/star/presentation/XPresentationSupplier.hpp> +#endif + #ifndef _COM_SUN_STAR_PRESENTATION_XCUSTOMPRESENTATIONSUPPLIER_HPP_ #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp> #endif @@ -1595,66 +1599,197 @@ void SdXMLExport::_ExportContent() } if( IsImpress() ) + exportPresentationSettings(); +} + +////////////////////////////////////////////////////////////////////////////// + +void SdXMLExport::exportPresentationSettings() +{ + try { + Reference< XPresentationSupplier > xPresSupplier( GetModel(), UNO_QUERY ); + if( !xPresSupplier.is() ) + return; + + Reference< XPropertySet > xPresProps( xPresSupplier->getPresentation(), UNO_QUERY ); + if( !xPresProps.is() ) + return; + + sal_Bool bHasAttr = sal_False; + + sal_Bool bTemp; + + // export range + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowAll" ) ) ) >>= bTemp; + if( !bTemp ) + { + OUString aFirstPage; + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) >>= aFirstPage; + if( aFirstPage.getLength() ) + { + AddAttribute(XML_NAMESPACE_PRESENTATION, sXML_start_page, aFirstPage ); + bHasAttr = sal_True; + } + else + { + OUString aCustomShow; + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ) ) >>= aCustomShow; + if( aCustomShow.getLength() ) + { + AddAttribute(XML_NAMESPACE_PRESENTATION, sXML_show, aCustomShow ); + bHasAttr = sal_True; + } + } + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) ) >>= bTemp; + if( bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_endless, sXML_true ); + bHasAttr = sal_True; + + sal_Int32 nPause; + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pause" ) ) ) >>= nPause; + if( nPause ) + { + util::DateTime aTime( 0, (sal_uInt16)nPause, 0, 0, 0, 0, 0 ); + + OUStringBuffer aOut; + SvXMLUnitConverter::convertTime( aOut, aTime ); + AddAttribute(XML_NAMESPACE_PRESENTATION, sXML_pause, aOut.makeStringAndClear() ); + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowLogo" ) ) ) >>= bTemp; + if( bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_show_logo, sXML_true ); + } + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowAnimations" ) ) ) >>= bTemp; + if( !bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_animations, sXML_disabled ); + bHasAttr = sal_True; + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ) ) >>= bTemp; + if( bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_stay_on_top, sXML_true ); + bHasAttr = sal_True; + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ) ) >>= bTemp; + if( bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_force_manual, sXML_true ); + bHasAttr = sal_True; + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ) ) >>= bTemp; + if( !bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_full_screen, sXML_false ); + bHasAttr = sal_True; + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ) ) >>= bTemp; + if( !bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_mouse_visible, sXML_false ); + bHasAttr = sal_True; + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ) ) >>= bTemp; + if( bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_start_with_navigator, sXML_true ); + bHasAttr = sal_True; + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ) ) >>= bTemp; + if( bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_mouse_as_pen, sXML_true ); + bHasAttr = sal_True; + } + + xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTransitionOnClick" ) ) ) >>= bTemp; + if( !bTemp ) + { + AddAttributeASCII(XML_NAMESPACE_PRESENTATION, sXML_transition_on_click, sXML_disabled ); + bHasAttr = sal_True; + } + + Reference< container::XNameContainer > xShows; + Sequence< OUString > aShowNames; + const OUString* pShowNames = NULL; + sal_Int32 nShowCount = 0; + Reference< XCustomPresentationSupplier > xSup( GetModel(), UNO_QUERY ); if( xSup.is() ) { - Reference< container::XNameContainer > xShows( xSup->getCustomPresentations() ); + xShows = xSup->getCustomPresentations(); if( xShows.is() ) { - const OUString sPageNumber( RTL_CONSTASCII_USTRINGPARAM("Number") ); + aShowNames = xShows->getElementNames(); + pShowNames = aShowNames.getArray(); + nShowCount = aShowNames.getLength(); + } + } + + if( bHasAttr || nShowCount != 0 ) + { + SvXMLElementExport aSettings(*this, XML_NAMESPACE_PRESENTATION, sXML_settings, sal_True, sal_True); + + if( nShowCount == 0 ) + return; + + Reference< XIndexContainer > xShow; + Reference< XNamed > xPageName; - SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, sXML_shows, sal_True, sal_True); + OUStringBuffer sTmp; - Sequence< OUString > aShowNames = xShows->getElementNames(); - const OUString* pShowNames = aShowNames.getArray(); - const sal_Int32 nCount = aShowNames.getLength(); + for( sal_Int32 nIndex = 0; nIndex < nShowCount; nIndex++, pShowNames++ ) + { + AddAttribute(XML_NAMESPACE_PRESENTATION, sXML_name, *pShowNames ); - Reference< XIndexContainer > xShow; - Reference< XPropertySet > xPageSet; - sal_Int32 nPageNumber; - OUStringBuffer sTmp; + xShows->getByName( *pShowNames ) >>= xShow; + DBG_ASSERT( xShow.is(), "invalid custom show!" ); + if( !xShow.is() ) + continue; - for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++, pShowNames++ ) + const sal_Int32 nPageCount = xShow->getCount(); + for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ ) { - AddAttribute(XML_NAMESPACE_PRESENTATION, sXML_name, *pShowNames ); + xShow->getByIndex( nPage ) >>= xPageName; - xShows->getByName( *pShowNames ) >>= xShow; - DBG_ASSERT( xShow.is(), "invalid custom show!" ); - if( !xShow.is() ) + if( !xPageName.is() ) continue; - const sal_Int32 nPageCount = xShow->getCount(); - for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ ) - { - xShow->getByIndex( nPage ) >>= xPageSet; - - if( !xPageSet.is() ) - continue; + if( sTmp.getLength() != 0 ) + sTmp.append( sal_Unicode( ',' ) ); + sTmp.append( xPageName->getName() ); - if( xPageSet->getPropertyValue( sPageNumber ) >>= nPageNumber ) - { - if( sTmp.getLength() != 0 ) - sTmp.append( sal_Unicode( ',' ) ); - sTmp.append( nPageNumber ); - } - } + } + if( sTmp.getLength() ) AddAttribute(XML_NAMESPACE_PRESENTATION, sXML_pages, sTmp.makeStringAndClear() ); - SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, sXML_show, sal_True, sal_True); - } + SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, sXML_show, sal_True, sal_True); } } } + catch( uno::Exception ) + { + DBG_ERROR( "uno::Exception while exporting <presentation:settings>" ); + } } ////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////// - void SdXMLExport::_ExportStyles(BOOL bUsed) { GetPropertySetMapper()->SetAutoStyles( sal_False ); diff --git a/xmloff/source/draw/sdxmlexp_impl.hxx b/xmloff/source/draw/sdxmlexp_impl.hxx index 28f471475f17..5149f6d71298 100644 --- a/xmloff/source/draw/sdxmlexp_impl.hxx +++ b/xmloff/source/draw/sdxmlexp_impl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: sdxmlexp_impl.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: cl $ $Date: 2001-02-02 11:14:37 $ + * last change: $Author: cl $ $Date: 2001-02-15 17:35:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -184,6 +184,7 @@ class SdXMLExport : public SvXMLExport void ImpWriteDefaultStyleInfos(); void exportFormsElement( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage ); + void exportPresentationSettings(); public: SdXMLExport( sal_Bool bIsDraw ); diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 367a74eb305c..b60bc9441402 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sdxmlimp.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: cl $ $Date: 2001-01-17 16:11:05 $ + * last change: $Author: cl $ $Date: 2001-02-15 17:35:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -152,7 +152,7 @@ static __FAR_DATA SvXMLTokenMapEntry aDocElemTokenMap[] = static __FAR_DATA SvXMLTokenMapEntry aBodyElemTokenMap[] = { { XML_NAMESPACE_DRAW, sXML_page, XML_TOK_BODY_PAGE }, - { XML_NAMESPACE_PRESENTATION, sXML_shows, XML_TOK_BODY_SHOWS }, + { XML_NAMESPACE_PRESENTATION, sXML_settings, XML_TOK_BODY_SETTINGS }, XML_TOKEN_MAP_END }; diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx index 9b0a6ef717b8..74d9c4578024 100644 --- a/xmloff/source/draw/sdxmlimp_impl.hxx +++ b/xmloff/source/draw/sdxmlimp_impl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: sdxmlimp_impl.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: mh $ $Date: 2001-02-01 16:23:07 $ + * last change: $Author: cl $ $Date: 2001-02-15 17:35:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,7 +106,7 @@ enum SdXMLDocElemTokenMap enum SdXMLBodyElemTokenMap { XML_TOK_BODY_PAGE, - XML_TOK_BODY_SHOWS + XML_TOK_BODY_SETTINGS }; enum SdXMLStylesElemTokenMap diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index e8a6e887f8f9..fd033b590588 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeimport.cxx,v $ * - * $Revision: 1.26 $ + * $Revision: 1.27 $ * - * last change: $Author: aw $ $Date: 2001-02-09 13:38:53 $ + * last change: $Author: cl $ $Date: 2001-02-15 17:35:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -918,7 +918,6 @@ void XMLShapeImportHelper::popGroupAndSort() { list<ZOrderHint>::iterator aIter( rZList.begin() ); - DBG_ASSERT( (*aIter).nShould >= nIndex, "wrong should!" ) while( nIndex < (*aIter).nShould && !rUnsortedList.empty() ) { ZOrderHint aGapHint( *rUnsortedList.begin() ); diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx index f54d8bf68792..06d857a643df 100644 --- a/xmloff/source/draw/ximpbody.cxx +++ b/xmloff/source/draw/ximpbody.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpbody.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: cl $ $Date: 2000-12-19 16:23:48 $ + * last change: $Author: cl $ $Date: 2001-02-15 17:35:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -427,7 +427,7 @@ SvXMLImportContext *SdXMLBodyContext::CreateChildContext( } break; } - case XML_TOK_BODY_SHOWS: + case XML_TOK_BODY_SETTINGS: { pContext = new SdXMLShowsContext( GetSdImport(), nPrefix, rLocalName, xAttrList ); } diff --git a/xmloff/source/draw/ximpshow.cxx b/xmloff/source/draw/ximpshow.cxx index 445da9b35fcb..a8431f57d40a 100644 --- a/xmloff/source/draw/ximpshow.cxx +++ b/xmloff/source/draw/ximpshow.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpshow.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: cl $ $Date: 2000-12-19 16:23:48 $ + * last change: $Author: cl $ $Date: 2001-02-15 17:35:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,6 +61,9 @@ #include <tools/debug.hxx> +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif #ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_ #include <com/sun/star/xml/sax/XAttributeList.hpp> #endif @@ -73,12 +76,22 @@ #ifndef _COM_SUN_STAR_PRESENTATION_XCUSTOMPRESENTATIONSUPPLIER_HPP_ #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp> #endif +#ifndef _COM_SUN_STAR_PRESENTATION_XPRESENTATIONSUPPLIER_HPP_ +#include <com/sun/star/presentation/XPresentationSupplier.hpp> +#endif #ifndef _COM_SUN_STAR_CONTAINER_XINDEXCONTAINER_HPP_ #include <com/sun/star/container/XIndexContainer.hpp> #endif +#ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGESSUPPLIER_HPP_ +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#endif #include "xmlkywd.hxx" +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif + #ifndef _XMLOFF_XMLNMSPE_HXX #include "xmlnmspe.hxx" #endif @@ -94,6 +107,10 @@ #include "ximpshow.hxx" #endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif + using namespace ::rtl; using namespace ::std; using namespace ::cppu; @@ -104,6 +121,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::util; using namespace ::com::sun::star::container; using namespace ::com::sun::star::presentation; @@ -114,6 +132,9 @@ class ShowsImpImpl public: Reference< XSingleServiceFactory > mxShowFactory; Reference< XNameContainer > mxShows; + Reference< XPropertySet > mxPresProps; + Reference< XNameAccess > mxPages; + OUString maCustomShowName; SdXMLImport& mrImport; ShowsImpImpl( SdXMLImport& rImport ) @@ -137,15 +158,119 @@ SdXMLShowsContext::SdXMLShowsContext( SdXMLImport& rImport, sal_uInt16 nPrfx, c mpImpl->mxShowFactory = Reference< XSingleServiceFactory >::query( mpImpl->mxShows ); } - if( !mpImpl->mxShowFactory.is() ) + Reference< XDrawPagesSupplier > xDrawPagesSupplier( rImport.GetModel(), UNO_QUERY ); + if( xDrawPagesSupplier.is() ) + mpImpl->mxPages = Reference< XNameAccess >::query( xDrawPagesSupplier->getDrawPages() ); + + Reference< XPresentationSupplier > xPresentationSupplier( rImport.GetModel(), UNO_QUERY ); + if( xPresentationSupplier.is() ) + mpImpl->mxPresProps = Reference< XPropertySet >::query( xPresentationSupplier->getPresentation() ); + + + if( mpImpl->mxPresProps.is() ) { - delete mpImpl; - mpImpl = NULL; + sal_Bool bAll = sal_True; + uno::Any aAny; + + // read attributes + const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for(sal_Int16 i=0; i < nAttrCount; i++) + { + OUString sAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); + OUString sValue = xAttrList->getValueByIndex( i ); + + switch( nPrefix ) + { + case XML_NAMESPACE_PRESENTATION: + if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_start_page ) ) ) + { + aAny <<= sValue; + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ), aAny ); + bAll = sal_False; + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_show ) ) ) + { + mpImpl->maCustomShowName = sValue; + bAll = sal_False; + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_pause ) ) ) + { + DateTime aTime; + if( !SvXMLUnitConverter::convertTime( aTime, sValue ) ) + continue; + + const sal_Int32 nMS = ( ( aTime.Hours * 60 + aTime.Minutes ) * 60 + aTime.Seconds ) * 100 + aTime.HundredthSeconds; + aAny <<= nMS; + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pause" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_animations ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_enabled ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowAnimations" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_stay_on_top ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_force_manual ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_endless ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_full_screen ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_mouse_visible ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_start_with_navigator ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_mouse_as_pen ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_transition_on_click ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_enabled ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTransitionOnClick" ) ), aAny ); + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_show_logo ) ) ) + { + aAny = bool2any( sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) ) ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowLogo" ) ), aAny ); + } + } + } + aAny = bool2any( bAll ); + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowAll" ) ), aAny ); } } SdXMLShowsContext::~SdXMLShowsContext() { + if( mpImpl && mpImpl->maCustomShowName.getLength() ) + { + uno::Any aAny; + aAny <<= mpImpl->maCustomShowName; + mpImpl->mxPresProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ), aAny ); + } + delete mpImpl; } @@ -184,23 +309,21 @@ SvXMLImportContext * SdXMLShowsContext::CreateChildContext( USHORT nPrefix, cons Reference< XIndexContainer > xShow( mpImpl->mxShowFactory->createInstance(), UNO_QUERY ); if( xShow.is() ) { - SvXMLTokenEnumerator aPageIds( aPages, sal_Unicode(',') ); - OUString sPageId; - sal_Int32 nPageId; + SvXMLTokenEnumerator aPageNames( aPages, sal_Unicode(',') ); + OUString sPageName; Any aAny; - vector< sal_Int32 > aPages; - while( aPageIds.getNextToken( sPageId ) ) + while( aPageNames.getNextToken( sPageName ) ) { - if( SvXMLUnitConverter::convertNumber( nPageId, sPageId ) ) - { - Reference< XDrawPage > xPage( mpImpl->mrImport.getDrawPageForId( nPageId ) ); + if( !mpImpl->mxPages->hasByName( sPageName ) ) + continue; - if( xPage.is() ) - { - aAny <<= xPage; - xShow->insertByIndex( xShow->getCount(), aAny ); - } + Reference< XDrawPage > xPage; + mpImpl->mxPages->getByName( sPageName ) >>= xPage; + if( xPage.is() ) + { + aAny <<= xPage; + xShow->insertByIndex( xShow->getCount(), aAny ); } } |