merge the formfield patch from ooo-build
[ooovba.git] / autodoc / source / ary / loc / loc_traits.cxx
blobcfb9d6c4ea311dd414535ca111bdee97ff9e3aea
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: loc_traits.cxx,v $
10 * $Revision: 1.3 $
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 ************************************************************************/
31 #include <precomp.h>
32 #include <ary/loc/loc_traits.hxx>
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/namesort.hxx>
37 #include <ary/getncast.hxx>
38 #include "locs_le.hxx"
42 namespace ary
44 namespace loc
48 //******************** Le_Traits ************************//
49 Le_Traits::entity_base_type &
50 Le_Traits::EntityOf_(id_type i_id)
52 csv_assert(i_id.IsValid());
53 return Le_Storage::Instance_()[i_id];
56 //******************** LeNode_Traits ************************//
57 symtree::Node<LeNode_Traits> *
58 LeNode_Traits::NodeOf_(entity_base_type & io_entity)
60 if (is_type<Directory>(io_entity))
61 return & ary_cast<Directory>(io_entity).AsNode();
62 return 0;
65 Le_Traits::entity_base_type *
66 LeNode_Traits::ParentOf_(const entity_base_type & i_entity)
68 Le_Traits::id_type
69 ret = i_entity.ParentDirectory();
70 if (ret.IsValid())
71 return &EntityOf_(ret);
72 return 0;
75 //******************** Le_Compare ************************//
76 const Le_Compare::key_type &
77 Le_Compare::KeyOf_(const entity_base_type & i_entity)
79 return i_entity.LocalName();
82 bool
83 Le_Compare::Lesser_( const key_type & i_1,
84 const key_type & i_2 )
86 static ::ary::LesserName less_;
87 return less_(i_1,i_2);
93 } // namespace loc
94 } // namespace ary