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/uno/Sequence.hxx>
21 #include <com/sun/star/beans/PropertyValue.hpp>
22 #include <com/sun/star/beans/PropertyState.hpp>
24 #include <svl/ownlist.hxx>
26 using namespace com::sun::star
;
30 * An object of the type SvCommand is created and the list is
33 void SvCommandList::Append
35 const OUString
& rCommand
, /* The command */
36 const OUString
& rArg
/* The command's argument */
39 aCommandList
.emplace_back( rCommand
, rArg
);
42 void SvCommandList::FillFromSequence( const css::uno::Sequence
< css::beans::PropertyValue
>& aCommandSequence
)
44 OUString aCommand
, aArg
;
46 for( const auto& rCommand
: aCommandSequence
)
48 aCommand
= rCommand
.Name
;
49 if( !( rCommand
.Value
>>= aApiArg
) )
52 Append( aCommand
, aArg
);
56 void SvCommandList::FillSequence( css::uno::Sequence
< css::beans::PropertyValue
>& aCommandSequence
) const
58 const sal_Int32 nCount
= aCommandList
.size();
59 aCommandSequence
.realloc( nCount
);
60 auto pCommandSequence
= aCommandSequence
.getArray();
61 for( sal_Int32 nIndex
= 0; nIndex
< nCount
; nIndex
++ )
63 pCommandSequence
[nIndex
].Name
= aCommandList
[ nIndex
].GetCommand();
64 pCommandSequence
[nIndex
].Handle
= -1;
65 pCommandSequence
[nIndex
].Value
<<= aCommandList
[ nIndex
].GetArgument();
66 pCommandSequence
[nIndex
].State
= beans::PropertyState_DIRECT_VALUE
;
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */