LibreOffice Module sw (master) 1
vbaformfieldtextinput.cxx
Go to the documentation of this file.
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
10#include <ooo/vba/word/WdTextFormFieldType.hpp>
11
12#include <sal/log.hxx>
13
15
16using namespace ::ooo::vba;
17using namespace ::com::sun::star;
18
27 const uno::Reference<ooo::vba::XHelperInterface>& rParent,
28 const uno::Reference<uno::XComponentContext>& rContext, sw::mark::IFieldmark& rFormField)
29 : SwVbaFormFieldTextInput_BASE(rParent, rContext)
30 , m_rTextInput(rFormField)
31{
32}
33
35
37
39{
42}
43
45{
46 if (!getValid())
47 return OUString();
48
49 return m_rTextInput.GetContent();
50}
51
52void SwVbaFormFieldTextInput::setDefault(const OUString& sSet)
53{
54 // Hard to know what to do here, since LO doesn't have a default property for text input.
55 // This really only makes sense when macro-adding a text input.
56 // In that case, we want it to affect the actual text content.
57 // However, if the text has already been set by the user, then this shouldn't do anything.
58 // Assuming this is only ever set when adding a text input seems the sanest approach.
59 if (!getValid() || getDefault() == sSet)
60 return;
61
62 m_rTextInput.ReplaceContent(sSet);
63}
64
66{
67 if (!getValid())
68 return OUString();
69
70 SAL_INFO("sw.vba", "SwVbaFormFieldTextInput::getFormat stub");
71 return OUString();
72}
73
75{
76 if (!getValid())
77 return word::WdTextFormFieldType::wdRegularText;
78
79 SAL_INFO("sw.vba", "SwVbaFormFieldTextInput::getType stub");
80 return word::WdTextFormFieldType::wdRegularText;
81}
82
84{
85 if (!getValid())
86 return 0;
87
88 SAL_INFO("sw.vba", "SwVbaFormFieldTextInput::getWidth stub");
89 return 11 * 50;
90}
91
93{
94 if (!getValid())
95 return;
96
97 SAL_INFO("sw.vba", "SwVbaFormFieldTextInput::setWidth[" << nWidth << "] stub");
98}
99
101{
102 if (!getValid() || m_rTextInput.GetContent().isEmpty())
103 return;
104
105 m_rTextInput.ReplaceContent("");
106}
107
108void SwVbaFormFieldTextInput::EditType(sal_Int32 nType, const uno::Any& rDefault,
109 const uno::Any& rFormat, const uno::Any& rEnabled)
110{
111 OUString sDefault;
112 OUString sFormat;
113 bool bEnabled = true;
114 rDefault >>= sDefault;
115 rFormat >>= sFormat;
116 rEnabled >>= bEnabled;
117 SAL_INFO("sw.vba", "SwVbaFormFieldTextInput::EditType["
118 << nType << "] sDefault[" << sDefault << "] sFormat[" << sFormat
119 << "] bEnabled[" << bEnabled << "] stub");
120}
121
122OUString SwVbaFormFieldTextInput::getServiceImplName() { return "SwVbaFormFieldTextInput"; }
123
125{
126 static uno::Sequence<OUString> const aServiceNames{ "ooo.vba.word.TextInput" };
127 return aServiceNames;
128}
129
130/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:502
sw::mark::IFieldmark & m_rTextInput
void SAL_CALL Clear() override
OUString getServiceImplName() override
OUString SAL_CALL getDefault() override
OUString SAL_CALL getDefaultPropertyName() override
void SAL_CALL EditType(sal_Int32 nType, const css::uno::Any &rDefault, const css::uno::Any &rFormat, const css::uno::Any &rEnabled) override
void SAL_CALL setDefault(const OUString &bSet) override
css::uno::Sequence< OUString > getServiceNames() override
void SAL_CALL setWidth(sal_Int32 nSet) override
sal_Int32 SAL_CALL getType() override
SwVbaFormFieldTextInput(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, sw::mark::IFieldmark &rFormField)
TextInput formfields are inline text objects that are only found in MS Word.
sal_Int32 SAL_CALL getWidth() override
OUString SAL_CALL getFormat() override
sal_Bool SAL_CALL getValid() override
Sequence< OUString > aServiceNames
#define SAL_INFO(area, stream)
QPRO_FUNC_TYPE nType
unsigned char sal_Bool