summaryrefslogtreecommitdiffstats
path: root/sw/source/ui/vba/vbacontentcontrol.hxx
blob: 9f98b92468b5014e7b11034438a842ca7d5996c9 (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
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
#pragma once

#include <com/sun/star/text/XTextDocument.hpp>
#include <ooo/vba/word/XContentControl.hpp>

#include <vbahelper/vbahelperinterface.hxx>

#include <textcontentcontrol.hxx>

typedef InheritedHelperInterfaceWeakImpl<ooo::vba::word::XContentControl> SwVbaContentControl_BASE;

class SwVbaContentControl : public SwVbaContentControl_BASE
{
private:
    css::uno::Reference<css::text::XTextDocument> mxTextDocument;
    std::shared_ptr<SwContentControl> m_pCC;

public:
    /// @throws css::uno::RuntimeException
    SwVbaContentControl(const css::uno::Reference<ooo::vba::XHelperInterface>& rParent,
                        const css::uno::Reference<css::uno::XComponentContext>& rContext,
                        const css::uno::Reference<css::text::XTextDocument>& xTextDocument,
                        std::shared_ptr<SwContentControl> pContentControl);
    ~SwVbaContentControl() override;

    // XContentControl Properties
    sal_Bool SAL_CALL getAllowInsertDeleteSection() override;
    void SAL_CALL setAllowInsertDeleteSection(sal_Bool bSet) override;

    sal_Int32 SAL_CALL getAppearance() override;
    void SAL_CALL setAppearance(sal_Int32 nSet) override;

    OUString SAL_CALL getBuildingBlockCategory() override;
    void SAL_CALL setBuildingBlockCategory(const OUString& sSet) override;

    sal_Int32 SAL_CALL getBuildingBlockType() override;
    void SAL_CALL setBuildingBlockType(sal_Int32 nSet) override;

    sal_Bool SAL_CALL getChecked() override;
    void SAL_CALL setChecked(sal_Bool bSet) override;

    // returns or sets a WdColor (@since after 2010 I assume)
    sal_Int32 SAL_CALL getColor() override;
    void SAL_CALL setColor(sal_Int32 nSet) override;

    sal_Int32 SAL_CALL getDateCalendarType() override;
    void SAL_CALL setDateCalendarType(sal_Int32 nSet) override;

    OUString SAL_CALL getDateDisplayFormat() override;
    void SAL_CALL setDateDisplayFormat(const OUString& sSet) override;

    sal_Int32 SAL_CALL getDateDisplayLocale() override;

    sal_Int32 SAL_CALL getDateStorageFormat() override;
    void SAL_CALL setDateStorageFormat(sal_Int32 nSet) override;

    css::uno::Any SAL_CALL getDropdownListEntries() override;

    // This is an integer used as a unique identifier string
    OUString SAL_CALL getID() override;

    sal_Int32 SAL_CALL getLevel() override;

    // returns or sets if the user can delete the control
    sal_Bool SAL_CALL getLockContentControl() override;
    void SAL_CALL setLockContentControl(sal_Bool bSet) override;

    // returns or sets if the user can edit the contents (i.e. read-only flag)
    sal_Bool SAL_CALL getLockContents() override;
    void SAL_CALL setLockContents(sal_Bool bSet) override;

    sal_Bool SAL_CALL getMultiLine() override;
    void SAL_CALL setMultiLine(sal_Bool bSet) override;

    // WRONG- THIS SHOULD RETURN XBUILDINGBLOCK
    OUString SAL_CALL getPlaceholderText() override;

    sal_Bool SAL_CALL getShowingPlaceholderText() override;

    OUString SAL_CALL getRepeatingSectionItemTitle() override;
    void SAL_CALL setRepeatingSectionItemTitle(const OUString& rSet) override;

    css::uno::Reference<ooo::vba::word::XRange> SAL_CALL getRange() override;

    OUString SAL_CALL getTag() override;
    void SAL_CALL setTag(const OUString& rSet) override;

    // returns or sets if the control is removed after accepting user change (i.e. control -> text)
    sal_Bool SAL_CALL getTemporary() override;
    void SAL_CALL setTemporary(sal_Bool bSet) override;

    OUString SAL_CALL getTitle() override;
    void SAL_CALL setTitle(const OUString& rSet) override;

    // returns or sets a WdContentControlType that represents the type for a content control.
    sal_Int32 SAL_CALL getType() override;
    void SAL_CALL setType(sal_Int32 nSet) override;

    // XContentControl Methods

    // Copies the content control from the active document to the Clipboard.
    // Retrieve from the clipboard using the Paste method of the Selection object
    // or of the Range object, or use the Paste function from within Microsoft Word.
    void SAL_CALL Copy() override;

    // Removes the control from the active document and moves it to the Clipboard.
    void SAL_CALL Cut() override;

    // Specifies whether to delete the contents of the content control. The default value is False.
    // True removes both the content control and its contents.
    // False removes the control but leaves the contents of the content control in the document.
    void SAL_CALL Delete(const css::uno::Any& bDeleteContents) override;

    // Set the Unicode character used to display the checked state.
    void SAL_CALL SetCheckedSymbol(sal_Int32 Character, const css::uno::Any& sFont) override;

    // Set the Unicode character used to display the unchecked state.
    void SAL_CALL SetUnCheckedSymbol(sal_Int32 Character, const css::uno::Any& sFont) override;

    // Sets the placeholder text that displays until a user enters their own text.
    // Only one of the parameters is used when specifying placeholder text.
    // If more than one parameter is provided, use the text specified in the first parameter.
    // If all parameters are omitted, the placeholder text is blank.
    void SAL_CALL SetPlaceholderText(const css::uno::Any& BuildingBlock, const css::uno::Any& Range,
                                     const css::uno::Any& sText) override;

    void SAL_CALL Ungroup() override;

    // XHelperInterface
    OUString getServiceImplName() override;
    css::uno::Sequence<OUString> getServiceNames() override;
};

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