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