LibreOffice Module svx (master)  1
SmartTagItem.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 
21 #include <svx/SmartTagItem.hxx>
22 #include <sal/log.hxx>
23 
24 #include <com/sun/star/container/XStringKeyMap.hpp>
25 
26 
27 using namespace ::com::sun::star;
28 
29 
30 SfxPoolItem* SvxSmartTagItem::CreateDefault() { SAL_WARN( "svx", "No SvxSmartTagItem factory available"); return nullptr; }
31 
32 SvxSmartTagItem::SvxSmartTagItem( const sal_uInt16 nId,
33  const css::uno::Sequence < css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > >& rActionComponentsSequence,
34  const css::uno::Sequence < css::uno::Sequence< sal_Int32 > >& rActionIndicesSequence,
35  const css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > >& rStringKeyMaps,
36  const css::uno::Reference<css::text::XTextRange>& rRange,
37  const css::uno::Reference<css::frame::XController>& rController,
38  const css::lang::Locale& rLocale,
39  const OUString& rApplicationName,
40  const OUString& rRangeText ) :
41  SfxPoolItem( nId ),
42  maActionComponentsSequence( rActionComponentsSequence ),
43  maActionIndicesSequence( rActionIndicesSequence ),
44  maStringKeyMaps( rStringKeyMaps ),
45  mxRange( rRange ),
46  mxController( rController ),
47  maLocale( rLocale ),
48  maApplicationName( rApplicationName ),
49  maRangeText( rRangeText )
50 {
51 }
52 
53 
54 bool SvxSmartTagItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
55 {
57  { "ActionComponents", css::uno::makeAny( maActionComponentsSequence ) },
58  { "ActionIndices", css::uno::makeAny( maActionIndicesSequence ) },
59  { "StringKeyMaps", css::uno::makeAny( maStringKeyMaps ) },
60  { "TextRange", css::uno::makeAny( mxRange ) },
61  { "Controller", css::uno::makeAny( mxController ) },
62  { "Locale", css::uno::makeAny( maLocale ) },
63  { "ApplicationName", css::uno::makeAny( maApplicationName ) },
64  { "RangeText", css::uno::makeAny( maRangeText ) },
65  } );
66  return true;
67 }
68 
69 bool SvxSmartTagItem::PutValue( const uno::Any& /*rVal*/, sal_uInt8 /* nMemberId */)
70 {
71  return false;
72 }
73 
74 
75 bool SvxSmartTagItem::operator==( const SfxPoolItem& rAttr ) const
76 {
77  assert(SfxPoolItem::operator==(rAttr));
78 
79  const SvxSmartTagItem& rItem = static_cast<const SvxSmartTagItem&>(rAttr);
80 
84  mxRange == rItem.mxRange &&
85  mxController == rItem.mxController &&
87  maRangeText == rItem.maRangeText;
88 }
89 
90 
92 {
93  return new SvxSmartTagItem( *this );
94 }
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SvxSmartTagItem * Clone(SfxItemPool *pPool=nullptr) const override
const OUString maRangeText
const css::uno::Sequence< css::uno::Sequence< sal_Int32 > > maActionIndicesSequence
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool operator==(const SfxPoolItem &) const override
const OUString maApplicationName
unsigned char sal_uInt8
static SfxPoolItem * CreateDefault()
const css::lang::Locale maLocale
#define SAL_WARN(area, stream)
const css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > > maStringKeyMaps
const css::uno::Reference< css::text::XTextRange > mxRange
const css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > > maActionComponentsSequence
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
const css::uno::Reference< css::frame::XController > mxController
SvxSmartTagItem(const sal_uInt16 nId, const css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > > &rActionComponentsSequence, const css::uno::Sequence< css::uno::Sequence< sal_Int32 > > &rActionIndicesSequence, const css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > > &rStringKeyMaps, const css::uno::Reference< css::text::XTextRange > &rRange, const css::uno::Reference< css::frame::XController > &rController, const css::lang::Locale &rLocale, const OUString &rApplicationName, const OUString &rRangeText)