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 25 #ifndef _FILTER_CONFIG_ITEM_HXX_ 26 #define _FILTER_CONFIG_ITEM_HXX_ 27 28 #include "svtools/svtdllapi.h" 29 #include <tools/string.hxx> 30 #include <com/sun/star/awt/Size.hpp> 31 #include <com/sun/star/uno/Any.h> 32 #include <com/sun/star/uno/Reference.h> 33 #include <com/sun/star/uno/XInterface.hpp> 34 #include <com/sun/star/beans/XPropertySet.hpp> 35 #include <com/sun/star/beans/XPropertyAccess.hpp> 36 #include <com/sun/star/task/XStatusIndicator.hpp> 37 38 class SVT_DLLPUBLIC FilterConfigItem 39 { 40 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xUpdatableView; 41 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet; 42 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aFilterData; 43 44 sal_Bool bModified; 45 46 SVT_DLLPRIVATE sal_Bool ImplGetPropertyValue( ::com::sun::star::uno::Any& rAny, 47 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet, 48 const ::rtl::OUString& rPropName, 49 sal_Bool bTestPropertyAvailability ); 50 51 SVT_DLLPRIVATE void ImpInitTree( const String& rTree ); 52 53 54 SVT_DLLPRIVATE static ::com::sun::star::beans::PropertyValue* GetPropertyValue( 55 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rPropSeq, 56 const ::rtl::OUString& rName ); 57 SVT_DLLPRIVATE static sal_Bool WritePropertyValue( 58 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rPropSeq, 59 const ::com::sun::star::beans::PropertyValue& rPropValue ); 60 61 public : 62 63 FilterConfigItem( const ::rtl::OUString& rSubTree ); 64 FilterConfigItem( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); 65 FilterConfigItem( const ::rtl::OUString& rSubTree, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); 66 ~FilterConfigItem(); 67 68 // all read methods are trying to return values in following order: 69 // 1. FilterData PropertySequence 70 // 2. configuration 71 // 3. given default 72 sal_Bool ReadBool( const ::rtl::OUString& rKey, sal_Bool bDefault ); 73 sal_Int32 ReadInt32( const ::rtl::OUString& rKey, sal_Int32 nDefault ); 74 ::com::sun::star::awt::Size 75 ReadSize( const ::rtl::OUString& rKey, const ::com::sun::star::awt::Size& rDefault ); 76 ::rtl::OUString 77 ReadString( const ::rtl::OUString& rKey, const ::rtl::OUString& rDefault ); 78 ::com::sun::star::uno::Any 79 ReadAny( const ::rtl::OUString& rKey, const ::com::sun::star::uno::Any& rDefault ); 80 81 // try to store to configuration 82 // and always stores into the FilterData sequence 83 void WriteBool( const ::rtl::OUString& rKey, sal_Bool bValue ); 84 void WriteInt32( const ::rtl::OUString& rKey, sal_Int32 nValue ); 85 void WriteSize( const ::rtl::OUString& rKey, const ::com::sun::star::awt::Size& rSize ); 86 void WriteString( const ::rtl::OUString& rKey, const ::rtl::OUString& rString ); 87 void WriteAny( const rtl::OUString& rKey, const ::com::sun::star::uno::Any& rAny ); 88 89 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetFilterData() const; 90 91 // GetStatusIndicator is returning the "StatusIndicator" property of the FilterData sequence 92 ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > GetStatusIndicator() const; 93 }; 94 95 #endif // _FILTER_CONFIG_ITEM_HXX_ 96 97