Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmlscript/source/xmldlg_imexp/imp_share.hxx
Line
Count
Source
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
#pragma once
21
22
#include <utility>
23
#include <xmlscript/xmldlg_imexp.hxx>
24
#include <cppuhelper/implbase.hxx>
25
#include <com/sun/star/uno/XComponentContext.hpp>
26
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
27
#include <com/sun/star/container/XNameContainer.hpp>
28
#include <com/sun/star/beans/XPropertySet.hpp>
29
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
30
#include <com/sun/star/awt/XControlModel.hpp>
31
#include <com/sun/star/awt/FontDescriptor.hpp>
32
#include <com/sun/star/awt/FontEmphasisMark.hpp>
33
#include <com/sun/star/awt/FontRelief.hpp>
34
#include <com/sun/star/xml/input/XRoot.hpp>
35
#include <com/sun/star/xml/sax/SAXException.hpp>
36
#include <com/sun/star/container/ElementExistException.hpp>
37
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
38
#include <osl/diagnose.h>
39
#include <rtl/ref.hxx>
40
#include <o3tl/string_view.hxx>
41
#include <memory>
42
#include <vector>
43
44
namespace xmlscript
45
{
46
47
inline sal_Int32 toInt32( std::u16string_view rStr )
48
0
{
49
0
    sal_Int32 nVal;
50
0
    if (rStr.size() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x')
51
0
        nVal = o3tl::toUInt32(rStr.substr( 2 ), 16);
52
0
    else
53
0
        nVal = o3tl::toInt32(rStr);
54
0
    return nVal;
55
0
}
56
57
inline bool getBoolAttr(
58
    sal_Bool * pRet, OUString const & rAttrName,
59
    css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
60
    sal_Int32 nUid )
61
0
{
62
0
    OUString aValue( xAttributes->getValueByUidName( nUid, rAttrName ) );
63
0
    if (!aValue.isEmpty())
64
0
    {
65
0
        if ( aValue == "true" )
66
0
        {
67
0
            *pRet = true;
68
0
            return true;
69
0
        }
70
0
        else if ( aValue == "false" )
71
0
        {
72
0
            *pRet = false;
73
0
            return true;
74
0
        }
75
0
        else
76
0
        {
77
0
            throw css::xml::sax::SAXException(
78
0
                rAttrName + ": no boolean value (true|false)!",
79
0
                css::uno::Reference<css::uno::XInterface>(), css::uno::Any() );
80
0
        }
81
0
    }
82
0
    return false;
83
0
}
84
85
inline bool getStringAttr(
86
    OUString * pRet, OUString const & rAttrName,
87
    css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
88
    sal_Int32 nUid )
89
0
{
90
0
    *pRet = xAttributes->getValueByUidName( nUid, rAttrName );
91
0
    return (!pRet->isEmpty());
92
0
}
93
94
inline bool getLongAttr(
95
    sal_Int32 * pRet, OUString const & rAttrName,
96
    css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
97
    sal_Int32 nUid )
98
0
{
99
0
    OUString aValue( xAttributes->getValueByUidName( nUid, rAttrName ) );
100
0
    if (!aValue.isEmpty())
101
0
    {
102
0
        *pRet = toInt32( aValue );
103
0
        return true;
104
0
    }
105
0
    return false;
106
0
}
107
108
struct DialogImport
109
    : public ::cppu::WeakImplHelper< css::xml::input::XRoot >
110
{
111
    friend class ImportContext;
112
private:
113
    css::uno::Reference< css::uno::XComponentContext > _xContext;
114
    css::uno::Reference< css::util::XNumberFormatsSupplier > _xSupplier;
115
116
    std::shared_ptr< std::vector< OUString > > _pStyleNames;
117
    std::shared_ptr< std::vector< css::uno::Reference< css::xml::input::XElement > > > _pStyles;
118
119
    css::uno::Reference< css::frame::XModel > _xDoc;
120
public:
121
    css::uno::Reference< css::container::XNameContainer > _xDialogModel;
122
    css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
123
124
    sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
125
126
    bool isEventElement(
127
        sal_Int32 nUid, std::u16string_view rLocalName ) const
128
0
    {
129
0
        return ((XMLNS_SCRIPT_UID == nUid && (rLocalName == u"event" || rLocalName == u"listener-event" )) ||
130
0
                (XMLNS_DIALOGS_UID == nUid && rLocalName == u"event" ));
131
0
    }
132
133
    void addStyle(
134
        OUString const & rStyleId,
135
        css::uno::Reference< css::xml::input::XElement > const & xStyle );
136
    css::uno::Reference< css::xml::input::XElement > getStyle(
137
        std::u16string_view rStyleId ) const;
138
139
    css::uno::Reference< css::uno::XComponentContext >
140
0
    const & getComponentContext() const { return _xContext; }
141
    css::uno::Reference< css::util::XNumberFormatsSupplier >
142
    const & getNumberFormatsSupplier();
143
144
    DialogImport(
145
        css::uno::Reference<css::uno::XComponentContext> xContext,
146
        css::uno::Reference<css::container::XNameContainer>
147
        const & xDialogModel,
148
        std::shared_ptr< std::vector< OUString > > pStyleNames,
149
        std::shared_ptr< std::vector< css::uno::Reference< css::xml::input::XElement > > > pStyles,
150
        css::uno::Reference<css::frame::XModel> xDoc )
151
0
        : _xContext(std::move( xContext ))
152
0
        , _pStyleNames(std::move( pStyleNames ))
153
0
        , _pStyles(std::move( pStyles ))
154
0
        , _xDoc(std::move( xDoc ))
155
0
        , _xDialogModel( xDialogModel )
156
0
        , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
157
0
        , XMLNS_DIALOGS_UID( 0 )
158
0
        , XMLNS_SCRIPT_UID( 0 )
159
0
        { OSL_ASSERT( _xDialogModel.is() && _xContext.is() ); }
160
    DialogImport( const DialogImport& rOther ) :
161
0
        ::cppu::WeakImplHelper< css::xml::input::XRoot >()
162
0
        , _xContext( rOther._xContext )
163
0
        , _xSupplier( rOther._xSupplier )
164
0
        , _pStyleNames( rOther._pStyleNames )
165
0
        , _pStyles( rOther._pStyles )
166
0
        , _xDoc( rOther._xDoc )
167
0
        , _xDialogModel( rOther._xDialogModel )
168
0
        , _xDialogModelFactory( rOther._xDialogModelFactory )
169
0
        , XMLNS_DIALOGS_UID( rOther.XMLNS_DIALOGS_UID )
170
0
        , XMLNS_SCRIPT_UID( rOther.XMLNS_SCRIPT_UID ) {}
171
172
    virtual ~DialogImport() override;
173
174
0
    const css::uno::Reference< css::frame::XModel >& getDocOwner() const { return _xDoc; }
175
176
    // XRoot
177
    virtual void SAL_CALL startDocument(
178
        css::uno::Reference< css::xml::input::XNamespaceMapping >
179
        const & xNamespaceMapping ) override;
180
    virtual void SAL_CALL endDocument() override;
181
    virtual void SAL_CALL processingInstruction(
182
        OUString const & rTarget, OUString const & rData ) override;
183
    virtual void SAL_CALL setDocumentLocator(
184
        css::uno::Reference< css::xml::sax::XLocator > const & xLocator ) override;
185
    virtual css::uno::Reference< css::xml::input::XElement >
186
    SAL_CALL startRootElement(
187
        sal_Int32 nUid, OUString const & rLocalName,
188
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
189
};
190
191
class ElementBase
192
    : public ::cppu::WeakImplHelper< css::xml::input::XElement >
193
{
194
protected:
195
    // We deliberately store these as raw pointers, otherwise we get reference cycles between DialogImport and the elements
196
    DialogImport* m_pImport;
197
    ElementBase* m_pParent;
198
private:
199
    const sal_Int32 _nUid;
200
    const OUString _aLocalName;
201
protected:
202
    const css::uno::Reference< css::xml::input::XAttributes > _xAttributes;
203
204
public:
205
    ElementBase(
206
        sal_Int32 nUid, OUString aLocalName,
207
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
208
        ElementBase * pParent, DialogImport * pImport );
209
    virtual ~ElementBase() override;
210
211
    // XElement
212
    virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent() override;
213
    virtual OUString SAL_CALL getLocalName() override;
214
    virtual sal_Int32 SAL_CALL getUid() override;
215
    virtual css::uno::Reference< css::xml::input::XAttributes >
216
    SAL_CALL getAttributes() override;
217
    virtual void SAL_CALL ignorableWhitespace(
218
        OUString const & rWhitespaces ) override;
219
    virtual void SAL_CALL characters( OUString const & rChars ) override;
220
    virtual void SAL_CALL processingInstruction(
221
        OUString const & Target, OUString const & Data ) override;
222
    virtual void SAL_CALL endElement() override;
223
    virtual css::uno::Reference< css::xml::input::XElement >
224
    SAL_CALL startChildElement(
225
        sal_Int32 nUid, OUString const & rLocalName,
226
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
227
};
228
229
class StylesElement
230
    : public ElementBase
231
{
232
public:
233
    virtual css::uno::Reference< css::xml::input::XElement >
234
    SAL_CALL startChildElement(
235
        sal_Int32 nUid, OUString const & rLocalName,
236
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
237
238
    StylesElement(
239
        OUString const & rLocalName,
240
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
241
        ElementBase * pParent, DialogImport * pImport )
242
0
        : ElementBase( pImport->XMLNS_DIALOGS_UID,
243
0
                       rLocalName, xAttributes, pParent, pImport )
244
0
        {}
245
};
246
247
class StyleElement
248
    : public ElementBase
249
{
250
    sal_Int32 _backgroundColor;
251
    sal_Int32 _textColor;
252
    sal_Int32 _textLineColor;
253
    sal_Int16 _border;
254
    sal_Int32 _borderColor;
255
    css::awt::FontDescriptor _descr;
256
    sal_Int16 _fontRelief;
257
    sal_Int16 _fontEmphasisMark;
258
    sal_Int32 _fillColor;
259
    sal_Int16 _visualEffect;
260
261
    // current highest mask: 0x40
262
    short _inited, _hasValue;
263
264
    void setFontProperties(
265
        css::uno::Reference< css::beans::XPropertySet > const & xProps ) const;
266
267
public:
268
    virtual css::uno::Reference< css::xml::input::XElement >
269
    SAL_CALL startChildElement(
270
        sal_Int32 nUid, OUString const & rLocalName,
271
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
272
    virtual void SAL_CALL endElement() override;
273
274
    void importTextColorStyle(
275
        css::uno::Reference< css::beans::XPropertySet > const & xProps );
276
    void importTextLineColorStyle(
277
        css::uno::Reference< css::beans::XPropertySet > const & xProps );
278
    void importFillColorStyle(
279
        css::uno::Reference< css::beans::XPropertySet > const & xProps );
280
    void importBackgroundColorStyle(
281
        css::uno::Reference< css::beans::XPropertySet > const & xProps );
282
    void importFontStyle(
283
        css::uno::Reference< css::beans::XPropertySet > const & xProps );
284
    void importBorderStyle(
285
        css::uno::Reference< css::beans::XPropertySet > const & xProps );
286
    void importVisualEffectStyle(
287
        css::uno::Reference< css::beans::XPropertySet > const & xProps );
288
289
    StyleElement(
290
        OUString const & rLocalName,
291
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
292
        ElementBase * pParent, DialogImport * pImport )
293
0
        : ElementBase( pImport->XMLNS_DIALOGS_UID,
294
0
                       rLocalName, xAttributes, pParent, pImport )
295
0
        , _backgroundColor(0)
296
0
        , _textColor(0)
297
0
        , _textLineColor(0)
298
0
        , _border(0)
299
0
        , _borderColor(0)
300
0
        , _fontRelief( css::awt::FontRelief::NONE )
301
0
        , _fontEmphasisMark( css::awt::FontEmphasisMark::NONE )
302
0
        , _fillColor(0)
303
0
        , _visualEffect(0)
304
0
        , _inited( 0 )
305
0
        , _hasValue( 0 )
306
0
    {
307
0
    }
308
};
309
310
class MenuPopupElement
311
    : public ElementBase
312
{
313
    std::vector< OUString > _itemValues;
314
    std::vector< sal_Int16 > _itemSelected;
315
    bool _allowEmptyItems;
316
public:
317
    css::uno::Sequence< OUString > getItemValues();
318
    css::uno::Sequence< sal_Int16 > getSelectedItems();
319
320
    virtual css::uno::Reference< css::xml::input::XElement >
321
    SAL_CALL startChildElement(
322
        sal_Int32 nUid, OUString const & rLocalName,
323
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
324
325
    MenuPopupElement(
326
        OUString const & rLocalName,
327
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
328
        ElementBase * pParent, DialogImport * pImport,
329
        bool aAllowEmptyItems)
330
0
        : ElementBase( pImport->XMLNS_DIALOGS_UID,
331
0
                       rLocalName, xAttributes, pParent, pImport )
332
0
        , _allowEmptyItems(aAllowEmptyItems)
333
0
        {}
334
};
335
336
class ControlElement
337
    : public ElementBase
338
{
339
    friend class EventElement;
340
341
protected:
342
    sal_Int32 _nBasePosX, _nBasePosY;
343
344
    std::vector< css::uno::Reference< css::xml::input::XElement > > _events;
345
346
    OUString getControlId(
347
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
348
    OUString getControlModelName(
349
        OUString const& rDefaultModel,
350
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
351
    css::uno::Reference< css::xml::input::XElement > getStyle(
352
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
353
public:
354
    std::vector<css::uno::Reference< css::xml::input::XElement> >& getEvents()
355
0
         { return _events; }
356
357
    ControlElement(
358
        OUString const & rLocalName,
359
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
360
        ElementBase * pParent, DialogImport * pImport );
361
};
362
363
class ImportContext
364
{
365
protected:
366
    DialogImport * const _pImport;
367
    const css::uno::Reference< css::beans::XPropertySet > _xControlModel;
368
    const OUString _aId;
369
370
public:
371
    ImportContext(
372
        DialogImport * pImport,
373
        css::uno::Reference< css::beans::XPropertySet > xControlModel_,
374
        OUString id )
375
0
        : _pImport( pImport ),
376
0
          _xControlModel(std::move( xControlModel_ )),
377
0
          _aId(std::move( id ))
378
0
        { OSL_ASSERT( _xControlModel.is() ); }
379
380
    const css::uno::Reference< css::beans::XPropertySet >& getControlModel() const
381
0
        { return _xControlModel; }
382
383
    void importScollableSettings( css::uno::Reference< css::xml::input::XAttributes > const & xAttributes );
384
    void importDefaults(
385
        sal_Int32 nBaseX, sal_Int32 nBaseY,
386
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
387
        bool supportPrintable = true );
388
    void importEvents(
389
        std::vector< css::uno::Reference< css::xml::input::XElement > >
390
        const & rEvents );
391
392
    bool importStringProperty(
393
        OUString const & rPropName, OUString const & rAttrName,
394
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
395
    bool importDoubleProperty(
396
        OUString const & rPropName, OUString const & rAttrName,
397
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
398
    bool importBooleanProperty(
399
        OUString const & rPropName, OUString const & rAttrName,
400
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
401
    bool importShortProperty(
402
        OUString const & rPropName, OUString const & rAttrName,
403
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
404
    bool importLongProperty(
405
        OUString const & rPropName, OUString const & rAttrName,
406
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
407
    bool importLongProperty(
408
        sal_Int32 nOffset,
409
        OUString const & rPropName, OUString const & rAttrName,
410
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
411
    bool importHexLongProperty(
412
        OUString const & rPropName, OUString const & rAttrName,
413
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
414
    bool importAlignProperty(
415
        OUString const & rPropName, OUString const & rAttrName,
416
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
417
    bool importVerticalAlignProperty(
418
        OUString const & rPropName, OUString const & rAttrName,
419
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
420
    bool importGraphicOrImageProperty(OUString const & rAttrName,
421
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes );
422
    bool importImageAlignProperty(
423
        OUString const & rPropName, OUString const & rAttrName,
424
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
425
    bool importImagePositionProperty(
426
        OUString const & rPropName, OUString const & rAttrName,
427
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
428
    bool importDateProperty(
429
        OUString const & rPropName, OUString const & rAttrName,
430
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
431
    bool importDateFormatProperty(
432
        OUString const & rPropName, OUString const & rAttrName,
433
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
434
    bool importTimeProperty(
435
        OUString const & rPropName, OUString const & rAttrName,
436
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
437
    bool importTimeFormatProperty(
438
        OUString const & rPropName, OUString const & rAttrName,
439
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
440
    bool importOrientationProperty(
441
        OUString const & rPropName, OUString const & rAttrName,
442
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
443
    bool importButtonTypeProperty(
444
        OUString const & rPropName, OUString const & rAttrName,
445
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
446
    bool importLineEndFormatProperty(
447
        OUString const & rPropName, OUString const & rAttrName,
448
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
449
    bool importSelectionTypeProperty(
450
        OUString const & rPropName, OUString const & rAttrName,
451
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
452
    bool importDataAwareProperty(
453
        OUString const & rPropName,
454
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
455
    bool importImageScaleModeProperty(
456
        OUString const & rPropName, OUString const & rAttrName,
457
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
458
};
459
460
class ControlImportContext : public ImportContext
461
{
462
public:
463
    ControlImportContext(
464
        DialogImport * pImport,
465
        OUString const & rId, OUString const & rControlName )
466
0
        : ImportContext(
467
0
            pImport,
468
0
            css::uno::Reference< css::beans::XPropertySet >(
469
0
                pImport->_xDialogModelFactory->createInstance( rControlName ),
470
0
                css::uno::UNO_QUERY_THROW ), rId )
471
0
        {}
472
    ControlImportContext(
473
        DialogImport * pImport,
474
        const css::uno::Reference< css::beans::XPropertySet >& xProps, OUString const & rControlName )
475
0
        : ImportContext(
476
0
            pImport,
477
0
                xProps,
478
0
                rControlName )
479
0
        {}
480
481
    /// @throws css::xml::sax::SAXException
482
    /// @throws css::uno::RuntimeException
483
    void finish()
484
0
    {
485
0
        try
486
0
        {
487
0
            _pImport->_xDialogModel->insertByName(
488
0
                _aId, css::uno::Any(
489
0
                    css::uno::Reference<css::awt::XControlModel>::query(
490
0
                        _xControlModel ) ) );
491
0
        }
492
0
        catch(const css::container::ElementExistException &e)
493
0
        {
494
0
            throw css::lang::WrappedTargetRuntimeException(u""_ustr, e.Context, css::uno::Any(e));
495
0
        }
496
0
    }
497
};
498
499
class WindowElement
500
    : public ControlElement
501
{
502
public:
503
    virtual css::uno::Reference< css::xml::input::XElement >
504
    SAL_CALL startChildElement(
505
        sal_Int32 nUid, OUString const & rLocalName,
506
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
507
    virtual void SAL_CALL endElement() override;
508
509
    WindowElement(
510
        OUString const & rLocalName,
511
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
512
        DialogImport * pImport )
513
0
        : ControlElement( rLocalName, xAttributes, nullptr, pImport )
514
0
        {}
515
};
516
517
class EventElement
518
    : public ElementBase
519
{
520
public:
521
    virtual void SAL_CALL endElement() override;
522
523
    EventElement(
524
        sal_Int32 nUid, OUString const & rLocalName,
525
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
526
        ElementBase * pParent, DialogImport * pImport )
527
0
        : ElementBase( nUid, rLocalName, xAttributes, pParent, pImport )
528
0
        {}
529
};
530
531
class BulletinBoardElement
532
    : public ControlElement
533
{
534
    // we are the owner of this, so have to keep a reference to it
535
    rtl::Reference<DialogImport> mxDialogImport;
536
public:
537
    virtual css::uno::Reference< css::xml::input::XElement >
538
    SAL_CALL startChildElement(
539
        sal_Int32 nUid, OUString const & rLocalName,
540
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
541
542
    BulletinBoardElement(
543
        OUString const & rLocalName,
544
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
545
        ElementBase * pParent, DialogImport * pImport );
546
};
547
548
class ButtonElement
549
    : public ControlElement
550
{
551
public:
552
    virtual css::uno::Reference< css::xml::input::XElement >
553
    SAL_CALL startChildElement(
554
        sal_Int32 nUid, OUString const & rLocalName,
555
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
556
    virtual void SAL_CALL endElement() override;
557
558
    ButtonElement(
559
        OUString const & rLocalName,
560
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
561
        ElementBase * pParent, DialogImport * pImport )
562
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
563
0
        {}
564
};
565
566
class CheckBoxElement
567
    : public ControlElement
568
{
569
public:
570
    virtual css::uno::Reference< css::xml::input::XElement >
571
    SAL_CALL startChildElement(
572
        sal_Int32 nUid, OUString const & rLocalName,
573
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
574
    virtual void SAL_CALL endElement() override;
575
576
    CheckBoxElement(
577
        OUString const & rLocalName,
578
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
579
        ElementBase * pParent, DialogImport * pImport )
580
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
581
0
        {}
582
};
583
584
class ComboBoxElement
585
    : public ControlElement
586
{
587
    rtl::Reference< MenuPopupElement > _popup;
588
public:
589
    virtual css::uno::Reference< css::xml::input::XElement >
590
    SAL_CALL startChildElement(
591
        sal_Int32 nUid, OUString const & rLocalName,
592
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
593
    virtual void SAL_CALL endElement() override;
594
595
    ComboBoxElement(
596
        OUString const & rLocalName,
597
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
598
        ElementBase * pParent, DialogImport * pImport )
599
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
600
0
        {}
601
};
602
603
class MenuListElement
604
    : public ControlElement
605
{
606
    rtl::Reference< MenuPopupElement > _popup;
607
public:
608
    virtual css::uno::Reference< css::xml::input::XElement >
609
    SAL_CALL startChildElement(
610
        sal_Int32 nUid, OUString const & rLocalName,
611
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
612
    virtual void SAL_CALL endElement() override;
613
614
    MenuListElement(
615
        OUString const & rLocalName,
616
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
617
        ElementBase * pParent, DialogImport * pImport )
618
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
619
0
        {}
620
};
621
622
class RadioElement
623
    : public ControlElement
624
{
625
public:
626
    virtual css::uno::Reference< css::xml::input::XElement >
627
    SAL_CALL startChildElement(
628
        sal_Int32 nUid, OUString const & rLocalName,
629
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
630
631
    RadioElement(
632
        OUString const & rLocalName,
633
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
634
        ElementBase * pParent, DialogImport * pImport )
635
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
636
0
        {}
637
};
638
639
class RadioGroupElement
640
    : public ControlElement
641
{
642
    std::vector< css::uno::Reference< css::xml::input::XElement > > _radios;
643
public:
644
    virtual css::uno::Reference< css::xml::input::XElement >
645
    SAL_CALL startChildElement(
646
        sal_Int32 nUid, OUString const & rLocalName,
647
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
648
    void SAL_CALL endElement() override;
649
650
    RadioGroupElement(
651
        OUString const & rLocalName,
652
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
653
        ElementBase * pParent, DialogImport * pImport )
654
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
655
0
        {}
656
};
657
658
class TitledBoxElement
659
    : public BulletinBoardElement
660
{
661
    OUString _label;
662
    std::vector< css::uno::Reference< css::xml::input::XElement > > _radios;
663
public:
664
    virtual css::uno::Reference< css::xml::input::XElement >
665
    SAL_CALL startChildElement(
666
        sal_Int32 nUid, OUString const & rLocalName,
667
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
668
    virtual void SAL_CALL endElement() override;
669
670
    TitledBoxElement(
671
        OUString const & rLocalName,
672
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
673
        ElementBase * pParent, DialogImport * pImport )
674
0
        : BulletinBoardElement( rLocalName, xAttributes, pParent, pImport )
675
0
        {}
676
};
677
678
class TextElement
679
    : public ControlElement
680
{
681
public:
682
    virtual css::uno::Reference< css::xml::input::XElement >
683
    SAL_CALL startChildElement(
684
        sal_Int32 nUid, OUString const & rLocalName,
685
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
686
    virtual void SAL_CALL endElement() override;
687
688
    TextElement(
689
        OUString const & rLocalName,
690
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
691
        ElementBase * pParent, DialogImport * pImport )
692
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
693
0
        {}
694
};
695
class FixedHyperLinkElement
696
    : public ControlElement
697
{
698
public:
699
    virtual css::uno::Reference< css::xml::input::XElement >
700
    SAL_CALL startChildElement(
701
        sal_Int32 nUid, OUString const & rLocalName,
702
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
703
    virtual void SAL_CALL endElement() override;
704
705
    FixedHyperLinkElement(
706
        OUString const & rLocalName,
707
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
708
        ElementBase * pParent, DialogImport * pImport )
709
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
710
0
        {}
711
};
712
713
class TextFieldElement
714
    : public ControlElement
715
{
716
public:
717
    virtual css::uno::Reference< css::xml::input::XElement >
718
    SAL_CALL startChildElement(
719
        sal_Int32 nUid, OUString const & rLocalName,
720
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
721
    virtual void SAL_CALL endElement() override;
722
723
    TextFieldElement(
724
        OUString const & rLocalName,
725
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
726
        ElementBase * pParent, DialogImport * pImport )
727
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
728
0
        {}
729
};
730
731
class ImageControlElement
732
    : public ControlElement
733
{
734
public:
735
    virtual css::uno::Reference< css::xml::input::XElement >
736
    SAL_CALL startChildElement(
737
        sal_Int32 nUid, OUString const & rLocalName,
738
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
739
    virtual void SAL_CALL endElement() override;
740
741
    ImageControlElement(
742
        OUString const & rLocalName,
743
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
744
        ElementBase * pParent, DialogImport * pImport )
745
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
746
0
        {}
747
};
748
749
class FileControlElement
750
    : public ControlElement
751
{
752
public:
753
    virtual css::uno::Reference< css::xml::input::XElement >
754
    SAL_CALL startChildElement(
755
        sal_Int32 nUid, OUString const & rLocalName,
756
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
757
    virtual void SAL_CALL endElement() override;
758
759
    FileControlElement(
760
        OUString const & rLocalName,
761
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
762
        ElementBase * pParent, DialogImport * pImport )
763
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
764
0
        {}
765
};
766
767
class TreeControlElement
768
    : public ControlElement
769
{
770
public:
771
    virtual css::uno::Reference< css::xml::input::XElement >
772
    SAL_CALL startChildElement(
773
        sal_Int32 nUid, OUString const & rLocalName,
774
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
775
    virtual void SAL_CALL endElement() override;
776
777
    TreeControlElement(
778
        OUString const & rLocalName,
779
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
780
        ElementBase * pParent, DialogImport * pImport )
781
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
782
0
        {}
783
};
784
785
class CurrencyFieldElement
786
    : public ControlElement
787
{
788
public:
789
    virtual css::uno::Reference< css::xml::input::XElement >
790
    SAL_CALL startChildElement(
791
        sal_Int32 nUid, OUString const & rLocalName,
792
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
793
    virtual void SAL_CALL endElement() override;
794
795
    CurrencyFieldElement(
796
        OUString const & rLocalName,
797
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
798
        ElementBase * pParent, DialogImport * pImport )
799
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
800
0
        {}
801
};
802
803
class DateFieldElement
804
    : public ControlElement
805
{
806
public:
807
    virtual css::uno::Reference< css::xml::input::XElement >
808
    SAL_CALL startChildElement(
809
        sal_Int32 nUid, OUString const & rLocalName,
810
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
811
    virtual void SAL_CALL endElement() override;
812
813
    DateFieldElement(
814
        OUString const & rLocalName,
815
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
816
        ElementBase * pParent, DialogImport * pImport )
817
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
818
0
        {}
819
};
820
821
class NumericFieldElement
822
    : public ControlElement
823
{
824
public:
825
    virtual css::uno::Reference< css::xml::input::XElement >
826
    SAL_CALL startChildElement(
827
        sal_Int32 nUid, OUString const & rLocalName,
828
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
829
    virtual void SAL_CALL endElement() override;
830
831
    NumericFieldElement(
832
        OUString const & rLocalName,
833
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
834
        ElementBase * pParent, DialogImport * pImport )
835
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
836
0
        {}
837
};
838
839
class TimeFieldElement
840
    : public ControlElement
841
{
842
public:
843
    virtual css::uno::Reference< css::xml::input::XElement >
844
    SAL_CALL startChildElement(
845
        sal_Int32 nUid, OUString const & rLocalName,
846
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
847
    virtual void SAL_CALL endElement() override;
848
849
    TimeFieldElement(
850
        OUString const & rLocalName,
851
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
852
        ElementBase * pParent, DialogImport * pImport )
853
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
854
0
        {}
855
};
856
857
class PatternFieldElement
858
    : public ControlElement
859
{
860
public:
861
    virtual css::uno::Reference< css::xml::input::XElement >
862
    SAL_CALL startChildElement(
863
        sal_Int32 nUid, OUString const & rLocalName,
864
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
865
    virtual void SAL_CALL endElement() override;
866
867
    PatternFieldElement(
868
        OUString const & rLocalName,
869
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
870
        ElementBase * pParent, DialogImport * pImport )
871
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
872
0
        {}
873
};
874
875
class FormattedFieldElement
876
    : public ControlElement
877
{
878
public:
879
    virtual css::uno::Reference< css::xml::input::XElement >
880
    SAL_CALL startChildElement(
881
        sal_Int32 nUid, OUString const & rLocalName,
882
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
883
    virtual void SAL_CALL endElement() override;
884
885
    FormattedFieldElement(
886
        OUString const & rLocalName,
887
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
888
        ElementBase * pParent, DialogImport * pImport )
889
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
890
0
        {}
891
};
892
893
class FixedLineElement
894
    : public ControlElement
895
{
896
public:
897
    virtual css::uno::Reference< css::xml::input::XElement >
898
    SAL_CALL startChildElement(
899
        sal_Int32 nUid, OUString const & rLocalName,
900
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
901
    virtual void SAL_CALL endElement() override;
902
903
    FixedLineElement(
904
        OUString const & rLocalName,
905
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
906
        ElementBase * pParent, DialogImport * pImport )
907
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
908
0
        {}
909
};
910
911
class ScrollBarElement
912
    : public ControlElement
913
{
914
public:
915
    virtual css::uno::Reference< css::xml::input::XElement >
916
    SAL_CALL startChildElement(
917
        sal_Int32 nUid, OUString const & rLocalName,
918
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
919
    virtual void SAL_CALL endElement() override;
920
921
    ScrollBarElement(
922
        OUString const & rLocalName,
923
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
924
        ElementBase * pParent, DialogImport * pImport )
925
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
926
0
        {}
927
};
928
929
class SpinButtonElement
930
    : public ControlElement
931
{
932
public:
933
    virtual css::uno::Reference< css::xml::input::XElement >
934
    SAL_CALL startChildElement(
935
        sal_Int32 nUid, OUString const & rLocalName,
936
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
937
    virtual void SAL_CALL endElement() override;
938
939
    SpinButtonElement(
940
        OUString const & rLocalName,
941
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
942
        ElementBase * pParent, DialogImport * pImport )
943
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
944
0
        {}
945
};
946
947
class MultiPage
948
    : public ControlElement
949
{
950
public:
951
    virtual css::uno::Reference< css::xml::input::XElement >
952
    SAL_CALL startChildElement(
953
        sal_Int32 nUid, OUString const & rLocalName,
954
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
955
    virtual void SAL_CALL endElement() override;
956
957
    MultiPage(
958
        OUString const & rLocalName,
959
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
960
        ElementBase * pParent, DialogImport * pImport )
961
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
962
0
        {
963
0
            m_xContainer.set( m_pImport->_xDialogModelFactory->createInstance( u"com.sun.star.awt.UnoMultiPageModel"_ustr ), css::uno::UNO_QUERY );
964
0
        }
965
private:
966
    css::uno::Reference< css::container::XNameContainer > m_xContainer;
967
};
968
969
class Frame
970
    : public ControlElement
971
{
972
    OUString _label;
973
public:
974
    virtual css::uno::Reference< css::xml::input::XElement >
975
    SAL_CALL startChildElement(
976
        sal_Int32 nUid, OUString const & rLocalName,
977
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
978
    virtual void SAL_CALL endElement() override;
979
980
    Frame(
981
        OUString const & rLocalName,
982
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
983
        ElementBase * pParent, DialogImport * pImport )
984
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
985
0
        {}
986
private:
987
    css::uno::Reference< css::container::XNameContainer > m_xContainer;
988
};
989
990
class Page
991
    : public ControlElement
992
{
993
public:
994
    virtual css::uno::Reference< css::xml::input::XElement >
995
    SAL_CALL startChildElement(
996
        sal_Int32 nUid, OUString const & rLocalName,
997
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
998
    virtual void SAL_CALL endElement() override;
999
1000
    Page(
1001
        OUString const & rLocalName,
1002
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
1003
        ElementBase * pParent, DialogImport * pImport )
1004
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
1005
0
        {
1006
0
            m_xContainer.set( m_pImport->_xDialogModelFactory->createInstance( u"com.sun.star.awt.UnoPageModel"_ustr ), css::uno::UNO_QUERY );
1007
0
        }
1008
private:
1009
    css::uno::Reference< css::container::XNameContainer > m_xContainer;
1010
};
1011
1012
class ProgressBarElement
1013
    : public ControlElement
1014
{
1015
public:
1016
    virtual css::uno::Reference< css::xml::input::XElement >
1017
    SAL_CALL startChildElement(
1018
        sal_Int32 nUid, OUString const & rLocalName,
1019
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
1020
    virtual void SAL_CALL endElement() override;
1021
1022
    ProgressBarElement(
1023
        OUString const & rLocalName,
1024
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
1025
        ElementBase * pParent, DialogImport * pImport )
1026
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
1027
0
        {}
1028
};
1029
1030
//==============================================================================
1031
class GridControlElement
1032
    : public ControlElement
1033
{
1034
public:
1035
    virtual css::uno::Reference< css::xml::input::XElement >
1036
    SAL_CALL startChildElement(
1037
        sal_Int32 nUid,::rtl::OUString const & rLocalName,
1038
        css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) override;
1039
    virtual void SAL_CALL endElement() override;
1040
1041
    GridControlElement(OUString const & rLocalName,
1042
        css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
1043
        ElementBase * pParent, DialogImport * pImport )
1044
0
        : ControlElement( rLocalName, xAttributes, pParent, pImport )
1045
0
        {}
1046
};
1047
1048
}
1049
1050
1051
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */