1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
11 #include <com/sun/star/text/XTextDocument.hpp>
12 #include <ooo/vba/word/XContentControl.hpp>
14 #include <vbahelper/vbahelperinterface.hxx>
16 #include <textcontentcontrol.hxx>
18 typedef InheritedHelperInterfaceWeakImpl
<ooo::vba::word::XContentControl
> SwVbaContentControl_BASE
;
20 class SwVbaContentControl
: public SwVbaContentControl_BASE
23 css::uno::Reference
<css::text::XTextDocument
> mxTextDocument
;
24 std::shared_ptr
<SwContentControl
> m_pCC
;
27 /// @throws css::uno::RuntimeException
28 SwVbaContentControl(const css::uno::Reference
<ooo::vba::XHelperInterface
>& rParent
,
29 const css::uno::Reference
<css::uno::XComponentContext
>& rContext
,
30 const css::uno::Reference
<css::text::XTextDocument
>& xTextDocument
,
31 std::shared_ptr
<SwContentControl
> pContentControl
);
32 ~SwVbaContentControl() override
;
34 // XContentControl Properties
35 sal_Bool SAL_CALL
getAllowInsertDeleteSection() override
;
36 void SAL_CALL
setAllowInsertDeleteSection(sal_Bool bSet
) override
;
38 sal_Int32 SAL_CALL
getAppearance() override
;
39 void SAL_CALL
setAppearance(sal_Int32 nSet
) override
;
41 OUString SAL_CALL
getBuildingBlockCategory() override
;
42 void SAL_CALL
setBuildingBlockCategory(const OUString
& sSet
) override
;
44 sal_Int32 SAL_CALL
getBuildingBlockType() override
;
45 void SAL_CALL
setBuildingBlockType(sal_Int32 nSet
) override
;
47 sal_Bool SAL_CALL
getChecked() override
;
48 void SAL_CALL
setChecked(sal_Bool bSet
) override
;
50 // returns or sets a WdColor (@since after 2010 I assume)
51 sal_Int32 SAL_CALL
getColor() override
;
52 void SAL_CALL
setColor(sal_Int32 nSet
) override
;
54 sal_Int32 SAL_CALL
getDateCalendarType() override
;
55 void SAL_CALL
setDateCalendarType(sal_Int32 nSet
) override
;
57 OUString SAL_CALL
getDateDisplayFormat() override
;
58 void SAL_CALL
setDateDisplayFormat(const OUString
& sSet
) override
;
60 sal_Int32 SAL_CALL
getDateDisplayLocale() override
;
62 sal_Int32 SAL_CALL
getDateStorageFormat() override
;
63 void SAL_CALL
setDateStorageFormat(sal_Int32 nSet
) override
;
65 css::uno::Any SAL_CALL
getDropdownListEntries() override
;
67 // This is an integer used as a unique identifier string
68 OUString SAL_CALL
getID() override
;
70 sal_Int32 SAL_CALL
getLevel() override
;
72 // returns or sets if the user can delete the control
73 sal_Bool SAL_CALL
getLockContentControl() override
;
74 void SAL_CALL
setLockContentControl(sal_Bool bSet
) override
;
76 // returns or sets if the user can edit the contents (i.e. read-only flag)
77 sal_Bool SAL_CALL
getLockContents() override
;
78 void SAL_CALL
setLockContents(sal_Bool bSet
) override
;
80 sal_Bool SAL_CALL
getMultiLine() override
;
81 void SAL_CALL
setMultiLine(sal_Bool bSet
) override
;
83 // WRONG- THIS SHOULD RETURN XBUILDINGBLOCK
84 OUString SAL_CALL
getPlaceholderText() override
;
86 sal_Bool SAL_CALL
getShowingPlaceholderText() override
;
88 OUString SAL_CALL
getRepeatingSectionItemTitle() override
;
89 void SAL_CALL
setRepeatingSectionItemTitle(const OUString
& rSet
) override
;
91 css::uno::Reference
<ooo::vba::word::XRange
> SAL_CALL
getRange() override
;
93 OUString SAL_CALL
getTag() override
;
94 void SAL_CALL
setTag(const OUString
& rSet
) override
;
96 // returns or sets if the control is removed after accepting user change (i.e. control -> text)
97 sal_Bool SAL_CALL
getTemporary() override
;
98 void SAL_CALL
setTemporary(sal_Bool bSet
) override
;
100 OUString SAL_CALL
getTitle() override
;
101 void SAL_CALL
setTitle(const OUString
& rSet
) override
;
103 // returns or sets a WdContentControlType that represents the type for a content control.
104 sal_Int32 SAL_CALL
getType() override
;
105 void SAL_CALL
setType(sal_Int32 nSet
) override
;
107 // XContentControl Methods
109 // Copies the content control from the active document to the Clipboard.
110 // Retrieve from the clipboard using the Paste method of the Selection object
111 // or of the Range object, or use the Paste function from within Microsoft Word.
112 void SAL_CALL
Copy() override
;
114 // Removes the control from the active document and moves it to the Clipboard.
115 void SAL_CALL
Cut() override
;
117 // Specifies whether to delete the contents of the content control. The default value is False.
118 // True removes both the content control and its contents.
119 // False removes the control but leaves the contents of the content control in the document.
120 void SAL_CALL
Delete(const css::uno::Any
& bDeleteContents
) override
;
122 // Set the Unicode character used to display the checked state.
123 void SAL_CALL
SetCheckedSymbol(sal_Int32 Character
, const css::uno::Any
& sFont
) override
;
125 // Set the Unicode character used to display the unchecked state.
126 void SAL_CALL
SetUnCheckedSymbol(sal_Int32 Character
, const css::uno::Any
& sFont
) override
;
128 // Sets the placeholder text that displays until a user enters their own text.
129 // Only one of the parameters is used when specifying placeholder text.
130 // If more than one parameter is provided, use the text specified in the first parameter.
131 // If all parameters are omitted, the placeholder text is blank.
132 void SAL_CALL
SetPlaceholderText(const css::uno::Any
& BuildingBlock
, const css::uno::Any
& Range
,
133 const css::uno::Any
& sText
) override
;
135 void SAL_CALL
Ungroup() override
;
138 OUString
getServiceImplName() override
;
139 css::uno::Sequence
<OUString
> getServiceNames() override
;
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */