Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SUBCOMPONENTRECOVERY_HXX
21 : #define SUBCOMPONENTRECOVERY_HXX
22 :
23 : #include "subcomponents.hxx"
24 :
25 : #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
26 : #include <com/sun/star/embed/XStorage.hpp>
27 :
28 : #include <comphelper/componentcontext.hxx>
29 :
30 : //........................................................................
31 : namespace dbaccess
32 : {
33 : //........................................................................
34 :
35 : //====================================================================
36 : //= SubComponentRecovery
37 : //====================================================================
38 0 : class DBACCESS_DLLPRIVATE SubComponentRecovery
39 : {
40 : public:
41 0 : SubComponentRecovery( const ::comphelper::ComponentContext& i_rContext, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& i_rController,
42 : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& i_rComponent )
43 : :m_rContext( i_rContext )
44 : ,m_xDocumentUI( i_rController, ::com::sun::star::uno::UNO_SET_THROW )
45 : ,m_xComponent( i_rComponent )
46 : ,m_eType( UNKNOWN )
47 0 : ,m_aCompDesc()
48 : {
49 0 : impl_identifyComponent_throw();
50 0 : }
51 :
52 0 : SubComponentRecovery( const ::comphelper::ComponentContext& i_rContext, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& i_rController,
53 : const SubComponentType i_eType )
54 : :m_rContext( i_rContext )
55 : ,m_xDocumentUI( i_rController, ::com::sun::star::uno::UNO_SET_THROW )
56 : ,m_xComponent()
57 : ,m_eType( i_eType )
58 0 : ,m_aCompDesc()
59 : {
60 0 : }
61 :
62 : // only to be used after being constructed with a component
63 : void saveToRecoveryStorage(
64 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rRecoveryStorage,
65 : MapCompTypeToCompDescs& io_mapCompDescs
66 : );
67 :
68 : // only to be used after being constructed with a type
69 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
70 : recoverFromStorage(
71 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rRecoveryStorage,
72 : const ::rtl::OUString& i_rComponentName,
73 : const bool i_bForEditing
74 : );
75 :
76 : static const ::rtl::OUString getComponentsStorageName( const SubComponentType i_eType );
77 :
78 : private:
79 : void impl_saveSubDocument_throw(
80 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rObjectStorage
81 : );
82 :
83 : void impl_saveQueryDesign_throw(
84 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rObjectStorage
85 : );
86 :
87 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
88 : impl_recoverSubDocument_throw(
89 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rRecoveryStorage,
90 : const ::rtl::OUString& i_rComponentName,
91 : const bool i_bForEditing
92 : );
93 :
94 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
95 : impl_recoverQueryDesign_throw(
96 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rRecoveryStorage,
97 : const ::rtl::OUString& i_rComponentName,
98 : const bool i_bForEditing
99 : );
100 :
101 : void impl_identifyComponent_throw();
102 :
103 : private:
104 : const ::comphelper::ComponentContext& m_rContext;
105 : ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >
106 : m_xDocumentUI;
107 : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
108 : m_xComponent;
109 : SubComponentType m_eType;
110 : SubComponentDescriptor m_aCompDesc;
111 : };
112 :
113 :
114 : //........................................................................
115 : } // namespace dbaccess
116 : //........................................................................
117 :
118 : #endif // SUBCOMPONENTRECOVERY_HXX
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|