LibreOffice Module forms (master) 1
cloneable.cxx
Go to the documentation of this file.
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
20#include <cloneable.hxx>
21#include <com/sun/star/util/XCloneable.hpp>
22#include <comphelper/uno3.hxx>
23#include <tools/debug.hxx>
24
25
26namespace frm
27{
28
29
30 using namespace ::comphelper;
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::util;
33
34
35 //= OCloneableAggregation
36
37
38 Reference< XAggregation > OCloneableAggregation::createAggregateClone( const OCloneableAggregation* _pOriginal )
39 {
40 Reference< XCloneable > xAggregateCloneable; // will be the aggregate's XCloneable
41 Reference< XAggregation > xAggregateClone; // will be the aggregate's clone
42
43 if ( query_aggregation( _pOriginal->m_xAggregate, xAggregateCloneable ) )
44 {
45 xAggregateClone.set(xAggregateCloneable->createClone(), css::uno::UNO_QUERY);
46 DBG_ASSERT( xAggregateClone.is(), "OCloneableAggregation::createAggregateClone: invalid clone returned by the aggregate!" );
47 }
48 else {
49 DBG_ASSERT( !_pOriginal->m_xAggregate.is(), "OCloneableAggregation::createAggregateClone: aggregate is not cloneable!" );
50 }
51
52 return xAggregateClone;
53 }
54
55
56} // namespace frm
57
58
59/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static css::uno::Reference< css::uno::XAggregation > createAggregateClone(const OCloneableAggregation *_pOriginal)
Definition: cloneable.cxx:38
css::uno::Reference< css::uno::XAggregation > m_xAggregate
Definition: cloneable.hxx:31
#define DBG_ASSERT(sCon, aError)
bool query_aggregation(const css::uno::Reference< css::uno::XAggregation > &_rxAggregate, css::uno::Reference< iface > &_rxOut)
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25