xref: /trunk/main/chart2/source/tools/WrappedIgnoreProperty.cxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_charttools.hxx"
26 
27 #include "WrappedIgnoreProperty.hxx"
28 #include "macros.hxx"
29 #include <com/sun/star/awt/Gradient.hpp>
30 #include <com/sun/star/drawing/Hatch.hpp>
31 #include <com/sun/star/drawing/BitmapMode.hpp>
32 #include <com/sun/star/drawing/FillStyle.hpp>
33 #include <com/sun/star/drawing/LineDash.hpp>
34 #include <com/sun/star/drawing/LineJoint.hpp>
35 #include <com/sun/star/drawing/LineStyle.hpp>
36 #include <com/sun/star/drawing/RectanglePoint.hpp>
37 
38 using namespace ::com::sun::star;
39 using ::com::sun::star::uno::Any;
40 using ::com::sun::star::uno::Reference;
41 using ::rtl::OUString;
42 
43 //.............................................................................
44 namespace chart
45 {
46 //.............................................................................
47 
48 
WrappedIgnoreProperty(const OUString & rOuterName,const Any & rDefaultValue)49 WrappedIgnoreProperty::WrappedIgnoreProperty( const OUString& rOuterName, const Any& rDefaultValue )
50                          : WrappedProperty( rOuterName, OUString() )
51                          , m_aDefaultValue( rDefaultValue )
52                          , m_aCurrentValue( rDefaultValue )
53 {
54 }
~WrappedIgnoreProperty()55 WrappedIgnoreProperty::~WrappedIgnoreProperty()
56 {
57 }
58 
setPropertyValue(const Any & rOuterValue,const Reference<beans::XPropertySet> &) const59 void WrappedIgnoreProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
60 {
61     m_aCurrentValue = rOuterValue;
62 }
63 
getPropertyValue(const Reference<beans::XPropertySet> &) const64 Any WrappedIgnoreProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
65 {
66     return m_aCurrentValue;
67 }
68 
setPropertyToDefault(const Reference<beans::XPropertyState> &) const69 void WrappedIgnoreProperty::setPropertyToDefault( const Reference< beans::XPropertyState >& /* xInnerPropertyState */ ) const
70 {
71     m_aCurrentValue = m_aDefaultValue;
72 }
73 
getPropertyDefault(const Reference<beans::XPropertyState> &) const74 Any WrappedIgnoreProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /* xInnerPropertyState */ ) const
75 {
76     return m_aDefaultValue;
77 }
78 
getPropertyState(const Reference<beans::XPropertyState> &) const79 beans::PropertyState WrappedIgnoreProperty::getPropertyState( const Reference< beans::XPropertyState >& /* xInnerPropertyState */ ) const
80 {
81     return ( m_aCurrentValue == m_aDefaultValue
82              ? beans::PropertyState_DEFAULT_VALUE
83              : beans::PropertyState_DIRECT_VALUE );
84 }
85 
addIgnoreLineProperties(std::vector<WrappedProperty * > & rList)86 void WrappedIgnoreProperties::addIgnoreLineProperties( std::vector< WrappedProperty* >& rList )
87 {
88     rList.push_back( new WrappedIgnoreProperty( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID ) ) );
89 //     rList.push_back( new WrappedIgnoreProperty( C2U( "LineDash" ), uno::makeAny( drawing::LineDash() ) ) );
90     rList.push_back( new WrappedIgnoreProperty( C2U( "LineDashName" ), uno::makeAny( rtl::OUString() ) ) );
91     rList.push_back( new WrappedIgnoreProperty( C2U( "LineColor" ), uno::makeAny( sal_Int32(0) ) ) );
92     rList.push_back( new WrappedIgnoreProperty( C2U( "LineTransparence" ), uno::makeAny( sal_Int16(0) ) ) );
93     rList.push_back( new WrappedIgnoreProperty( C2U( "LineWidth" ), uno::makeAny( sal_Int32(0) ) ) );
94     rList.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_ROUND ) ) );
95 }
96 
addIgnoreFillProperties(std::vector<WrappedProperty * > & rList)97 void WrappedIgnoreProperties::addIgnoreFillProperties( std::vector< WrappedProperty* >& rList )
98 {
99     addIgnoreFillProperties_without_BitmapProperties( rList );
100     addIgnoreFillProperties_only_BitmapProperties( rList );
101 }
102 
addIgnoreFillProperties_without_BitmapProperties(::std::vector<WrappedProperty * > & rList)103 void WrappedIgnoreProperties::addIgnoreFillProperties_without_BitmapProperties( ::std::vector< WrappedProperty* >& rList )
104 {
105     rList.push_back( new WrappedIgnoreProperty( C2U( "FillStyle" ), uno::makeAny( drawing::FillStyle_SOLID ) ) );
106     rList.push_back( new WrappedIgnoreProperty( C2U( "FillColor" ), uno::makeAny( sal_Int32(-1) ) ) );
107     rList.push_back( new WrappedIgnoreProperty( C2U( "FillTransparence" ), uno::makeAny( sal_Int16(0) ) ) );
108     rList.push_back( new WrappedIgnoreProperty( C2U( "FillTransparenceGradientName" ), uno::makeAny( ::rtl::OUString() ) ) );
109 //    rList.push_back( new WrappedIgnoreProperty( C2U( "FillTransparenceGradient" ), uno::makeAny( awt::Gradient() ) ) );
110     rList.push_back( new WrappedIgnoreProperty( C2U( "FillGradientName" ), uno::makeAny( ::rtl::OUString() ) ) );
111 //    rList.push_back( new WrappedIgnoreProperty( C2U( "FillGradient" ), uno::makeAny( awt::Gradient() ) ) );
112     rList.push_back( new WrappedIgnoreProperty( C2U( "FillHatchName" ), uno::makeAny( ::rtl::OUString() ) ) );
113 //    rList.push_back( new WrappedIgnoreProperty( C2U( "FillHatch" ), uno::makeAny( drawing::Hatch() ) ) );
114     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBackground" ), uno::makeAny( sal_Bool(sal_False) ) ) );
115 }
116 
addIgnoreFillProperties_only_BitmapProperties(::std::vector<WrappedProperty * > & rList)117 void WrappedIgnoreProperties::addIgnoreFillProperties_only_BitmapProperties( ::std::vector< WrappedProperty* >& rList )
118 {
119 //     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapName" ), uno::makeAny( ::rtl::OUString() ) ) );
120 //    rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmap" ), uno::makeAny( uno::Reference< awt::XBitmap > (0) ) ) );
121 //    rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapURL" ), uno::makeAny( ::rtl::OUString() ) ) );
122     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapOffsetX" ), uno::makeAny( sal_Int16(0) ) ) );
123     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapOffsetY" ), uno::makeAny( sal_Int16(0) ) ) );
124     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapPositionOffsetX" ), uno::makeAny( sal_Int16(0) ) ) );
125     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapPositionOffsetY" ), uno::makeAny( sal_Int16(0) ) ) );
126     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapRectanglePoint" ), uno::makeAny( drawing::RectanglePoint_LEFT_TOP ) ) );
127     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapLogicalSize" ), uno::makeAny( sal_Bool(sal_False) ) ) );//todo correct default?
128     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapSizeX" ), uno::makeAny( sal_Int32(10) ) ) );//todo which default?
129     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapSizeY" ), uno::makeAny( sal_Int32(10) ) ) );//todo which default?
130     rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapMode" ), uno::makeAny( drawing::BitmapMode_REPEAT ) ) );
131 }
132 
133 //.............................................................................
134 } //namespace chart
135 //.............................................................................
136