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