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 <comphelper/propertysequence.hxx>
21 #include <svx/SmartTagItem.hxx>
22 #include <sal/log.hxx>
24 #include <com/sun/star/container/XStringKeyMap.hpp>
28 using namespace ::com::sun::star
;
31 SfxPoolItem
* SvxSmartTagItem::CreateDefault() { SAL_WARN( "svx", "No SvxSmartTagItem factory available"); return nullptr; }
33 SvxSmartTagItem::SvxSmartTagItem( const TypedWhichId
<SvxSmartTagItem
> nId
,
34 const css::uno::Sequence
< css::uno::Sequence
< css::uno::Reference
< css::smarttags::XSmartTagAction
> > >& rActionComponentsSequence
,
35 const css::uno::Sequence
< css::uno::Sequence
< sal_Int32
> >& rActionIndicesSequence
,
36 const css::uno::Sequence
< css::uno::Reference
< css::container::XStringKeyMap
> >& rStringKeyMaps
,
37 css::uno::Reference
<css::text::XTextRange
> xRange
,
38 css::uno::Reference
<css::frame::XController
> xController
,
39 css::lang::Locale aLocale
,
40 OUString aApplicationName
,
41 OUString aRangeText
) :
42 SfxPoolItem( nId
, SfxItemType::SvxSmartTagItemType
),
43 maActionComponentsSequence( rActionComponentsSequence
),
44 maActionIndicesSequence( rActionIndicesSequence
),
45 maStringKeyMaps( rStringKeyMaps
),
46 mxRange(std::move( xRange
)),
47 mxController(std::move( xController
)),
48 maLocale(std::move( aLocale
)),
49 maApplicationName(std::move( aApplicationName
)),
50 maRangeText(std::move( aRangeText
))
55 bool SvxSmartTagItem::QueryValue( uno::Any
& rVal
, sal_uInt8
/*nMemberId*/ ) const
57 rVal
<<= comphelper::InitPropertySequence( {
58 { "ActionComponents", css::uno::Any( maActionComponentsSequence
) },
59 { "ActionIndices", css::uno::Any( maActionIndicesSequence
) },
60 { "StringKeyMaps", css::uno::Any( maStringKeyMaps
) },
61 { "TextRange", css::uno::Any( mxRange
) },
62 { "Controller", css::uno::Any( mxController
) },
63 { "Locale", css::uno::Any( maLocale
) },
64 { "ApplicationName", css::uno::Any( maApplicationName
) },
65 { "RangeText", css::uno::Any( maRangeText
) },
70 bool SvxSmartTagItem::PutValue( const uno::Any
& /*rVal*/, sal_uInt8
/* nMemberId */)
76 bool SvxSmartTagItem::operator==( const SfxPoolItem
& rAttr
) const
78 assert(SfxPoolItem::operator==(rAttr
));
80 const SvxSmartTagItem
& rItem
= static_cast<const SvxSmartTagItem
&>(rAttr
);
82 return maActionComponentsSequence
== rItem
.maActionComponentsSequence
&&
83 maActionIndicesSequence
== rItem
.maActionIndicesSequence
&&
84 maStringKeyMaps
== rItem
.maStringKeyMaps
&&
85 mxRange
== rItem
.mxRange
&&
86 mxController
== rItem
.mxController
&&
87 maApplicationName
== rItem
.maApplicationName
&&
88 maRangeText
== rItem
.maRangeText
;
92 SvxSmartTagItem
* SvxSmartTagItem::Clone( SfxItemPool
* ) const
94 return new SvxSmartTagItem( *this );
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */