2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-02 10:15:23 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-17 14:12:13 +00:00
|
|
|
|
2019-05-31 17:37:07 +02:00
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
|
|
|
#include <com/sun/star/beans/PropertyState.hpp>
|
2004-10-04 18:47:45 +00:00
|
|
|
|
2009-10-08 16:59:48 +02:00
|
|
|
#include <svl/ownlist.hxx>
|
2004-10-04 18:47:45 +00:00
|
|
|
|
|
|
|
using namespace com::sun::star;
|
2000-09-18 15:59:02 +00:00
|
|
|
|
|
|
|
|
2014-07-25 15:41:58 +02:00
|
|
|
/**
|
|
|
|
* An object of the type SvCommand is created and the list is
|
|
|
|
* attached.
|
|
|
|
*/
|
2016-01-13 08:44:21 +02:00
|
|
|
void SvCommandList::Append
|
2000-09-18 15:59:02 +00:00
|
|
|
(
|
2014-07-25 15:41:58 +02:00
|
|
|
const OUString & rCommand, /* The command */
|
|
|
|
const OUString & rArg /* The command's argument */
|
2000-09-18 15:59:02 +00:00
|
|
|
)
|
|
|
|
{
|
2017-09-12 12:00:35 +02:00
|
|
|
aCommandList.emplace_back( rCommand, rArg );
|
2000-09-18 15:59:02 +00:00
|
|
|
}
|
|
|
|
|
2016-01-13 08:44:21 +02:00
|
|
|
void SvCommandList::FillFromSequence( const css::uno::Sequence < css::beans::PropertyValue >& aCommandSequence )
|
2004-10-04 18:47:45 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aCommand, aArg;
|
|
|
|
OUString aApiArg;
|
2019-07-13 21:29:10 +03:00
|
|
|
for( const auto& rCommand : aCommandSequence )
|
2004-10-04 18:47:45 +00:00
|
|
|
{
|
2019-07-13 21:29:10 +03:00
|
|
|
aCommand = rCommand.Name;
|
|
|
|
if( !( rCommand.Value >>= aApiArg ) )
|
2016-01-13 08:44:21 +02:00
|
|
|
return;
|
2004-10-04 18:47:45 +00:00
|
|
|
aArg = aApiArg;
|
|
|
|
Append( aCommand, aArg );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-25 16:43:05 +02:00
|
|
|
void SvCommandList::FillSequence( css::uno::Sequence < css::beans::PropertyValue >& aCommandSequence ) const
|
2004-10-04 18:47:45 +00:00
|
|
|
{
|
2011-05-18 18:57:38 -07:00
|
|
|
const sal_Int32 nCount = aCommandList.size();
|
2004-10-04 18:47:45 +00:00
|
|
|
aCommandSequence.realloc( nCount );
|
|
|
|
for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
|
|
|
|
{
|
2011-05-18 18:57:38 -07:00
|
|
|
aCommandSequence[nIndex].Name = aCommandList[ nIndex ].GetCommand();
|
2004-10-04 18:47:45 +00:00
|
|
|
aCommandSequence[nIndex].Handle = -1;
|
2017-02-24 11:22:18 +02:00
|
|
|
aCommandSequence[nIndex].Value <<= aCommandList[ nIndex ].GetArgument();
|
2004-10-04 18:47:45 +00:00
|
|
|
aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 15:59:02 +00:00
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|