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 <WrappedIgnoreProperty.hxx>
21 #include <com/sun/star/drawing/BitmapMode.hpp>
22 #include <com/sun/star/drawing/FillStyle.hpp>
23 #include <com/sun/star/drawing/LineJoint.hpp>
24 #include <com/sun/star/drawing/LineStyle.hpp>
25 #include <com/sun/star/drawing/RectanglePoint.hpp>
27 using namespace ::com::sun::star
;
28 using ::com::sun::star::uno::Any
;
29 using ::com::sun::star::uno::Reference
;
34 WrappedIgnoreProperty::WrappedIgnoreProperty( const OUString
& rOuterName
, const Any
& rDefaultValue
)
35 : WrappedProperty( rOuterName
, OUString() )
36 , m_aDefaultValue( rDefaultValue
)
37 , m_aCurrentValue( rDefaultValue
)
40 WrappedIgnoreProperty::~WrappedIgnoreProperty()
44 void WrappedIgnoreProperty::setPropertyValue( const Any
& rOuterValue
, const Reference
< beans::XPropertySet
>& /* xInnerPropertySet */ ) const
46 m_aCurrentValue
= rOuterValue
;
49 Any
WrappedIgnoreProperty::getPropertyValue( const Reference
< beans::XPropertySet
>& /* xInnerPropertySet */ ) const
51 return m_aCurrentValue
;
54 void WrappedIgnoreProperty::setPropertyToDefault( const Reference
< beans::XPropertyState
>& /* xInnerPropertyState */ ) const
56 m_aCurrentValue
= m_aDefaultValue
;
59 Any
WrappedIgnoreProperty::getPropertyDefault( const Reference
< beans::XPropertyState
>& /* xInnerPropertyState */ ) const
61 return m_aDefaultValue
;
64 beans::PropertyState
WrappedIgnoreProperty::getPropertyState( const Reference
< beans::XPropertyState
>& /* xInnerPropertyState */ ) const
66 return ( m_aCurrentValue
== m_aDefaultValue
67 ? beans::PropertyState_DEFAULT_VALUE
68 : beans::PropertyState_DIRECT_VALUE
);
71 void WrappedIgnoreProperties::addIgnoreLineProperties( std::vector
< std::unique_ptr
<WrappedProperty
> >& rList
)
73 rList
.emplace_back( new WrappedIgnoreProperty( u
"LineStyle"_ustr
, uno::Any( drawing::LineStyle_SOLID
) ) );
74 rList
.emplace_back( new WrappedIgnoreProperty( u
"LineDashName"_ustr
, uno::Any( OUString() ) ) );
75 rList
.emplace_back( new WrappedIgnoreProperty( u
"LineColor"_ustr
, uno::Any( sal_Int32(0) ) ) );
76 rList
.emplace_back( new WrappedIgnoreProperty( u
"LineTransparence"_ustr
, uno::Any( sal_Int16(0) ) ) );
77 rList
.emplace_back( new WrappedIgnoreProperty( u
"LineWidth"_ustr
, uno::Any( sal_Int32(0) ) ) );
78 rList
.emplace_back( new WrappedIgnoreProperty( u
"LineJoint"_ustr
, uno::Any( drawing::LineJoint_ROUND
) ) );
81 void WrappedIgnoreProperties::addIgnoreFillProperties( std::vector
< std::unique_ptr
<WrappedProperty
> >& rList
)
83 addIgnoreFillProperties_without_BitmapProperties( rList
);
84 addIgnoreFillProperties_only_BitmapProperties( rList
);
87 void WrappedIgnoreProperties::addIgnoreFillProperties_without_BitmapProperties( std::vector
< std::unique_ptr
<WrappedProperty
> >& rList
)
89 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillStyle"_ustr
, uno::Any( drawing::FillStyle_SOLID
) ) );
90 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillColor"_ustr
, uno::Any( sal_Int32(-1) ) ) );
91 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillTransparence"_ustr
, uno::Any( sal_Int16(0) ) ) );
92 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillTransparenceGradientName"_ustr
, uno::Any( OUString() ) ) );
93 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillGradientName"_ustr
, uno::Any( OUString() ) ) );
94 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillHatchName"_ustr
, uno::Any( OUString() ) ) );
95 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBackground"_ustr
, uno::Any( false ) ) );
98 void WrappedIgnoreProperties::addIgnoreFillProperties_only_BitmapProperties( std::vector
< std::unique_ptr
<WrappedProperty
> >& rList
)
100 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBitmapOffsetX"_ustr
, uno::Any( sal_Int16(0) ) ) );
101 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBitmapOffsetY"_ustr
, uno::Any( sal_Int16(0) ) ) );
102 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBitmapPositionOffsetX"_ustr
, uno::Any( sal_Int16(0) ) ) );
103 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBitmapPositionOffsetY"_ustr
, uno::Any( sal_Int16(0) ) ) );
104 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBitmapRectanglePoint"_ustr
, uno::Any( drawing::RectanglePoint_LEFT_TOP
) ) );
105 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBitmapLogicalSize"_ustr
, uno::Any( false ) ) );//todo correct default?
106 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBitmapSizeX"_ustr
, uno::Any( sal_Int32(10) ) ) );//todo which default?
107 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBitmapSizeY"_ustr
, uno::Any( sal_Int32(10) ) ) );//todo which default?
108 rList
.emplace_back( new WrappedIgnoreProperty( u
"FillBitmapMode"_ustr
, uno::Any( drawing::BitmapMode_REPEAT
) ) );
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */