diff options
Diffstat (limited to 'oox/source/ppt/presentationfragmenthandler.cxx')
-rw-r--r-- | oox/source/ppt/presentationfragmenthandler.cxx | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 5c4bfe987249..908b13fdc4ab 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -100,55 +100,55 @@ PresentationFragmentHandler::~PresentationFragmentHandler() throw() static void ResolveTextFields( XmlFilterBase const & rFilter ) { const oox::core::TextFieldStack& rTextFields = rFilter.getTextFieldStack(); - if ( !rTextFields.empty() ) + if ( rTextFields.empty() ) + return; + + const Reference< frame::XModel >& xModel( rFilter.getModel() ); + for (auto const& textField : rTextFields) { - const Reference< frame::XModel >& xModel( rFilter.getModel() ); - for (auto const& textField : rTextFields) + const OUString sURL = "URL"; + Reference< drawing::XDrawPagesSupplier > xDPS( xModel, uno::UNO_QUERY_THROW ); + Reference< drawing::XDrawPages > xDrawPages( xDPS->getDrawPages(), uno::UNO_SET_THROW ); + + const oox::core::TextField& rTextField( textField ); + Reference< XPropertySet > xPropSet( rTextField.xTextField, UNO_QUERY ); + Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); + if ( xPropSetInfo->hasPropertyByName( sURL ) ) { - const OUString sURL = "URL"; - Reference< drawing::XDrawPagesSupplier > xDPS( xModel, uno::UNO_QUERY_THROW ); - Reference< drawing::XDrawPages > xDrawPages( xDPS->getDrawPages(), uno::UNO_SET_THROW ); - - const oox::core::TextField& rTextField( textField ); - Reference< XPropertySet > xPropSet( rTextField.xTextField, UNO_QUERY ); - Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); - if ( xPropSetInfo->hasPropertyByName( sURL ) ) + OUString aURL; + if ( xPropSet->getPropertyValue( sURL ) >>= aURL ) { - OUString aURL; - if ( xPropSet->getPropertyValue( sURL ) >>= aURL ) + const OUString sSlide = "#Slide "; + const OUString sNotes = "#Notes "; + bool bNotes = false; + sal_Int32 nPageNumber = 0; + if ( aURL.match( sSlide ) ) + nPageNumber = aURL.copy( sSlide.getLength() ).toInt32(); + else if ( aURL.match( sNotes ) ) { - const OUString sSlide = "#Slide "; - const OUString sNotes = "#Notes "; - bool bNotes = 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 = true; - } - if ( nPageNumber ) + nPageNumber = aURL.copy( sNotes.getLength() ).toInt32(); + bNotes = true; + } + if ( nPageNumber ) + { + try { - try - { - Reference< XDrawPage > xDrawPage; - xDrawPages->getByIndex( nPageNumber - 1 ) >>= xDrawPage; - if ( bNotes ) - { - Reference< css::presentation::XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW ); - xDrawPage = xPresentationPage->getNotesPage(); - } - Reference< container::XNamed > xNamed( xDrawPage, UNO_QUERY_THROW ); - aURL = "#" + xNamed->getName(); - xPropSet->setPropertyValue( sURL, Any( aURL ) ); - Reference< text::XTextContent > xContent( rTextField.xTextField, UNO_QUERY); - Reference< text::XTextRange > xTextRange = rTextField.xTextCursor; - rTextField.xText->insertTextContent( xTextRange, xContent, true ); - } - catch( uno::Exception& ) + Reference< XDrawPage > xDrawPage; + xDrawPages->getByIndex( nPageNumber - 1 ) >>= xDrawPage; + if ( bNotes ) { + Reference< css::presentation::XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW ); + xDrawPage = xPresentationPage->getNotesPage(); } + Reference< container::XNamed > xNamed( xDrawPage, UNO_QUERY_THROW ); + aURL = "#" + xNamed->getName(); + xPropSet->setPropertyValue( sURL, Any( aURL ) ); + Reference< text::XTextContent > xContent( rTextField.xTextField, UNO_QUERY); + Reference< text::XTextRange > xTextRange = rTextField.xTextCursor; + rTextField.xText->insertTextContent( xTextRange, xContent, true ); + } + catch( uno::Exception& ) + { } } } |