1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef _SFX_FRMLOAD_HXX
29 #define _SFX_FRMLOAD_HXX
31 #include "sfx2/sfxuno.hxx"
32 #include "sfx2/objsh.hxx"
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 === **/
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>
60 class SfxFilterMatcher
;
64 class SAL_DLLPRIVATE SfxFrameLoader_Impl
: public ::cppu::WeakImplHelper2
< ::com::sun::star::frame::XSynchronousFrameLoader
, ::com::sun::star::lang::XServiceInfo
>
66 ::comphelper::ComponentContext m_aContext
;
69 SfxFrameLoader_Impl( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
);
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
);
80 virtual ~SfxFrameLoader_Impl();
83 const SfxFilter
* impl_getFilterFromServiceName_nothrow(
84 const ::rtl::OUString
& i_rServiceName
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
92 const SfxFilter
* impl_detectFilterForURL(
93 const ::rtl::OUString
& _rURL
,
94 const ::comphelper::NamedValueCollection
& i_rDescriptor
,
95 const SfxFilterMatcher
& rMatcher
98 sal_Bool
impl_createNewDocWithSlotParam(
99 const sal_uInt16 _nSlotID
,
100 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& i_rxFrame
,
104 void impl_determineFilter(
105 ::comphelper::NamedValueCollection
& io_rDescriptor
108 bool impl_determineTemplateDocument(
109 ::comphelper::NamedValueCollection
& io_rDescriptor
112 sal_uInt16
impl_findSlotParam(
113 const ::rtl::OUString
& i_rFactoryURL
116 SfxObjectShellRef
impl_findObjectShell(
117 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel2
>& i_rxDocument
120 void impl_lockHiddenDocument(
121 SfxObjectShell
& i_rDocument
,
122 const ::comphelper::NamedValueCollection
& i_rDescriptor
125 void impl_handleCaughtError_nothrow(
126 const ::com::sun::star::uno::Any
& i_rCaughtError
,
127 const ::comphelper::NamedValueCollection
& i_rDescriptor
130 void impl_removeLoaderArguments(
131 ::comphelper::NamedValueCollection
& io_rDescriptor
134 sal_Int16
impl_determineEffectiveViewId_nothrow(
135 const SfxObjectShell
& i_rDocument
,
136 const ::comphelper::NamedValueCollection
& i_rDescriptor
139 ::comphelper::NamedValueCollection
140 impl_extractViewCreationArgs(
141 ::comphelper::NamedValueCollection
& io_rDescriptor
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