Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / extensions / source / bibliography / bibmod.cxx
blob71515a03fe531df6389a9790603bd0ff33c7472e
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 <unotools/resmgr.hxx>
21 #include <svl/urihelper.hxx>
22 #include <vcl/settings.hxx>
23 #include <vcl/svapp.hxx>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <com/sun/star/util/XLocalizedAliases.hpp>
26 #include <com/sun/star/lang/XLocalizable.hpp>
28 #include "bibmod.hxx"
29 #include "bibprop.hxx"
30 #include "bibview.hxx"
31 #include "bibresid.hxx"
32 #include "datman.hxx"
33 #include "bibconfig.hxx"
34 #include <ucbhelper/content.hxx>
36 static BibModul* pBibModul=nullptr;
37 static sal_uInt32 nBibModulCount=0;
39 using namespace ::com::sun::star;
40 using namespace ::com::sun::star::uno;
41 using namespace ::com::sun::star::util;
42 using namespace ::com::sun::star::lang;
43 using namespace ::com::sun::star::ucb;
45 HdlBibModul OpenBibModul()
47 if(pBibModul==nullptr)
49 pBibModul=new BibModul();
51 nBibModulCount++;
52 return &pBibModul;
55 void CloseBibModul(HdlBibModul ppBibModul)
57 nBibModulCount--;
58 if(nBibModulCount==0 && ppBibModul!=nullptr)
60 delete pBibModul;
61 pBibModul=nullptr;
65 OUString BibResId(const char* pId)
67 return Translate::get(pId, pBibModul->GetResLocale());
70 BibConfig* BibModul::pBibConfig = nullptr;
72 BibModul::BibModul()
73 : m_aResLocale(Translate::Create("pcr"))
77 BibModul::~BibModul()
79 if (pBibConfig && pBibConfig->IsModified())
80 pBibConfig->Commit();
81 delete pBibConfig;
82 pBibConfig = nullptr;
85 BibDataManager* BibModul::createDataManager()
87 return new BibDataManager();
90 BibConfig* BibModul::GetConfig()
92 if(! pBibConfig)
93 pBibConfig = new BibConfig;
94 return pBibConfig;
98 // PropertyNames
99 #define STATIC_USTRING(a,b) const OUString a(b)
100 STATIC_USTRING(FM_PROP_LABEL,"Label");
101 STATIC_USTRING(FM_PROP_CONTROLSOURCE,"DataField");
102 STATIC_USTRING(FM_PROP_NAME,"Name");
103 STATIC_USTRING(FM_PROP_FORMATKEY,"FormatKey");
104 STATIC_USTRING(FM_PROP_EDITMODE,"RecordMode");
105 STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,"DataSelectionType");
106 STATIC_USTRING(FM_PROP_CURSORSOURCE,"DataSelection");
107 STATIC_USTRING(FM_PROP_DATASOURCE, "DataSource");
108 STATIC_USTRING(FM_PROP_VALUE,"Value");
109 STATIC_USTRING(FM_PROP_TEXT,"Text");
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */