merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / source / bibliography / bibmod.cxx
blob97ff0ce9cc86d80233f147aa3b0845bc7b69be98
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_extensions.hxx"
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>
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>
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;
55 #define C2U(cChar) OUString::createFromAscii(cChar)
56 #define C2S(cChar) String::CreateFromAscii(cChar)
58 HdlBibModul OpenBibModul()
60 if(pBibModul==NULL)
62 pBibModul=new BibModul();
64 nBibModulCount++;
65 return &pBibModul;
68 void CloseBibModul(HdlBibModul ppBibModul)
70 nBibModulCount--;
71 if(nBibModulCount==0 && ppBibModul!=NULL)
73 delete pBibModul;
74 pBibModul=NULL;
78 BibResId::BibResId( sal_uInt16 nId ) :
79 ResId( nId, *pBibModul->GetResMgr() )
82 BibConfig* BibModul::pBibConfig = 0;
83 BibModul::BibModul()
85 pResMgr = ResMgr::CreateResMgr( "bib" );
88 BibModul::~BibModul()
90 delete pResMgr;
91 delete pBibConfig;
92 pBibConfig = 0;
95 BibDataManager* BibModul::createDataManager()
97 return new BibDataManager();
99 //-----------------------------------------------------------------------------
100 BibConfig* BibModul::GetConfig()
102 if(! pBibConfig)
103 pBibConfig = new BibConfig;
104 return pBibConfig;
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"));