summaryrefslogtreecommitdiff
path: root/sw/source/ui/vba
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2022-12-16 11:33:23 -0500
committerMiklos Vajna <vmiklos@collabora.com>2022-12-19 15:26:14 +0000
commitea9938b0a63b25cbfdd575c1745f208d27660f20 (patch)
tree2acf85e51c2a0aa52c1a646233b45af083925f49 /sw/source/ui/vba
parenta0c6bc75628513f3c501321eea1458d77bacc36c (diff)
tdf#151548 vba ContentControls: fix fundamental error
The problem was that the SwTextControl could be deleted by the user or in VBA and my references (or pointers for that matter) to m_rCC would be invalid. Instead, use the shared_ptr, which will always be valid, from the SwContentControl. Thankfully, there is backwards access to the Format and Text controls. This is nicer anyways. It has reduced code lines, and simpler access to the most used aspect. Change-Id: Ie382b33ecda5c3d0024f0eabcb8ff158db942f52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144345 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/ui/vba')
-rw-r--r--sw/source/ui/vba/vbacontentcontrol.cxx275
-rw-r--r--sw/source/ui/vba/vbacontentcontrol.hxx4
-rw-r--r--sw/source/ui/vba/vbacontentcontrollistentries.cxx38
-rw-r--r--sw/source/ui/vba/vbacontentcontrollistentries.hxx4
-rw-r--r--sw/source/ui/vba/vbacontentcontrollistentry.cxx80
-rw-r--r--sw/source/ui/vba/vbacontentcontrollistentry.hxx4
-rw-r--r--sw/source/ui/vba/vbacontentcontrols.cxx26
7 files changed, 184 insertions, 247 deletions
diff --git a/sw/source/ui/vba/vbacontentcontrol.cxx b/sw/source/ui/vba/vbacontentcontrol.cxx
index b1de99ee3388..8e8d8a12382b 100644
--- a/sw/source/ui/vba/vbacontentcontrol.cxx
+++ b/sw/source/ui/vba/vbacontentcontrol.cxx
@@ -34,11 +34,12 @@ using namespace ::com::sun::star;
SwVbaContentControl::SwVbaContentControl(const uno::Reference<XHelperInterface>& rParent,
const uno::Reference<uno::XComponentContext>& rContext,
const uno::Reference<text::XTextDocument>& xTextDocument,
- SwTextContentControl& rContentControl)
+ std::shared_ptr<SwContentControl> pContentControl)
: SwVbaContentControl_BASE(rParent, rContext)
, mxTextDocument(xTextDocument)
- , m_rCC(rContentControl)
+ , m_pCC(pContentControl)
{
+ assert(m_pCC && "SwVbaContentControl created without a shared_ptr. Why would you do that?");
}
SwVbaContentControl::~SwVbaContentControl() {}
@@ -89,11 +90,7 @@ void SwVbaContentControl::setBuildingBlockType(sal_Int32 nSet)
SAL_INFO("sw.vba", "SwVbaContentControl::setBuildingBlockType[" << nSet << "] stub");
}
-sal_Bool SwVbaContentControl::getChecked()
-{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
- return pCC->GetCheckbox() && pCC->GetChecked();
-}
+sal_Bool SwVbaContentControl::getChecked() { return m_pCC->GetCheckbox() && m_pCC->GetChecked(); }
void SwVbaContentControl::setChecked(sal_Bool bSet)
{
@@ -104,20 +101,19 @@ void SwVbaContentControl::setChecked(sal_Bool bSet)
if (getLockContents())
return;
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- if (pCC->GetCheckbox() && pCC->GetChecked() != static_cast<bool>(bSet))
+ if (m_pCC->GetCheckbox() && m_pCC->GetChecked() != static_cast<bool>(bSet))
{
- pCC->SetChecked(bSet);
- pCC->SetShowingPlaceHolder(false);
- m_rCC.Invalidate();
+ m_pCC->SetChecked(bSet);
+ m_pCC->SetShowingPlaceHolder(false);
+ if (m_pCC->GetTextAttr())
+ m_pCC->GetTextAttr()->Invalidate();
}
}
sal_Int32 SwVbaContentControl::getColor()
{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
//This is just an assumed implementation - I have no testing environment to confirm.
- OUString sColor = pCC->GetColor();
+ OUString sColor = m_pCC->GetColor();
if (sColor == "wdColorAutomatic")
return word::WdColor::wdColorAutomatic;
if (sColor == "wdColorBlack")
@@ -242,186 +238,184 @@ sal_Int32 SwVbaContentControl::getColor()
void SwVbaContentControl::setColor(sal_Int32 nWdColor)
{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
-
switch (nWdColor)
{
case word::WdColor::wdColorAqua:
- pCC->SetColor("wdColorAqua");
+ m_pCC->SetColor("wdColorAqua");
break;
case word::WdColor::wdColorAutomatic:
- pCC->SetColor("wdColorAutomatic");
+ m_pCC->SetColor("wdColorAutomatic");
break;
case word::WdColor::wdColorBlack:
- pCC->SetColor("wdColorBlack");
+ m_pCC->SetColor("wdColorBlack");
break;
case word::WdColor::wdColorBlue:
- pCC->SetColor("wdColorBlue");
+ m_pCC->SetColor("wdColorBlue");
break;
case word::WdColor::wdColorBlueGray:
- pCC->SetColor("wdColorBlueGray");
+ m_pCC->SetColor("wdColorBlueGray");
break;
case word::WdColor::wdColorBrightGreen:
- pCC->SetColor("wdColorBrightGreen");
+ m_pCC->SetColor("wdColorBrightGreen");
break;
case word::WdColor::wdColorBrown:
- pCC->SetColor("wdColorBrown");
+ m_pCC->SetColor("wdColorBrown");
break;
case word::WdColor::wdColorDarkBlue:
- pCC->SetColor("wdColorDarkBlue");
+ m_pCC->SetColor("wdColorDarkBlue");
break;
case word::WdColor::wdColorDarkGreen:
- pCC->SetColor("wdColorDarkGreen");
+ m_pCC->SetColor("wdColorDarkGreen");
break;
case word::WdColor::wdColorDarkRed:
- pCC->SetColor("wdColorDarkRed");
+ m_pCC->SetColor("wdColorDarkRed");
break;
case word::WdColor::wdColorDarkTeal:
- pCC->SetColor("wdColorDarkTeal");
+ m_pCC->SetColor("wdColorDarkTeal");
break;
case word::WdColor::wdColorDarkYellow:
- pCC->SetColor("wdColorDarkYellow");
+ m_pCC->SetColor("wdColorDarkYellow");
break;
case word::WdColor::wdColorGold:
- pCC->SetColor("wdColorGold");
+ m_pCC->SetColor("wdColorGold");
break;
case word::WdColor::wdColorGray05:
- pCC->SetColor("wdColorGray05");
+ m_pCC->SetColor("wdColorGray05");
break;
case word::WdColor::wdColorGray10:
- pCC->SetColor("wdColorGray10");
+ m_pCC->SetColor("wdColorGray10");
break;
case word::WdColor::wdColorGray125:
- pCC->SetColor("wdColorGray125");
+ m_pCC->SetColor("wdColorGray125");
break;
case word::WdColor::wdColorGray15:
- pCC->SetColor("wdColorGray15");
+ m_pCC->SetColor("wdColorGray15");
break;
case word::WdColor::wdColorGray20:
- pCC->SetColor("wdColorGray20");
+ m_pCC->SetColor("wdColorGray20");
break;
case word::WdColor::wdColorGray25:
- pCC->SetColor("wdColorGray25");
+ m_pCC->SetColor("wdColorGray25");
break;
case word::WdColor::wdColorGray30:
- pCC->SetColor("wdColorGray30");
+ m_pCC->SetColor("wdColorGray30");
break;
case word::WdColor::wdColorGray35:
- pCC->SetColor("wdColorGray35");
+ m_pCC->SetColor("wdColorGray35");
break;
case word::WdColor::wdColorGray375:
- pCC->SetColor("wdColorGray375");
+ m_pCC->SetColor("wdColorGray375");
break;
case word::WdColor::wdColorGray40:
- pCC->SetColor("wdColorGray40");
+ m_pCC->SetColor("wdColorGray40");
break;
case word::WdColor::wdColorGray45:
- pCC->SetColor("wdColorGray45");
+ m_pCC->SetColor("wdColorGray45");
break;
case word::WdColor::wdColorGray50:
- pCC->SetColor("wdColorGray50");
+ m_pCC->SetColor("wdColorGray50");
break;
case word::WdColor::wdColorGray55:
- pCC->SetColor("wdColorGray55");
+ m_pCC->SetColor("wdColorGray55");
break;
case word::WdColor::wdColorGray60:
- pCC->SetColor("wdColorGray60");
+ m_pCC->SetColor("wdColorGray60");
break;
case word::WdColor::wdColorGray625:
- pCC->SetColor("wdColorGray625");
+ m_pCC->SetColor("wdColorGray625");
break;
case word::WdColor::wdColorGray65:
- pCC->SetColor("wdColorGray65");
+ m_pCC->SetColor("wdColorGray65");
break;
case word::WdColor::wdColorGray70:
- pCC->SetColor("wdColorGray70");
+ m_pCC->SetColor("wdColorGray70");
break;
case word::WdColor::wdColorGray75:
- pCC->SetColor("wdColorGray75");
+ m_pCC->SetColor("wdColorGray75");
break;
case word::WdColor::wdColorGray80:
- pCC->SetColor("wdColorGray80");
+ m_pCC->SetColor("wdColorGray80");
break;
case word::WdColor::wdColorGray85:
- pCC->SetColor("wdColorGray85");
+ m_pCC->SetColor("wdColorGray85");
break;
case word::WdColor::wdColorGray875:
- pCC->SetColor("wdColorGray875");
+ m_pCC->SetColor("wdColorGray875");
break;
case word::WdColor::wdColorGray90:
- pCC->SetColor("wdColorGray90");
+ m_pCC->SetColor("wdColorGray90");
break;
case word::WdColor::wdColorGray95:
- pCC->SetColor("wdColorGray95");
+ m_pCC->SetColor("wdColorGray95");
break;
case word::WdColor::wdColorGreen:
- pCC->SetColor("wdColorGreen");
+ m_pCC->SetColor("wdColorGreen");
break;
case word::WdColor::wdColorIndigo:
- pCC->SetColor("wdColorIndigo");
+ m_pCC->SetColor("wdColorIndigo");
break;
case word::WdColor::wdColorLavender:
- pCC->SetColor("wdColorLavender");
+ m_pCC->SetColor("wdColorLavender");
break;
case word::WdColor::wdColorLightBlue:
- pCC->SetColor("wdColorLightBlue");
+ m_pCC->SetColor("wdColorLightBlue");
break;
case word::WdColor::wdColorLightGreen:
- pCC->SetColor("wdColorLightGreen");
+ m_pCC->SetColor("wdColorLightGreen");
break;
case word::WdColor::wdColorLightOrange:
- pCC->SetColor("wdColorLightOrange");
+ m_pCC->SetColor("wdColorLightOrange");
break;
case word::WdColor::wdColorLightTurquoise:
- pCC->SetColor("wdColorLightTurquoise");
+ m_pCC->SetColor("wdColorLightTurquoise");
break;
case word::WdColor::wdColorLightYellow:
- pCC->SetColor("wdColorLightYellow");
+ m_pCC->SetColor("wdColorLightYellow");
break;
case word::WdColor::wdColorLime:
- pCC->SetColor("wdColorLime");
+ m_pCC->SetColor("wdColorLime");
break;
case word::WdColor::wdColorOliveGreen:
- pCC->SetColor("wdColorOliveGreen");
+ m_pCC->SetColor("wdColorOliveGreen");
break;
case word::WdColor::wdColorOrange:
- pCC->SetColor("wdColorOrange");
+ m_pCC->SetColor("wdColorOrange");
break;
case word::WdColor::wdColorPaleBlue:
- pCC->SetColor("wdColorPaleBlue");
+ m_pCC->SetColor("wdColorPaleBlue");
break;
case word::WdColor::wdColorPink:
- pCC->SetColor("wdColorPink");
+ m_pCC->SetColor("wdColorPink");
break;
case word::WdColor::wdColorPlum:
- pCC->SetColor("wdColorPlum");
+ m_pCC->SetColor("wdColorPlum");
break;
case word::WdColor::wdColorRed:
- pCC->SetColor("wdColorRed");
+ m_pCC->SetColor("wdColorRed");
break;
case word::WdColor::wdColorRose:
- pCC->SetColor("wdColorRose");
+ m_pCC->SetColor("wdColorRose");
break;
case word::WdColor::wdColorSeaGreen:
- pCC->SetColor("wdColorSeaGreen");
+ m_pCC->SetColor("wdColorSeaGreen");
break;
case word::WdColor::wdColorSkyBlue:
- pCC->SetColor("wdColorSkyBlue");
+ m_pCC->SetColor("wdColorSkyBlue");
break;
case word::WdColor::wdColorTan:
- pCC->SetColor("wdColorTan");
+ m_pCC->SetColor("wdColorTan");
break;
case word::WdColor::wdColorTeal:
- pCC->SetColor("wdColorTeal");
+ m_pCC->SetColor("wdColorTeal");
break;
case word::WdColor::wdColorTurquoise:
- pCC->SetColor("wdColorTurquoise");
+ m_pCC->SetColor("wdColorTurquoise");
break;
case word::WdColor::wdColorViolet:
- pCC->SetColor("wdColorViolet");
+ m_pCC->SetColor("wdColorViolet");
break;
case word::WdColor::wdColorWhite:
- pCC->SetColor("wdColorWhite");
+ m_pCC->SetColor("wdColorWhite");
break;
default:;
}
@@ -439,17 +433,9 @@ void SwVbaContentControl::setDateCalendarType(sal_Int32 nSet)
SAL_INFO("sw.vba", "SwVbaContentControl::setDateCalendarType[" << nSet << "] stub");
}
-OUString SwVbaContentControl::getDateDisplayFormat()
-{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
- return pCC->GetDateFormat();
-}
+OUString SwVbaContentControl::getDateDisplayFormat() { return m_pCC->GetDateFormat(); }
-void SwVbaContentControl::setDateDisplayFormat(const OUString& sSet)
-{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- pCC->SetDateFormat(sSet);
-}
+void SwVbaContentControl::setDateDisplayFormat(const OUString& sSet) { m_pCC->SetDateFormat(sSet); }
sal_Int32 SwVbaContentControl::getDateStorageFormat()
{
@@ -472,19 +458,17 @@ sal_Int32 SwVbaContentControl::getDateDisplayLocale()
uno::Any SwVbaContentControl::getDropdownListEntries()
{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- if (!pCC->GetDropDown() && !pCC->GetComboBox())
+ if (!m_pCC->GetDropDown() && !m_pCC->GetComboBox())
return uno::Any();
return uno::Any(
- uno::Reference<XCollection>(new SwVbaContentControlListEntries(this, mxContext, m_rCC)));
+ uno::Reference<XCollection>(new SwVbaContentControlListEntries(this, mxContext, m_pCC)));
}
OUString SwVbaContentControl::getID()
{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
// This signed integer is treated in VBA as if it was an unsigned int.
- return OUString::number(static_cast<sal_uInt32>(pCC->GetId()));
+ return OUString::number(static_cast<sal_uInt32>(m_pCC->GetId()));
}
sal_Int32 SwVbaContentControl::getLevel()
@@ -496,53 +480,49 @@ sal_Int32 SwVbaContentControl::getLevel()
sal_Bool SwVbaContentControl::getLockContentControl()
{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
- std::optional<bool> oLock = pCC->GetLock(/*bControl=*/true);
+ std::optional<bool> oLock = m_pCC->GetLock(/*bControl=*/true);
return oLock && *oLock;
}
void SwVbaContentControl::setLockContentControl(sal_Bool bSet)
{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- std::optional<bool> oLock = pCC->GetLock(/*bControl=*/false);
- pCC->SetLock(/*bContents=*/oLock && *oLock, /*bControl=*/bSet);
+ std::optional<bool> oLock = m_pCC->GetLock(/*bControl=*/false);
+ m_pCC->SetLock(/*bContents=*/oLock && *oLock, /*bControl=*/bSet);
}
sal_Bool SwVbaContentControl::getLockContents()
{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
// If the theoretical design model says it is locked, then report as locked.
- std::optional<bool> oLock = pCC->GetLock(/*bControl=*/false);
+ std::optional<bool> oLock = m_pCC->GetLock(/*bControl=*/false);
if (oLock && *oLock)
return true;
// Now check the real implementation.
// Checkbox/DropDown/Picture are normally locked - but not in this sense. Report as unlocked.
- if (pCC->GetType() == SwContentControlType::CHECKBOX
- || pCC->GetType() == SwContentControlType::DROP_DOWN_LIST
- || pCC->GetType() == SwContentControlType::PICTURE)
+ if (m_pCC->GetType() == SwContentControlType::CHECKBOX
+ || m_pCC->GetType() == SwContentControlType::DROP_DOWN_LIST
+ || m_pCC->GetType() == SwContentControlType::PICTURE)
{
return false;
}
- return pCC->GetReadWrite();
+ return m_pCC->GetReadWrite();
}
void SwVbaContentControl::setLockContents(sal_Bool bSet)
{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
// Set the lock both theoretically and actually.
- std::optional<bool> oLock = pCC->GetLock(/*bControl=*/true);
- pCC->SetLock(/*bContents=*/bSet, /*bControl=*/oLock && *oLock);
+ std::optional<bool> oLock = m_pCC->GetLock(/*bControl=*/true);
+ m_pCC->SetLock(/*bContents=*/bSet, /*bControl=*/oLock && *oLock);
// Checkbox/DropDown/Picture are normally locked in LO implementation - don't unlock them.
- if (pCC->GetType() == SwContentControlType::CHECKBOX
- || pCC->GetType() == SwContentControlType::DROP_DOWN_LIST
- || pCC->GetType() == SwContentControlType::PICTURE)
+ if (m_pCC->GetType() == SwContentControlType::CHECKBOX
+ || m_pCC->GetType() == SwContentControlType::DROP_DOWN_LIST
+ || m_pCC->GetType() == SwContentControlType::PICTURE)
{
return;
}
- pCC->SetReadWrite(bSet);
+ m_pCC->SetReadWrite(bSet);
}
sal_Bool SwVbaContentControl::getMultiLine()
@@ -558,27 +538,23 @@ void SwVbaContentControl::setMultiLine(sal_Bool /*bSet*/)
OUString SwVbaContentControl::getPlaceholderText()
{
- // return pCC->GetPlaceholderDocPart(); // This is not correct. Much more complex than this...
+ // return m_pCC->GetPlaceholderDocPart(); // This is not correct. Much more complex than this...
SAL_INFO("sw.vba", "SwVbaContentControl::getPlaceholderText stub");
return OUString();
}
-sal_Bool SwVbaContentControl::getShowingPlaceholderText()
-{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
- return pCC->GetShowingPlaceHolder();
-}
+sal_Bool SwVbaContentControl::getShowingPlaceholderText() { return m_pCC->GetShowingPlaceHolder(); }
uno::Reference<word::XRange> SwVbaContentControl::getRange()
{
uno::Reference<word::XRange> xRet;
- SwTextNode* pTextNode = m_rCC.GetTextNode();
- if (pTextNode)
+ SwTextNode* pTextNode = m_pCC->GetTextNode();
+ if (pTextNode && m_pCC->GetTextAttr())
{
// Don't select the text attribute itself at the start.
- SwPosition aStart(*pTextNode, m_rCC.GetStart() + 1);
+ SwPosition aStart(*pTextNode, m_pCC->GetTextAttr()->GetStart() + 1);
// Don't select the CH_TXTATR_BREAKWORD itself at the end.
- SwPosition aEnd(*pTextNode, *m_rCC.End() - 1);
+ SwPosition aEnd(*pTextNode, *m_pCC->GetTextAttr()->End() - 1);
uno::Reference<text::XTextRange> xText(
SwXTextRange::CreateXTextRange(pTextNode->GetDoc(), aStart, &aEnd));
if (xText.is())
@@ -599,17 +575,9 @@ void SwVbaContentControl::setRepeatingSectionItemTitle(const OUString& rSet)
SAL_INFO("sw.vba", "SwVbaContentControl::setRepeatingSectionItemTitle[" << rSet << "] stub");
}
-OUString SwVbaContentControl::getTag()
-{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
- return pCC->GetTag();
-}
+OUString SwVbaContentControl::getTag() { return m_pCC->GetTag(); }
-void SwVbaContentControl::setTag(const OUString& rSet)
-{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- return pCC->SetTag(rSet);
-}
+void SwVbaContentControl::setTag(const OUString& rSet) { return m_pCC->SetTag(rSet); }
sal_Bool SwVbaContentControl::getTemporary()
{
@@ -623,22 +591,13 @@ void SwVbaContentControl::setTemporary(sal_Bool /*bSet*/)
SAL_INFO("sw.vba", "SwVbaContentControl::setTemporary stub");
}
-OUString SwVbaContentControl::getTitle()
-{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
- return pCC->GetAlias();
-}
+OUString SwVbaContentControl::getTitle() { return m_pCC->GetAlias(); }
-void SwVbaContentControl::setTitle(const OUString& rSet)
-{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- return pCC->SetAlias(rSet);
-}
+void SwVbaContentControl::setTitle(const OUString& rSet) { return m_pCC->SetAlias(rSet); }
sal_Int32 SwVbaContentControl::getType()
{
- const std::shared_ptr<SwContentControl>& pCC = m_rCC.GetContentControl().GetContentControl();
- SwContentControlType eType = pCC->GetType();
+ SwContentControlType eType = m_pCC->GetType();
sal_Int32 eVbaType = word::WdContentControlType::wdContentControlRichText;
switch (eType)
@@ -670,7 +629,6 @@ sal_Int32 SwVbaContentControl::getType()
void SwVbaContentControl::setType(sal_Int32 nSet)
{
SAL_INFO("sw.vba", "SwVbaContentControl::setType[" << nSet << "] stub");
- // std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
// SwContentControlType eType = SwContentControlType::RICH_TEXT;
// switch(nSet)
// {
@@ -695,7 +653,7 @@ void SwVbaContentControl::setType(sal_Int32 nSet)
// case word::WdContentControlType::wdContentControlRichText:
// default:;
// }
- // pCC->SetType(eType);
+ // m_pCC->SetType(eType);
}
void SwVbaContentControl::Copy()
@@ -705,57 +663,60 @@ void SwVbaContentControl::Copy()
void SwVbaContentControl::Cut()
{
- if (getLockContentControl())
+ if (getLockContentControl() || !m_pCC->GetTextAttr())
return;
SAL_INFO("sw.vba",
"SwVbaContentControl::Cut[" << getID() << "], but missing sending to clipboard");
- m_rCC.Delete(/*bSaveContents=*/getLockContents());
+ m_pCC->GetTextAttr()->Delete(/*bSaveContents=*/getLockContents());
}
void SwVbaContentControl::Delete(const uno::Any& DeleteContents)
{
- if (getLockContentControl())
+ if (getLockContentControl() || !m_pCC->GetTextAttr())
return;
bool bDeleteContents = false;
DeleteContents >>= bDeleteContents;
- m_rCC.Delete(/*bSaveContents=*/!bDeleteContents || getLockContents());
+ m_pCC->GetTextAttr()->Delete(/*bSaveContents=*/!bDeleteContents || getLockContents());
}
void SwVbaContentControl::SetCheckedSymbol(sal_Int32 Character, const uno::Any& Font)
{
+ if (!m_pCC->GetTextAttr())
+ return;
+
SAL_INFO_IF(Font.hasValue(), "sw.vba", "SetCheckedSymbol Font[" << Font << "] stub");
if (Character < 31 || Character > SAL_MAX_UINT16)
return; // unsupported character. Would such a thing exist in VBA?
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- pCC->SetCheckedState(OUString(static_cast<sal_Unicode>(Character)));
+ m_pCC->SetCheckedState(OUString(static_cast<sal_Unicode>(Character)));
- if (pCC->GetCheckbox() && pCC->GetChecked() && !pCC->GetShowingPlaceHolder())
- m_rCC.Invalidate();
+ if (m_pCC->GetCheckbox() && m_pCC->GetChecked() && !m_pCC->GetShowingPlaceHolder())
+ m_pCC->GetTextAttr()->Invalidate();
}
void SwVbaContentControl::SetUnCheckedSymbol(sal_Int32 Character, const uno::Any& Font)
{
+ if (!m_pCC->GetTextAttr())
+ return;
+
SAL_INFO_IF(Font.hasValue(), "sw.vba", "SetUnCheckedSymbol Font[" << Font << "] stub");
if (Character < 31 || Character > SAL_MAX_UINT16)
return; // unsupported character. Would such a thing exist in VBA?
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- pCC->SetUncheckedState(OUString(static_cast<sal_Unicode>(Character)));
+ m_pCC->SetUncheckedState(OUString(static_cast<sal_Unicode>(Character)));
- if (pCC->GetCheckbox() && !pCC->GetChecked() && !pCC->GetShowingPlaceHolder())
- m_rCC.Invalidate();
+ if (m_pCC->GetCheckbox() && !m_pCC->GetChecked() && !m_pCC->GetShowingPlaceHolder())
+ m_pCC->GetTextAttr()->Invalidate();
}
void SwVbaContentControl::SetPlaceholderText(const uno::Any& BuildingBlock, const uno::Any& Range,
const uno::Any& Text)
{
SAL_INFO("sw.vba", "SwVbaContentControl::SetPlaceholderText stub");
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
if (BuildingBlock.hasValue())
{
// Set placeholder text to the building block - whatever that is.
@@ -771,9 +732,9 @@ void SwVbaContentControl::SetPlaceholderText(const uno::Any& BuildingBlock, cons
else
{
// Remove placeholder text.
- pCC->SetPlaceholderDocPart("");
+ m_pCC->SetPlaceholderDocPart("");
}
- if (pCC->GetShowingPlaceHolder() && !getLockContents())
+ if (m_pCC->GetShowingPlaceHolder() && !getLockContents() && m_pCC->GetTextAttr())
{
//replace the text and ensure showing placeholder is still set
}
diff --git a/sw/source/ui/vba/vbacontentcontrol.hxx b/sw/source/ui/vba/vbacontentcontrol.hxx
index 2d3c2ee56ad1..9f98b92468b5 100644
--- a/sw/source/ui/vba/vbacontentcontrol.hxx
+++ b/sw/source/ui/vba/vbacontentcontrol.hxx
@@ -21,14 +21,14 @@ class SwVbaContentControl : public SwVbaContentControl_BASE
{
private:
css::uno::Reference<css::text::XTextDocument> mxTextDocument;
- SwTextContentControl& m_rCC;
+ 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,
- SwTextContentControl& rContentControl);
+ std::shared_ptr<SwContentControl> pContentControl);
~SwVbaContentControl() override;
// XContentControl Properties
diff --git a/sw/source/ui/vba/vbacontentcontrollistentries.cxx b/sw/source/ui/vba/vbacontentcontrollistentries.cxx
index 40684e04ab60..552397e156b7 100644
--- a/sw/source/ui/vba/vbacontentcontrollistentries.cxx
+++ b/sw/source/ui/vba/vbacontentcontrollistentries.cxx
@@ -48,23 +48,20 @@ class ContentControlListEntryCollectionHelper
private:
uno::Reference<XHelperInterface> mxParent;
uno::Reference<uno::XComponentContext> mxContext;
- SwTextContentControl& m_rCC;
+ std::shared_ptr<SwContentControl> m_pCC;
public:
/// @throws css::uno::RuntimeException
ContentControlListEntryCollectionHelper(uno::Reference<ov::XHelperInterface> xParent,
uno::Reference<uno::XComponentContext> xContext,
- SwTextContentControl& rCC)
+ std::shared_ptr<SwContentControl> pCC)
: mxParent(xParent)
, mxContext(xContext)
- , m_rCC(rCC)
+ , m_pCC(pCC)
{
}
- sal_Int32 SAL_CALL getCount() override
- {
- return m_rCC.GetContentControl().GetContentControl()->GetListItems().size();
- }
+ sal_Int32 SAL_CALL getCount() override { return m_pCC->GetListItems().size(); }
uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
{
@@ -72,7 +69,7 @@ public:
throw lang::IndexOutOfBoundsException();
return uno::Any(uno::Reference<word::XContentControlListEntry>(
- new SwVbaContentControlListEntry(mxParent, mxContext, m_rCC, Index)));
+ new SwVbaContentControlListEntry(mxParent, mxContext, m_pCC, Index)));
}
uno::Type SAL_CALL getElementType() override
@@ -96,12 +93,12 @@ public:
*/
SwVbaContentControlListEntries::SwVbaContentControlListEntries(
const uno::Reference<XHelperInterface>& xParent,
- const uno::Reference<uno::XComponentContext>& xContext, SwTextContentControl& rCC)
+ const uno::Reference<uno::XComponentContext>& xContext, std::shared_ptr<SwContentControl> pCC)
: SwVbaContentControlListEntries_BASE(
xParent, xContext,
uno::Reference<container::XIndexAccess>(
- new ContentControlListEntryCollectionHelper(xParent, xContext, rCC)))
- , m_rCC(rCC)
+ new ContentControlListEntryCollectionHelper(xParent, xContext, pCC)))
+ , m_pCC(pCC)
{
}
@@ -110,8 +107,7 @@ SwVbaContentControlListEntries::Add(const OUString& rName, const uno::Any& rValu
const uno::Any& rIndex)
{
// No duplicate Names allowed in VBA
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- for (auto& rListItem : pCC->GetListItems())
+ for (auto& rListItem : m_pCC->GetListItems())
{
if (rListItem.ToString() == rName)
return uno::Reference<word::XContentControlListEntry>();
@@ -122,28 +118,22 @@ SwVbaContentControlListEntries::Add(const OUString& rName, const uno::Any& rValu
// rIndex is 1-based, nZIndex is 0-based. If rIndex is not given, then add as the last choice.
assert(nZIndex > 0);
--nZIndex;
- nZIndex = std::min(static_cast<size_t>(nZIndex), pCC->GetListItems().size());
+ nZIndex = std::min(static_cast<size_t>(nZIndex), m_pCC->GetListItems().size());
OUString sValue;
rValue >>= sValue;
- if (pCC->AddListItem(nZIndex, rName, sValue))
+ if (m_pCC->AddListItem(nZIndex, rName, sValue))
{
return uno::Reference<word::XContentControlListEntry>(
- new SwVbaContentControlListEntry(mxParent, mxContext, m_rCC, nZIndex));
+ new SwVbaContentControlListEntry(mxParent, mxContext, m_pCC, nZIndex));
}
return uno::Reference<word::XContentControlListEntry>();
}
-void SwVbaContentControlListEntries::Clear()
-{
- m_rCC.GetContentControl().GetContentControl()->ClearListItems();
-}
+void SwVbaContentControlListEntries::Clear() { m_pCC->ClearListItems(); }
-sal_Int32 SwVbaContentControlListEntries::getCount()
-{
- return m_rCC.GetContentControl().GetContentControl()->GetListItems().size();
-}
+sal_Int32 SwVbaContentControlListEntries::getCount() { return m_pCC->GetListItems().size(); }
// XEnumerationAccess
uno::Type SwVbaContentControlListEntries::getElementType()
diff --git a/sw/source/ui/vba/vbacontentcontrollistentries.hxx b/sw/source/ui/vba/vbacontentcontrollistentries.hxx
index 65ee6ac814a9..dc32203179dc 100644
--- a/sw/source/ui/vba/vbacontentcontrollistentries.hxx
+++ b/sw/source/ui/vba/vbacontentcontrollistentries.hxx
@@ -24,13 +24,13 @@ typedef CollTestImplHelper<ooo::vba::word::XContentControlListEntries>
class SwVbaContentControlListEntries : public SwVbaContentControlListEntries_BASE
{
private:
- SwTextContentControl& m_rCC;
+ std::shared_ptr<SwContentControl> m_pCC;
public:
/// @throws css::uno::RuntimeException
SwVbaContentControlListEntries(const css::uno::Reference<ov::XHelperInterface>& xParent,
const css::uno::Reference<css::uno::XComponentContext>& xContext,
- SwTextContentControl& rCC);
+ std::shared_ptr<SwContentControl> pCC);
// XContentControlListEntries
css::uno::Reference<ooo::vba::word::XContentControlListEntry> SAL_CALL
diff --git a/sw/source/ui/vba/vbacontentcontrollistentry.cxx b/sw/source/ui/vba/vbacontentcontrollistentry.cxx
index 80603df21309..73f5e9d0a2cf 100644
--- a/sw/source/ui/vba/vbacontentcontrollistentry.cxx
+++ b/sw/source/ui/vba/vbacontentcontrollistentry.cxx
@@ -14,10 +14,10 @@ using namespace ::com::sun::star;
SwVbaContentControlListEntry::SwVbaContentControlListEntry(
const uno::Reference<ooo::vba::XHelperInterface>& rParent,
- const uno::Reference<uno::XComponentContext>& rContext, SwTextContentControl& rCC,
+ const uno::Reference<uno::XComponentContext>& rContext, std::shared_ptr<SwContentControl> pCC,
size_t nZIndex)
: SwVbaContentControlListEntry_BASE(rParent, rContext)
- , m_rCC(rCC)
+ , m_pCC(pCC)
, m_nZIndex(nZIndex)
{
}
@@ -31,9 +31,8 @@ void SwVbaContentControlListEntry::setIndex(sal_Int32 nSet)
if (nSet < 1 || static_cast<size_t>(nSet) == m_nZIndex + 1)
return;
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
// Given a one-based index to set to
- size_t nIndex = std::min(static_cast<size_t>(nSet), pCC->GetListItems().size());
+ size_t nIndex = std::min(static_cast<size_t>(nSet), m_pCC->GetListItems().size());
// change to zero-based index
--nIndex;
while (nIndex < m_nZIndex)
@@ -44,16 +43,14 @@ void SwVbaContentControlListEntry::setIndex(sal_Int32 nSet)
OUString SwVbaContentControlListEntry::getText()
{
- const std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- assert(m_nZIndex < pCC->GetListItems().size());
- const SwContentControlListItem& rListItem = pCC->GetListItems()[m_nZIndex];
+ assert(m_nZIndex < m_pCC->GetListItems().size());
+ const SwContentControlListItem& rListItem = m_pCC->GetListItems()[m_nZIndex];
return rListItem.ToString();
}
void SwVbaContentControlListEntry::setText(const OUString& rSet)
{
- const std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- std::vector<SwContentControlListItem> vListItems = pCC->GetListItems();
+ std::vector<SwContentControlListItem> vListItems = m_pCC->GetListItems();
assert(m_nZIndex < vListItems.size());
// prevent duplicates
@@ -63,97 +60,90 @@ void SwVbaContentControlListEntry::setText(const OUString& rSet)
return;
}
- const std::optional<size_t> oSel(pCC->GetSelectedListItem(/*bCheckDocModel=*/true));
- const bool bNeedsInvalidation = pCC->GetDropDown() && oSel && *oSel == m_nZIndex;
+ const std::optional<size_t> oSel(m_pCC->GetSelectedListItem(/*bCheckDocModel=*/true));
+ const bool bNeedsInvalidation = m_pCC->GetDropDown() && oSel && *oSel == m_nZIndex;
vListItems[m_nZIndex].m_aDisplayText = rSet;
- pCC->SetListItems(vListItems);
+ m_pCC->SetListItems(vListItems);
if (bNeedsInvalidation)
{
- pCC->SetSelectedListItem(m_nZIndex);
- m_rCC.Invalidate();
+ m_pCC->SetSelectedListItem(m_nZIndex);
+ if (m_pCC->GetTextAttr())
+ m_pCC->GetTextAttr()->Invalidate();
}
}
OUString SwVbaContentControlListEntry::getValue()
{
- const std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- assert(m_nZIndex < pCC->GetListItems().size());
- const SwContentControlListItem& rListItem = pCC->GetListItems()[m_nZIndex];
+ assert(m_nZIndex < m_pCC->GetListItems().size());
+ const SwContentControlListItem& rListItem = m_pCC->GetListItems()[m_nZIndex];
return rListItem.m_aValue;
}
void SwVbaContentControlListEntry::setValue(const OUString& rSet)
{
- const std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- assert(m_nZIndex < pCC->GetListItems().size());
- std::vector<SwContentControlListItem> vListItems = pCC->GetListItems();
+ assert(m_nZIndex < m_pCC->GetListItems().size());
+ std::vector<SwContentControlListItem> vListItems = m_pCC->GetListItems();
// LO may pull the display text from Value. Ensure changing Value doesn't alter display text.
if (vListItems[m_nZIndex].m_aDisplayText.isEmpty())
vListItems[m_nZIndex].m_aDisplayText = vListItems[m_nZIndex].ToString();
vListItems[m_nZIndex].m_aValue = rSet;
- pCC->SetListItems(vListItems);
+ m_pCC->SetListItems(vListItems);
}
-void SwVbaContentControlListEntry::Delete()
-{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- pCC->DeleteListItem(m_nZIndex);
-}
+void SwVbaContentControlListEntry::Delete() { m_pCC->DeleteListItem(m_nZIndex); }
void SwVbaContentControlListEntry::MoveDown()
{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
// if already at last position, can't move down
- if (m_nZIndex >= pCC->GetListItems().size() - 1)
+ if (m_nZIndex >= m_pCC->GetListItems().size() - 1)
return;
- const std::optional<size_t> oSelected = pCC->GetSelectedListItem(/*bCheckDocModel=*/false);
+ const std::optional<size_t> oSelected = m_pCC->GetSelectedListItem(/*bCheckDocModel=*/false);
if (oSelected)
{
if (*oSelected == m_nZIndex)
- pCC->SetSelectedListItem(m_nZIndex + 1);
+ m_pCC->SetSelectedListItem(m_nZIndex + 1);
else if (*oSelected == m_nZIndex + 1)
- pCC->SetSelectedListItem(*oSelected - 1);
+ m_pCC->SetSelectedListItem(*oSelected - 1);
}
- std::vector<SwContentControlListItem> vListItems = pCC->GetListItems();
+ std::vector<SwContentControlListItem> vListItems = m_pCC->GetListItems();
std::swap(vListItems[m_nZIndex], vListItems[m_nZIndex + 1]);
- pCC->SetListItems(vListItems);
+ m_pCC->SetListItems(vListItems);
++m_nZIndex;
}
void SwVbaContentControlListEntry::MoveUp()
{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
// if already at position 0, can't move up
- if (!m_nZIndex || m_nZIndex >= pCC->GetListItems().size())
+ if (!m_nZIndex || m_nZIndex >= m_pCC->GetListItems().size())
return;
- const std::optional<size_t> oSelected = pCC->GetSelectedListItem(/*bCheckDocModel=*/false);
+ const std::optional<size_t> oSelected = m_pCC->GetSelectedListItem(/*bCheckDocModel=*/false);
if (oSelected)
{
if (*oSelected == m_nZIndex)
- pCC->SetSelectedListItem(m_nZIndex - 1);
+ m_pCC->SetSelectedListItem(m_nZIndex - 1);
else if (*oSelected == m_nZIndex - 1)
- pCC->SetSelectedListItem(*oSelected + 1);
+ m_pCC->SetSelectedListItem(*oSelected + 1);
}
- std::vector<SwContentControlListItem> vListItems = pCC->GetListItems();
+ std::vector<SwContentControlListItem> vListItems = m_pCC->GetListItems();
std::swap(vListItems[m_nZIndex], vListItems[m_nZIndex - 1]);
- pCC->SetListItems(vListItems);
+ m_pCC->SetListItems(vListItems);
--m_nZIndex;
}
void SwVbaContentControlListEntry::Select()
{
- std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
- assert(m_nZIndex < pCC->GetListItems().size());
- pCC->SetSelectedListItem(m_nZIndex);
- pCC->SetShowingPlaceHolder(false);
- m_rCC.Invalidate();
+ assert(m_nZIndex < m_pCC->GetListItems().size());
+ m_pCC->SetSelectedListItem(m_nZIndex);
+ m_pCC->SetShowingPlaceHolder(false);
+ if (m_pCC->GetTextAttr())
+ m_pCC->GetTextAttr()->Invalidate();
}
// XHelperInterface
diff --git a/sw/source/ui/vba/vbacontentcontrollistentry.hxx b/sw/source/ui/vba/vbacontentcontrollistentry.hxx
index e6e3c341afe0..bb55eade34d5 100644
--- a/sw/source/ui/vba/vbacontentcontrollistentry.hxx
+++ b/sw/source/ui/vba/vbacontentcontrollistentry.hxx
@@ -20,7 +20,7 @@ typedef InheritedHelperInterfaceWeakImpl<ooo::vba::word::XContentControlListEntr
class SwVbaContentControlListEntry : public SwVbaContentControlListEntry_BASE
{
private:
- SwTextContentControl& m_rCC;
+ std::shared_ptr<SwContentControl> m_pCC;
// All LO and internal UNO functions are 0-based. Convert to 1-based when sending to VBA
size_t m_nZIndex;
@@ -28,7 +28,7 @@ public:
/// @throws css::uno::RuntimeException
SwVbaContentControlListEntry(const css::uno::Reference<ooo::vba::XHelperInterface>& rParent,
const css::uno::Reference<css::uno::XComponentContext>& rContext,
- SwTextContentControl& rCC, size_t nZIndex);
+ std::shared_ptr<SwContentControl> pCC, size_t nZIndex);
~SwVbaContentControlListEntry() override;
// XContentControlListEntry
diff --git a/sw/source/ui/vba/vbacontentcontrols.cxx b/sw/source/ui/vba/vbacontentcontrols.cxx
index da0033487aee..a53bb5801763 100644
--- a/sw/source/ui/vba/vbacontentcontrols.cxx
+++ b/sw/source/ui/vba/vbacontentcontrols.cxx
@@ -26,7 +26,7 @@ using namespace ::com::sun::star;
// [in] negative indexes indicate the need to search by name, otherwise get by index,
// using SAL_MAX_INT32 to indicate the need to just get the total count.
// [out] rIndex indicates the found index, or the total number of content controls
-static SwTextContentControl*
+static std::shared_ptr<SwContentControl>
lcl_getContentControl(std::u16string_view sName, std::u16string_view sTag,
std::u16string_view sTitle, sal_Int32& rIndex,
const uno::Reference<text::XTextDocument>& xTextDocument,
@@ -38,7 +38,7 @@ lcl_getContentControl(std::u16string_view sName, std::u16string_view sTag,
assert(sTag.empty() || sTitle.empty()); // only one grouping at a time is allowed
- SwTextContentControl* pControl = nullptr;
+ std::shared_ptr<SwContentControl> pControl;
std::vector<OUString> vElementNames;
SwContentControlManager& rManager = pDoc->GetContentControlManager();
const size_t nLen = rManager.GetCount();
@@ -47,7 +47,7 @@ lcl_getContentControl(std::u16string_view sName, std::u16string_view sTag,
size_t i = static_cast<size_t>(rIndex);
// This is the normal get-by-index/getCount mode - no need for fancy filtering.
if (i < nLen)
- pControl = rManager.Get(i);
+ pControl = rManager.Get(i)->GetContentControl().GetContentControl();
else
rIndex = nLen;
}
@@ -57,17 +57,14 @@ lcl_getContentControl(std::u16string_view sName, std::u16string_view sTag,
sal_Int32 nCounter = 0;
for (size_t i = 0; i < nLen; ++i)
{
- pControl = rManager.Get(i);
- if (!sTag.empty()
- && sTag != pControl->GetContentControl().GetContentControl()->GetTag())
+ pControl = rManager.Get(i)->GetContentControl().GetContentControl();
+ if (!sTag.empty() && sTag != pControl->GetTag())
continue;
- if (!sTitle.empty()
- && sTitle != pControl->GetContentControl().GetContentControl()->GetAlias())
+ if (!sTitle.empty() && sTitle != pControl->GetAlias())
continue;
// When treated as a name, consider the integer ID to be unsigned
- const OUString sID = OUString::number(static_cast<sal_uInt32>(
- pControl->GetContentControl().GetContentControl()->GetId()));
+ const OUString sID = OUString::number(static_cast<sal_uInt32>(pControl->GetId()));
if (!sName.empty() && sName != sID)
continue;
@@ -123,7 +120,7 @@ private:
uno::Reference<text::XTextDocument> mxTextDocument;
const OUString m_sTag;
const OUString m_sTitle;
- SwTextContentControl* m_pCache;
+ std::shared_ptr<SwContentControl> m_pCache;
public:
/// @throws css::uno::RuntimeException
@@ -137,7 +134,6 @@ public:
, mxTextDocument(std::move(xTextDocument))
, m_sTag(rTag)
, m_sTitle(rTitle)
- , m_pCache(nullptr)
{
}
@@ -156,7 +152,7 @@ public:
throw lang::IndexOutOfBoundsException();
return uno::Any(uno::Reference<word::XContentControl>(
- new SwVbaContentControl(mxParent, mxContext, mxTextDocument, *m_pCache)));
+ new SwVbaContentControl(mxParent, mxContext, mxTextDocument, m_pCache)));
}
// XNameAccess
@@ -174,7 +170,7 @@ public:
throw container::NoSuchElementException();
return uno::Any(uno::Reference<word::XContentControl>(
- new SwVbaContentControl(mxParent, mxContext, mxTextDocument, *m_pCache)));
+ new SwVbaContentControl(mxParent, mxContext, mxTextDocument, m_pCache)));
}
sal_Bool SAL_CALL hasByName(const OUString& aName) override
@@ -236,7 +232,7 @@ SwVbaContentControls::SwVbaContentControls(const uno::Reference<XHelperInterface
// }
//
// return uno::Reference<ooo::vba::word::XContentControl>(
-// new SwVbaContentControl(mxParent, mxContext, m_xTextDocument, *pFieldmark));
+// new SwVbaContentControl(mxParent, mxContext, m_xTextDocument, pFieldmark));
// }
// XEnumerationAccess