1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SFX_FRMLOAD_HXX 29 #define _SFX_FRMLOAD_HXX 30 31 #include "sfx2/sfxuno.hxx" 32 #include "sfx2/objsh.hxx" 33 34 /** === begin UNO includes === **/ 35 #include <com/sun/star/frame/XLoadEventListener.hpp> 36 #include <com/sun/star/frame/XSynchronousFrameLoader.hpp> 37 #include <com/sun/star/frame/XController2.hpp> 38 #include <com/sun/star/frame/XModel2.hpp> 39 #include <com/sun/star/document/XExtendedFilterDetection.hpp> 40 #include <com/sun/star/uno/Exception.hpp> 41 #include <com/sun/star/lang/XServiceInfo.hpp> 42 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 43 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 44 #include <com/sun/star/frame/XFrame.hpp> 45 #include <com/sun/star/task/XInteractionHandler.hpp> 46 /** === end UNO includes === **/ 47 48 #include <rtl/ustring.hxx> 49 #include <tools/debug.hxx> 50 #include <cppuhelper/implbase1.hxx> 51 #include <cppuhelper/implbase2.hxx> 52 #include <cppuhelper/implbase3.hxx> 53 #include <cppuhelper/factory.hxx> 54 #include <tools/link.hxx> 55 #include <tools/string.hxx> 56 #include <comphelper/componentcontext.hxx> 57 #include <comphelper/namedvaluecollection.hxx> 58 59 class SfxFilter; 60 class SfxFilterMatcher; 61 62 class SfxFrameWeak; 63 64 class SAL_DLLPRIVATE SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > 65 { 66 ::comphelper::ComponentContext m_aContext; 67 68 public: 69 SfxFrameLoader_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); 70 71 SFX_DECL_XSERVICEINFO 72 73 //---------------------------------------------------------------------------------- 74 // XSynchronousFrameLoader 75 //---------------------------------------------------------------------------------- 76 virtual sal_Bool SAL_CALL load( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ) throw( ::com::sun::star::uno::RuntimeException ); 77 virtual void SAL_CALL cancel() throw( ::com::sun::star::uno::RuntimeException ); 78 79 protected: 80 virtual ~SfxFrameLoader_Impl(); 81 82 private: 83 const SfxFilter* impl_getFilterFromServiceName_nothrow( 84 const ::rtl::OUString& i_rServiceName 85 ) const; 86 87 ::rtl::OUString impl_askForFilter_nothrow( 88 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& i_rxHandler, 89 const ::rtl::OUString& i_rDocumentURL 90 ) const; 91 92 const SfxFilter* impl_detectFilterForURL( 93 const ::rtl::OUString& _rURL, 94 const ::comphelper::NamedValueCollection& i_rDescriptor, 95 const SfxFilterMatcher& rMatcher 96 ) const; 97 98 sal_Bool impl_createNewDocWithSlotParam( 99 const sal_uInt16 _nSlotID, 100 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame, 101 const bool i_bHidden 102 ); 103 104 void impl_determineFilter( 105 ::comphelper::NamedValueCollection& io_rDescriptor 106 ) const; 107 108 bool impl_determineTemplateDocument( 109 ::comphelper::NamedValueCollection& io_rDescriptor 110 ) const; 111 112 sal_uInt16 impl_findSlotParam( 113 const ::rtl::OUString& i_rFactoryURL 114 ) const; 115 116 SfxObjectShellRef impl_findObjectShell( 117 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rxDocument 118 ) const; 119 120 void impl_lockHiddenDocument( 121 SfxObjectShell& i_rDocument, 122 const ::comphelper::NamedValueCollection& i_rDescriptor 123 ) const; 124 125 void impl_handleCaughtError_nothrow( 126 const ::com::sun::star::uno::Any& i_rCaughtError, 127 const ::comphelper::NamedValueCollection& i_rDescriptor 128 ) const; 129 130 void impl_removeLoaderArguments( 131 ::comphelper::NamedValueCollection& io_rDescriptor 132 ); 133 134 sal_Int16 impl_determineEffectiveViewId_nothrow( 135 const SfxObjectShell& i_rDocument, 136 const ::comphelper::NamedValueCollection& i_rDescriptor 137 ); 138 139 ::comphelper::NamedValueCollection 140 impl_extractViewCreationArgs( 141 ::comphelper::NamedValueCollection& io_rDescriptor 142 ); 143 144 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > 145 impl_createDocumentView( 146 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rModel, 147 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, 148 const ::comphelper::NamedValueCollection& i_rViewFactoryArgs, 149 const ::rtl::OUString& i_rViewName 150 ); 151 }; 152 153 #endif 154