sw: prefix members of FieldDocWatchingStack, NaviContentBookmark, ...
... SwTransferDdeLink and sw::sidebarwindows::SidebarWinAccessible
See tdf#94879 for motivation.
Change-Id: I4aba516260ad1f55081c91d8812ca9060ad11bb1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126010
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index ab31e7f..45e13b3 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -176,13 +176,13 @@ namespace {
class SwTransferDdeLink : public ::sfx2::SvBaseLink
{
OUString sName;
::sfx2::SvLinkSourceRef refObj;
SwTransferable& rTrnsfr;
SwDocShell* pDocShell;
sal_uLong nOldTimeOut;
bool bDelBookmark : 1;
bool bInDisconnect : 1;
OUString m_sName;
::sfx2::SvLinkSourceRef m_xRefObj;
SwTransferable& m_rTransfer;
SwDocShell* m_pDocShell;
sal_uLong m_nOldTimeOut;
bool m_bDelBookmark : 1;
bool m_bInDisconnect : 1;
bool FindDocShell();
@@ -4212,18 +4212,18 @@ SwTransferable* SwTransferable::GetSwTransferable( const TransferableDataHelper&
}
SwTransferDdeLink::SwTransferDdeLink( SwTransferable& rTrans, SwWrtShell& rSh )
: rTrnsfr(rTrans)
, pDocShell(nullptr)
, nOldTimeOut(0)
, bDelBookmark(false)
, bInDisconnect(false)
: m_rTransfer(rTrans)
, m_pDocShell(nullptr)
, m_nOldTimeOut(0)
, m_bDelBookmark(false)
, m_bInDisconnect(false)
{
// we only end up here with table- or text selection
if( SelectionType::TableCell & rSh.GetSelectionType() )
{
SwFrameFormat* pFormat = rSh.GetTableFormat();
if( pFormat )
sName = pFormat->GetName();
m_sName = pFormat->GetName();
}
else
{
@@ -4238,36 +4238,36 @@ SwTransferDdeLink::SwTransferDdeLink( SwTransferable& rTrans, SwWrtShell& rSh )
IDocumentMarkAccess::MarkType::DDE_BOOKMARK);
if(pMark)
{
sName = pMark->GetName();
bDelBookmark = true;
m_sName = pMark->GetName();
m_bDelBookmark = true;
if( !bIsModified )
rSh.ResetModified();
}
else
sName.clear();
m_sName.clear();
rSh.DoUndo( bUndo );
}
if( sName.isEmpty() ||
nullptr == ( pDocShell = rSh.GetDoc()->GetDocShell() ))
if( m_sName.isEmpty() ||
nullptr == ( m_pDocShell = rSh.GetDoc()->GetDocShell() ))
return;
// then we create our "server" and connect to it
refObj = pDocShell->DdeCreateLinkSource( sName );
if( refObj.is() )
m_xRefObj = m_pDocShell->DdeCreateLinkSource( m_sName );
if( m_xRefObj.is() )
{
refObj->AddConnectAdvise( this );
refObj->AddDataAdvise( this,
m_xRefObj->AddConnectAdvise( this );
m_xRefObj->AddDataAdvise( this,
OUString(),
ADVISEMODE_NODATA | ADVISEMODE_ONLYONCE );
nOldTimeOut = refObj->GetUpdateTimeout();
refObj->SetUpdateTimeout( 0 );
m_nOldTimeOut = m_xRefObj->GetUpdateTimeout();
m_xRefObj->SetUpdateTimeout( 0 );
}
}
SwTransferDdeLink::~SwTransferDdeLink()
{
if( refObj.is() )
if( m_xRefObj.is() )
Disconnect( true );
}
@@ -4275,10 +4275,10 @@ SwTransferDdeLink::~SwTransferDdeLink()
const uno::Any& )
{
// well, that's it with the link
if( !bInDisconnect )
if( !m_bInDisconnect )
{
if( FindDocShell() && pDocShell->GetView() )
rTrnsfr.RemoveDDELinkFormat( pDocShell->GetView()->GetEditWin() );
if( FindDocShell() && m_pDocShell->GetView() )
m_rTransfer.RemoveDDELinkFormat( m_pDocShell->GetView()->GetEditWin() );
Disconnect( false );
}
return SUCCESS;
@@ -4286,15 +4286,15 @@ SwTransferDdeLink::~SwTransferDdeLink()
bool SwTransferDdeLink::WriteData( SvStream& rStrm )
{
if( !refObj.is() || !FindDocShell() )
if( !m_xRefObj.is() || !FindDocShell() )
return false;
rtl_TextEncoding eEncoding = osl_getThreadTextEncoding();
const OString aAppNm(OUStringToOString(
Application::GetAppName(), eEncoding));
const OString aTopic(OUStringToOString(
pDocShell->GetTitle(SFX_TITLE_FULLNAME), eEncoding));
const OString aName(OUStringToOString(sName, eEncoding));
m_pDocShell->GetTitle(SFX_TITLE_FULLNAME), eEncoding));
const OString aName(OUStringToOString(m_sName, eEncoding));
std::unique_ptr<char[]> pMem(new char[ aAppNm.getLength() + aTopic.getLength() + aName.getLength() + 4 ]);
@@ -4312,15 +4312,15 @@ bool SwTransferDdeLink::WriteData( SvStream& rStrm )
rStrm.WriteBytes( pMem.get(), nLen );
pMem.reset();
IDocumentMarkAccess* const pMarkAccess = pDocShell->GetDoc()->getIDocumentMarkAccess();
IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(sName);
IDocumentMarkAccess* const pMarkAccess = m_pDocShell->GetDoc()->getIDocumentMarkAccess();
IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(m_sName);
if(ppMark != pMarkAccess->getAllMarksEnd()
&& IDocumentMarkAccess::GetType(**ppMark) != IDocumentMarkAccess::MarkType::BOOKMARK)
{
// the mark is still a DdeBookmark
// we replace it with a Bookmark, so it will get saved etc.
::sw::mark::IMark* const pMark = *ppMark;
::sfx2::SvLinkSource* p = refObj.get();
::sfx2::SvLinkSource* p = m_xRefObj.get();
SwServerObject& rServerObject = dynamic_cast<SwServerObject&>(*p);
// collecting state of old mark
@@ -4347,7 +4347,7 @@ bool SwTransferDdeLink::WriteData( SvStream& rStrm )
rServerObject.SetDdeBookmark(*pNewMark);
}
bDelBookmark = false;
m_bDelBookmark = false;
return true;
}
@@ -4355,13 +4355,13 @@ void SwTransferDdeLink::Disconnect( bool bRemoveDataAdvise )
{
// don't accept DataChanged anymore, when already in Disconnect!
// (DTOR from Bookmark sends a DataChanged!)
bool bOldDisconnect = bInDisconnect;
bInDisconnect = true;
bool bOldDisconnect = m_bInDisconnect;
m_bInDisconnect = true;
// destroy the unused bookmark again (without Undo!)?
if( bDelBookmark && refObj.is() && FindDocShell() )
if( m_bDelBookmark && m_xRefObj.is() && FindDocShell() )
{
SwDoc* pDoc = pDocShell->GetDoc();
SwDoc* pDoc = m_pDocShell->GetDoc();
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
// #i58448#
@@ -4371,29 +4371,29 @@ void SwTransferDdeLink::Disconnect( bool bRemoveDataAdvise )
bool bIsModified = pDoc->getIDocumentState().IsModified();
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
pMarkAccess->deleteMark(pMarkAccess->findMark(sName));
pMarkAccess->deleteMark(pMarkAccess->findMark(m_sName));
if( !bIsModified )
pDoc->getIDocumentState().ResetModified();
// #i58448#
pDoc->SetOle2Link( aSavedOle2Link );
bDelBookmark = false;
m_bDelBookmark = false;
}
if( refObj.is() )
if( m_xRefObj.is() )
{
refObj->SetUpdateTimeout( nOldTimeOut );
refObj->RemoveConnectAdvise( this );
m_xRefObj->SetUpdateTimeout( m_nOldTimeOut );
m_xRefObj->RemoveConnectAdvise( this );
if( bRemoveDataAdvise )
// in a DataChanged the SelectionObject must NEVER be deleted
// is already handled by the base class
// (ADVISEMODE_ONLYONCE!!!!)
// but always in normal Disconnect!
refObj->RemoveAllDataAdvise( this );
refObj.clear();
m_xRefObj->RemoveAllDataAdvise( this );
m_xRefObj.clear();
}
bInDisconnect = bOldDisconnect;
m_bInDisconnect = bOldDisconnect;
}
bool SwTransferDdeLink::FindDocShell()
@@ -4401,26 +4401,26 @@ bool SwTransferDdeLink::FindDocShell()
SfxObjectShell* pTmpSh = SfxObjectShell::GetFirst( checkSfxObjectShell<SwDocShell> );
while( pTmpSh )
{
if( pTmpSh == pDocShell ) // that's what we want to have
if( pTmpSh == m_pDocShell ) // that's what we want to have
{
if( pDocShell->GetDoc() )
if( m_pDocShell->GetDoc() )
return true;
break; // the Doc is not there anymore, so leave!
}
pTmpSh = SfxObjectShell::GetNext( *pTmpSh, checkSfxObjectShell<SwDocShell> );
}
pDocShell = nullptr;
m_pDocShell = nullptr;
return false;
}
void SwTransferDdeLink::Closed()
{
if( !bInDisconnect && refObj.is() )
if( !m_bInDisconnect && m_xRefObj.is() )
{
refObj->RemoveAllDataAdvise( this );
refObj->RemoveConnectAdvise( this );
refObj.clear();
m_xRefObj->RemoveAllDataAdvise( this );
m_xRefObj->RemoveConnectAdvise( this );
m_xRefObj.clear();
}
}
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index a7dc4d3..f6d5563 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1408,8 +1408,8 @@ public:
//Fields more than once.
class FieldDocWatchingStack : public SfxListener
{
std::vector<std::unique_ptr<SwSidebarItem>>& sidebarItemVector;
std::vector<const SwFormatField*> v;
std::vector<std::unique_ptr<SwSidebarItem>>& m_aSidebarItems;
std::vector<const SwFormatField*> m_aFormatFields;
SwDocShell& m_rDocShell;
FilterFunctor& m_rFilter;
@@ -1427,7 +1427,7 @@ class FieldDocWatchingStack : public SfxListener
if (!bAllInvalidated && m_rFilter(pField))
{
EndListening(const_cast<SwFormatField&>(*pField));
v.erase(std::remove(v.begin(), v.end(), pField), v.end());
m_aFormatFields.erase(std::remove(m_aFormatFields.begin(), m_aFormatFields.end(), pField), m_aFormatFields.end());
}
}
else if (pHint->Which() == SwFormatFieldHintWhich::INSERTED)
@@ -1437,7 +1437,7 @@ class FieldDocWatchingStack : public SfxListener
if (!bAllInvalidated && m_rFilter(pField))
{
StartListening(const_cast<SwFormatField&>(*pField));
v.push_back(pField);
m_aFormatFields.push_back(pField);
}
}
@@ -1449,7 +1449,7 @@ class FieldDocWatchingStack : public SfxListener
public:
FieldDocWatchingStack(std::vector<std::unique_ptr<SwSidebarItem>>& in, SwDocShell &rDocShell, FilterFunctor& rFilter)
: sidebarItemVector(in)
: m_aSidebarItems(in)
, m_rDocShell(rDocShell)
, m_rFilter(rFilter)
{
@@ -1459,20 +1459,20 @@ public:
void FillVector()
{
EndListeningToAllFields();
v.clear();
v.reserve(sidebarItemVector.size());
for (auto const& p : sidebarItemVector)
m_aFormatFields.clear();
m_aFormatFields.reserve(m_aSidebarItems.size());
for (auto const& p : m_aSidebarItems)
{
const SwFormatField& rField = p->GetFormatField();
if (!m_rFilter(&rField))
continue;
StartListening(const_cast<SwFormatField&>(rField));
v.push_back(&rField);
m_aFormatFields.push_back(&rField);
}
}
void EndListeningToAllFields()
{
for (auto const& pField : v)
for (auto const& pField : m_aFormatFields)
{
EndListening(const_cast<SwFormatField&>(*pField));
}
@@ -1484,11 +1484,11 @@ public:
}
const SwFormatField* pop()
{
if (v.empty())
if (m_aFormatFields.empty())
return nullptr;
const SwFormatField* p = v.back();
const SwFormatField* p = m_aFormatFields.back();
EndListening(const_cast<SwFormatField&>(*p));
v.pop_back();
m_aFormatFields.pop_back();
return p;
}
};
diff --git a/sw/source/uibase/docvw/SidebarWinAcc.cxx b/sw/source/uibase/docvw/SidebarWinAcc.cxx
index 9c2247c..54c30f5 100644
--- a/sw/source/uibase/docvw/SidebarWinAcc.cxx
+++ b/sw/source/uibase/docvw/SidebarWinAcc.cxx
@@ -100,7 +100,7 @@ SidebarWinAccessible::SidebarWinAccessible( sw::annotation::SwAnnotationWin& rSi
: mrSidebarWin( rSidebarWin )
, mrViewShell( rViewShell )
, mpAnchorFrame( rSidebarItem.maLayoutInfo.mpAnchorFrame )
, bAccContextCreated( false )
, m_bAccContextCreated( false )
{
SetWindow( &mrSidebarWin );
}
@@ -111,7 +111,7 @@ SidebarWinAccessible::~SidebarWinAccessible()
void SidebarWinAccessible::ChangeSidebarItem( const SwSidebarItem& rSidebarItem )
{
if ( !bAccContextCreated )
if ( !m_bAccContextCreated )
return;
css::uno::Reference< css::accessibility::XAccessibleContext > xAcc
@@ -133,7 +133,7 @@ css::uno::Reference< css::accessibility::XAccessibleContext > SidebarWinAccessib
new SidebarWinAccessibleContext( mrSidebarWin,
mrViewShell,
mpAnchorFrame );
bAccContextCreated = true;
m_bAccContextCreated = true;
return pAccContext;
}
diff --git a/sw/source/uibase/docvw/SidebarWinAcc.hxx b/sw/source/uibase/docvw/SidebarWinAcc.hxx
index 6484baa..5453a42 100644
--- a/sw/source/uibase/docvw/SidebarWinAcc.hxx
+++ b/sw/source/uibase/docvw/SidebarWinAcc.hxx
@@ -45,7 +45,7 @@ class SidebarWinAccessible : public VCLXWindow
sw::annotation::SwAnnotationWin& mrSidebarWin;
SwViewShell& mrViewShell;
const SwFrame* mpAnchorFrame;
bool bAccContextCreated;
bool m_bAccContextCreated;
};
} // end of namespace sw::sidebarwindows
diff --git a/sw/source/uibase/inc/navicont.hxx b/sw/source/uibase/inc/navicont.hxx
index 79ff0ce..e6ee7e3 100644
--- a/sw/source/uibase/inc/navicont.hxx
+++ b/sw/source/uibase/inc/navicont.hxx
@@ -34,19 +34,19 @@ enum class RegionMode;
class NaviContentBookmark
{
OUString aUrl; // URL including jump mark
OUString aDescr; // description
tools::Long nDocSh; // address of DocShell
RegionMode nDefDrag; // description contains defaultDragType
OUString m_aUrl; // URL including jump mark
OUString m_aDescription; // description
tools::Long m_nDocSh; // address of DocShell
RegionMode m_nDefaultDrag; // description contains defaultDragType
public:
NaviContentBookmark();
NaviContentBookmark( const OUString &rUrl, const OUString& rDesc,
RegionMode nDragType, const SwDocShell* );
const OUString& GetURL() const { return aUrl; }
const OUString& GetDescription() const { return aDescr; }
RegionMode GetDefaultDragType() const { return nDefDrag; }
const OUString& GetURL() const { return m_aUrl; }
const OUString& GetDescription() const { return m_aDescription; }
RegionMode GetDefaultDragType() const { return m_nDefaultDrag; }
void Copy( TransferDataContainer& rData ) const;
bool Paste( const TransferableDataHelper& rData );
};
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 0dbbd73..edf53fc 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -5281,8 +5281,8 @@ void SwContentTree::GotoContent(const SwContent* pCnt)
// Now even the matching text::Bookmark
NaviContentBookmark::NaviContentBookmark()
:
nDocSh(0),
nDefDrag( RegionMode::NONE )
m_nDocSh(0),
m_nDefaultDrag( RegionMode::NONE )
{
}
@@ -5290,10 +5290,10 @@ NaviContentBookmark::NaviContentBookmark( const OUString &rUrl,
const OUString& rDesc,
RegionMode nDragType,
const SwDocShell* pDocSh ) :
aUrl( rUrl ),
aDescr(rDesc),
nDocSh(reinterpret_cast<sal_IntPtr>(pDocSh)),
nDefDrag( nDragType )
m_aUrl( rUrl ),
m_aDescription(rDesc),
m_nDocSh(reinterpret_cast<sal_IntPtr>(pDocSh)),
m_nDefaultDrag( nDragType )
{
}
@@ -5301,10 +5301,10 @@ void NaviContentBookmark::Copy( TransferDataContainer& rData ) const
{
rtl_TextEncoding eSysCSet = osl_getThreadTextEncoding();
OString sStrBuf(OUStringToOString(aUrl, eSysCSet) + OStringChar(NAVI_BOOKMARK_DELIM) +
OUStringToOString(aDescr, eSysCSet) + OStringChar(NAVI_BOOKMARK_DELIM) +
OString::number(static_cast<int>(nDefDrag)) + OStringChar(NAVI_BOOKMARK_DELIM) +
OString::number(nDocSh));
OString sStrBuf(OUStringToOString(m_aUrl, eSysCSet) + OStringChar(NAVI_BOOKMARK_DELIM) +
OUStringToOString(m_aDescription, eSysCSet) + OStringChar(NAVI_BOOKMARK_DELIM) +
OString::number(static_cast<int>(m_nDefaultDrag)) + OStringChar(NAVI_BOOKMARK_DELIM) +
OString::number(m_nDocSh));
rData.CopyByteString(SotClipboardFormatId::SONLK, sStrBuf);
}
@@ -5315,10 +5315,10 @@ bool NaviContentBookmark::Paste( const TransferableDataHelper& rData )
if( bRet )
{
sal_Int32 nPos = 0;
aUrl = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos );
aDescr = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos );
nDefDrag= static_cast<RegionMode>( sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos ).toInt32() );
nDocSh = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos ).toInt32();
m_aUrl = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos );
m_aDescription = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos );
m_nDefaultDrag= static_cast<RegionMode>( sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos ).toInt32() );
m_nDocSh = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos ).toInt32();
}
return bRet;
}