1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SFX_FRMLOAD_HXX 25 #define _SFX_FRMLOAD_HXX 26 27 #include "sfx2/sfxuno.hxx" 28 #include "sfx2/objsh.hxx" 29 30 /** === begin UNO includes === **/ 31 #include <com/sun/star/frame/XLoadEventListener.hpp> 32 #include <com/sun/star/frame/XSynchronousFrameLoader.hpp> 33 #include <com/sun/star/frame/XController2.hpp> 34 #include <com/sun/star/frame/XModel2.hpp> 35 #include <com/sun/star/document/XExtendedFilterDetection.hpp> 36 #include <com/sun/star/uno/Exception.hpp> 37 #include <com/sun/star/lang/XServiceInfo.hpp> 38 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 39 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 40 #include <com/sun/star/frame/XFrame.hpp> 41 #include <com/sun/star/task/XInteractionHandler.hpp> 42 /** === end UNO includes === **/ 43 44 #include <rtl/ustring.hxx> 45 #include <tools/debug.hxx> 46 #include <cppuhelper/implbase1.hxx> 47 #include <cppuhelper/implbase2.hxx> 48 #include <cppuhelper/implbase3.hxx> 49 #include <cppuhelper/factory.hxx> 50 #include <tools/link.hxx> 51 #include <tools/string.hxx> 52 #include <comphelper/componentcontext.hxx> 53 #include <comphelper/namedvaluecollection.hxx> 54 55 class SfxFilter; 56 class SfxFilterMatcher; 57 58 class SfxFrameWeak; 59 60 class SAL_DLLPRIVATE SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > 61 { 62 ::comphelper::ComponentContext m_aContext; 63 64 public: 65 SfxFrameLoader_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); 66 67 SFX_DECL_XSERVICEINFO 68 69 //---------------------------------------------------------------------------------- 70 // XSynchronousFrameLoader 71 //---------------------------------------------------------------------------------- 72 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 ); 73 virtual void SAL_CALL cancel() throw( ::com::sun::star::uno::RuntimeException ); 74 75 protected: 76 virtual ~SfxFrameLoader_Impl(); 77 78 private: 79 const SfxFilter* impl_getFilterFromServiceName_nothrow( 80 const ::rtl::OUString& i_rServiceName 81 ) const; 82 83 ::rtl::OUString impl_askForFilter_nothrow( 84 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& i_rxHandler, 85 const ::rtl::OUString& i_rDocumentURL 86 ) const; 87 88 const SfxFilter* impl_detectFilterForURL( 89 const ::rtl::OUString& _rURL, 90 const ::comphelper::NamedValueCollection& i_rDescriptor, 91 const SfxFilterMatcher& rMatcher 92 ) const; 93 94 sal_Bool impl_createNewDocWithSlotParam( 95 const sal_uInt16 _nSlotID, 96 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame, 97 const bool i_bHidden 98 ); 99 100 void impl_determineFilter( 101 ::comphelper::NamedValueCollection& io_rDescriptor 102 ) const; 103 104 bool impl_determineTemplateDocument( 105 ::comphelper::NamedValueCollection& io_rDescriptor 106 ) const; 107 108 sal_uInt16 impl_findSlotParam( 109 const ::rtl::OUString& i_rFactoryURL 110 ) const; 111 112 SfxObjectShellRef impl_findObjectShell( 113 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rxDocument 114 ) const; 115 116 void impl_lockHiddenDocument( 117 SfxObjectShell& i_rDocument, 118 const ::comphelper::NamedValueCollection& i_rDescriptor 119 ) const; 120 121 void impl_handleCaughtError_nothrow( 122 const ::com::sun::star::uno::Any& i_rCaughtError, 123 const ::comphelper::NamedValueCollection& i_rDescriptor 124 ) const; 125 126 void impl_removeLoaderArguments( 127 ::comphelper::NamedValueCollection& io_rDescriptor 128 ); 129 130 sal_Int16 impl_determineEffectiveViewId_nothrow( 131 const SfxObjectShell& i_rDocument, 132 const ::comphelper::NamedValueCollection& i_rDescriptor 133 ); 134 135 ::comphelper::NamedValueCollection 136 impl_extractViewCreationArgs( 137 ::comphelper::NamedValueCollection& io_rDescriptor 138 ); 139 140 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > 141 impl_createDocumentView( 142 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rModel, 143 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, 144 const ::comphelper::NamedValueCollection& i_rViewFactoryArgs, 145 const ::rtl::OUString& i_rViewName 146 ); 147 }; 148 149 #endif 150