bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / bibliography / bibmod.cxx
blobcda8769d0204f2cef20dd5fce9a65f5d5b2b09ac
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <tools/resmgr.hxx>
21 #include <svl/urihelper.hxx>
22 #include <com/sun/star/container/XNameAccess.hpp>
23 #include <com/sun/star/util/XLocalizedAliases.hpp>
24 #include <com/sun/star/lang/XLocalizable.hpp>
26 #include "bibmod.hxx"
27 #include "bibview.hxx"
28 #include "bibresid.hxx"
29 #include "datman.hxx"
30 #include "bibconfig.hxx"
31 static PtrBibModul pBibModul=NULL;
32 static sal_uInt32 nBibModulCount=0;
33 #include <ucbhelper/content.hxx>
35 using namespace ::com::sun::star;
36 using namespace ::com::sun::star::uno;
37 using namespace ::com::sun::star::util;
38 using namespace ::com::sun::star::lang;
39 using namespace ::com::sun::star::ucb;
41 HdlBibModul OpenBibModul()
43 if(pBibModul==NULL)
45 pBibModul=new BibModul();
47 nBibModulCount++;
48 return &pBibModul;
51 void CloseBibModul(HdlBibModul ppBibModul)
53 nBibModulCount--;
54 if(nBibModulCount==0 && ppBibModul!=NULL)
56 delete pBibModul;
57 pBibModul=NULL;
61 BibResId::BibResId( sal_uInt16 nId ) :
62 ResId( nId, *pBibModul->GetResMgr() )
65 BibConfig* BibModul::pBibConfig = 0;
66 BibModul::BibModul()
68 pResMgr = ResMgr::CreateResMgr( "bib" );
71 BibModul::~BibModul()
73 delete pResMgr;
74 if (pBibConfig && pBibConfig->IsModified())
75 pBibConfig->Commit();
76 delete pBibConfig;
77 pBibConfig = 0;
80 BibDataManager* BibModul::createDataManager()
82 return new BibDataManager();
85 BibConfig* BibModul::GetConfig()
87 if(! pBibConfig)
88 pBibConfig = new BibConfig;
89 return pBibConfig;
93 // PropertyNames
94 #define STATIC_USTRING(a,b) OUString a(b)
95 STATIC_USTRING(FM_PROP_LABEL,"Label");
96 STATIC_USTRING(FM_PROP_CONTROLSOURCE,"DataField");
97 STATIC_USTRING(FM_PROP_NAME,"Name");
98 STATIC_USTRING(FM_PROP_FORMATKEY,"FormatKey");
99 STATIC_USTRING(FM_PROP_EDITMODE,"RecordMode");
100 STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,"DataSelectionType");
101 STATIC_USTRING(FM_PROP_CURSORSOURCE,"DataSelection");
102 STATIC_USTRING(FM_PROP_DATASOURCE, "DataSource");
103 STATIC_USTRING(FM_PROP_VALUE,"Value");
104 STATIC_USTRING(FM_PROP_TEXT,"Text");
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */