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/.
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 .
22 #include <cppuhelper/implbase.hxx>
23 #include <cppuhelper/supportsservice.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <com/sun/star/rdf/XBlankNode.hpp>
28 #include <com/sun/star/lang/IllegalArgumentException.hpp>
31 /// anonymous implementation namespace
35 public ::cppu::WeakImplHelper
<
36 css::lang::XServiceInfo
,
37 css::lang::XInitialization
,
43 // css::lang::XServiceInfo:
44 virtual OUString SAL_CALL
getImplementationName() override
;
45 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
46 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
48 // css::lang::XInitialization:
49 virtual void SAL_CALL
initialize(const css::uno::Sequence
< css::uno::Any
> & aArguments
) override
;
52 virtual OUString SAL_CALL
getStringValue() override
;
55 CBlankNode(CBlankNode
const&) = delete;
56 CBlankNode
& operator=(CBlankNode
const&) = delete;
61 CBlankNode::CBlankNode() :
65 // com.sun.star.uno.XServiceInfo:
66 OUString SAL_CALL
CBlankNode::getImplementationName()
68 return comp_CBlankNode::_getImplementationName();
71 sal_Bool SAL_CALL
CBlankNode::supportsService(OUString
const & serviceName
)
73 return cppu::supportsService(this, serviceName
);
76 css::uno::Sequence
< OUString
> SAL_CALL
CBlankNode::getSupportedServiceNames()
78 return comp_CBlankNode::_getSupportedServiceNames();
81 // css::lang::XInitialization:
82 void SAL_CALL
CBlankNode::initialize(const css::uno::Sequence
< css::uno::Any
> & aArguments
)
84 if (aArguments
.getLength() != 1) {
85 throw css::lang::IllegalArgumentException(
86 "CBlankNode::initialize: must give exactly 1 argument", *this, 1);
90 if (!(aArguments
[0] >>= arg
)) {
91 throw css::lang::IllegalArgumentException(
92 "CBlankNode::initialize: argument must be string", *this, 0);
95 //FIXME: what is legal?
97 throw css::lang::IllegalArgumentException(
98 "CBlankNode::initialize: argument is not valid blank node ID", *this, 0);
104 OUString SAL_CALL
CBlankNode::getStringValue()
109 } // closing anonymous implementation namespace
112 // component helper namespace
113 namespace comp_CBlankNode
{
115 OUString
_getImplementationName() {
119 css::uno::Sequence
< OUString
> _getSupportedServiceNames()
121 css::uno::Sequence
< OUString
> s
{ "com.sun.star.rdf.BlankNode" };
125 css::uno::Reference
< css::uno::XInterface
> _create(
126 const css::uno::Reference
< css::uno::XComponentContext
> & )
128 return static_cast< ::cppu::OWeakObject
* >(new CBlankNode
);
131 } // closing component helper namespace
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */