LibreOffice Module vcl (master)  1
FilterConfigItem.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 
21 #ifndef INCLUDED_VCL_FILTERCONFIGITEM_HXX
22 #define INCLUDED_VCL_FILTERCONFIGITEM_HXX
23 
24 #include <sal/config.h>
25 
26 #include <string_view>
27 
28 #include <vcl/dllapi.h>
29 
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>
34 
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; }
39 
41 {
42  css::uno::Reference< css::uno::XInterface > xUpdatableView;
43  css::uno::Reference< css::beans::XPropertySet > xPropSet;
44  css::uno::Sequence< css::beans::PropertyValue > aFilterData;
45 
46  bool bModified;
47 
48  static bool ImplGetPropertyValue( css::uno::Any& rAny,
49  const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
50  const OUString& rPropName );
51 
52  void ImpInitTree( std::u16string_view rTree );
53 
54 
55  static css::beans::PropertyValue* GetPropertyValue(
56  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 );
61 
62 public:
63 
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 );
70  void WriteModifiedConfig();
71 
72  // all read methods are trying to return values in following order:
73  // 1. FilterData PropertySequence
74  // 2. configuration
75  // 3. given default
76  bool ReadBool( const OUString& rKey, bool bDefault );
77  sal_Int32 ReadInt32( const OUString& rKey, sal_Int32 nDefault );
78  OUString
79  ReadString( const OUString& rKey, const OUString& rDefault );
80 
81  // try to store to configuration
82  // and always stores into the FilterData sequence
83  void WriteBool( const OUString& rKey, bool bValue );
84  void WriteInt32( const OUString& rKey, sal_Int32 nValue );
85 
86  const css::uno::Sequence< css::beans::PropertyValue >& GetFilterData() const { return aFilterData;}
87 
88  // GetStatusIndicator is returning the "StatusIndicator" property of the FilterData sequence
89  css::uno::Reference< css::task::XStatusIndicator > GetStatusIndicator() const;
90 };
91 
92 #endif // INCLUDED_VCL_FILTERCONFIGITEM_HXX
93 
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XInterface > xUpdatableView
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
css::uno::Sequence< css::beans::PropertyValue > aFilterData
css::uno::Reference< css::beans::XPropertySet > xPropSet
class SAL_NO_VTABLE XPropertySet
css::uno::Any GetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
const css::uno::Sequence< css::beans::PropertyValue > & GetFilterData() const