1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: migration_impl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _DESKTOP_MIGRATION_IMPL_HXX_
31 #define _DESKTOP_MIGRATION_IMPL_HXX_
37 #include "migration.hxx"
39 #include <sal/types.h>
40 #include <rtl/string.hxx>
41 #include <rtl/ustring.hxx>
43 #include <com/sun/star/uno/Reference.hxx>
45 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 #include <com/sun/star/container/XNameAccess.hpp>
48 #define NS_CSS com::sun::star
49 #define NS_UNO com::sun::star::uno
56 rtl::OUString productname
; // human readeable product name
57 rtl::OUString userdata
; // file: url for user installation
60 typedef std::vector
< rtl::OUString
> strings_v
;
61 typedef std::auto_ptr
< strings_v
> strings_vr
;
66 strings_v includeFiles
;
67 strings_v excludeFiles
;
68 strings_v includeConfig
;
69 strings_v excludeConfig
;
70 strings_v configComponents
;
71 rtl::OUString service
;
74 typedef std::vector
< migration_step
> migrations_v
;
75 typedef std::auto_ptr
< migrations_v
> migrations_vr
;
86 explicit VersionNumber();
87 explicit VersionNumber(sal_Int32 nMajor
, sal_Int32 nMinor
, sal_Int32 nMicro
);
91 strings_vr m_vrVersions
;
92 NS_UNO::Reference
< NS_CSS::lang::XMultiServiceFactory
> m_xFactory
;
93 migrations_vr m_vrMigrations
; // list of all migration specs from config
94 install_info m_aInfo
; // info about the version being migrated
95 strings_vr m_vrFileList
; // final list of files to be copied
96 strings_vr m_vrConfigList
; // final list of nodes to be copied
97 strings_vr m_vrServiceList
; // final list of services to be called
98 ::rtl::OUString m_aAppVerStr
;
99 bool m_bMigrationCompleted
;
100 VersionNumber m_aAppVerNum
;
101 VersionNumber m_aConfigVerNum
;
103 void initDirectoryMigration();
105 // initializer functions...
106 migrations_vr
readMigrationSteps();
107 install_info
findInstallation();
108 strings_vr
compileFileList();
109 strings_vr
compileConfigList();
110 strings_vr
compileServiceList();
113 void substract(strings_v
& va
, const strings_v
& vb_c
) const;
114 strings_vr
getAllFiles(const rtl::OUString
& baseURL
) const;
115 strings_vr
applyPatterns(const strings_v
& vSet
, const strings_v
& vPatterns
) const;
116 NS_UNO::Reference
< NS_CSS::container::XNameAccess
> getConfigAccess(const sal_Char
* path
, sal_Bool rw
=sal_False
);
118 // actual processing function that perform the migration steps
123 void transKeyConfig();
124 void cleanCSVImportCharSet();
125 void transCalcFormulaConfig();
127 void setMigrationCompleted();
130 MigrationImpl(const NS_UNO::Reference
< NS_CSS::lang::XMultiServiceFactory
>&);
132 sal_Bool
doMigration();
133 sal_Bool
checkMigration();
134 rtl::OUString
getOldVersionName();