Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #include "Tools.hxx"
20 : #include "core_resource.hrc"
21 : #include "core_resource.hxx"
22 : #include <comphelper/property.hxx>
23 :
24 :
25 : namespace reportdesign
26 : {
27 :
28 : using namespace com::sun::star;
29 :
30 0 : uno::Reference< report::XSection> lcl_getSection(const uno::Reference< uno::XInterface>& _xReportComponent)
31 : {
32 0 : uno::Reference< container::XChild> xChild(_xReportComponent,uno::UNO_QUERY);
33 0 : uno::Reference< report::XSection> xRet(_xReportComponent,uno::UNO_QUERY);
34 0 : while( !xRet.is() && xChild.is() )
35 : {
36 0 : uno::Reference< uno::XInterface> xTemp = xChild->getParent();
37 0 : xChild.set(xTemp,uno::UNO_QUERY);
38 0 : xRet.set(xTemp,uno::UNO_QUERY);
39 0 : }
40 0 : return xRet;
41 : }
42 :
43 0 : 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_
47 : )
48 : {
49 0 : OUString sErrorMessage(RPT_RESSTRING(RID_STR_ERROR_WRONG_ARGUMENT,Context_->getServiceManager()));
50 0 : sErrorMessage = sErrorMessage.replaceAt(sErrorMessage.indexOf('#'),2,_sTypeName);
51 0 : throw lang::IllegalArgumentException(sErrorMessage,ExceptionContext_,ArgumentPosition_);
52 : }
53 :
54 0 : uno::Reference< util::XCloneable > cloneObject(const uno::Reference< report::XReportComponent>& _xReportComponent
55 : ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
56 : ,const OUString& _sServiceName)
57 : {
58 : OSL_ENSURE(_xReportComponent.is() && _xFactory.is() ,"reportcomponent is null -> GPF");
59 0 : uno::Reference< report::XReportComponent> xClone(_xFactory->createInstance(_sServiceName),uno::UNO_QUERY_THROW);
60 0 : ::comphelper::copyProperties(_xReportComponent.get(),xClone.get());
61 0 : return xClone.get();
62 : }
63 :
64 :
65 :
66 : } // namespace reportdesign
67 :
68 :
69 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|