Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / extensions / source / bibliography / bibmod.cxx
blob06638a88f7d1b93799ff9df483f04605f4fca751
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 "bibprop.hrc"
28 #include "bibview.hxx"
29 #include "bibresid.hxx"
30 #include "datman.hxx"
31 #include "bibconfig.hxx"
32 #include <ucbhelper/content.hxx>
34 static BibModul* pBibModul=nullptr;
35 static sal_uInt32 nBibModulCount=0;
37 using namespace ::com::sun::star;
38 using namespace ::com::sun::star::uno;
39 using namespace ::com::sun::star::util;
40 using namespace ::com::sun::star::lang;
41 using namespace ::com::sun::star::ucb;
43 HdlBibModul OpenBibModul()
45 if(pBibModul==nullptr)
47 pBibModul=new BibModul();
49 nBibModulCount++;
50 return &pBibModul;
53 void CloseBibModul(HdlBibModul ppBibModul)
55 nBibModulCount--;
56 if(nBibModulCount==0 && ppBibModul!=nullptr)
58 delete pBibModul;
59 pBibModul=nullptr;
63 OUString BibResId(sal_uInt16 nId)
65 return ResId(nId, *pBibModul->GetResMgr());
68 BibConfig* BibModul::pBibConfig = nullptr;
70 BibModul::BibModul()
72 pResMgr = ResMgr::CreateResMgr( "bib" );
75 BibModul::~BibModul()
77 delete pResMgr;
78 if (pBibConfig && pBibConfig->IsModified())
79 pBibConfig->Commit();
80 delete pBibConfig;
81 pBibConfig = nullptr;
84 BibDataManager* BibModul::createDataManager()
86 return new BibDataManager();
89 BibConfig* BibModul::GetConfig()
91 if(! pBibConfig)
92 pBibConfig = new BibConfig;
93 return pBibConfig;
97 // PropertyNames
98 #define STATIC_USTRING(a,b) OUString a(b)
99 STATIC_USTRING(FM_PROP_LABEL,"Label");
100 STATIC_USTRING(FM_PROP_CONTROLSOURCE,"DataField");
101 STATIC_USTRING(FM_PROP_NAME,"Name");
102 STATIC_USTRING(FM_PROP_FORMATKEY,"FormatKey");
103 STATIC_USTRING(FM_PROP_EDITMODE,"RecordMode");
104 STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,"DataSelectionType");
105 STATIC_USTRING(FM_PROP_CURSORSOURCE,"DataSelection");
106 STATIC_USTRING(FM_PROP_DATASOURCE, "DataSource");
107 STATIC_USTRING(FM_PROP_VALUE,"Value");
108 STATIC_USTRING(FM_PROP_TEXT,"Text");
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */