1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #ifndef INCLUDED_VCL_FILTERCONFIGITEM_HXX
22 #define INCLUDED_VCL_FILTERCONFIGITEM_HXX
24 #include <sal/config.h>
26 #include <string_view>
28 #include <vcl/dllapi.h>
30 #include <rtl/ustring.hxx>
31 #include <com/sun/star/beans/PropertyValue.hpp>
32 #include <com/sun/star/uno/Reference.h>
33 #include <com/sun/star/uno/Sequence.hxx>
35 namespace com::sun::star::beans
{ class XPropertySet
; }
36 namespace com::sun::star::task
{ class XStatusIndicator
; }
37 namespace com::sun::star::uno
{ class Any
; }
38 namespace com::sun::star::uno
{ class XInterface
; }
40 class VCL_DLLPUBLIC FilterConfigItem
42 css::uno::Reference
< css::uno::XInterface
> xUpdatableView
;
43 css::uno::Reference
< css::beans::XPropertySet
> xPropSet
;
44 css::uno::Sequence
< css::beans::PropertyValue
> aFilterData
;
48 static bool ImplGetPropertyValue( css::uno::Any
& rAny
,
49 const css::uno::Reference
< css::beans::XPropertySet
>& rXPropSet
,
50 const OUString
& rPropName
);
52 void ImpInitTree( std::u16string_view rTree
);
55 static const css::beans::PropertyValue
* GetPropertyValue(
56 const css::uno::Sequence
< css::beans::PropertyValue
>& rPropSeq
,
57 const OUString
& rName
);
58 static bool WritePropertyValue(
59 css::uno::Sequence
< css::beans::PropertyValue
>& rPropSeq
,
60 const css::beans::PropertyValue
& rPropValue
);
64 FilterConfigItem( std::u16string_view rSubTree
);
65 FilterConfigItem( css::uno::Sequence
< css::beans::PropertyValue
> const * pFilterData
);
66 FilterConfigItem( std::u16string_view rSubTree
, css::uno::Sequence
< css::beans::PropertyValue
> const * pFilterData
);
67 /// Writes config in destructor
69 /// Writes config and sets unmodified state again.
70 void WriteModifiedConfig();
72 bool IsReadOnly(const OUString
& rPropName
);
74 // all read methods are trying to return values in following order:
75 // 1. FilterData PropertySequence
78 bool ReadBool( const OUString
& rKey
, bool bDefault
);
79 sal_Int32
ReadInt32( const OUString
& rKey
, sal_Int32 nDefault
);
81 ReadString( const OUString
& rKey
, const OUString
& rDefault
);
83 // try to store to configuration
84 // and always stores into the FilterData sequence
85 void WriteBool( const OUString
& rKey
, bool bValue
);
86 void WriteInt32( const OUString
& rKey
, sal_Int32 nValue
);
88 const css::uno::Sequence
< css::beans::PropertyValue
>& GetFilterData() const { return aFilterData
;}
90 // GetStatusIndicator is returning the "StatusIndicator" property of the FilterData sequence
91 css::uno::Reference
< css::task::XStatusIndicator
> GetStatusIndicator() const;
94 #endif // INCLUDED_VCL_FILTERCONFIGITEM_HXX
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */