update dev300-m58
[ooovba.git] / extensions / source / bibliography / bibmod.cxx
blob80e6907195ec404fe3fee84390ce29607778ea9e
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: bibmod.cxx,v $
10 * $Revision: 1.12 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_extensions.hxx"
35 #include <tools/resmgr.hxx>
36 #include <tools/urlobj.hxx>
37 #include <svtools/urihelper.hxx>
38 #include <com/sun/star/container/XNameAccess.hpp>
39 #include <com/sun/star/util/XLocalizedAliases.hpp>
40 #include <com/sun/star/lang/XLocalizable.hpp>
41 #include <tools/debug.hxx>
43 #include "bibmod.hxx"
44 #include "bibresid.hxx"
45 #include "datman.hxx"
46 #include "bibconfig.hxx"
47 static PtrBibModul pBibModul=NULL;
48 static sal_uInt32 nBibModulCount=0;
49 #include <ucbhelper/content.hxx>
51 using namespace ::rtl;
52 using namespace ::com::sun::star;
53 using namespace ::com::sun::star::uno;
54 using namespace ::com::sun::star::util;
55 using namespace ::com::sun::star::lang;
56 using namespace ::com::sun::star::ucb;
58 #define C2U(cChar) OUString::createFromAscii(cChar)
59 #define C2S(cChar) String::CreateFromAscii(cChar)
61 HdlBibModul OpenBibModul()
63 if(pBibModul==NULL)
65 pBibModul=new BibModul();
67 nBibModulCount++;
68 return &pBibModul;
71 void CloseBibModul(HdlBibModul ppBibModul)
73 nBibModulCount--;
74 if(nBibModulCount==0 && ppBibModul!=NULL)
76 delete pBibModul;
77 pBibModul=NULL;
81 BibResId::BibResId( sal_uInt16 nId ) :
82 ResId( nId, *pBibModul->GetResMgr() )
85 BibConfig* BibModul::pBibConfig = 0;
86 BibModul::BibModul()
88 pResMgr = ResMgr::CreateResMgr( "bib" );
91 BibModul::~BibModul()
93 delete pResMgr;
94 delete pBibConfig;
95 pBibConfig = 0;
98 BibDataManager* BibModul::createDataManager()
100 return new BibDataManager();
102 //-----------------------------------------------------------------------------
103 BibConfig* BibModul::GetConfig()
105 if(! pBibConfig)
106 pBibConfig = new BibConfig;
107 return pBibConfig;
111 // PropertyNames
112 #define STATIC_USTRING(a,b) rtl::OUString a(b)
113 STATIC_USTRING(FM_PROP_LABEL,C2U("Label"));
114 STATIC_USTRING(FM_PROP_CONTROLSOURCE,C2U("DataField"));
115 STATIC_USTRING(FM_PROP_NAME,C2U("Name"));
116 STATIC_USTRING(FM_PROP_FORMATKEY,C2U("FormatKey"));
117 #ifdef TF_SDBAPI
118 #else // !TF_SDBAPI
119 STATIC_USTRING(FM_PROP_EDITMODE,C2U("RecordMode"));
120 STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,C2U("DataSelectionType"));
121 STATIC_USTRING(FM_PROP_CURSORSOURCE,C2U("DataSelection"));
122 STATIC_USTRING(FM_PROP_DATASOURCE, C2U("DataSource"));
123 #endif // !TF_SDBAPI
124 STATIC_USTRING(FM_PROP_VALUE,C2U("Value"));
125 STATIC_USTRING(FM_PROP_TEXT,C2U("Text"));