From dffb97276ae61aefeb62696bd16dc78ab6b5b5d1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 1 Dec 2010 09:57:05 +0100 Subject: dba34b: #i113555# when a button's URL points to a document-local target, properly export this to PDF --- toolkit/source/helper/formpdfexport.cxx | 58 +++++++++++++-------------------- 1 file changed, 23 insertions(+), 35 deletions(-) (limited to 'toolkit/source') diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx index bff2d6008d10..1bde6f66a3c0 100644 --- a/toolkit/source/helper/formpdfexport.cxx +++ b/toolkit/source/helper/formpdfexport.cxx @@ -28,58 +28,27 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_toolkit.hxx" -#ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX #include -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_STYLE_VERTICALALIGNMENT_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_FORM_SUBMITMETHOD_HPP_ #include -#endif /** === end UNO includes === **/ -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include -#endif -#ifndef _VCL_PDFEXTOUTDEVDATA_HXX +#include #include -#endif -#ifndef _SV_OUTDEV_HXX #include -#endif #include #include @@ -315,7 +284,8 @@ namespace toolkitform //-------------------------------------------------------------------- /** creates a PDF compatible control descriptor for the given control */ - void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl, ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor ) SAL_THROW(()) + void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl, + ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor, ::vcl::PDFExtOutDevData& i_pdfExportData ) SAL_THROW(()) { _rpDescriptor.reset( NULL ); OSL_ENSURE( _rxControl.is(), "describePDFControl: invalid (NULL) control!" ); @@ -529,7 +499,25 @@ namespace toolkitform } else if ( eButtonType == FormButtonType_URL ) { - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= pButtonWidget->URL); + ::rtl::OUString sURL; + OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= sURL ); + const bool bDocumentLocalTarget = ( sURL.getLength() > 0 ) && ( sURL.getStr()[0] == '#' ); + if ( bDocumentLocalTarget ) + { + const ::rtl::OUString sDestinationName( sURL.copy(1) ); + // Register the destination for for future handling ... + pButtonWidget->Dest = i_pdfExportData.RegisterDest(); + + // and put it into the bookmarks, to ensure the future handling really happens + ::std::vector< ::vcl::PDFExtOutDevBookmarkEntry >& rBookmarks( i_pdfExportData.GetBookmarks() ); + ::vcl::PDFExtOutDevBookmarkEntry aBookmark; + aBookmark.nDestId = pButtonWidget->Dest; + aBookmark.aBookmark = sURL; + rBookmarks.push_back( aBookmark ); + } + else + pButtonWidget->URL = sURL; + pButtonWidget->Submit = false; } @@ -630,7 +618,7 @@ namespace toolkitform } catch( const Exception& ) { - OSL_ENSURE( sal_False, "describePDFControl: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } } -- cgit From b4a5fc894e64aeb5c7cd0ddd5efd4c78b55cc883 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 3 Dec 2010 14:29:06 +0100 Subject: dba34c: during #i115901#: do not use an own static WorkWindow, but the Application-provided one, this is ensure to be cleaned up properly upon application termination --- toolkit/source/controls/unocontrol.cxx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'toolkit/source') diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 075080906900..9529791db067 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -91,17 +91,6 @@ static const LanguageDependentProp aLanguageDependentProp[] = { 0, 0 } }; -WorkWindow* lcl_GetDefaultWindow() -{ - static WorkWindow* pW = NULL; - if ( !pW ) - { - pW = new WorkWindow( NULL, 0 ); - pW->EnableChildTransparentMode(); - } - return pW; -} - static Sequence< ::rtl::OUString> lcl_ImplGetPropertyNames( const Reference< XMultiPropertySet > & rxModel ) { Sequence< ::rtl::OUString> aNames; @@ -218,14 +207,15 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE Reference< XControl > xMe; OWeakAggObject::queryInterface( ::getCppuType( &xMe ) ) >>= xMe; - WorkWindow* pWW; + Window* pParentWindow( NULL ); { osl::Guard< vos::IMutex > aGuard( Application::GetSolarMutex() ); - pWW = lcl_GetDefaultWindow(); + pParentWindow = dynamic_cast< Window* >( Application::GetDefaultDevice() ); + ENSURE_OR_THROW( pParentWindow != NULL, "could obtain a default parent window!" ); } try { - xMe->createPeer( NULL, pWW->GetComponentInterface( sal_True ) ); + xMe->createPeer( NULL, pParentWindow->GetComponentInterface( sal_True ) ); } catch( const Exception& ) { -- cgit