1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_extensions.hxx"
26
27
28 #include <tools/resmgr.hxx>
29 #include <tools/urlobj.hxx>
30 #include <svl/urihelper.hxx>
31 #include <com/sun/star/container/XNameAccess.hpp>
32 #include <com/sun/star/util/XLocalizedAliases.hpp>
33 #include <com/sun/star/lang/XLocalizable.hpp>
34 #include <tools/debug.hxx>
35
36 #include "bibmod.hxx"
37 #include "bibresid.hxx"
38 #include "datman.hxx"
39 #include "bibconfig.hxx"
40 static PtrBibModul pBibModul=NULL;
41 static sal_uInt32 nBibModulCount=0;
42 #include <ucbhelper/content.hxx>
43
44 using namespace ::rtl;
45 using namespace ::com::sun::star;
46 using namespace ::com::sun::star::uno;
47 using namespace ::com::sun::star::util;
48 using namespace ::com::sun::star::lang;
49 using namespace ::com::sun::star::ucb;
50
51 #define C2U(cChar) OUString::createFromAscii(cChar)
52 #define C2S(cChar) String::CreateFromAscii(cChar)
53
OpenBibModul()54 HdlBibModul OpenBibModul()
55 {
56 if(pBibModul==NULL)
57 {
58 pBibModul=new BibModul();
59 }
60 nBibModulCount++;
61 return &pBibModul;
62 }
63
CloseBibModul(HdlBibModul ppBibModul)64 void CloseBibModul(HdlBibModul ppBibModul)
65 {
66 nBibModulCount--;
67 if(nBibModulCount==0 && ppBibModul!=NULL)
68 {
69 delete pBibModul;
70 pBibModul=NULL;
71 }
72 }
73
BibResId(sal_uInt16 nId)74 BibResId::BibResId( sal_uInt16 nId ) :
75 ResId( nId, *pBibModul->GetResMgr() )
76 {
77 }
78 BibConfig* BibModul::pBibConfig = 0;
BibModul()79 BibModul::BibModul()
80 {
81 pResMgr = ResMgr::CreateResMgr( "bib" );
82 }
83
~BibModul()84 BibModul::~BibModul()
85 {
86 delete pResMgr;
87 delete pBibConfig;
88 pBibConfig = 0;
89 }
90
createDataManager()91 BibDataManager* BibModul::createDataManager()
92 {
93 return new BibDataManager();
94 }
95 //-----------------------------------------------------------------------------
GetConfig()96 BibConfig* BibModul::GetConfig()
97 {
98 if(! pBibConfig)
99 pBibConfig = new BibConfig;
100 return pBibConfig;
101 }
102
103
104 // PropertyNames
105 #define STATIC_USTRING(a,b) rtl::OUString a(b)
106 STATIC_USTRING(FM_PROP_LABEL,C2U("Label"));
107 STATIC_USTRING(FM_PROP_CONTROLSOURCE,C2U("DataField"));
108 STATIC_USTRING(FM_PROP_NAME,C2U("Name"));
109 STATIC_USTRING(FM_PROP_FORMATKEY,C2U("FormatKey"));
110 #ifdef TF_SDBAPI
111 #else // !TF_SDBAPI
112 STATIC_USTRING(FM_PROP_EDITMODE,C2U("RecordMode"));
113 STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,C2U("DataSelectionType"));
114 STATIC_USTRING(FM_PROP_CURSORSOURCE,C2U("DataSelection"));
115 STATIC_USTRING(FM_PROP_DATASOURCE, C2U("DataSource"));
116 #endif // !TF_SDBAPI
117 STATIC_USTRING(FM_PROP_VALUE,C2U("Value"));
118 STATIC_USTRING(FM_PROP_TEXT,C2U("Text"));
119