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 : #include <com/sun/star/uno/XComponentContext.hpp>
28 :
29 : //........................................................................
30 : namespace dbaccess
31 : {
32 : //........................................................................
33 :
34 : //====================================================================
35 : //= SubComponentRecovery
36 : //====================================================================
37 0 : class DBACCESS_DLLPRIVATE SubComponentRecovery
38 : {
39 : public:
40 0 : SubComponentRecovery(
41 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
42 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& i_rController,
43 : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& i_rComponent )
44 : :m_rContext( i_rContext )
45 : ,m_xDocumentUI( i_rController, ::com::sun::star::uno::UNO_SET_THROW )
46 : ,m_xComponent( i_rComponent )
47 : ,m_eType( UNKNOWN )
48 0 : ,m_aCompDesc()
49 : {
50 0 : impl_identifyComponent_throw();
51 0 : }
52 :
53 0 : SubComponentRecovery(
54 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
55 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& i_rController,
56 : const SubComponentType i_eType )
57 : :m_rContext( i_rContext )
58 : ,m_xDocumentUI( i_rController, ::com::sun::star::uno::UNO_SET_THROW )
59 : ,m_xComponent()
60 : ,m_eType( i_eType )
61 0 : ,m_aCompDesc()
62 : {
63 0 : }
64 :
65 : // only to be used after being constructed with a component
66 : void saveToRecoveryStorage(
67 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rRecoveryStorage,
68 : MapCompTypeToCompDescs& io_mapCompDescs
69 : );
70 :
71 : // only to be used after being constructed with a type
72 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
73 : recoverFromStorage(
74 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rRecoveryStorage,
75 : const OUString& i_rComponentName,
76 : const bool i_bForEditing
77 : );
78 :
79 : static const OUString getComponentsStorageName( const SubComponentType i_eType );
80 :
81 : private:
82 : void impl_saveSubDocument_throw(
83 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rObjectStorage
84 : );
85 :
86 : void impl_saveQueryDesign_throw(
87 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rObjectStorage
88 : );
89 :
90 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
91 : impl_recoverSubDocument_throw(
92 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rRecoveryStorage,
93 : const OUString& i_rComponentName,
94 : const bool i_bForEditing
95 : );
96 :
97 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
98 : impl_recoverQueryDesign_throw(
99 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rRecoveryStorage,
100 : const OUString& i_rComponentName,
101 : const bool i_bForEditing
102 : );
103 :
104 : void impl_identifyComponent_throw();
105 :
106 : private:
107 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
108 : m_rContext;
109 : ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >
110 : m_xDocumentUI;
111 : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
112 : m_xComponent;
113 : SubComponentType m_eType;
114 : SubComponentDescriptor m_aCompDesc;
115 : };
116 :
117 :
118 : //........................................................................
119 : } // namespace dbaccess
120 : //........................................................................
121 :
122 : #endif // SUBCOMPONENTRECOVERY_HXX
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|