diff options
author | Release Engineers <releng@openoffice.org> | 2009-08-05 17:01:07 +0000 |
---|---|---|
committer | Release Engineers <releng@openoffice.org> | 2009-08-05 17:01:07 +0000 |
commit | 40553b5e383ee02726eeafa8cc44082086399af7 (patch) | |
tree | d7e06c7ca505f2a7173d71d95a3d560f3244222b /oox | |
parent | 3280419c5ad24d65beced46ee55a189f993926cc (diff) |
CWS-TOOLING: integrate CWS impress172
2009-07-30 15:29:39 +0200 cl r274492 : #i102921# remove reference to inssrc.obj which was moved to svx
2009-07-29 11:40:35 +0200 wg r274445 : i103869
2009-07-22 14:39:13 +0200 sj r274241 : #i102713# fixed cloud shape
2009-07-07 15:28:04 +0200 sj r273800 : fixed build problem
2009-07-07 13:27:13 +0200 cl r273792 : #i102921# moved insert col/rows dialog to svx
2009-07-07 10:36:05 +0200 cl r273782 : fixed compiler warnings
2009-07-02 10:40:21 +0200 sj r273626 : fixed build problem
2009-07-02 10:27:56 +0200 cl r273624 : fixed merge problem
2009-07-02 10:27:19 +0200 cl r273623 : fixed compiler warning
2009-07-01 10:04:58 +0200 cl r273550 : CWS-TOOLING: rebase CWS impress172 to trunk@273468 (milestone: DEV300:m51)
2009-06-30 16:22:02 +0200 cl r273518 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:46 +0200 cl r273517 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:20:28 +0200 cl r273516 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:49 +0200 cl r273515 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:19:28 +0200 cl r273514 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 16:17:38 +0200 cl r273513 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:45:44 +0200 cl r273511 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:37:16 +0200 cl r273510 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:33:47 +0200 cl r273509 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:32:10 +0200 cl r273508 : #i102921# added insert table row/col dialog for impress tables
2009-06-30 15:30:05 +0200 cl r273507 : #i102921# added insert table row/col dialog for impress tables
2009-06-29 12:32:42 +0200 sj r273465 : #158632# fixed textrange hyperlinks to specific pages, added slide names
2009-06-24 15:17:59 +0200 sj r273349 : #158636# fixed text range hyperlink to first/last slide
2009-06-22 13:18:30 +0200 sj r273224 : #158651# fixed header footer import
2009-06-19 15:18:24 +0200 sj r273160 : #158614# default text of presentation objects now cleared
2009-06-16 15:54:19 +0200 sj r273023 : #i101545# fixed crash - bracketing of graphic links has been done twice leading to a broken graphic state stack
2009-06-15 16:26:26 +0200 sj r272998 : #158635# importing bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-15 16:25:26 +0200 sj r272997 : #158635# added bookmark interactions: firstslide, lastslide, nextslide, previousslide
2009-06-12 13:17:32 +0200 sj r272915 : #i102713# fixed cloud shape
2009-06-10 18:36:58 +0200 sj r272833 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-08 19:52:28 +0200 sj r272746 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
2009-06-04 15:28:32 +0200 cl r272640 : #i102358# applied patch to remove warnings
2009-06-04 14:39:45 +0200 cl r272630 : #i99423# applied path to change impress wizard create button to open when opening exisitng documents
2009-06-03 18:21:26 +0200 sj r272601 : #158635# now using the correct paragraph bottom spacing. using font independent linespacing for impress text objects
2009-06-03 15:47:27 +0200 cl r272583 : #i101817# added color collection based on scribus
2009-06-03 14:43:59 +0200 cl r272580 : #i102163# use weak ref to SdrObject instead of listening to the model
2009-06-03 12:39:29 +0200 cl r272556 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 12:27:00 +0200 cl r272555 : #i93308# correct namespace for com.sun.star.text.textfields
2009-06-03 11:33:44 +0200 cl r272553 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:59 +0200 cl r272552 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-03 11:30:22 +0200 cl r272551 : #i23221# allow all settings (that make sense) for presentation styles
2009-06-02 18:41:07 +0200 sj r272527 : #i28358# applied patch (better conversion of dotted lines)
2009-06-02 11:52:13 +0200 cl r272491 : #i98668# applied patch to fix possible endless loop if exception occours
2009-05-28 17:02:55 +0200 sj r272416 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:25 +0200 sj r272415 : #i102336# retaining graphic file names unchanged
2009-05-28 17:00:10 +0200 sj r272414 : #i102336# retaining graphic file names unchanged
2009-05-25 12:43:58 +0200 sj r272232 : #i102069# added patch from thb (fixed rotated group objects)
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/core/xmlfilterbase.hxx | 16 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/shape.hxx | 3 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/textspacing.hxx | 1 | ||||
-rw-r--r-- | oox/inc/oox/ppt/headerfooter.hxx | 54 | ||||
-rw-r--r-- | oox/inc/oox/ppt/slidepersist.hxx | 3 | ||||
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 7 | ||||
-rw-r--r-- | oox/source/drawingml/hyperlinkcontext.cxx | 103 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 16 | ||||
-rw-r--r-- | oox/source/drawingml/textrun.cxx | 11 | ||||
-rw-r--r-- | oox/source/ppt/headerfootercontext.cxx | 69 | ||||
-rw-r--r-- | oox/source/ppt/headerfootercontext.hxx | 53 | ||||
-rw-r--r-- | oox/source/ppt/layoutfragmenthandler.cxx | 4 | ||||
-rw-r--r-- | oox/source/ppt/makefile.mk | 1 | ||||
-rw-r--r-- | oox/source/ppt/pptshape.cxx | 25 | ||||
-rw-r--r-- | oox/source/ppt/pptshapecontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/ppt/presentationfragmenthandler.cxx | 89 | ||||
-rw-r--r-- | oox/source/ppt/slidefragmenthandler.cxx | 4 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 2 |
18 files changed, 439 insertions, 24 deletions
diff --git a/oox/inc/oox/core/xmlfilterbase.hxx b/oox/inc/oox/core/xmlfilterbase.hxx index ec50f68e5389..40fc54bb5039 100644 --- a/oox/inc/oox/core/xmlfilterbase.hxx +++ b/oox/inc/oox/core/xmlfilterbase.hxx @@ -38,6 +38,9 @@ #include "oox/core/filterbase.hxx" #include "oox/core/relations.hxx" #include <oox/dllapi.h> +#include <com/sun/star/text/XTextField.hpp> +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/text/XText.hpp> namespace com { namespace sun { namespace star { namespace container { class XNameContainer; } @@ -60,6 +63,13 @@ namespace core { class FragmentHandler; +struct TextField { + com::sun::star::uno::Reference< com::sun::star::text::XText > xText; + com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > xTextCursor; + com::sun::star::uno::Reference< com::sun::star::text::XTextField > xTextField; +}; +typedef std::vector< TextField > TextFieldStack; + // ============================================================================ struct XmlFilterBaseImpl; @@ -135,8 +145,10 @@ public: */ ::rtl::OUString addRelation( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutputStream, const ::rtl::OUString& rType, const ::rtl::OUString& rTarget, bool bExternal = false ); - /** Opens and returns the specified output stream from the base storage - with specified media type. + /** Returns a stack of used textfields, used by the pptx importer to replace links to slidepages with rhe real page name */ + TextFieldStack& getTextFieldStack() const; + + /** Opens and returns the specified output stream from the base storage with specified media type. @param rStreamName The name of the embedded storage stream. The name may contain diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx index 1d38830339d2..4d288b52fa1f 100644 --- a/oox/inc/oox/drawingml/shape.hxx +++ b/oox/inc/oox/drawingml/shape.hxx @@ -166,7 +166,8 @@ protected: const ::rtl::OUString& rServiceName, const ThemePtr& rxTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle* pShapeRect ); + const ::com::sun::star::awt::Rectangle* pShapeRect, + sal_Bool bClearText ); void addChildren( const ::oox::core::XmlFilterBase& rFilterBase, diff --git a/oox/inc/oox/drawingml/textspacing.hxx b/oox/inc/oox/drawingml/textspacing.hxx index fb0016ed7583..e5eda81aaf8e 100644 --- a/oox/inc/oox/drawingml/textspacing.hxx +++ b/oox/inc/oox/drawingml/textspacing.hxx @@ -51,6 +51,7 @@ namespace oox { namespace drawingml { : nUnit( POINTS ), nValue( 0 ), bHasValue( sal_False ) { } + TextSpacing( sal_Int32 nPoints ) : nUnit( POINTS ), nValue( nPoints ), bHasValue( sal_True ){}; ::com::sun::star::style::LineSpacing toLineSpacing() const { ::com::sun::star::style::LineSpacing aSpacing; diff --git a/oox/inc/oox/ppt/headerfooter.hxx b/oox/inc/oox/ppt/headerfooter.hxx new file mode 100644 index 000000000000..afb5da3ac32c --- /dev/null +++ b/oox/inc/oox/ppt/headerfooter.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile:$ + * $Revision:$ + * + * 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 OOX_PPT_HEADERFOOTER +#define OOX_PPT_HEADERFOOTER + +#include <sal/types.h> + +namespace oox { namespace ppt { + + struct HeaderFooter + { + sal_Bool mbSlideNumber; + sal_Bool mbHeader; + sal_Bool mbFooter; + sal_Bool mbDateTime; + + HeaderFooter() + : mbSlideNumber( sal_True ) + , mbHeader( sal_True ) + , mbFooter( sal_True ) + , mbDateTime( sal_True ) {}; + }; + +} } + +#endif diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx index c8d270a724f4..a9a64f74a369 100644 --- a/oox/inc/oox/ppt/slidepersist.hxx +++ b/oox/inc/oox/ppt/slidepersist.hxx @@ -38,6 +38,7 @@ #include "oox/drawingml/clrscheme.hxx" #include "oox/drawingml/textliststyle.hxx" #include "oox/drawingml/textparagraphproperties.hxx" +#include <oox/ppt/headerfooter.hxx> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/animations/XAnimationNode.hpp> @@ -109,6 +110,7 @@ public: oox::drawingml::ShapePtr getShapes() { return maShapesPtr; } ::std::list< boost::shared_ptr< TimeNode > >& getTimeNodeList() { return maTimeNodeList; } + oox::ppt::HeaderFooter& getHeaderFooter(){ return maHeaderFooter; }; oox::vml::Drawing* getDrawing() { return mpDrawingPtr.get(); } @@ -134,6 +136,7 @@ private: oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr; ::std::list< boost::shared_ptr< TimeNode > > maTimeNodeList; + oox::ppt::HeaderFooter maHeaderFooter; sal_Int32 mnLayoutValueToken; sal_Bool mbMaster; sal_Bool mbNotes; diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 5af7f5d7a194..fb3410e75427 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -84,7 +84,7 @@ struct XmlFilterBaseImpl Reference< XFastTokenHandler > mxTokenHandler; RelationsMap maRelationsMap; - + TextFieldStack maTextFieldStack; explicit XmlFilterBaseImpl(); }; @@ -234,6 +234,11 @@ FSHelperPtr XmlFilterBase::openFragmentStreamWithSerializer( const OUString& rSt return FSHelperPtr( new FastSerializerHelper( openFragmentStream( rStreamName, rMediaType ) ) ); } +TextFieldStack& XmlFilterBase::getTextFieldStack() const +{ + return mxImpl->maTextFieldStack; +} + namespace { OUString lclAddRelation( const Reference< XRelationshipAccess > xRelations, sal_Int32 nId, const OUString& rType, const OUString& rTarget, bool bExternal ) diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index 2c83aedeff82..f1c87d2507dc 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -55,33 +55,106 @@ HyperLinkContext::HyperLinkContext( ContextHandler& rParent, : ContextHandler( rParent ) , maProperties(aProperties) { + OUString sURL, sHref; OUString aRelId = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_id ); - OSL_TRACE("OOX: URI rId %s", ::rtl::OUStringToOString (aRelId, RTL_TEXTENCODING_UTF8).pData->buffer); - const OUString& sHref = getRelations().getExternalTargetFromRelId( aRelId ); - if( sHref.getLength() > 0 ) + if ( aRelId.getLength() ) { - OSL_TRACE("OOX: URI href %s", ::rtl::OUStringToOString (sHref, RTL_TEXTENCODING_UTF8).pData->buffer); - maProperties[ PROP_URL ] <<= getFilter().getAbsoluteUrl( sHref ); - OUString sTooltip = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_tooltip ); + OSL_TRACE("OOX: URI rId %s", ::rtl::OUStringToOString (aRelId, RTL_TEXTENCODING_UTF8).pData->buffer); + sHref = getRelations().getTargetFromRelId( aRelId ); + if( sHref.getLength() > 0 ) + { + OSL_TRACE("OOX: URI href %s", ::rtl::OUStringToOString (sHref, RTL_TEXTENCODING_UTF8).pData->buffer); + sURL = getFilter().getAbsoluteUrl( sHref ); + } + } + OUString sTooltip = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_tooltip ); + if ( sTooltip.getLength() ) maProperties[ PROP_Representation ] <<= sTooltip; + OUString sFrame = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_tgtFrame ); + if( sFrame.getLength() ) + maProperties[ PROP_TargetFrame ] <<= sFrame; + OUString aAction = xAttributes->getOptionalValue( XML_action ); + if ( aAction.getLength() ) + { + // reserved values of the unrestricted string aAction: + // ppaction://customshow?id=SHOW_ID // custom presentation + // ppaction://hlinkfile // external file via r:id + // ppaction://hlinkpres?slideindex=SLIDE_NUM // external presentation via r:id + // ppaction://hlinkshowjump?jump=endshow + // ppaction://hlinkshowjump?jump=firstslide + // ppaction://hlinkshowjump?jump=lastslide + // ppaction://hlinkshowjump?jump=lastslideviewed + // ppaction://hlinkshowjump?jump=nextslide + // ppaction://hlinkshowjump?jump=previousslide + // ppaction://hlinksldjump + // ppaction://macro?name=MACRO_NAME + // ppaction://program - OUString sFrame = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_tgtFrame ); - if( sFrame.getLength() ) - maProperties[ PROP_TargetFrame ] <<= sFrame; + const OUString sPPAction( CREATE_OUSTRING( "ppaction://" ) ); + if ( aAction.matchIgnoreAsciiCase( sPPAction, 0 ) ) + { + OUString aPPAct( aAction.copy( sPPAction.getLength() ) ); + sal_Int32 nIndex = aPPAct.indexOf( '?', 0 ); + OUString aPPAction( nIndex > 0 ? aPPAct.copy( 0, nIndex ) : aPPAct ); -// sValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) ); -// const rtl::OUString sUnvisitedCharStyleName( CREATE_OUSTRING( "UnvisitedCharStyleName" ) ); -// maProperties[ sUnvisitedCharStyleName ] <<= sValue; -// const rtl::OUString sVisitedCharStyleName( CREATE_OUSTRING( "VisitedCharStyleName" ) ); -// maProperties[ sVisitedCharStyleName ] <<= sValue; + const OUString sHlinkshowjump( CREATE_OUSTRING( "hlinkshowjump" ) ); + const OUString sHlinksldjump( CREATE_OUSTRING( "hlinksldjump" ) ); + if ( aPPAction.match( sHlinkshowjump ) ) + { + const OUString sJump( CREATE_OUSTRING( "jump=" ) ); + if ( aPPAct.match( sJump, nIndex + 1 ) ) + { + OUString aDestination( aPPAct.copy( nIndex + 1 + sJump.getLength() ) ); + sURL = sURL.concat( CREATE_OUSTRING( "#action?jump=" ) ); + sURL = sURL.concat( aDestination ); + } + } + else if ( aPPAction.match( sHlinksldjump ) ) + { + sURL = OUString(); + sal_Int32 nIndex2 = 0; + while ( nIndex2 < sHref.getLength() ) + { + sal_Unicode nChar = sHref[ nIndex2 ]; + if ( ( nChar >= '0' ) && ( nChar <= '9' ) ) + break; + nIndex2++; + } + if ( nIndex2 && ( nIndex2 != sHref.getLength() ) ) + { + sal_Int32 nLength = 1; + while( ( nIndex2 + nLength ) < sHref.getLength() ) + { + sal_Unicode nChar = sHref[ nIndex2 + nLength ]; + if ( ( nChar < '0' ) || ( nChar > '9' ) ) + break; + nLength++; + } + sal_Int32 nPageNumber = sHref.copy( nIndex2, nLength ).toInt32(); + if ( nPageNumber ) + { + const OUString sSlide( CREATE_OUSTRING( "slide" ) ); + const OUString sNotesSlide( CREATE_OUSTRING( "notesSlide" ) ); + const OUString aSlideType( sHref.copy( 0, nIndex2 ) ); + if ( aSlideType.match( sSlide ) ) + sURL = CREATE_OUSTRING( "#Slide " ).concat( rtl::OUString::valueOf( nPageNumber ) ); + else if ( aSlideType.match( sNotesSlide ) ) + sURL = CREATE_OUSTRING( "#Notes " ).concat( rtl::OUString::valueOf( nPageNumber ) ); +// else: todo for other types such as notesMaster or slideMaster as they can't be referenced easily + } + } + } + } } + if ( sURL.getLength() ) + maProperties[ PROP_URL ] <<= sURL; + // TODO unhandled // XML_invalidUrl // XML_history // XML_highlightClick // XML_endSnd - // XML_action } HyperLinkContext::~HyperLinkContext() diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 08f6d63f0ee5..329aa6b36226 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -148,7 +148,7 @@ void Shape::addShape( rtl::OUString sServiceName( msServiceName ); if( sServiceName.getLength() ) { - Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, rxTheme, rxShapes, pShapeRect ) ); + Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, rxTheme, rxShapes, pShapeRect, sal_False ) ); if( pShapeMap && msId.getLength() ) { @@ -247,7 +247,8 @@ Reference< XShape > Shape::createAndInsert( const rtl::OUString& rServiceName, const ThemePtr& rxTheme, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const awt::Rectangle* pShapeRect ) + const awt::Rectangle* pShapeRect, + sal_Bool bClearText ) { awt::Size aSize( pShapeRect ? awt::Size( pShapeRect->Width, pShapeRect->Height ) : maSize ); awt::Point aPosition( pShapeRect ? awt::Point( pShapeRect->X, pShapeRect->Y ) : maPosition ); @@ -367,6 +368,17 @@ Reference< XShape > Shape::createAndInsert( } rxShapes->add( mxShape ); + // sj: removing default text of placeholder objects such as SlideNumberShape or HeaderShape + if ( bClearText ) + { + uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY ); + if ( xText.is() ) + { + OUString aEmpty; + xText->setString( aEmpty ); + } + } + LineProperties aLineProperties; aLineProperties.maLineFill.moFillType = XML_noFill; sal_Int32 nLinePhClr = -1; diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx index 2d8422b2f018..04dcb68c053f 100644 --- a/oox/source/drawingml/textrun.cxx +++ b/oox/source/drawingml/textrun.cxx @@ -91,12 +91,21 @@ void TextRun::insertAt( Reference< XTextField > xField( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.text.TextField.URL" ) ), UNO_QUERY ); if( xField.is() ) { + Reference< XTextCursor > xTextFieldCursor = xText->createTextCursor(); + xTextFieldCursor->gotoEnd( sal_False ); + PropertySet aFieldProps( xField ); aFieldProps.setProperties( maTextCharacterProperties.maHyperlinkPropertyMap ); aFieldProps.setProperty( PROP_Representation, getText() ); - Reference< XTextContent > xContent( xField, UNO_QUERY); xText->insertTextContent( xStart, xContent, sal_False ); + + xTextFieldCursor->gotoEnd( sal_True ); + oox::core::TextField aTextField; + aTextField.xText = xText; + aTextField.xTextCursor = xTextFieldCursor; + aTextField.xTextField = xField; + rFilterBase.getTextFieldStack().push_back( aTextField ); } else { diff --git a/oox/source/ppt/headerfootercontext.cxx b/oox/source/ppt/headerfootercontext.cxx new file mode 100644 index 000000000000..9214e2d3b4ba --- /dev/null +++ b/oox/source/ppt/headerfootercontext.cxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile:$ + * $Revision:$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "headerfootercontext.hxx" +#include "oox/core/namespaces.hxx" +#include "oox/helper/attributelist.hxx" +#include "tokens.hxx" + +using namespace ::oox::core; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +namespace oox { namespace ppt { + + HeaderFooterContext::HeaderFooterContext( ContextHandler& rParent, + const Reference< XFastAttributeList >& xAttribs, HeaderFooter& rHeaderFooter ) + : ContextHandler( rParent ) + { + AttributeList aAttribs( xAttribs ); + if ( xAttribs->hasAttribute( XML_sldNum ) ) + { + rHeaderFooter.mbSlideNumber = aAttribs.getBool( XML_sldNum, sal_True ); + } + if ( xAttribs->hasAttribute( XML_hdr ) ) + { + rHeaderFooter.mbHeader = aAttribs.getBool( XML_hdr, sal_True ); + } + if ( xAttribs->hasAttribute( XML_ftr ) ) + { + rHeaderFooter.mbFooter = aAttribs.getBool( XML_ftr, sal_True ); + } + if ( xAttribs->hasAttribute( XML_dt ) ) + { + rHeaderFooter.mbDateTime = aAttribs.getBool( XML_dt, sal_True ); + } + } + + HeaderFooterContext::~HeaderFooterContext( ) + { + } + +} } diff --git a/oox/source/ppt/headerfootercontext.hxx b/oox/source/ppt/headerfootercontext.hxx new file mode 100644 index 000000000000..3bf07315c62e --- /dev/null +++ b/oox/source/ppt/headerfootercontext.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile:$ + * $Revision:$ + * + * 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 OOX_PPT_HEADERFOOTERCONTEXT +#define OOX_PPT_HEADERFOOTERCONTEXT + +#include "oox/ppt/headerfooter.hxx" +#include "oox/core/contexthandler.hxx" + +namespace oox { namespace ppt { + + /** CT_HeaderFooter */ + class HeaderFooterContext : public ::oox::core::ContextHandler + { + public: + HeaderFooterContext( ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, HeaderFooter& rHeaderFooter ); + + ~HeaderFooterContext( ); + }; + +} } + +#endif diff --git a/oox/source/ppt/layoutfragmenthandler.cxx b/oox/source/ppt/layoutfragmenthandler.cxx index 06db75f82724..98ff039a9099 100644 --- a/oox/source/ppt/layoutfragmenthandler.cxx +++ b/oox/source/ppt/layoutfragmenthandler.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/container/XNamed.hpp> +#include "headerfootercontext.hxx" #include "oox/ppt/layoutfragmenthandler.hxx" #include "oox/drawingml/shapegroupcontext.hxx" #include "oox/core/namespaces.hxx" @@ -72,6 +73,9 @@ Reference< XFastContextHandler > LayoutFragmentHandler::createFastChildContext( case NMSP_PPT|XML_sldLayout: // CT_SlideLayout mpSlidePersistPtr->setLayoutValueToken( xAttribs->getOptionalValueToken( XML_type, 0 ) ); // CT_SlideLayoutType break; + case NMSP_PPT|XML_hf: // CT_HeaderFooter + xRet.set( new HeaderFooterContext( *this, xAttribs, mpSlidePersistPtr->getHeaderFooter() ) ); + break; default: xRet.set( SlideFragmentHandler::createFastChildContext( aElementToken, xAttribs ) ); } diff --git a/oox/source/ppt/makefile.mk b/oox/source/ppt/makefile.mk index df1826b9add2..fd2946d54826 100644 --- a/oox/source/ppt/makefile.mk +++ b/oox/source/ppt/makefile.mk @@ -54,6 +54,7 @@ SLOFILES = \ $(SLO)$/commontimenodecontext.obj \ $(SLO)$/conditioncontext.obj \ $(SLO)$/customshowlistcontext.obj \ + $(SLO)$/headerfootercontext.obj \ $(SLO)$/layoutfragmenthandler.obj\ $(SLO)$/pptfilterhelpers.obj\ $(SLO)$/pptimport.obj\ diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index c168b8085894..253ae2d799f0 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -82,6 +82,7 @@ void PPTShape::addShape( { oox::drawingml::TextListStylePtr aMasterTextListStyle; Reference< lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW ); + sal_Bool bClearText = sal_False; if ( sServiceName != OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) { @@ -122,24 +123,28 @@ void PPTShape::addShape( { const rtl::OUString sDateTimeShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.DateTimeShape" ) ); sServiceName = sDateTimeShapeService; + bClearText = sal_True; } break; case XML_hdr : { const rtl::OUString sHeaderShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.HeaderShape" ) ); sServiceName = sHeaderShapeService; + bClearText = sal_True; } break; case XML_ftr : { const rtl::OUString sFooterShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.FooterShape" ) ); sServiceName = sFooterShapeService; + bClearText = sal_True; } break; case XML_sldNum : { const rtl::OUString sSlideNumberShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.SlideNumberShape" ) ); sServiceName = sSlideNumberShapeService; + bClearText = sal_True; } break; case XML_sldImg : @@ -157,8 +162,24 @@ void PPTShape::addShape( aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getOtherTextStyle() : rSlidePersist.getOtherTextStyle(); setMasterTextListStyle( aMasterTextListStyle ); - Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, rxTheme, rxShapes, pShapeRect ) ); - + Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, rxTheme, rxShapes, pShapeRect, bClearText ) ); + if ( !rSlidePersist.isMasterPage() && rSlidePersist.getPage().is() && ( (sal_Int32)mnSubType == XML_title ) ) + { + try + { + rtl::OUString aTitleText; + Reference< XTextRange > xText( xShape, UNO_QUERY_THROW ); + aTitleText = xText->getString(); + if ( aTitleText.getLength() && ( aTitleText.getLength() < 64 ) ) // just a magic value, but we don't want to set slide names which are too long + { + Reference< container::XNamed > xName( rSlidePersist.getPage(), UNO_QUERY_THROW ); + xName->setName( aTitleText ); + } + } + catch( uno::Exception& ) + { + } + } if( pShapeMap && msId.getLength() ) { (*pShapeMap)[ msId ] = shared_from_this(); diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx index 2a94ff0dbb63..0b481f8c91cf 100644 --- a/oox/source/ppt/pptshapecontext.cxx +++ b/oox/source/ppt/pptshapecontext.cxx @@ -46,6 +46,7 @@ #include "oox/drawingml/customshapegeometry.hxx" #include "oox/drawingml/textbodycontext.hxx" #include "tokens.hxx" +#include "properties.hxx" using rtl::OUString; using namespace oox::core; @@ -189,6 +190,7 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In case NMSP_PPT|XML_txBody: { oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody ); + xTextBody->getTextProperties().maPropertyMap[ PROP_FontIndependentLineSpacing ] <<= static_cast< sal_Bool >( sal_True ); mpShapePtr->setTextBody( xTextBody ); xRet = new oox::drawingml::TextBodyContext( *this, *xTextBody ); break; diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 287e64e14b55..2cd4fb4d2e5b 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -68,6 +68,14 @@ PresentationFragmentHandler::PresentationFragmentHandler( XmlFilterBase& rFilter : FragmentHandler( rFilter, rFragmentPath ) , mpTextListStyle( new TextListStyle ) { + TextParagraphPropertiesVector& rParagraphDefaulsVector( mpTextListStyle->getListStyle() ); + TextParagraphPropertiesVector::iterator aParagraphDefaultIter( rParagraphDefaulsVector.begin() ); + while( aParagraphDefaultIter != rParagraphDefaulsVector.end() ) + { + // ppt is having zero bottom margin per default, whereas OOo is 0,5cm, + // so this attribute needs to be set always + (*aParagraphDefaultIter++)->getParaBottomMargin() = TextSpacing( 0 ); + } } PresentationFragmentHandler::~PresentationFragmentHandler() throw() @@ -78,6 +86,66 @@ void PresentationFragmentHandler::startDocument() throw (SAXException, RuntimeEx { } +void ResolveTextFields( XmlFilterBase& rFilter ) +{ + const oox::core::TextFieldStack& rTextFields = rFilter.getTextFieldStack(); + if ( rTextFields.size() ) + { + Reference< frame::XModel > xModel( rFilter.getModel() ); + oox::core::TextFieldStack::const_iterator aIter( rTextFields.begin() ); + while( aIter != rTextFields.end() ) + { + const OUString sURL = CREATE_OUSTRING( "URL" ); + Reference< drawing::XDrawPagesSupplier > xDPS( xModel, uno::UNO_QUERY_THROW ); + Reference< drawing::XDrawPages > xDrawPages( xDPS->getDrawPages(), uno::UNO_QUERY_THROW ); + + const oox::core::TextField& rTextField( *aIter++ ); + Reference< XPropertySet > xPropSet( rTextField.xTextField, UNO_QUERY ); + Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); + if ( xPropSetInfo->hasPropertyByName( sURL ) ) + { + rtl::OUString aURL; + if ( xPropSet->getPropertyValue( sURL ) >>= aURL ) + { + const OUString sSlide = CREATE_OUSTRING( "#Slide " ); + const OUString sNotes = CREATE_OUSTRING( "#Notes " ); + sal_Bool bNotes = sal_False; + sal_Int32 nPageNumber = 0; + if ( aURL.match( sSlide ) ) + nPageNumber = aURL.copy( sSlide.getLength() ).toInt32(); + else if ( aURL.match( sNotes ) ) + { + nPageNumber = aURL.copy( sNotes.getLength() ).toInt32(); + bNotes = sal_True; + } + if ( nPageNumber ) + { + try + { + Reference< XDrawPage > xDrawPage; + xDrawPages->getByIndex( nPageNumber - 1 ) >>= xDrawPage; + if ( bNotes ) + { + Reference< ::com::sun::star::presentation::XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW ); + xDrawPage = xPresentationPage->getNotesPage(); + } + Reference< container::XNamed > xNamed( xDrawPage, UNO_QUERY_THROW ); + aURL = CREATE_OUSTRING( "#" ).concat( xNamed->getName() ); + xPropSet->setPropertyValue( sURL, Any( aURL ) ); + Reference< text::XTextContent > xContent( rTextField.xTextField, UNO_QUERY); + Reference< text::XTextRange > xTextRange( rTextField.xTextCursor, UNO_QUERY ); + rTextField.xText->insertTextContent( xTextRange, xContent, sal_True ); + } + catch( uno::Exception& ) + { + } + } + } + } + } + } +} + void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeException) { // todo: localized progress bar text @@ -216,6 +284,7 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce } } } + ResolveTextFields( rFilter ); } catch( uno::Exception& ) { @@ -297,6 +366,26 @@ bool PresentationFragmentHandler::importSlide( const FragmentHandlerRef& rxSlide awt::Size& rPageSize( pSlidePersistPtr->isNotesPage() ? maNotesSize : maSlideSize ); xPropertySet->setPropertyValue( sWidth, Any( rPageSize.Width ) ); xPropertySet->setPropertyValue( sHeight, Any( rPageSize.Height ) ); + + oox::ppt::HeaderFooter aHeaderFooter( pSlidePersistPtr->getHeaderFooter() ); + if ( !pSlidePersistPtr->isMasterPage() ) + aHeaderFooter.mbSlideNumber = aHeaderFooter.mbHeader = aHeaderFooter.mbFooter = aHeaderFooter.mbDateTime = sal_False; + try + { + static const OUString sIsHeaderVisible = CREATE_OUSTRING( "IsHeaderVisible" ); + static const OUString sIsFooterVisible = CREATE_OUSTRING( "IsFooterVisible" ); + static const OUString sIsDateTimeVisible = CREATE_OUSTRING( "IsDateTimeVisible" ); + static const OUString sIsPageNumberVisible = CREATE_OUSTRING( "IsPageNumberVisible" ); + + if ( pSlidePersistPtr->isNotesPage() ) + xPropertySet->setPropertyValue( sIsHeaderVisible, Any( aHeaderFooter.mbHeader ) ); + xPropertySet->setPropertyValue( sIsFooterVisible, Any( aHeaderFooter.mbFooter ) ); + xPropertySet->setPropertyValue( sIsDateTimeVisible, Any( aHeaderFooter.mbDateTime ) ); + xPropertySet->setPropertyValue( sIsPageNumberVisible, Any( aHeaderFooter.mbSlideNumber ) ); + } + catch( uno::Exception& ) + { + } } pSlidePersistPtr->setPath( rxSlideFragmentHandler->getFragmentPath() ); return getFilter().importFragment( rxSlideFragmentHandler ); diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 3de6a18977b8..4127eb32a218 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -38,6 +38,7 @@ #include "oox/helper/propertyset.hxx" #include "oox/core/namespaces.hxx" #include "oox/core/xmlfilterbase.hxx" +#include "headerfootercontext.hxx" #include "oox/ppt/backgroundproperties.hxx" #include "oox/ppt/slidefragmenthandler.hxx" #include "oox/ppt/slidetimingcontext.hxx" @@ -122,6 +123,9 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s case NMSP_PPT|XML_transition: // CT_SlideTransition xRet.set( new SlideTransitionContext( *this, xAttribs, maSlideProperties ) ); break; + case NMSP_PPT|XML_hf: + xRet.set( new HeaderFooterContext( *this, xAttribs, mpSlidePersistPtr->getHeaderFooter() ) ); + break; // BackgroundGroup case NMSP_PPT|XML_bgPr: // CT_BackgroundProperties diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 39cc9cfe58c0..958a9ac24e77 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -1,4 +1,5 @@ AbsoluteName +Action ActiveSplitRange ActiveTable Adjust @@ -135,6 +136,7 @@ FirstPageNumber FocusOnClick FontCharset FontHeight +FontIndependentLineSpacing FontName FontSlant FontStrikeout |