summaryrefslogtreecommitdiff
path: root/desktop/source/migration/cfgfilter.hxx
blob: 44a5006e8cd320c681dcddcc71bfb1c48cac990f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef _DESKTOP_CFGFILTER_HXX_
#define _DESKTOP_CFGFILTER_HXX_

#include <stack>

#include <sal/types.h>
#include <rtl/ustring.hxx>

#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>

#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Type.hxx>

#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/configuration/backend/XLayer.hpp>
#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
#include <com/sun/star/configuration/backend/TemplateIdentifier.hpp>


#include "migration_impl.hxx"

#define NS_CSS com::sun::star
#define NS_UNO com::sun::star::uno


namespace desktop {

struct element
{
    rtl::OUString name;
    rtl::OUString path;
    sal_Bool use;

};

typedef std::stack< element > element_stack;

// XInitialization:
//  -> Source : XLayer
// XLayer
// XLayerHandler
class CConfigFilter : public cppu::WeakImplHelper3<
    NS_CSS::configuration::backend::XLayer,
    NS_CSS::configuration::backend::XLayerHandler,
    NS_CSS::lang::XInitialization>
{

private:
    NS_UNO::Reference< NS_CSS::configuration::backend::XLayerHandler > m_xLayerHandler;
    NS_UNO::Reference< NS_CSS::configuration::backend::XLayer > m_xSourceLayer;

    rtl::OUString m_aCurrentComponent;

    const strings_v *m_pvInclude;
    const strings_v *m_pvExclude;

    element_stack m_elementStack;

    void pushElement(rtl::OUString aName, sal_Bool bUse = sal_True);
    void popElement();
    sal_Bool checkElement(rtl::OUString aName);
    sal_Bool checkCurrentElement();

public:
    CConfigFilter(const strings_v* include,  const strings_v* exclude);

    // XInitialization
    virtual void SAL_CALL initialize(const NS_UNO::Sequence< NS_UNO::Any >& seqArgs)
        throw (NS_UNO::Exception);

    // XLayer
    virtual void SAL_CALL readData(
        const NS_UNO::Reference< NS_CSS::configuration::backend::XLayerHandler >& layerHandler)
        throw (NS_CSS::lang::NullPointerException, NS_CSS::lang::WrappedTargetException,
               NS_CSS::configuration::backend::MalformedDataException);

    // XLayerHandler
    virtual void SAL_CALL startLayer()
        throw(::com::sun::star::lang::WrappedTargetException);

    virtual void SAL_CALL endLayer()
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL overrideNode(
            const rtl::OUString& aName,
            sal_Int16 aAttributes,
            sal_Bool bClear)
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL addOrReplaceNode(
            const rtl::OUString& aName,
            sal_Int16 aAttributes)
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL  addOrReplaceNodeFromTemplate(
            const rtl::OUString& aName,
            const NS_CSS::configuration::backend::TemplateIdentifier& aTemplate,
            sal_Int16 aAttributes )
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL  endNode()
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL  dropNode(
            const rtl::OUString& aName )
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL  overrideProperty(
            const rtl::OUString& aName,
            sal_Int16 aAttributes,
            const NS_UNO::Type& aType,
            sal_Bool bClear )
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL  setPropertyValue(
            const NS_UNO::Any& aValue )
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL setPropertyValueForLocale(
            const NS_UNO::Any& aValue,
            const rtl::OUString& aLocale )
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL  endProperty()
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL  addProperty(
            const rtl::OUString& aName,
            sal_Int16 aAttributes,
            const NS_UNO::Type& aType )
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

    virtual void SAL_CALL  addPropertyWithValue(
            const rtl::OUString& aName,
            sal_Int16 aAttributes,
            const NS_UNO::Any& aValue )
        throw(
            ::com::sun::star::configuration::backend::MalformedDataException,
            ::com::sun::star::lang::WrappedTargetException );

};

} // namespace desktop
#undef NS_CSS
#undef NS_UNO

#endif


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */