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 .
20 #include "core_resource.hrc"
21 #include "core_resource.hxx"
22 #include <comphelper/property.hxx>
25 namespace reportdesign
28 using namespace com::sun::star
;
30 uno::Reference
< report::XSection
> lcl_getSection(const uno::Reference
< uno::XInterface
>& _xReportComponent
)
32 uno::Reference
< container::XChild
> xChild(_xReportComponent
,uno::UNO_QUERY
);
33 uno::Reference
< report::XSection
> xRet(_xReportComponent
,uno::UNO_QUERY
);
34 while( !xRet
.is() && xChild
.is() )
36 uno::Reference
< uno::XInterface
> xTemp
= xChild
->getParent();
37 xChild
.set(xTemp
,uno::UNO_QUERY
);
38 xRet
.set(xTemp
,uno::UNO_QUERY
);
43 void throwIllegallArgumentException( const OUString
& _sTypeName
44 ,const uno::Reference
< uno::XInterface
>& ExceptionContext_
45 ,const ::sal_Int16
& ArgumentPosition_
46 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& Context_
49 OUString
sErrorMessage(RPT_RESSTRING(RID_STR_ERROR_WRONG_ARGUMENT
,Context_
->getServiceManager()));
50 sErrorMessage
= sErrorMessage
.replaceAt(sErrorMessage
.indexOf('#'),2,_sTypeName
);
51 throw lang::IllegalArgumentException(sErrorMessage
,ExceptionContext_
,ArgumentPosition_
);
54 uno::Reference
< util::XCloneable
> cloneObject(const uno::Reference
< report::XReportComponent
>& _xReportComponent
55 ,const uno::Reference
< lang::XMultiServiceFactory
>& _xFactory
56 ,const OUString
& _sServiceName
)
58 OSL_ENSURE(_xReportComponent
.is() && _xFactory
.is() ,"reportcomponent is null -> GPF");
59 uno::Reference
< report::XReportComponent
> xClone(_xFactory
->createInstance(_sServiceName
),uno::UNO_QUERY_THROW
);
60 ::comphelper::copyProperties(_xReportComponent
.get(),xClone
.get());
66 } // namespace reportdesign
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */