1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_CONFIGMGR_SOURCE_DATA_HXX 29 #define INCLUDED_CONFIGMGR_SOURCE_DATA_HXX 30 31 #include "sal/config.h" 32 33 #include <climits> 34 #include <map> 35 #include <vector> 36 37 #include "boost/noncopyable.hpp" 38 #include "rtl/ref.hxx" 39 #include "rtl/ustring.hxx" 40 #include "sal/types.h" 41 #include "salhelper/simplereferenceobject.hxx" 42 43 #include "additions.hxx" 44 #include "modifications.hxx" 45 #include "nodemap.hxx" 46 #include "path.hxx" 47 48 namespace configmgr { 49 50 class Node; 51 52 struct Data: private boost::noncopyable { 53 enum { NO_LAYER = INT_MAX }; 54 55 struct ExtensionXcu: public salhelper::SimpleReferenceObject { 56 int layer; 57 Additions additions; 58 }; 59 60 NodeMap templates; 61 62 NodeMap components; 63 64 Modifications modifications; 65 66 static rtl::OUString createSegment( 67 rtl::OUString const & templateName, rtl::OUString const & name); 68 69 static sal_Int32 parseSegment( 70 rtl::OUString const & path, sal_Int32 index, rtl::OUString * name, 71 bool * setElement, rtl::OUString * templateName); 72 73 static rtl::OUString fullTemplateName( 74 rtl::OUString const & component, rtl::OUString const & name); 75 76 //TODO: better rules under which circumstances a short template name matches 77 static bool equalTemplateNames( 78 rtl::OUString const & shortName, rtl::OUString const & longName); 79 80 static rtl::Reference< Node > findNode( 81 int layer, NodeMap const & map, rtl::OUString const & name); 82 83 rtl::Reference< Node > resolvePathRepresentation( 84 rtl::OUString const & pathRepresentation, 85 rtl::OUString * canonicRepresenation, Path * path, int * finalizedLayer) 86 const; 87 88 rtl::Reference< Node > getTemplate( 89 int layer, rtl::OUString const & fullName) const; 90 91 Additions * addExtensionXcuAdditions( 92 rtl::OUString const & url, int layer); 93 94 rtl::Reference< ExtensionXcu > removeExtensionXcuAdditions( 95 rtl::OUString const & url); 96 97 private: 98 typedef std::map< rtl::OUString, rtl::Reference< ExtensionXcu > > 99 ExtensionXcuAdditions; 100 101 ExtensionXcuAdditions extensionXcuAdditions_; 102 }; 103 104 } 105 106 #endif 107