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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_extensions.hxx"
30 
31 
32 #include <tools/resmgr.hxx>
33 #include <tools/urlobj.hxx>
34 #include <svl/urihelper.hxx>
35 #include <com/sun/star/container/XNameAccess.hpp>
36 #include <com/sun/star/util/XLocalizedAliases.hpp>
37 #include <com/sun/star/lang/XLocalizable.hpp>
38 #include <tools/debug.hxx>
39 
40 #include "bibmod.hxx"
41 #include "bibresid.hxx"
42 #include "datman.hxx"
43 #include "bibconfig.hxx"
44 static PtrBibModul pBibModul=NULL;
45 static sal_uInt32 nBibModulCount=0;
46 #include <ucbhelper/content.hxx>
47 
48 using namespace ::rtl;
49 using namespace ::com::sun::star;
50 using namespace ::com::sun::star::uno;
51 using namespace ::com::sun::star::util;
52 using namespace ::com::sun::star::lang;
53 using namespace ::com::sun::star::ucb;
54 
55 #define C2U(cChar) OUString::createFromAscii(cChar)
56 #define C2S(cChar) String::CreateFromAscii(cChar)
57 
58 HdlBibModul	OpenBibModul()
59 {
60 	if(pBibModul==NULL)
61 	{
62 		pBibModul=new BibModul();
63 	}
64 	nBibModulCount++;
65 	return &pBibModul;
66 }
67 
68 void CloseBibModul(HdlBibModul ppBibModul)
69 {
70 	nBibModulCount--;
71 	if(nBibModulCount==0 && ppBibModul!=NULL)
72 	{
73 		delete pBibModul;
74 		pBibModul=NULL;
75 	}
76 }
77 
78 BibResId::BibResId( sal_uInt16 nId ) :
79 	ResId( nId, *pBibModul->GetResMgr() )
80 {
81 }
82 BibConfig* BibModul::pBibConfig = 0;
83 BibModul::BibModul()
84 {
85 	pResMgr = ResMgr::CreateResMgr( "bib" );
86 }
87 
88 BibModul::~BibModul()
89 {
90 	delete pResMgr;
91 	delete pBibConfig;
92 	pBibConfig = 0;
93 }
94 
95 BibDataManager*	 BibModul::createDataManager()
96 {
97 	return new BibDataManager();
98 }
99 //-----------------------------------------------------------------------------
100 BibConfig*	BibModul::GetConfig()
101 {
102 	if(! pBibConfig)
103 		pBibConfig = new BibConfig;
104 	return pBibConfig;
105 }
106 
107 
108 // PropertyNames
109 #define STATIC_USTRING(a,b) rtl::OUString a(b)
110 STATIC_USTRING(FM_PROP_LABEL,C2U("Label"));
111 STATIC_USTRING(FM_PROP_CONTROLSOURCE,C2U("DataField"));
112 STATIC_USTRING(FM_PROP_NAME,C2U("Name"));
113 STATIC_USTRING(FM_PROP_FORMATKEY,C2U("FormatKey"));
114 #ifdef TF_SDBAPI
115 #else // !TF_SDBAPI
116 STATIC_USTRING(FM_PROP_EDITMODE,C2U("RecordMode"));
117 STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,C2U("DataSelectionType"));
118 STATIC_USTRING(FM_PROP_CURSORSOURCE,C2U("DataSelection"));
119 STATIC_USTRING(FM_PROP_DATASOURCE, C2U("DataSource"));
120 #endif // !TF_SDBAPI
121 STATIC_USTRING(FM_PROP_VALUE,C2U("Value"));
122 STATIC_USTRING(FM_PROP_TEXT,C2U("Text"));
123