LibreOffice Module sw (master) 1
vbaformfieldcheckbox.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 <sal/log.hxx>
11
13
14using namespace ::ooo::vba;
15using namespace ::com::sun::star;
16
25 const uno::Reference<ooo::vba::XHelperInterface>& rParent,
26 const uno::Reference<uno::XComponentContext>& rContext, sw::mark::IFieldmark& rFormField)
27 : SwVbaFormFieldCheckBox_BASE(rParent, rContext)
28 , m_pCheckBox(dynamic_cast<sw::mark::ICheckboxFieldmark*>(&rFormField))
29{
30}
31
33
35
37{
38 return m_pCheckBox
41}
42
44{
45 if (!getValid())
46 return false;
47
48 SAL_INFO("sw.vba", "SwVbaFormFieldCheckBox::getAutoSize stub");
49 return true;
50}
51
53{
54 if (!getValid())
55 return;
56
57 SAL_INFO("sw.vba", "SwVbaFormFieldCheckBox::setAutoSize stub");
58}
59
61{
62 if (!getValid())
63 return false;
64
65 return getValue();
66}
67
69{
70 if (!getValid())
71 return;
72
73 // Hard to know what to do here, since LO doesn't have a default property for checkboxes.
74 // Setting this really only makes sense when macro-adding a checkbox.
75 // In that case, we want it to affect the actual checkbox.
76 // However, if the checkbox has already been set by the user, then this shouldn't do anything.
77 // Assuming this is only ever called when adding a checkbox seems the sanest approach.
78 setValue(bSet);
79}
80
81// Returns the size of a check box, in points
83{
84 if (!getValid())
85 return 0;
86
87 SAL_INFO("sw.vba", "SwVbaFormFieldCheckBox::getSize stub");
88 return 11;
89}
90
92{
93 if (!getValid())
94 return;
95
96 SAL_INFO("sw.vba", "SwVbaFormFieldCheckBox::setSize[" << nSet << "] stub");
97}
98
100
102{
103 if (!getValid() || !getValue() == !bSet)
104 return;
105
106 m_pCheckBox->SetChecked(bSet);
107}
108
109OUString SwVbaFormFieldCheckBox::getServiceImplName() { return "SwVbaFormFieldCheckBox"; }
110
112{
113 static uno::Sequence<OUString> const aServiceNames{ "ooo.vba.word.CheckBox" };
114 return aServiceNames;
115}
116
117/* 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:489
sal_Bool SAL_CALL getDefault() override
SwVbaFormFieldCheckBox(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, sw::mark::IFieldmark &rFormField)
CheckBoxes are inline text objects that are only found in MS Word.
sal_Bool SAL_CALL getAutoSize() override
void SAL_CALL setAutoSize(sal_Bool bSet) override
css::uno::Sequence< OUString > getServiceNames() override
void SAL_CALL setSize(sal_Int32 nSet) override
void SAL_CALL setValue(sal_Bool bSet) override
OUString getServiceImplName() override
sw::mark::ICheckboxFieldmark * m_pCheckBox
sal_Bool SAL_CALL getValid() override
void SAL_CALL setDefault(sal_Bool bSet) override
OUString SAL_CALL getDefaultPropertyName() override
sal_Bool SAL_CALL getValue() override
sal_Int32 SAL_CALL getSize() override
virtual void SetChecked(bool checked)=0
virtual bool IsChecked() const =0
Sequence< OUString > aServiceNames
#define SAL_INFO(area, stream)
Dialog to specify the properties of date form field.
unsigned char sal_Bool