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 "STLPropertySet.hxx"
21 #include <sal/log.hxx>
23 using com::sun::star::uno::Any
;
28 STLPropertySet::STLPropertySet()
32 STLPropertySet::~STLPropertySet()
36 void STLPropertySet::setPropertyDefaultValue( sal_Int32 nHandle
, const Any
& rValue
)
38 maPropertyMap
[nHandle
] = STLPropertyMapEntry(rValue
);
41 void STLPropertySet::setPropertyValue( sal_Int32 nHandle
, const Any
& rValue
)
43 PropertyMapIter aIter
;
44 if( findProperty( nHandle
, aIter
) )
46 (*aIter
).second
.mnState
= STLPropertyState::Direct
;
47 (*aIter
).second
.maValue
= rValue
;
51 SAL_WARN("sd", "sd::STLPropertySet::setPropertyValue(), unknown property!");
55 Any
STLPropertySet::getPropertyValue( sal_Int32 nHandle
) const
57 PropertyMapConstIter aIter
;
58 if( findProperty( nHandle
, aIter
) )
60 return (*aIter
).second
.maValue
;
64 SAL_WARN("sd", "sd::STLPropertySet::getPropertyValue(), unknown property!");
71 STLPropertyState
STLPropertySet::getPropertyState( sal_Int32 nHandle
) const
73 PropertyMapConstIter aIter
;
74 if( findProperty( nHandle
, aIter
) )
76 return (*aIter
).second
.mnState
;
80 SAL_WARN("sd", "sd::STLPropertySet::getPropertyState(), unknown property!");
81 return STLPropertyState::Ambiguous
;
85 void STLPropertySet::setPropertyState( sal_Int32 nHandle
, STLPropertyState nState
)
87 PropertyMapIter aIter
;
88 if( findProperty( nHandle
, aIter
) )
90 (*aIter
).second
.mnState
= nState
;
94 SAL_WARN("sd","sd::STLPropertySet::setPropertyState(), unknown property!");
98 bool STLPropertySet::findProperty( sal_Int32 nHandle
, PropertyMapIter
& rIter
)
100 rIter
= maPropertyMap
.find(nHandle
);
101 return( rIter
!= maPropertyMap
.end() );
104 bool STLPropertySet::findProperty( sal_Int32 nHandle
, PropertyMapConstIter
& rIter
) const
106 rIter
= maPropertyMap
.find(nHandle
);
107 return( rIter
!= maPropertyMap
.end() );
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */