Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/sfx2/dinfdlg.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
#ifndef INCLUDED_SFX2_DINFDLG_HXX
20
#define INCLUDED_SFX2_DINFDLG_HXX
21
22
#include <config_options.h>
23
#include <sal/config.h>
24
#include <sfx2/dllapi.h>
25
26
#include <com/sun/star/beans/PropertyValue.hpp>
27
#include <com/sun/star/util/DateTime.hpp>
28
#include <com/sun/star/util/Duration.hpp>
29
#include <com/sun/star/document/CmisProperty.hpp>
30
31
#include <svl/numformat.hxx>
32
#include <svl/stritem.hxx>
33
#include <svtools/ctrlbox.hxx>
34
35
#include <vcl/idle.hxx>
36
#include <vcl/weld/Builder.hxx>
37
#include <vcl/weld/Entry.hxx>
38
#include <vcl/weld/FormattedSpinButton.hxx>
39
#include <vcl/weld/ScrolledWindow.hxx>
40
#include <vcl/weld/SpinButton.hxx>
41
#include <vcl/weld/weldutils.hxx>
42
43
#include <sfx2/tabdlg.hxx>
44
45
#include <optional>
46
#include <memory>
47
#include <vcl/abstdlg.hxx>
48
49
namespace com::sun::star {
50
    namespace document {
51
        class XDocumentProperties;
52
    }
53
}
54
namespace weld { class TextView; }
55
56
struct CustomProperty;
57
58
// class SfxDocumentInfoItem ---------------------------------------------
59
60
class UNLESS_MERGELIBS(SFX2_DLLPUBLIC) SfxDocumentInfoItem final : public SfxStringItem
61
{
62
private:
63
    sal_Int32                    m_AutoloadDelay;
64
    OUString                     m_AutoloadURL;
65
    bool                         m_isAutoloadEnabled;
66
    OUString                     m_DefaultTarget;
67
    OUString                     m_TemplateName;
68
    OUString                     m_Author;
69
    css::util::DateTime          m_CreationDate;
70
    OUString                     m_ModifiedBy;
71
    css::util::DateTime          m_ModificationDate;
72
    OUString                     m_PrintedBy;
73
    css::util::DateTime          m_PrintDate;
74
    sal_Int16                    m_EditingCycles;
75
    sal_Int32                    m_EditingDuration;
76
    OUString                     m_Description;
77
    OUString                     m_Keywords;
78
    OUString                     m_Contributor;
79
    OUString                     m_Coverage;
80
    OUString                     m_Identifier;
81
    OUString                     m_Publisher;
82
    OUString                     m_Relation;
83
    OUString                     m_Rights;
84
    OUString                     m_Source;
85
    OUString                     m_Type;
86
    OUString                     m_Subject;
87
    OUString                     m_Title;
88
    sal_Int64                    m_nFileSize;
89
    bool                         m_bHasTemplate;
90
    bool                         m_bDeleteUserData;
91
    bool                         m_bUseUserData;
92
    bool                         m_bUseThumbnailSave;
93
    std::vector< std::unique_ptr<CustomProperty> >    m_aCustomProperties;
94
    css::uno::Sequence< css::document::CmisProperty > m_aCmisProperties;
95
96
public:
97
    static SfxPoolItem* CreateDefault();
98
    DECLARE_ITEM_TYPE_FUNCTION(SfxDocumentInfoItem)
99
    SfxDocumentInfoItem();
100
    SfxDocumentInfoItem( const OUString &rFileName,
101
        const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps,
102
        const css::uno::Sequence< css::document::CmisProperty> & i_cmisProps,
103
        bool bUseUserData, bool bUseThumbnailSave, sal_Int64 nFileSize );
104
    SfxDocumentInfoItem( const SfxDocumentInfoItem& );
105
    virtual ~SfxDocumentInfoItem() override;
106
107
    /// update i_xDocProps with the data in this object
108
    void UpdateDocumentInfo(
109
        const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps,
110
        bool i_bDoNotUpdateUserDefined = false)
111
        const;
112
0
    bool        isCmisDocument() const { return m_aCmisProperties.hasElements();}
113
114
0
    bool        isAutoloadEnabled() const { return m_isAutoloadEnabled; }
115
0
    sal_Int32   getAutoloadDelay() const { return m_AutoloadDelay; }
116
0
    const OUString& getAutoloadURL() const { return m_AutoloadURL; }
117
0
    const OUString& getDefaultTarget() const { return m_DefaultTarget; }
118
0
    const OUString& getTemplateName() const { return m_TemplateName; }
119
0
    const OUString& getAuthor() const { return m_Author; }
120
121
    const css::util::DateTime&
122
0
                getCreationDate() const { return m_CreationDate; }
123
0
    const OUString& getModifiedBy() const { return m_ModifiedBy; }
124
125
    const css::util::DateTime&
126
0
                getModificationDate() const { return m_ModificationDate; }
127
0
    const OUString& getPrintedBy() const { return m_PrintedBy; }
128
    const css::util::DateTime&
129
0
                getPrintDate() const { return m_PrintDate; }
130
0
    sal_Int16   getEditingCycles() const { return m_EditingCycles; }
131
0
    sal_Int32   getEditingDuration() const { return m_EditingDuration; }
132
0
    const OUString& getDescription() const { return m_Description; }
133
0
    void        setDescription(const OUString& i_val) { m_Description = i_val; }
134
0
    const OUString& getKeywords() const { return m_Keywords; }
135
0
    void        setKeywords(const OUString& i_val) { m_Keywords = i_val; }
136
0
    const OUString& getContributor() const { return m_Contributor; }
137
0
    void        setContributor(const OUString& i_val) { m_Contributor = i_val; }
138
0
    const OUString& getCoverage() const { return m_Coverage; }
139
0
    void        setCoverage(const OUString& i_val) { m_Coverage = i_val; }
140
0
    const OUString& getIdentifier() const { return m_Identifier; }
141
0
    void        setIdentifier(const OUString& i_val) { m_Identifier = i_val; }
142
0
    const OUString& getPublisher() const { return m_Publisher; }
143
0
    void        setPublisher(const OUString& i_val) { m_Publisher = i_val; }
144
0
    const OUString& getRelation() const { return m_Relation; }
145
0
    void        setRelation(const OUString& i_val) { m_Relation = i_val; }
146
0
    const OUString& getRights() const { return m_Rights; }
147
0
    void        setRights(const OUString& i_val) { m_Rights = i_val; }
148
0
    const OUString& getSource() const { return m_Source; }
149
0
    void        setSource(const OUString& i_val) { m_Source = i_val; }
150
0
    const OUString& getType() const { return m_Type; }
151
0
    void        setType(const OUString& i_val) { m_Type = i_val; }
152
0
    const OUString& getSubject() const { return m_Subject; }
153
0
    void        setSubject(const OUString& i_val) { m_Subject = i_val; }
154
0
    const OUString& getTitle() const { return m_Title; }
155
0
    void        setTitle(const OUString& i_val) { m_Title = i_val; }
156
0
    sal_Int64   getFileSize() const { return m_nFileSize; }
157
158
    /// reset user-specific data (author, modified-by, ...)
159
    void        resetUserData(const OUString & i_rAuthor);
160
161
0
    void        SetTemplate( bool b ) { m_bHasTemplate = b; }
162
0
    bool        HasTemplate() const { return m_bHasTemplate; }
163
    void        SetDeleteUserData( bool bSet );
164
    void        SetUseUserData( bool bSet );
165
    void        SetUseThumbnailSave( bool bSet );
166
0
    bool        IsUseUserData() const { return m_bUseUserData;}
167
0
    bool        IsUseThumbnailSave() const { return m_bUseThumbnailSave;}
168
169
170
    std::vector< std::unique_ptr<CustomProperty> > GetCustomProperties() const;
171
    void        ClearCustomProperties();
172
    void        AddCustomProperty(  const OUString& sName,
173
                                    const css::uno::Any& rValue );
174
175
    const css::uno::Sequence< css::document::CmisProperty >&
176
0
                        GetCmisProperties() const { return m_aCmisProperties;}
177
178
    void        SetCmisProperties(const css::uno::Sequence< css::document::CmisProperty >& cmisProps );
179
    virtual SfxDocumentInfoItem* Clone( SfxItemPool* pPool = nullptr ) const override;
180
    virtual bool        operator==( const SfxPoolItem& ) const override;
181
    // Marked as false since the SfxStringItem superclass supports hashing, but
182
    // this class has not been checked for safety under hashing yet.
183
0
    virtual bool        supportsHashCode() const override { return false; }
184
    virtual bool        QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
185
    virtual bool        PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
186
};
187
188
// class SfxDocumentPage -------------------------------------------------
189
190
class SfxDocumentPage final : public SfxTabPage
191
{
192
private:
193
    OUString                    m_aUnknownSize;
194
    OUString                    m_aMultiSignedStr;
195
    OUString                    m_sFileURL;
196
197
    bool                        bEnableUseUserData  : 1,
198
                                bHandleDelete       : 1;
199
200
    std::unique_ptr<weld::Image> m_xBmp;
201
    std::unique_ptr<weld::Label> m_xNameED;
202
    std::unique_ptr<weld::Button> m_xChangePassBtn;
203
204
    std::unique_ptr<weld::Label> m_xShowTypeFT;
205
    std::unique_ptr<weld::Label> m_xFileValEd;
206
    std::unique_ptr<weld::Button> m_xFileValBtn;
207
    std::unique_ptr<weld::Label> m_xShowSizeFT;
208
209
    std::unique_ptr<weld::Label> m_xCreateValFt;
210
    std::unique_ptr<weld::Label> m_xChangeValFt;
211
    std::unique_ptr<weld::Label> m_xSignedValFt;
212
    std::unique_ptr<weld::Button> m_xSignatureBtn;
213
    std::unique_ptr<weld::Label> m_xPrintValFt;
214
    std::unique_ptr<weld::Label> m_xTimeLogValFt;
215
    std::unique_ptr<weld::Label> m_xDocNoValFt;
216
217
    std::unique_ptr<weld::CheckButton> m_xUseUserDataCB;
218
    std::unique_ptr<weld::Button> m_xDeleteBtn;
219
    std::unique_ptr<weld::CheckButton> m_xUseThumbnailSaveCB;
220
221
    std::unique_ptr<weld::Label> m_xTemplFt;
222
    std::unique_ptr<weld::Label> m_xTemplValFt;
223
    std::unique_ptr<weld::CheckButton> m_xImagePreferredDpiCheckButton;
224
    std::unique_ptr<weld::ComboBox> m_xImagePreferredDpiComboBox;
225
226
    DECL_LINK(FileValHdl, weld::Button&, void);
227
    DECL_LINK(DeleteHdl, weld::Button&, void);
228
    DECL_LINK(SignatureHdl, weld::Button&, void);
229
    DECL_LINK(ChangePassHdl, weld::Button&, void);
230
    DECL_LINK(ImagePreferredDPICheckBoxClicked, weld::Toggleable&, void);
231
232
    void                ImplUpdateSignatures();
233
    void                ImplCheckPasswordState();
234
235
    virtual bool        FillItemSet( SfxItemSet* ) override;
236
    virtual void        Reset( const SfxItemSet* ) override;
237
    VclPtr<AbstractPasswordToOpenModifyDialog> m_xPasswordDialog;
238
239
public:
240
    SfxDocumentPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
241
    static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
242
    virtual ~SfxDocumentPage() override;
243
244
    void                EnableUseUserData();
245
};
246
247
// class SfxDocumentDescPage ---------------------------------------------
248
249
class SfxDocumentDescPage final : public SfxTabPage
250
{
251
private:
252
    SfxDocumentInfoItem* m_pInfoItem;
253
    std::unique_ptr<weld::Entry> m_xTitleEd;
254
    std::unique_ptr<weld::Entry> m_xThemaEd;
255
    std::unique_ptr<weld::Entry> m_xKeywordsEd;
256
    std::unique_ptr<weld::Entry> m_xContributorEd;
257
    std::unique_ptr<weld::Entry> m_xCoverageEd;
258
    std::unique_ptr<weld::Entry> m_xIdentifierEd;
259
    std::unique_ptr<weld::Entry> m_xPublisherEd;
260
    std::unique_ptr<weld::Entry> m_xRelationEd;
261
    std::unique_ptr<weld::Entry> m_xRightsEd;
262
    std::unique_ptr<weld::Entry> m_xSourceEd;
263
    std::unique_ptr<weld::Entry> m_xTypeEd;
264
    std::unique_ptr<weld::TextView> m_xCommentEd;
265
266
    virtual bool            FillItemSet( SfxItemSet* ) override;
267
    virtual void            Reset( const SfxItemSet* ) override;
268
269
public:
270
    SfxDocumentDescPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
271
    virtual ~SfxDocumentDescPage() override;
272
    static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
273
};
274
275
// class SfxDocumentInfoDialog -------------------------------------------
276
277
class SFX2_DLLPUBLIC SfxDocumentInfoDialog final : public SfxTabDialogController
278
{
279
    virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override;
280
281
public:
282
    SfxDocumentInfoDialog(weld::Window* pParent, const SfxItemSet&);
283
    void AddFontTabPage();
284
};
285
286
class CustomPropertiesDateField
287
{
288
private:
289
    std::unique_ptr<SvtCalendarBox> m_xDateField;
290
public:
291
    ::std::optional<sal_Int16> m_TZ;
292
293
    CustomPropertiesDateField(SvtCalendarBox* pDateField);
294
    void set_visible(bool bVisible);
295
    Date get_date() const;
296
    void set_date(const Date& rDate);
297
    ~CustomPropertiesDateField();
298
};
299
300
class CustomPropertiesTimeField
301
{
302
public:
303
    std::unique_ptr<weld::FormattedSpinButton> m_xTimeField;
304
    std::unique_ptr<weld::TimeFormatter> m_xFormatter;
305
    bool m_isUTC;
306
307
    CustomPropertiesTimeField(std::unique_ptr<weld::FormattedSpinButton> xTimeField);
308
0
    void set_visible(bool bVisible) { m_xTimeField->set_visible(bVisible); }
309
    tools::Time get_value() const;
310
    void set_value(const tools::Time& rTime);
311
312
    ~CustomPropertiesTimeField();
313
};
314
315
class DurationDialog_Impl final : public weld::GenericDialogController
316
{
317
    std::unique_ptr<weld::CheckButton> m_xNegativeCB;
318
    std::unique_ptr<weld::SpinButton> m_xYearNF;
319
    std::unique_ptr<weld::SpinButton> m_xMonthNF;
320
    std::unique_ptr<weld::SpinButton> m_xDayNF;
321
    std::unique_ptr<weld::SpinButton> m_xHourNF;
322
    std::unique_ptr<weld::SpinButton> m_xMinuteNF;
323
    std::unique_ptr<weld::SpinButton> m_xSecondNF;
324
    std::unique_ptr<weld::SpinButton> m_xMSecondNF;
325
326
public:
327
    DurationDialog_Impl(weld::Widget* pParent, const css::util::Duration& rDuration);
328
    css::util::Duration  GetDuration() const;
329
};
330
331
class CustomPropertiesDurationField
332
{
333
    css::util::Duration             m_aDuration;
334
    std::unique_ptr<weld::Entry>    m_xEntry;
335
    std::unique_ptr<weld::Button>   m_xEditButton;
336
    std::shared_ptr<DurationDialog_Impl> m_xDurationDialog;
337
338
    DECL_LINK(ClickHdl, weld::Button&, void);
339
public:
340
    CustomPropertiesDurationField(std::unique_ptr<weld::Entry> xEntry,
341
                                  std::unique_ptr<weld::Button> xEditButton);
342
343
    void SetDuration( const css::util::Duration& rDuration );
344
0
    const css::util::Duration& GetDuration() const { return m_aDuration; }
345
346
    void set_visible(bool bVisible);
347
348
    ~CustomPropertiesDurationField();
349
};
350
351
class CustomPropertiesYesNoButton
352
{
353
private:
354
    std::unique_ptr<weld::Widget> m_xTopLevel;
355
    std::unique_ptr<weld::RadioButton> m_xYesButton;
356
    std::unique_ptr<weld::RadioButton> m_xNoButton;
357
358
public:
359
    CustomPropertiesYesNoButton(std::unique_ptr<weld::Widget>,
360
                                std::unique_ptr<weld::RadioButton> xYesButton,
361
                                std::unique_ptr<weld::RadioButton> xNoButton);
362
    ~CustomPropertiesYesNoButton();
363
364
0
    void     CheckYes() { m_xYesButton->set_active(true); }
365
0
    void     CheckNo() { m_xNoButton->set_active(true); }
366
0
    bool     IsYesChecked() const { return m_xYesButton->get_active(); }
367
0
    void     set_visible(bool bVisible) { m_xTopLevel->set_visible(bVisible); }
368
};
369
370
class CustomPropertiesWindow;
371
372
// struct CustomPropertyLine ---------------------------------------------
373
struct CustomPropertyLine
374
{
375
    CustomPropertiesWindow* m_pParent;
376
377
    std::unique_ptr<weld::Builder> m_xBuilder;
378
    std::unique_ptr<weld::Container> m_xLine;
379
    std::unique_ptr<weld::ComboBox> m_xNameBox;
380
    std::unique_ptr<weld::ComboBox> m_xTypeBox;
381
    std::unique_ptr<weld::Entry> m_xValueEdit;
382
    std::unique_ptr<weld::Widget> m_xDateTimeBox;
383
    std::unique_ptr<CustomPropertiesDateField> m_xDateField;
384
    std::unique_ptr<CustomPropertiesTimeField> m_xTimeField;
385
    std::unique_ptr<weld::Widget> m_xDurationBox;
386
    std::unique_ptr<CustomPropertiesDurationField> m_xDurationField;
387
    std::unique_ptr<CustomPropertiesYesNoButton> m_xYesNoButton;
388
    std::unique_ptr<weld::Button> m_xRemoveButton;
389
390
    bool m_bTypeLostFocus;
391
392
    CustomPropertyLine(CustomPropertiesWindow* pParent, weld::Widget* pContainer);
393
    DECL_LINK(TypeHdl, weld::ComboBox&, void);
394
    DECL_LINK(RemoveHdl, weld::Button&, void);
395
    DECL_LINK(EditLoseFocusHdl, weld::Widget&, void);
396
    DECL_LINK(BoxLoseFocusHdl, weld::Widget&, void);
397
398
    void DoTypeHdl(const weld::ComboBox& rBox);
399
400
    void Clear();
401
    void Hide();
402
};
403
404
// class CustomPropertiesWindow ------------------------------------------
405
406
class CustomPropertiesWindow
407
{
408
private:
409
    sal_Int32                           m_nHeight;
410
    sal_Int32                           m_nLineHeight;
411
    sal_Int32                           m_nScrollPos;
412
    std::vector<std::unique_ptr<CustomProperty>> m_aCustomProperties;
413
    std::vector<std::unique_ptr<CustomPropertyLine>> m_aCustomPropertiesLines;
414
    CustomPropertyLine*                 m_pCurrentLine;
415
    SvNumberFormatter                   m_aNumberFormatter;
416
    Idle                                m_aEditLoseFocusIdle;
417
    Idle                                m_aBoxLoseFocusIdle;
418
    Link<void*,void>                    m_aRemovedHdl;
419
420
    weld::Container& m_rBody;
421
    weld::Label& m_rHeaderAccName;
422
    weld::Label& m_rHeaderAccType;
423
    weld::Label& m_rHeaderAccValue;
424
425
    DECL_LINK(EditTimeoutHdl, Timer *, void);
426
    DECL_LINK(BoxTimeoutHdl, Timer *, void);
427
428
    bool        IsLineValid( CustomPropertyLine* pLine ) const;
429
    void        ValidateLine( CustomPropertyLine* pLine, bool bIsFromTypeBox );
430
    void        CreateNewLine();
431
    void        StoreCustomProperties();
432
0
    sal_uInt32  GetCurrentDataModelPosition() const { return -1 * m_nScrollPos / m_nLineHeight; }
433
434
public:
435
    CustomPropertiesWindow(weld::Container& rParent, weld::Label& rHeaderAccName,
436
                           weld::Label& rHeaderAccType, weld::Label& rHeaderAccValue);
437
    ~CustomPropertiesWindow();
438
439
0
    sal_uInt16          GetExistingLineCount() const { return m_aCustomPropertiesLines.size(); }
440
0
    sal_uInt16          GetTotalLineCount() const { return m_aCustomProperties.size(); }
441
    void                SetVisibleLineCount(sal_uInt32 nCount);
442
0
    sal_Int32           GetHeight() const { return m_nHeight; }
443
0
    void                SetHeight(int nHeight) { m_nHeight = nHeight; }
444
0
    sal_Int32           GetLineHeight() const { return m_nLineHeight; }
445
0
    void                SetLineHeight(sal_Int32 nLineHeight) { m_nLineHeight = nLineHeight; }
446
    void                AddLine( const OUString& sName, css::uno::Any const & rAny );
447
    bool                AreAllLinesValid() const;
448
    void                ClearAllLines();
449
    void                DoScroll( sal_Int32 nNewPos );
450
    void                ReloadLinesContent();
451
452
    css::uno::Sequence< css::beans::PropertyValue >
453
                        GetCustomProperties();
454
    void                SetCustomProperties(std::vector< std::unique_ptr<CustomProperty> >&& rProperties);
455
0
    void                SetRemovedHdl( const Link<void*,void>& rLink ) { m_aRemovedHdl = rLink; }
456
457
    void                BoxLoseFocus(CustomPropertyLine* pLine);
458
    void                EditLoseFocus(CustomPropertyLine* pLine);
459
    void                Remove(const CustomPropertyLine* pLine);
460
};
461
462
// class CustomPropertiesControl -----------------------------------------
463
464
class CustomPropertiesControl
465
{
466
private:
467
    sal_Int32               m_nThumbPos;
468
469
    std::unique_ptr<weld::Widget> m_xBox;
470
    std::unique_ptr<weld::Container> m_xBody;
471
    std::unique_ptr<weld::ScrolledWindow> m_xVertScroll;
472
    std::unique_ptr<CustomPropertiesWindow> m_xPropertiesWin;
473
    std::unique_ptr<weld::Label> m_xName;
474
    std::unique_ptr<weld::Label> m_xType;
475
    std::unique_ptr<weld::Label> m_xValue;
476
477
    DECL_LINK( ResizeHdl, const Size&, void );
478
    DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void );
