LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / forms / source / component / cloneable.cxx
blob9770019c238da8ba4a56bfb7501de82dacee8d3d
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 <cloneable.hxx>
21 #include <com/sun/star/util/XCloneable.hpp>
22 #include <comphelper/uno3.hxx>
23 #include <tools/debug.hxx>
26 namespace frm
30 using namespace ::comphelper;
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::util;
35 //= OCloneableAggregation
38 Reference< XAggregation > OCloneableAggregation::createAggregateClone( const OCloneableAggregation* _pOriginal )
40 Reference< XCloneable > xAggregateCloneable; // will be the aggregate's XCloneable
41 Reference< XAggregation > xAggregateClone; // will be the aggregate's clone
43 if ( query_aggregation( _pOriginal->m_xAggregate, xAggregateCloneable ) )
45 xAggregateClone.set(xAggregateCloneable->createClone(), css::uno::UNO_QUERY);
46 DBG_ASSERT( xAggregateClone.is(), "OCloneableAggregation::createAggregateClone: invalid clone returned by the aggregate!" );
48 else {
49 DBG_ASSERT( !_pOriginal->m_xAggregate.is(), "OCloneableAggregation::createAggregateClone: aggregate is not cloneable!" );
52 return xAggregateClone;
56 } // namespace frm
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */