diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-03-25 10:57:30 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-03-25 10:57:30 +0100 |
commit | c75ebe36ab82d55c30a2c4fd9c866812474566fa (patch) | |
tree | 92cfddcfd31583a7fecb34eb3e4ffaa197a96201 /toolkit | |
parent | 7ca3f3c0a7b848e06b9c9d0bf1b0e44cd58937bf (diff) | |
parent | d26d7768d7315d783fd143765ae68bc802c4445b (diff) |
gridfixes: pulled and merged DEV300:m104
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/toolkit/controls/dialogcontrol.hxx | 26 | ||||
-rw-r--r-- | toolkit/inc/toolkit/helper/formpdfexport.hxx | 14 | ||||
-rw-r--r-- | toolkit/qa/unoapi/makefile.mk | 48 | ||||
-rw-r--r-- | toolkit/source/controls/dialogcontrol.cxx | 41 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrol.cxx | 18 | ||||
-rw-r--r-- | toolkit/source/helper/formpdfexport.cxx | 58 |
6 files changed, 111 insertions, 94 deletions
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx index 17b958aeace9..9c0ffa3b78fb 100644 --- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx +++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx @@ -30,12 +30,13 @@ #include <toolkit/controls/controlmodelcontainerbase.hxx> #include <com/sun/star/awt/XTopWindow.hpp> -#include <com/sun/star/awt/XDialog.hpp> +#include <com/sun/star/awt/XDialog2.hpp> #include <com/sun/star/resource/XStringResourceResolver.hpp> #include "toolkit/helper/servicenames.hxx" #include "toolkit/helper/macros.hxx" #include <toolkit/controls/unocontrolcontainer.hxx> #include <cppuhelper/basemutex.hxx> +#include <cppuhelper/implbase3.hxx> #include <list> // ---------------------------------------------------- @@ -64,10 +65,12 @@ public: }; -class UnoDialogControl :public ControlContainerBase, - public ::com::sun::star::awt::XTopWindow, - public ::com::sun::star::awt::XDialog, - public ::com::sun::star::awt::XWindowListener +typedef ::cppu::AggImplInheritanceHelper3 < ControlContainerBase + , ::com::sun::star::awt::XTopWindow + , ::com::sun::star::awt::XDialog2 + , ::com::sun::star::awt::XWindowListener + > UnoDialogControl_Base; +class UnoDialogControl : public UnoDialogControl_Base { private: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar; @@ -80,11 +83,6 @@ public: ~UnoDialogControl(); ::rtl::OUString GetComponentServiceName(); - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); } - ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); } - void SAL_CALL release() throw() { OWeakAggObject::release(); } - void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); @@ -102,16 +100,16 @@ public: virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XDialog2 + virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHelpId( const rtl::OUString& Id ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XDialog void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException); ::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException); sal_Int16 SAL_CALL execute() throw(::com::sun::star::uno::RuntimeException); void SAL_CALL endExecute() throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::awt::XControl sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException); diff --git a/toolkit/inc/toolkit/helper/formpdfexport.hxx b/toolkit/inc/toolkit/helper/formpdfexport.hxx index 502f25520145..cafcb5d00d38 100644 --- a/toolkit/inc/toolkit/helper/formpdfexport.hxx +++ b/toolkit/inc/toolkit/helper/formpdfexport.hxx @@ -28,22 +28,21 @@ #ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX #define _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX -#ifndef TOOLKIT_DLLAPI_H #include <toolkit/dllapi.h> -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ #include <com/sun/star/awt/XControl.hpp> -#endif /** === end UNO includes === **/ -#ifndef _VCL_PDFWRITER_HXX #include <vcl/pdfwriter.hxx> -#endif #include <memory> +namespace vcl +{ + class PDFExtOutDevData; +} + //........................................................................ namespace toolkitform { @@ -53,7 +52,8 @@ namespace toolkitform */ void TOOLKIT_DLLPUBLIC describePDFControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, - ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor + ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor, + ::vcl::PDFExtOutDevData& i_pdfExportData ) SAL_THROW(()); //........................................................................ diff --git a/toolkit/qa/unoapi/makefile.mk b/toolkit/qa/unoapi/makefile.mk new file mode 100644 index 000000000000..9517601c3917 --- /dev/null +++ b/toolkit/qa/unoapi/makefile.mk @@ -0,0 +1,48 @@ +#************************************************************************* +# 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. +#***********************************************************************/ + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ = ../.. +PRJNAME = toolkit +TARGET = qa_unoapi + +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/toolkit/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END + +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk + +ALLTAR : javatest + +.END diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 8f400ff1945c..556acbf5d0d2 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -165,7 +165,7 @@ Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) thro // ============================================================================ UnoDialogControl::UnoDialogControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory ) - :ControlContainerBase( i_factory ) + :UnoDialogControl_Base( i_factory ) ,maTopWindowListeners( *this ) ,mbWindowListener(false) { @@ -188,25 +188,6 @@ UnoDialogControl::~UnoDialogControl() return ::rtl::OUString::createFromAscii( "TabPage" ); } -// XInterface -Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException) -{ - uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XTopWindow*, this ) ); - if ( !aRet.hasValue() ) - aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XDialog*, this ) ); - if ( !aRet.hasValue() ) - aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XWindowListener*, this ) ); - return (aRet.hasValue() ? aRet : ControlContainerBase::queryAggregation( rType )); -} - - //lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( UnoDialogControl) - getCppuType( ( uno::Reference< awt::XTopWindow>* ) NULL ), - getCppuType( ( uno::Reference< awt::XDialog>* ) NULL ), - getCppuType( ( uno::Reference< awt::XWindowListener>* ) NULL ), - ControlContainerBase::getTypes() -IMPL_XTYPEPROVIDER_END - void UnoDialogControl::dispose() throw(RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); @@ -409,18 +390,30 @@ throw (::com::sun::star::uno::RuntimeException) } } -void SAL_CALL UnoDialogControl::windowShown( const ::com::sun::star::lang::EventObject& e ) -throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL UnoDialogControl::windowShown( const EventObject& e ) throw (RuntimeException) { (void)e; } -void SAL_CALL UnoDialogControl::windowHidden( const ::com::sun::star::lang::EventObject& e ) -throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL UnoDialogControl::windowHidden( const EventObject& e ) throw (RuntimeException) { (void)e; } +void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException) +{ + Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY ); + if ( xPeerDialog.is() ) + xPeerDialog->endDialog( i_result ); +} + +void SAL_CALL UnoDialogControl::setHelpId( const rtl::OUString& i_id ) throw (RuntimeException) +{ + Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY ); + if ( xPeerDialog.is() ) + xPeerDialog->setHelpId( i_id ); +} + void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 7fbac44035c6..38f2fd7c2603 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -92,17 +92,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; @@ -238,14 +227,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& ) { 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 <toolkit/helper/formpdfexport.hxx> -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ #include <com/sun/star/container/XIndexAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ #include <com/sun/star/container/XNameContainer.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_ #include <com/sun/star/form/XForm.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ #include <com/sun/star/container/XChild.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_ #include <com/sun/star/form/FormComponentType.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_ #include <com/sun/star/awt/TextAlign.hpp> -#endif -#ifndef _COM_SUN_STAR_STYLE_VERTICALALIGNMENT_HPP_ #include <com/sun/star/style/VerticalAlignment.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_ #include <com/sun/star/form/FormButtonType.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_SUBMITMETHOD_HPP_ #include <com/sun/star/form/FormSubmitMethod.hpp> -#endif /** === end UNO includes === **/ -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/helper/vclunohelper.hxx> -#endif -#ifndef _VCL_PDFEXTOUTDEVDATA_HXX +#include <tools/diagnose_ex.h> #include <vcl/pdfextoutdevdata.hxx> -#endif -#ifndef _SV_OUTDEV_HXX #include <vcl/outdev.hxx> -#endif #include <functional> #include <algorithm> @@ -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(); } } |