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 #ifndef RPT_REPORTCONTROLMODEL_HXX
25 #define RPT_REPORTCONTROLMODEL_HXX
26 
27 #include "ReportComponent.hxx"
28 #include "com/sun/star/style/VerticalAlignment.hpp"
29 #include "com/sun/star/awt/FontDescriptor.hpp"
30 #include "com/sun/star/report/XFormatCondition.hpp"
31 #include "com/sun/star/container/XContainer.hpp"
32 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
33 #include <com/sun/star/lang/Locale.hpp>
34 #include <tools/color.hxx>
35 #include <comphelper/uno3.hxx>
36 #include <cppuhelper/interfacecontainer.h>
37 
38 
39 namespace reportdesign
40 {
41     bool operator==( const ::com::sun::star::awt::FontDescriptor& _lhs, const ::com::sun::star::awt::FontDescriptor& _rhs );
42 
operator !=(const::com::sun::star::awt::FontDescriptor & _lhs,const::com::sun::star::awt::FontDescriptor & _rhs)43     inline bool operator!=( const ::com::sun::star::awt::FontDescriptor& _lhs, const ::com::sun::star::awt::FontDescriptor& _rhs )
44     {
45         return !( _lhs == _rhs );
46     }
47 
48 	struct OFormatProperties
49 	{
50 		::sal_Int16			                                nAlign;
51 		::com::sun::star::awt::FontDescriptor				aFontDescriptor;
52         ::com::sun::star::awt::FontDescriptor				aAsianFontDescriptor;
53         ::com::sun::star::awt::FontDescriptor				aComplexFontDescriptor;
54         ::com::sun::star::lang::Locale                      aCharLocale;
55         ::com::sun::star::lang::Locale                      aCharLocaleAsian;
56         ::com::sun::star::lang::Locale                      aCharLocaleComplex;
57 		::sal_Int16											nFontEmphasisMark;
58 		::sal_Int16											nFontRelief;
59 		::sal_Int32											nTextColor;
60 		::sal_Int32											nTextLineColor;
61 		::sal_Int32											nCharUnderlineColor;
62 		::sal_Int32											nBackgroundColor;
63         ::rtl::OUString                                     sCharCombinePrefix;
64         ::rtl::OUString                                     sCharCombineSuffix;
65         ::rtl::OUString                                     sHyperLinkURL;
66         ::rtl::OUString                                     sHyperLinkTarget;
67         ::rtl::OUString                                     sHyperLinkName;
68         ::rtl::OUString                                     sVisitedCharStyleName;
69         ::rtl::OUString                                     sUnvisitedCharStyleName;
70         com::sun::star::style::VerticalAlignment            aVerticalAlignment;
71         ::sal_Int16											nCharEscapement;
72         ::sal_Int16											nCharCaseMap;
73         ::sal_Int16											nCharKerning;
74         ::sal_Int8										    nCharEscapementHeight;
75         ::sal_Bool										    m_bBackgroundTransparent;
76         ::sal_Bool										    bCharFlash;
77         ::sal_Bool										    bCharAutoKerning;
78         ::sal_Bool										    bCharCombineIsOn;
79         ::sal_Bool										    bCharHidden;
80         ::sal_Bool										    bCharShadowed;
81         ::sal_Bool										    bCharContoured;
82 		OFormatProperties();
83 	};
84 	class OReportControlModel
85 	{
86         void checkIndex(sal_Int32 _nIndex);
87         OReportControlModel(OReportControlModel&);
88         void operator =(OReportControlModel&);
89     public:
90         ::cppu::OInterfaceContainerHelper		            aContainerListeners;
91 		OReportComponentProperties							aComponent;
92 		OFormatProperties									aFormatProperties;
93         ::com::sun::star::container::XContainer*            m_pOwner;
94         ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::report::XFormatCondition> >
95                                                             m_aFormatConditions;
96         osl::Mutex&                                         m_rMutex;
97 		::rtl::OUString										aDataField;
98 		::rtl::OUString										aConditionalPrintExpression;
99 		sal_Bool											bPrintWhenGroupChange;
100 
OReportControlModel(osl::Mutex & _rMutex,::com::sun::star::container::XContainer * _pOwner,::com::sun::star::uno::Reference<::com::sun::star::uno::XComponentContext> const & _xContext)101 		OReportControlModel(osl::Mutex& _rMutex
102                             ,::com::sun::star::container::XContainer* _pOwner
103                             ,::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext)
104 			:aContainerListeners(_rMutex)
105             ,aComponent(_xContext)
106             ,m_pOwner(_pOwner)
107             ,m_rMutex(_rMutex)
108 			,bPrintWhenGroupChange(sal_False)
109 		{}
110 
111         // XContainer
112 		void addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
113 		void removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
114 
115 		// XElementAccess
116 		::sal_Bool hasElements(  ) throw (::com::sun::star::uno::RuntimeException);
117 
118 		// XIndexReplace
119 		void replaceByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
120 
121 		// XIndexContainer
122 		void insertByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
123 		void removeByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
124 
125 		// XIndexAccess
126 		::sal_Int32 getCount(  ) throw (::com::sun::star::uno::RuntimeException);
127 		::com::sun::star::uno::Any getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
128 
129         static bool isInterfaceForbidden(const ::com::sun::star::uno::Type& _rType);
130 	};
131 }
132 #endif // RPT_REPORTCONTROLMODEL_HXX
133 
134