1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include <spsuppClassFactory.hpp>
11 #include <COMOpenDocuments.hpp>
13 LONG
ClassFactory::m_nObjCount
= 0;
14 LONG
ClassFactory::m_nLockCount
= 0;
16 ClassFactory::ClassFactory()
18 ::InterlockedIncrement(&m_nObjCount
);
21 ClassFactory::~ClassFactory()
23 ::InterlockedDecrement(&m_nObjCount
);
28 STDMETHODIMP
ClassFactory::QueryInterface(
33 if (IsEqualIID(riid
, __uuidof(IUnknown
)) ||
34 IsEqualIID(riid
, __uuidof(IClassFactory
)))
36 *ppvObject
= static_cast<IClassFactory
*>(this);
43 // IClassFactory methods
45 STDMETHODIMP
ClassFactory::CreateInstance(
53 return CLASS_E_NOAGGREGATION
;
56 COMOpenDocuments
* pObj
;
58 pObj
= new COMOpenDocuments
;
60 catch (const COMOpenDocuments::Error
& e
) {
67 HRESULT hr
= pObj
->QueryInterface(riid
, ppvObject
);
72 STDMETHODIMP
ClassFactory::LockServer(BOOL fLock
)
75 ::InterlockedIncrement(&m_nLockCount
);
77 ::InterlockedDecrement(&m_nLockCount
);
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */