diff options
author | Justin Luth <justin.luth@collabora.com> | 2022-11-10 10:26:50 -0500 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-11-16 09:02:17 +0100 |
commit | 383eaa656cf19f40f5b98533afb020c27ae09bc9 (patch) | |
tree | 52eb4fa78ad24b1bc8e270239fb6f47c1c635011 /sw | |
parent | d0a8c957be6dbc91cc05939468ce99947656481c (diff) |
tdf#151548: cleanup "Add basic word::XFormField support" etc.
Thanks to those who reviewed the first patch in my series.
I thought I had done so well, and yet...
-typo: 3df534a5ba01ec32590adb6c05ee6621e136b55e
-unused/std::move: 0232d4d19858f76fd63b8e525a835bd6fbcd3b8a
-const&: d9c708f78de6f6ef6621b47123a0ff164ddfee93
Kendy pointed out there are different license headers,
and new code should just use MPL. I had just copy/pasted
the header from nearby code. All the work done in these
new files was mine (composed by copy/paste as a template). Fixed.
I noticed a few stray css:: in .cxx files that I missed.
Those are unnecessary and I don't like them. Fixed
In the second round of reviews
-no need to specify virtual when override
-cleaning up ALL of them in bookmark.hxx to be internally
consistent - nothing worse than half and half in one file.
-use #pragma once for new files
-only use official documentation (but I don't like the layout
of the official documentation and didn't use it,
so the value of providing a web link seems dubious - removed.
Change-Id: I3c7aa7d647bfa91b69848258aca6d79d8e7b0edd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142556
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/bookmark.hxx | 112 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfield.cxx | 12 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfield.hxx | 76 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfieldcheckbox.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfieldcheckbox.hxx | 24 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfielddropdown.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfielddropdownlistentries.cxx | 23 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfielddropdownlistentry.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfields.cxx | 56 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfields.hxx | 31 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaformfieldtextinput.cxx | 2 |
11 files changed, 137 insertions, 206 deletions
diff --git a/sw/source/core/inc/bookmark.hxx b/sw/source/core/inc/bookmark.hxx index 075564d1b386..a349c9063b76 100644 --- a/sw/source/core/inc/bookmark.hxx +++ b/sw/source/core/inc/bookmark.hxx @@ -48,16 +48,16 @@ namespace sw::mark { { public: //getters - virtual SwPosition& GetMarkPos() const override + SwPosition& GetMarkPos() const override { return const_cast<SwPosition&>(*m_oPos1); } - virtual const OUString& GetName() const override + const OUString& GetName() const override { return m_aName; } - virtual SwPosition& GetOtherMarkPos() const override + SwPosition& GetOtherMarkPos() const override { OSL_PRECOND(IsExpanded(), "<SwPosition::GetOtherMarkPos(..)> - I have no other Pos set." ); return const_cast<SwPosition&>(*m_oPos2); } - virtual SwPosition& GetMarkStart() const override + SwPosition& GetMarkStart() const override { if( !IsExpanded() ) return GetMarkPos( ); if ( GetMarkPos( ) < GetOtherMarkPos( ) ) @@ -65,7 +65,7 @@ namespace sw::mark { else return GetOtherMarkPos( ); } - virtual SwPosition& GetMarkEnd() const override + SwPosition& GetMarkEnd() const override { if( !IsExpanded() ) return GetMarkPos(); if ( GetMarkPos( ) >= GetOtherMarkPos( ) ) @@ -74,8 +74,8 @@ namespace sw::mark { return GetOtherMarkPos( ); } - virtual bool IsCoveringPosition(const SwPosition& rPos) const override; - virtual bool IsExpanded() const override + bool IsCoveringPosition(const SwPosition& rPos) const override; + bool IsExpanded() const override { return m_oPos2.has_value(); } void SetName(const OUString& rName) @@ -87,8 +87,8 @@ namespace sw::mark { virtual auto InvalidateFrames() -> void; - virtual OUString ToString( ) const override; - virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; + OUString ToString( ) const override; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; void Swap() { @@ -100,7 +100,7 @@ namespace sw::mark { { } - virtual ~MarkBase() override; + ~MarkBase() override; const unotools::WeakReference<SwXBookmark> & GetXBookmark() const { return m_wXBookmark; } @@ -108,7 +108,7 @@ namespace sw::mark { protected: // SwClient - virtual void SwClientNotify(const SwModify&, const SfxHint&) override; + void SwClientNotify(const SwModify&, const SfxHint&) override; MarkBase(const SwPaM& rPaM, OUString aName); std::optional<SwPosition> m_oPos1; @@ -147,7 +147,7 @@ namespace sw::mark { void SetRefObject( SwServerObject* pObj ); virtual void DeregisterFromDoc(SwDoc& rDoc); - virtual ~DdeBookmark() override; + ~DdeBookmark() override; private: tools::SvRef<SwServerObject> m_aRefObj; @@ -162,33 +162,33 @@ namespace sw::mark { Bookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, const OUString& rName); - virtual void InitDoc(SwDoc& io_Doc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; + void InitDoc(SwDoc& io_Doc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; - virtual void DeregisterFromDoc(SwDoc& io_rDoc) override; + void DeregisterFromDoc(SwDoc& io_rDoc) override; - virtual auto InvalidateFrames() -> void override; + auto InvalidateFrames() -> void override; - virtual const OUString& GetShortName() const override + const OUString& GetShortName() const override { return m_sShortName; } - virtual const vcl::KeyCode& GetKeyCode() const override + const vcl::KeyCode& GetKeyCode() const override { return m_aCode; } - virtual void SetShortName(const OUString& rShortName) override + void SetShortName(const OUString& rShortName) override { m_sShortName = rShortName; } - virtual void SetKeyCode(const vcl::KeyCode& rCode) override + void SetKeyCode(const vcl::KeyCode& rCode) override { m_aCode = rCode; } - virtual bool IsHidden() const override + bool IsHidden() const override { return m_bHidden; } - virtual const OUString& GetHideCondition() const override + const OUString& GetHideCondition() const override { return m_sHideCondition; } - virtual void Hide(bool rHide) override; - virtual void SetHideCondition(const OUString& rHideCondition) override; + void Hide(bool rHide) override; + void SetHideCondition(const OUString& rHideCondition) override; // ::sfx2::Metadatable - virtual ::sfx2::IXmlIdRegistry& GetRegistry() override; - virtual bool IsInClipboard() const override; - virtual bool IsInUndo() const override; - virtual bool IsInContent() const override; - virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override; + ::sfx2::IXmlIdRegistry& GetRegistry() override; + bool IsInClipboard() const override; + bool IsInUndo() const override; + bool IsInContent() const override; + css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override; private: vcl::KeyCode m_aCode; @@ -204,29 +204,29 @@ namespace sw::mark { public: Fieldmark(const SwPaM& rPaM); - virtual OUString GetFieldname() const override + OUString GetFieldname() const override { return m_aFieldname; } - virtual OUString GetFieldHelptext() const override + OUString GetFieldHelptext() const override { return m_aFieldHelptext; } - virtual IFieldmark::parameter_map_t* GetParameters() override + IFieldmark::parameter_map_t* GetParameters() override { return &m_vParams; } - virtual const IFieldmark::parameter_map_t* GetParameters() const override + const IFieldmark::parameter_map_t* GetParameters() const override { return &m_vParams; } - virtual void SetFieldname(const OUString& aFieldname) override + void SetFieldname(const OUString& aFieldname) override { m_aFieldname = aFieldname; } - virtual void SetFieldHelptext(const OUString& aFieldHelptext) override + void SetFieldHelptext(const OUString& aFieldHelptext) override { m_aFieldHelptext = aFieldHelptext; } virtual void ReleaseDoc(SwDoc&) = 0; void SetMarkStartPos( const SwPosition& rNewStartPos ); - virtual void Invalidate() override; - virtual OUString ToString() const override; - virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; + void Invalidate() override; + OUString ToString() const override; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; private: OUString m_aFieldname; @@ -239,8 +239,8 @@ namespace sw::mark { { public: TextFieldmark(const SwPaM& rPaM, const OUString& rName); - virtual void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; - virtual void ReleaseDoc(SwDoc& rDoc) override; + void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; + void ReleaseDoc(SwDoc& rDoc) override; OUString GetContent() const override; void ReplaceContent(const OUString& sNewContent) override; @@ -255,8 +255,8 @@ namespace sw::mark { { public: NonTextFieldmark(const SwPaM& rPaM); - virtual void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; - virtual void ReleaseDoc(SwDoc& rDoc) override; + void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; + void ReleaseDoc(SwDoc& rDoc) override; }; /// Fieldmark representing a checkbox form field. @@ -268,8 +268,8 @@ namespace sw::mark { CheckboxFieldmark(const SwPaM& rPaM, const OUString& rName); bool IsChecked() const override; void SetChecked(bool checked) override; - virtual OUString GetContent() const override; - virtual void ReplaceContent(const OUString& sNewContent) override; + OUString GetContent() const override; + void ReplaceContent(const OUString& sNewContent) override; }; /// Fieldmark with a drop down button (e.g. this button opens the date picker for a date field) @@ -278,7 +278,7 @@ namespace sw::mark { { public: FieldmarkWithDropDownButton(const SwPaM& rPaM); - virtual ~FieldmarkWithDropDownButton() override; + ~FieldmarkWithDropDownButton() override; virtual void ShowButton(SwEditWin* pEditWin) = 0; virtual void RemoveButton(); @@ -295,10 +295,10 @@ namespace sw::mark { { public: DropDownFieldmark(const SwPaM& rPaM, const OUString& rName); - virtual ~DropDownFieldmark() override; + ~DropDownFieldmark() override; - virtual void ShowButton(SwEditWin* pEditWin) override; - virtual void RemoveButton() override; + void ShowButton(SwEditWin* pEditWin) override; + void RemoveButton() override; OUString GetContent(sal_Int32* pIndex) const override; OUString GetContent() const override; void AddContent(const OUString& rText, sal_Int32* pIndex = nullptr) override; @@ -327,22 +327,22 @@ namespace sw::mark { { public: DateFieldmark(const SwPaM& rPaM); - virtual ~DateFieldmark() override; + ~DateFieldmark() override; - virtual void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; - virtual void ReleaseDoc(SwDoc& rDoc) override; + void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; + void ReleaseDoc(SwDoc& rDoc) override; - virtual void ShowButton(SwEditWin* pEditWin) override; + void ShowButton(SwEditWin* pEditWin) override; void SetPortionPaintAreaStart(const SwRect& rPortionPaintArea); void SetPortionPaintAreaEnd(const SwRect& rPortionPaintArea); - virtual OUString GetContent() const override; - virtual void ReplaceContent(const OUString& sNewContent) override; + OUString GetContent() const override; + void ReplaceContent(const OUString& sNewContent) override; - virtual std::pair<bool, double> GetCurrentDate() const override; - virtual void SetCurrentDate(double fDate) override; - virtual OUString GetDateInStandardDateFormat(double fDate) const override; + std::pair<bool, double> GetCurrentDate() const override; + void SetCurrentDate(double fDate) override; + OUString GetDateInStandardDateFormat(double fDate) const override; private: OUString GetDateInCurrentDateFormat(double fDate) const; diff --git a/sw/source/ui/vba/vbaformfield.cxx b/sw/source/ui/vba/vbaformfield.cxx index f79c92913f29..8afaeb9d9480 100644 --- a/sw/source/ui/vba/vbaformfield.cxx +++ b/sw/source/ui/vba/vbaformfield.cxx @@ -5,16 +5,6 @@ * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include <ooo/vba/word/WdFieldType.hpp> @@ -209,7 +199,7 @@ OUString SwVbaFormField::getName() { return m_rFormField.GetName(); } void SwVbaFormField::setName(const OUString& rSet) { - SAL_WARN("sw.vba", "SwVbaFormField::setName[" << rSet << "] stub"); + SAL_INFO("sw.vba", "SwVbaFormField::setName[" << rSet << "] stub"); } OUString SwVbaFormField::getResult() { return m_rFormField.GetContent(); } diff --git a/sw/source/ui/vba/vbaformfield.hxx b/sw/source/ui/vba/vbaformfield.hxx index 14f44fc3c779..b004e4088cdb 100644 --- a/sw/source/ui/vba/vbaformfield.hxx +++ b/sw/source/ui/vba/vbaformfield.hxx @@ -5,19 +5,8 @@ * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_UI_VBA_VBAFORMFIELD_HXX -#define INCLUDED_SW_SOURCE_UI_VBA_VBAFORMFIELD_HXX +#pragma once #include <ooo/vba/word/XFormField.hpp> @@ -39,60 +28,59 @@ public: const css::uno::Reference<css::uno::XComponentContext>& rContext, const css::uno::Reference<css::frame::XModel>& xModel, sw::mark::IFieldmark& rFormField); - virtual ~SwVbaFormField() override; + ~SwVbaFormField() override; // XFormField Methods - virtual OUString SAL_CALL getDefaultPropertyName() override; + OUString SAL_CALL getDefaultPropertyName() override; - virtual css::uno::Any SAL_CALL CheckBox() override; - virtual css::uno::Any SAL_CALL DropDown() override; - virtual css::uno::Any SAL_CALL TextInput() override; - virtual css::uno::Any SAL_CALL Previous() override; - virtual css::uno::Any SAL_CALL Next() override; - virtual css::uno::Any SAL_CALL Range() override; + css::uno::Any SAL_CALL CheckBox() override; + css::uno::Any SAL_CALL DropDown() override; + css::uno::Any SAL_CALL TextInput() override; + css::uno::Any SAL_CALL Previous() override; + css::uno::Any SAL_CALL Next() override; + css::uno::Any SAL_CALL Range() override; // Indicates which of the three form fields this is: oovbaapi/ooo/vba/word/WdFieldType.idl - virtual sal_Int32 SAL_CALL getType() override; + sal_Int32 SAL_CALL getType() override; // True if references to the specified form field // are automatically updated whenever the field is exited - virtual sal_Bool SAL_CALL getCalculateOnExit() override; - virtual void SAL_CALL setCalculateOnExit(sal_Bool bSet) override; - virtual sal_Bool SAL_CALL getEnabled() override; - virtual void SAL_CALL setEnabled(sal_Bool bSet) override; - virtual OUString SAL_CALL getEntryMacro() override; - virtual void SAL_CALL setEntryMacro(const OUString& rSet) override; - virtual OUString SAL_CALL getExitMacro() override; - virtual void SAL_CALL setExitMacro(const OUString& rSet) override; + sal_Bool SAL_CALL getCalculateOnExit() override; + void SAL_CALL setCalculateOnExit(sal_Bool bSet) override; + sal_Bool SAL_CALL getEnabled() override; + void SAL_CALL setEnabled(sal_Bool bSet) override; + OUString SAL_CALL getEntryMacro() override; + void SAL_CALL setEntryMacro(const OUString& rSet) override; + OUString SAL_CALL getExitMacro() override; + void SAL_CALL setExitMacro(const OUString& rSet) override; /* * If the OwnHelp property is set to True, * HelpText specifies the text string value. * If OwnHelp is set to False, HelpText specifies the name of an AutoText entry * that contains help text for the form field. */ - virtual OUString SAL_CALL getHelpText() override; - virtual void SAL_CALL setHelpText(const OUString& rSet) override; - virtual sal_Bool SAL_CALL getOwnHelp() override; - virtual void SAL_CALL setOwnHelp(sal_Bool bSet) override; + OUString SAL_CALL getHelpText() override; + void SAL_CALL setHelpText(const OUString& rSet) override; + sal_Bool SAL_CALL getOwnHelp() override; + void SAL_CALL setOwnHelp(sal_Bool bSet) override; - virtual OUString SAL_CALL getName() override; - virtual void SAL_CALL setName(const OUString& rSet) override; - virtual OUString SAL_CALL getResult() override; - virtual void SAL_CALL setResult(const OUString& rSet) override; + OUString SAL_CALL getName() override; + void SAL_CALL setName(const OUString& rSet) override; + OUString SAL_CALL getResult() override; + void SAL_CALL setResult(const OUString& rSet) override; /* * If the OwnStatus property is set to True, * StatusText specifies the status bar value. * If OwnStatus is set to False, StatusText specifies the name of an AutoText entry * that contains status bar text for the form field. */ - virtual OUString SAL_CALL getStatusText() override; - virtual void SAL_CALL setStatusText(const OUString& rSet) override; - virtual sal_Bool SAL_CALL getOwnStatus() override; - virtual void SAL_CALL setOwnStatus(sal_Bool bSet) override; + OUString SAL_CALL getStatusText() override; + void SAL_CALL setStatusText(const OUString& rSet) override; + sal_Bool SAL_CALL getOwnStatus() override; + void SAL_CALL setOwnStatus(sal_Bool bSet) override; // XHelperInterface - virtual OUString getServiceImplName() override; - virtual css::uno::Sequence<OUString> getServiceNames() override; + OUString getServiceImplName() override; + css::uno::Sequence<OUString> getServiceNames() override; }; -#endif // INCLUDED_SW_SOURCE_UI_VBA_VBAFORMFIELD_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/vba/vbaformfieldcheckbox.cxx b/sw/source/ui/vba/vbaformfieldcheckbox.cxx index 9370d7a3df9d..5a32e7e426a4 100644 --- a/sw/source/ui/vba/vbaformfieldcheckbox.cxx +++ b/sw/source/ui/vba/vbaformfieldcheckbox.cxx @@ -15,9 +15,6 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; /** - * Information about the method and properties of CheckBox was gathered from - * https://www.codevba.com/Word/CheckBox.htm - * * CheckBoxes are inline text objects that are only found in MS Word. * They cannot be created in Excel or in Calc. * diff --git a/sw/source/ui/vba/vbaformfieldcheckbox.hxx b/sw/source/ui/vba/vbaformfieldcheckbox.hxx index 8f023e539e49..c62549585b4e 100644 --- a/sw/source/ui/vba/vbaformfieldcheckbox.hxx +++ b/sw/source/ui/vba/vbaformfieldcheckbox.hxx @@ -6,8 +6,7 @@ * 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/. */ -#ifndef INCLUDED_SW_SOURCE_UI_VBA_VBAFORMFIELDCHECKBOX_HXX -#define INCLUDED_SW_SOURCE_UI_VBA_VBAFORMFIELDCHECKBOX_HXX +#pragma once #include <ooo/vba/word/XCheckBox.hpp> @@ -30,27 +29,26 @@ public: ~SwVbaFormFieldCheckBox() override; // XCheckBox - virtual OUString SAL_CALL getDefaultPropertyName() override; + OUString SAL_CALL getDefaultPropertyName() override; // Default member: True if the specified form field object is a valid check box form field - virtual sal_Bool SAL_CALL getValid() override; + sal_Bool SAL_CALL getValid() override; - virtual sal_Bool SAL_CALL getAutoSize() override; - virtual void SAL_CALL setAutoSize(sal_Bool bSet) override; + sal_Bool SAL_CALL getAutoSize() override; + void SAL_CALL setAutoSize(sal_Bool bSet) override; // Returns the default check box value - virtual sal_Bool SAL_CALL getDefault() override; - virtual void SAL_CALL setDefault(sal_Bool bSet) override; + sal_Bool SAL_CALL getDefault() override; + void SAL_CALL setDefault(sal_Bool bSet) override; // Returns the size of a check box, in points - virtual sal_Int32 SAL_CALL getSize() override; - virtual void SAL_CALL setSize(sal_Int32 nSet) override; + sal_Int32 SAL_CALL getSize() override; + void SAL_CALL setSize(sal_Int32 nSet) override; - virtual sal_Bool SAL_CALL getValue() override; - virtual void SAL_CALL setValue(sal_Bool bSet) override; + sal_Bool SAL_CALL getValue() override; + void SAL_CALL setValue(sal_Bool bSet) override; // XHelperInterface OUString getServiceImplName() override; css::uno::Sequence<OUString> getServiceNames() override; }; -#endif // INCLUDED_SW_SOURCE_UI_VBA_VBAFORMFIELDCHECKBOX_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/vba/vbaformfielddropdown.cxx b/sw/source/ui/vba/vbaformfielddropdown.cxx index a1c3254d766b..f1edc8140357 100644 --- a/sw/source/ui/vba/vbaformfielddropdown.cxx +++ b/sw/source/ui/vba/vbaformfielddropdown.cxx @@ -16,8 +16,6 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; /** - * Official documentation found at https://learn.microsoft.com/en-us/office/vba/api/word.dropdown - * * DropDown formfields are inline text objects that are only found in MS Word. * They cannot be created in Excel or in Calc. * diff --git a/sw/source/ui/vba/vbaformfielddropdownlistentries.cxx b/sw/source/ui/vba/vbaformfielddropdownlistentries.cxx index 926ebeaa9656..9000736b0c72 100644 --- a/sw/source/ui/vba/vbaformfielddropdownlistentries.cxx +++ b/sw/source/ui/vba/vbaformfielddropdownlistentries.cxx @@ -35,12 +35,9 @@ public: { } - virtual sal_Bool SAL_CALL hasMoreElements() override - { - return (nIndex < mxIndexAccess->getCount()); - } + sal_Bool SAL_CALL hasMoreElements() override { return (nIndex < mxIndexAccess->getCount()); } - virtual uno::Any SAL_CALL nextElement() override + uno::Any SAL_CALL nextElement() override { if (nIndex < mxIndexAccess->getCount()) { @@ -69,12 +66,9 @@ public: { } - virtual sal_Int32 SAL_CALL getCount() override - { - return lcl_getListEntries(m_rDropDown).getLength(); - } + sal_Int32 SAL_CALL getCount() override { return lcl_getListEntries(m_rDropDown).getLength(); } - virtual uno::Any SAL_CALL getByIndex(sal_Int32 Index) override + uno::Any SAL_CALL getByIndex(sal_Int32 Index) override { if (Index < 0 || Index >= getCount()) throw lang::IndexOutOfBoundsException(); @@ -83,15 +77,12 @@ public: new SwVbaFormFieldDropDownListEntry(mxParent, mxContext, m_rDropDown, Index))); } - virtual uno::Type SAL_CALL getElementType() override - { - return cppu::UnoType<word::XListEntry>::get(); - } + uno::Type SAL_CALL getElementType() override { return cppu::UnoType<word::XListEntry>::get(); } - virtual sal_Bool SAL_CALL hasElements() override { return getCount() != 0; } + sal_Bool SAL_CALL hasElements() override { return getCount() != 0; } // XEnumerationAccess - virtual uno::Reference<container::XEnumeration> SAL_CALL createEnumeration() override + uno::Reference<container::XEnumeration> SAL_CALL createEnumeration() override { return new ListEntriesEnumWrapper(this); } diff --git a/sw/source/ui/vba/vbaformfielddropdownlistentry.hxx b/sw/source/ui/vba/vbaformfielddropdownlistentry.hxx index bfdd4cf2d6db..4ded080e632e 100644 --- a/sw/source/ui/vba/vbaformfielddropdownlistentry.hxx +++ b/sw/source/ui/vba/vbaformfielddropdownlistentry.hxx @@ -21,7 +21,7 @@ class SwVbaFormFieldDropDownListEntry : public SwVbaFormFieldDropDownListEntry_B { private: sw::mark::IDropdownFieldmark& m_rDropDown; - // All LO and internal functions are 0-based. Convert to 1-based when sending to VBA + // All LO and internal UNO functions are 0-based. Convert to 1-based when sending to VBA const sal_Int32 m_nZIndex; public: diff --git a/sw/source/ui/vba/vbaformfields.cxx b/sw/source/ui/vba/vbaformfields.cxx index ea97615f27f5..83d8af88524f 100644 --- a/sw/source/ui/vba/vbaformfields.cxx +++ b/sw/source/ui/vba/vbaformfields.cxx @@ -5,16 +5,6 @@ * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include <comphelper/sequence.hxx> @@ -36,7 +26,7 @@ using namespace ::com::sun::star; // [in] -1 to indicate searching using the provided name, SAL_MAX_INT32 for totals // [out] rIndex indicates the found index, or the total number of fieldmarks static sw::mark::IFieldmark* lcl_getFieldmark(std::string_view rName, sal_Int32& rIndex, - const css::uno::Reference<frame::XModel>& xModel, + const uno::Reference<frame::XModel>& xModel, uno::Sequence<OUString>* pElementNames = nullptr) { SwDoc* pDoc = word::getDocShell(xModel)->GetDoc(); @@ -91,16 +81,13 @@ class FormFieldsEnumWrapper : public EnumerationHelper_BASE public: explicit FormFieldsEnumWrapper(uno::Reference<container::XIndexAccess> xIndexAccess) - : mxIndexAccess(std::move(xIndexAccess)) + : mxIndexAccess(xIndexAccess) , nIndex(0) { } - virtual sal_Bool SAL_CALL hasMoreElements() override - { - return (nIndex < mxIndexAccess->getCount()); - } + sal_Bool SAL_CALL hasMoreElements() override { return (nIndex < mxIndexAccess->getCount()); } - virtual uno::Any SAL_CALL nextElement() override + uno::Any SAL_CALL nextElement() override { if (nIndex < mxIndexAccess->getCount()) { @@ -117,14 +104,14 @@ class FormFieldCollectionHelper private: uno::Reference<XHelperInterface> mxParent; uno::Reference<uno::XComponentContext> mxContext; - css::uno::Reference<frame::XModel> mxModel; + uno::Reference<frame::XModel> mxModel; sw::mark::IFieldmark* m_pCache; public: /// @throws css::uno::RuntimeException - FormFieldCollectionHelper(css::uno::Reference<ov::XHelperInterface> xParent, - css::uno::Reference<css::uno::XComponentContext> xContext, - css::uno::Reference<frame::XModel> xModel) + FormFieldCollectionHelper(uno::Reference<ov::XHelperInterface> xParent, + uno::Reference<uno::XComponentContext> xContext, + uno::Reference<frame::XModel> xModel) : mxParent(std::move(xParent)) , mxContext(std::move(xContext)) , mxModel(std::move(xModel)) @@ -133,25 +120,25 @@ public: } // XIndexAccess - virtual sal_Int32 SAL_CALL getCount() override + sal_Int32 SAL_CALL getCount() override { sal_Int32 nCount = SAL_MAX_INT32; lcl_getFieldmark("", nCount, mxModel); return nCount == SAL_MAX_INT32 ? 0 : nCount; } - virtual uno::Any SAL_CALL getByIndex(sal_Int32 Index) override + uno::Any SAL_CALL getByIndex(sal_Int32 Index) override { m_pCache = lcl_getFieldmark("", Index, mxModel); if (!m_pCache) - throw css::lang::IndexOutOfBoundsException(); + throw lang::IndexOutOfBoundsException(); return uno::Any(uno::Reference<word::XFormField>( new SwVbaFormField(mxParent, mxContext, mxModel, *m_pCache))); } // XNameAccess - virtual uno::Sequence<OUString> SAL_CALL getElementNames() override + uno::Sequence<OUString> SAL_CALL getElementNames() override { sal_Int32 nCount = SAL_MAX_INT32; uno::Sequence<OUString> aSeq; @@ -159,7 +146,7 @@ public: return aSeq; } - virtual uno::Any SAL_CALL getByName(const OUString& aName) override + uno::Any SAL_CALL getByName(const OUString& aName) override { if (!hasByName(aName)) throw container::NoSuchElementException(); @@ -168,7 +155,7 @@ public: new SwVbaFormField(mxParent, mxContext, mxModel, *m_pCache))); } - virtual sal_Bool SAL_CALL hasByName(const OUString& aName) override + sal_Bool SAL_CALL hasByName(const OUString& aName) override { sal_Int32 nCount = -1; m_pCache = lcl_getFieldmark(aName.toUtf8(), nCount, mxModel); @@ -176,15 +163,12 @@ public: } // XElementAccess - virtual uno::Type SAL_CALL getElementType() override - { - return cppu::UnoType<word::XFormField>::get(); - } + uno::Type SAL_CALL getElementType() override { return cppu::UnoType<word::XFormField>::get(); } - virtual sal_Bool SAL_CALL hasElements() override { return getCount() != 0; } + sal_Bool SAL_CALL hasElements() override { return getCount() != 0; } // XEnumerationAccess - virtual uno::Reference<container::XEnumeration> SAL_CALL createEnumeration() override + uno::Reference<container::XEnumeration> SAL_CALL createEnumeration() override { return new FormFieldsEnumWrapper(this); } @@ -211,7 +195,7 @@ void SwVbaFormFields::setShaded(sal_Bool /*bSet*/) SAL_INFO("sw.vba", "SwVbaFormFields::setShaded stub"); } -// uno::Reference<ooo::vba::word::XFormField> SwVbaFormFields::Add(const css::uno::Any& Range, +// uno::Reference<ooo::vba::word::XFormField> SwVbaFormFields::Add(const uno::Any& Range, // sal_Int32 Type) // { // sw::mark::IFieldmark* pFieldmark = nullptr; @@ -237,11 +221,11 @@ uno::Reference<container::XEnumeration> SwVbaFormFields::createEnumeration() return new FormFieldsEnumWrapper(m_xIndexAccess); } -uno::Any SwVbaFormFields::createCollectionObject(const css::uno::Any& aSource) { return aSource; } +uno::Any SwVbaFormFields::createCollectionObject(const uno::Any& aSource) { return aSource; } OUString SwVbaFormFields::getServiceImplName() { return "SwVbaFormFields"; } -css::uno::Sequence<OUString> SwVbaFormFields::getServiceNames() +uno::Sequence<OUString> SwVbaFormFields::getServiceNames() { static uno::Sequence<OUString> const sNames{ "ooo.vba.word.FormFields" }; return sNames; diff --git a/sw/source/ui/vba/vbaformfields.hxx b/sw/source/ui/vba/vbaformfields.hxx index 59226e5ea6f8..865a1dab5604 100644 --- a/sw/source/ui/vba/vbaformfields.hxx +++ b/sw/source/ui/vba/vbaformfields.hxx @@ -5,19 +5,8 @@ * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_UI_VBA_VBAFORMFIELDS_HXX -#define INCLUDED_SW_SOURCE_UI_VBA_VBAFORMFIELDS_HXX +#pragma once #include <ooo/vba/word/XFormFields.hpp> @@ -34,20 +23,18 @@ public: const css::uno::Reference<css::frame::XModel>& xModel); // XFormFields - virtual sal_Bool SAL_CALL getShaded() override; - virtual void SAL_CALL setShaded(sal_Bool bSet) override; - //virtual css::uno::Reference<ooo::vba::word::XFormField> SAL_CALL Add(const css::uno::Any& Range, sal_Int32 Type) override; + sal_Bool SAL_CALL getShaded() override; + void SAL_CALL setShaded(sal_Bool bSet) override; + //css::uno::Reference<ooo::vba::word::XFormField> SAL_CALL Add(const css::uno::Any& Range, sal_Int32 Type) override; // XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() override; - virtual css::uno::Reference<css::container::XEnumeration> SAL_CALL createEnumeration() override; + css::uno::Type SAL_CALL getElementType() override; + css::uno::Reference<css::container::XEnumeration> SAL_CALL createEnumeration() override; // SwVbaFormFields_BASE - virtual css::uno::Any createCollectionObject(const css::uno::Any& aSource) override; - virtual OUString getServiceImplName() override; - virtual css::uno::Sequence<OUString> getServiceNames() override; + css::uno::Any createCollectionObject(const css::uno::Any& aSource) override; + OUString getServiceImplName() override; + css::uno::Sequence<OUString> getServiceNames() override; }; -#endif // INCLUDED_SW_SOURCE_UI_VBA_VBAFORMFIELDS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/vba/vbaformfieldtextinput.cxx b/sw/source/ui/vba/vbaformfieldtextinput.cxx index 8fb65395ef88..4f78761f4eb1 100644 --- a/sw/source/ui/vba/vbaformfieldtextinput.cxx +++ b/sw/source/ui/vba/vbaformfieldtextinput.cxx @@ -17,8 +17,6 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; /** - * Official documentation at https://learn.microsoft.com/en-us/office/vba/api/word.textinput - * * TextInput formfields are inline text objects that are only found in MS Word. * They cannot be created in Excel or in Calc. * |