479
    DECL_LINK( RemovedHdl, void*, void );
480
481
public:
482
    CustomPropertiesControl();
483
    ~CustomPropertiesControl();
484
485
    void         AddLine(css::uno::Any const & rAny);
486
487
0
    bool         AreAllLinesValid() const { return m_xPropertiesWin->AreAllLinesValid(); }
488
0
    void         ClearAllLines() { m_xPropertiesWin->ClearAllLines(); }
489
490
    css::uno::Sequence<css::beans::PropertyValue>
491
                 GetCustomProperties() const
492
0
                        { return m_xPropertiesWin->GetCustomProperties(); }
493
    void         SetCustomProperties(std::vector< std::unique_ptr<CustomProperty> >&& rProperties);
494
495
    void         Init(weld::Builder& rParent);
496
};
497
498
// class SfxCustomPropertiesPage -----------------------------------------
499
500
class SfxCustomPropertiesPage final : public SfxTabPage
501
{
502
private:
503
    DECL_LINK(AddHdl, weld::Button&, void);
504
505
    std::unique_ptr<CustomPropertiesControl> m_xPropertiesCtrl;
506
    std::unique_ptr<weld::Button> m_xAdd;
507
508
    virtual bool        FillItemSet( SfxItemSet* ) override;
509
    virtual void        Reset( const SfxItemSet* ) override;
510
    virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
511
512
public:
513
    SfxCustomPropertiesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
514
    static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
515
    virtual ~SfxCustomPropertiesPage() override;
516
};
517
518
struct CmisValue
519
{
520
    std::unique_ptr<weld::Builder> m_xBuilder;
521
    std::unique_ptr<weld::Frame>  m_xFrame;
522
    std::unique_ptr<weld::Entry> m_xValueEdit;
523
524
    CmisValue(weld::Widget* pParent, const OUString& rStr);
525
};
526
527
struct CmisDateTime
528
{
529
    std::unique_ptr<weld::Builder> m_xBuilder;
530
    std::unique_ptr<weld::Frame>  m_xFrame;
531
    std::unique_ptr<SvtCalendarBox>  m_xDateField;
532
    std::unique_ptr<weld::FormattedSpinButton> m_xTimeField;
533
    std::unique_ptr<weld::TimeFormatter> m_xFormatter;
534
535
    CmisDateTime(weld::Widget* pParent, const css::util::DateTime& rDateTime);
536
};
537
538
struct CmisYesNo
539
{
540
    std::unique_ptr<weld::Builder> m_xBuilder;
541
    std::unique_ptr<weld::Frame>  m_xFrame;
542
    std::unique_ptr<weld::RadioButton> m_xYesButton;
543
    std::unique_ptr<weld::RadioButton> m_xNoButton;
544
545
    CmisYesNo(weld::Widget* pParent, bool bValue);
546
};
547
548
// struct CmisPropertyLine ---------------------------------------------
549
550
struct CmisPropertyLine
551
{
552
    std::unique_ptr<weld::Builder> m_xBuilder;
553
    OUString                      m_sId;
554
    OUString                      m_sType;
555
    bool                          m_bUpdatable;
556
    bool                          m_bRequired;
557
    bool                          m_bMultiValued;
558
    bool                          m_bOpenChoice;
559
    std::unique_ptr<weld::Frame>  m_xFrame;
560
    std::unique_ptr<weld::Label>  m_xName;
561
    std::unique_ptr<weld::Label>  m_xType;
562
    std::vector< std::unique_ptr<CmisValue> >     m_aValues;
563
    std::vector< std::unique_ptr<CmisDateTime> >  m_aDateTimes;
564
    std::vector< std::unique_ptr<CmisYesNo> >     m_aYesNos;
565
    CmisPropertyLine(weld::Widget* pParent);
566
    ~CmisPropertyLine();
567
};
568
569
// class CmisPropertiesWindow ------------------------------------------
570
571
class CmisPropertiesWindow
572
{
573
private:
574
    std::unique_ptr<weld::Container>    m_xBox;
575
    SvNumberFormatter                   m_aNumberFormatter;
576
    std::vector< std::unique_ptr<CmisPropertyLine> > m_aCmisPropertiesLines;
577
public:
578
    CmisPropertiesWindow(std::unique_ptr<weld::Container> xParent);
579
    ~CmisPropertiesWindow();
580
581
    void AddLine( const OUString& sId, const OUString& sName,
582
                  const OUString& sType, const bool bUpdatable,
583
                  const bool bRequired, const bool bMultiValued,
584
                  const bool bOpenChoice,
585
                  css::uno::Any& aChoices,
586
                  css::uno::Any const & rAny );
587
    void ClearAllLines();
588
589
    css::uno::Sequence< css::document::CmisProperty >
590
                        GetCmisProperties() const;
591
};
592
593
// class CmisPropertiesControl -----------------------------------------
594
595
class CmisPropertiesControl
596
{
597
private:
598
    CmisPropertiesWindow m_aPropertiesWin;
599
    std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
600
601
public:
602
    CmisPropertiesControl(weld::Builder& rBuilder);
603
604
    void AddLine( const OUString& sId, const OUString& sName,
605
                  const OUString& sType, const bool bUpdatable,
606
                  const bool bRequired, const bool bMultiValude,
607
                  const bool bOpenChoice,
608
                  css::uno::Any& aChoices,
609
                  css::uno::Any const & rAny );
610
611
    void ClearAllLines();
612
    css::uno::Sequence< css::document::CmisProperty >
613
                    GetCmisProperties() const
614
0
                        { return m_aPropertiesWin.GetCmisProperties(); }
615
};
616
617
// class SfxCmisPropertiesPage -------------------------------------------------
618
619
class SfxCmisPropertiesPage final : public SfxTabPage
620
{
621
private:
622
    std::unique_ptr<CmisPropertiesControl> m_xPropertiesCtrl;
623
624
    virtual bool        FillItemSet( SfxItemSet* ) override;
625
    virtual void        Reset( const SfxItemSet* ) override;
626
    virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
627
628
public:
629
    SfxCmisPropertiesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
630
    virtual ~SfxCmisPropertiesPage() override;
631
    static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*);
632
};
633
634
#endif // #ifndef _ INCLUDED_SFX2_DINFDLG_HXX
635
636
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */