Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVXMSBAS_HXX
30 : : #define _SVXMSBAS_HXX
31 : :
32 : : #include <tools/solar.h>
33 : : #include "filter/msfilter/msfilterdllapi.h"
34 : :
35 : : #include <sot/storage.hxx>
36 : : #include <map>
37 : : #include <boost/unordered_map.hpp>
38 : :
39 : : class SfxObjectShell;
40 : :
41 : : /* Construct with the root storage of the MS document, with bImportCode
42 : : * set the visual basic code will be imported into the stardocument when Import
43 : : * is called, with bCopyStorage set, the visual basic storage tree will be
44 : : * copied completely into staroffice, so that any future export to a msoffice
45 : : * format will retain the vba code, allowing a lossless roundtrip from
46 : : * msoffice to staroffice and back.
47 : : *
48 : : * Setting bAsComment to true in Import will import the visual basic as a
49 : : * starbasic comment. Which is currently necessary, as vb is not valid sb.
50 : : *
51 : : * Setting bStripped will remove the "Attribute" lines from the vb, msoffice
52 : : * does this itself when it shows the vb code in the vbeditor, so this is
53 : : * probably what the user expects to see when viewing the code
54 : : */
55 : :
56 : : typedef boost::unordered_map< sal_Int32, String > ObjIdToName;
57 : :
58 : : typedef std::map< String, ObjIdToName > ControlAttributeInfo;
59 : :
60 : 0 : class MSFILTER_DLLPUBLIC SvxImportMSVBasic
61 : : {
62 : : public:
63 : 0 : SvxImportMSVBasic( SfxObjectShell &rDocS, SotStorage &rRoot,
64 : : sal_Bool bImportCode = sal_True, sal_Bool bCopyStorage = sal_True )
65 : : : xRoot(&rRoot), rDocSh(rDocS),
66 : 0 : bImport(bImportCode), bCopy(bCopyStorage)
67 : 0 : {}
68 : : // only for the export - copy or delete the saved VBA-macro-storage
69 : : // form the ObjectShell
70 : : // - returns a warning code if a modified basic exist, in all other
71 : : // cases return ERRCODE_NONE.
72 : : sal_uLong SaveOrDelMSVBAStorage( sal_Bool bSaveInto, const String& rStorageName );
73 : :
74 : : // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
75 : : // If it exist, then return the WarningId for loosing the information.
76 : : static sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
77 : :
78 : : static String GetMSBasicStorageName();
79 : : private:
80 : : SotStorageRef xRoot;
81 : : SfxObjectShell &rDocSh;
82 : : sal_Bool bImport;
83 : : sal_Bool bCopy;
84 : : };
85 : :
86 : : #endif
87 : :
88 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|