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_chart2.hxx"
26 
27 #include "VLineProperties.hxx"
28 #include "macros.hxx"
29 #include <com/sun/star/drawing/LineStyle.hpp>
30 
31 //.............................................................................
32 namespace chart
33 {
34 //.............................................................................
35 using namespace ::com::sun::star;
36 
37 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
39 //  get line properties from a propertyset
40 //-----------------------------------------------------------------------------
41 //-----------------------------------------------------------------------------
42 
VLineProperties()43 VLineProperties::VLineProperties()
44 {
45     this->Color = uno::makeAny( sal_Int32(0x000000) ); //type sal_Int32 UNO_NAME_LINECOLOR
46     this->LineStyle = uno::makeAny( drawing::LineStyle_SOLID ); //type drawing::LineStyle for property UNO_NAME_LINESTYLE
47     this->Transparence = uno::makeAny( sal_Int16(0) );//type sal_Int16 for property UNO_NAME_LINETRANSPARENCE
48     this->Width = uno::makeAny( sal_Int32(0) );//type sal_Int32 for property UNO_NAME_LINEWIDTH
49 }
50 
initFromPropertySet(const uno::Reference<beans::XPropertySet> & xProp,bool bUseSeriesPropertyNames)51 void VLineProperties::initFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp, bool bUseSeriesPropertyNames )
52 {
53     if(xProp.is())
54     {
55         if( bUseSeriesPropertyNames ) try
56         {
57             this->Color = xProp->getPropertyValue( C2U( "BorderColor" ) );
58             this->LineStyle = xProp->getPropertyValue( C2U( "BorderStyle" ) );
59             this->Transparence = xProp->getPropertyValue( C2U( "BorderTransparency" ) );
60             this->Width = xProp->getPropertyValue( C2U( "BorderWidth" ) );
61             this->DashName = xProp->getPropertyValue( C2U( "BorderDashName" ) );
62         }
63         catch( uno::Exception& e )
64         {
65             ASSERT_EXCEPTION( e );
66         }
67         else try
68         {
69             this->Color = xProp->getPropertyValue( C2U( "LineColor" ) );
70             this->LineStyle = xProp->getPropertyValue( C2U( "LineStyle" ) );
71             this->Transparence = xProp->getPropertyValue( C2U( "LineTransparence" ) );
72             this->Width = xProp->getPropertyValue( C2U( "LineWidth" ) );
73             this->DashName = xProp->getPropertyValue( C2U( "LineDashName" ) );
74         }
75         catch( uno::Exception& e )
76 	    {
77             ASSERT_EXCEPTION( e );
78         }
79     }
80     else
81         this->LineStyle = uno::makeAny( drawing::LineStyle_NONE );
82 }
83 
isLineVisible() const84 bool VLineProperties::isLineVisible() const
85 {
86     bool bRet = false;
87 
88     drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID);
89     this->LineStyle >>= aLineStyle;
90     if( aLineStyle != drawing::LineStyle_NONE )
91     {
92         sal_Int16 nLineTransparence=0;
93         this->Transparence >>= nLineTransparence;
94         if(100!=nLineTransparence)
95         {
96             bRet = true;
97         }
98     }
99 
100     return bRet;
101 }
102 
103 //.............................................................................
104 } //namespace chart
105 //.............................................................................
106