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 <com/sun/star/beans/PropertyValues.hpp>
22 #include <svl/ownlist.hxx>
24 using namespace com::sun::star
;
28 * An object of the type SvCommand is created and the list is
31 void SvCommandList::Append
33 const OUString
& rCommand
, /* The command */
34 const OUString
& rArg
/* The command's argument */
37 aCommandList
.emplace_back( rCommand
, rArg
);
40 void SvCommandList::FillFromSequence( const css::uno::Sequence
< css::beans::PropertyValue
>& aCommandSequence
)
42 const sal_Int32 nCount
= aCommandSequence
.getLength();
43 OUString aCommand
, aArg
;
45 for( sal_Int32 nIndex
=0; nIndex
<nCount
; nIndex
++ )
47 aCommand
= aCommandSequence
[nIndex
].Name
;
48 if( !( aCommandSequence
[nIndex
].Value
>>= aApiArg
) )
51 Append( aCommand
, aArg
);
55 void SvCommandList::FillSequence( css::uno::Sequence
< css::beans::PropertyValue
>& aCommandSequence
) const
57 const sal_Int32 nCount
= aCommandList
.size();
58 aCommandSequence
.realloc( nCount
);
59 for( sal_Int32 nIndex
= 0; nIndex
< nCount
; nIndex
++ )
61 aCommandSequence
[nIndex
].Name
= aCommandList
[ nIndex
].GetCommand();
62 aCommandSequence
[nIndex
].Handle
= -1;
63 aCommandSequence
[nIndex
].Value
<<= aCommandList
[ nIndex
].GetArgument();
64 aCommandSequence
[nIndex
].State
= beans::PropertyState_DIRECT_VALUE
;
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */