LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / sfx2 / source / dialog / tplpitem.cxx
blob1662634440bd09f224d2e36e3a90ce1090adef6f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <sfx2/tplpitem.hxx>
21 #include <com/sun/star/frame/status/Template.hpp>
23 SfxPoolItem* SfxTemplateItem::CreateDefault() { return new SfxTemplateItem; }
26 SfxTemplateItem::SfxTemplateItem()
30 SfxTemplateItem::SfxTemplateItem
32 sal_uInt16 nWhichId, // Slot-ID
33 const OUString& rStyle, // Name of the current Styles
34 const OUString& rStyleIdentifier // Prog Name of current Style
35 ) : SfxFlagItem( nWhichId, static_cast<sal_uInt16>(SfxStyleSearchBits::All) ),
36 aStyle( rStyle ),
37 aStyleIdentifier( rStyleIdentifier )
41 // op ==
43 bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const
45 return ( SfxFlagItem::operator==( rCmp ) &&
46 aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle &&
47 aStyleIdentifier == static_cast<const SfxTemplateItem&>(rCmp).aStyleIdentifier );
50 SfxTemplateItem* SfxTemplateItem::Clone( SfxItemPool *) const
52 return new SfxTemplateItem(*this);
55 bool SfxTemplateItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
57 css::frame::status::Template aTemplate;
59 aTemplate.Value = static_cast<sal_uInt16>(GetValue());
60 aTemplate.StyleName = aStyle;
61 aTemplate.StyleNameIdentifier = aStyleIdentifier;
62 rVal <<= aTemplate;
64 return true;
68 bool SfxTemplateItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
70 css::frame::status::Template aTemplate;
72 if ( rVal >>= aTemplate )
74 SetValue( static_cast<SfxStyleSearchBits>(aTemplate.Value) );
75 aStyle = aTemplate.StyleName;
76 aStyleIdentifier = aTemplate.StyleNameIdentifier;
77 return true;
80 return false;
84 sal_uInt8 SfxTemplateItem::GetFlagCount() const
86 return sizeof(sal_uInt16) * 8;
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */