Kaydet (Commit) 0aa8fbe2 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: prefix members of SwBlockCursor, SwAutoCompleteWord and TransWrp

Change-Id: I993ee72f9e162a72b1d4e89d98763fe0d2dee4d4
Reviewed-on: https://gerrit.libreoffice.org/68662Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
üst 5feff994
......@@ -40,12 +40,12 @@ class SwAutoCompleteWord
/// contains extended strings carrying source information
editeng::SortedAutoCompleteStrings m_WordList;
editeng::Trie const m_LookupTree;
SwAutoCompleteStringPtrDeque aLRULst;
SwAutoCompleteStringPtrDeque m_aLRUList;
std::unique_ptr<SwAutoCompleteWord_Impl> pImpl;
editeng::SortedAutoCompleteStrings::size_type nMaxCount;
sal_uInt16 nMinWrdLen;
bool bLockWordLst;
std::unique_ptr<SwAutoCompleteWord_Impl> m_pImpl;
editeng::SortedAutoCompleteStrings::size_type m_nMaxCount;
sal_uInt16 m_nMinWordLen;
bool m_bLockWordList;
void DocumentDying(const SwDoc& rDoc);
public:
......@@ -56,12 +56,12 @@ public:
bool InsertWord( const OUString& rWord, SwDoc& rDoc );
bool IsLockWordLstLocked() const { return bLockWordLst; }
void SetLockWordLstLocked( bool bFlag ) { bLockWordLst = bFlag; }
bool IsLockWordLstLocked() const { return m_bLockWordList; }
void SetLockWordLstLocked( bool bFlag ) { m_bLockWordList = bFlag; }
void SetMaxCount( editeng::SortedAutoCompleteStrings::size_type n );
sal_uInt16 GetMinWordLen() const { return nMinWrdLen; }
sal_uInt16 GetMinWordLen() const { return m_nMinWordLen; }
void SetMinWordLen( sal_uInt16 n );
const editeng::SortedAutoCompleteStrings& GetWordList() const
......
......@@ -798,22 +798,22 @@ namespace
class TransWrp
{
private:
std::unique_ptr<utl::TransliterationWrapper> xTransWrp;
std::unique_ptr<utl::TransliterationWrapper> m_xTransWrp;
public:
TransWrp()
{
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
xTransWrp.reset(new ::utl::TransliterationWrapper( xContext,
m_xTransWrp.reset(new ::utl::TransliterationWrapper( xContext,
TransliterationFlags::IGNORE_CASE |
TransliterationFlags::IGNORE_KANA |
TransliterationFlags::IGNORE_WIDTH ));
xTransWrp->loadModuleIfNeeded( GetAppLanguage() );
m_xTransWrp->loadModuleIfNeeded( GetAppLanguage() );
}
const ::utl::TransliterationWrapper& getTransliterationWrapper() const
{
return *xTransWrp;
return *m_xTransWrp;
}
};
......
......@@ -26,7 +26,7 @@ SwBlockCursor::~SwBlockCursor()
SwShellCursor& SwBlockCursor::getShellCursor()
{
return aCursor;
return maCursor;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -37,13 +37,13 @@ class Point;
*/
class SwBlockCursor
{
SwShellCursor aCursor;
SwShellCursor maCursor;
boost::optional<Point> maStartPt;
boost::optional<Point> maEndPt;
public:
SwBlockCursor( const SwCursorShell& rCursorSh, const SwPosition &rPos ) :
aCursor( rCursorSh, rPos ) {}
maCursor( rCursorSh, rPos ) {}
/** Access to the shell cursor
@return SwShellCursor& which represents the start and end position of the
......
......@@ -206,10 +206,10 @@ bool SwAutoCompleteString::RemoveDocument(const SwDoc& rDoc)
SwAutoCompleteWord::SwAutoCompleteWord(
editeng::SortedAutoCompleteStrings::size_type nWords, sal_uInt16 nMWrdLen ):
pImpl(new SwAutoCompleteWord_Impl(*this)),
nMaxCount( nWords ),
nMinWrdLen( nMWrdLen ),
bLockWordLst( false )
m_pImpl(new SwAutoCompleteWord_Impl(*this)),
m_nMaxCount( nWords ),
m_nMinWordLen( nMWrdLen ),
m_bLockWordList( false )
{
}
......@@ -238,13 +238,13 @@ bool SwAutoCompleteWord::InsertWord( const OUString& rWord, SwDoc& rDoc )
OUString aNewWord = rWord.replaceAll(OUStringLiteral1(CH_TXTATR_INWORD), "")
.replaceAll(OUStringLiteral1(CH_TXTATR_BREAKWORD), "");
pImpl->AddDocument(rDoc);
m_pImpl->AddDocument(rDoc);
bool bRet = false;
sal_Int32 nWrdLen = aNewWord.getLength();
while( nWrdLen && '.' == aNewWord[ nWrdLen-1 ])
--nWrdLen;
if( !bLockWordLst && nWrdLen >= nMinWrdLen )
if( !m_bLockWordList && nWrdLen >= m_nMinWordLen )
{
SwAutoCompleteString* pNew = new SwAutoCompleteString( aNewWord, nWrdLen );
pNew->AddDocument(rDoc);
......@@ -256,16 +256,16 @@ bool SwAutoCompleteWord::InsertWord( const OUString& rWord, SwDoc& rDoc )
if (aInsPair.second)
{
bRet = true;
if (aLRULst.size() >= nMaxCount)
if (m_aLRUList.size() >= m_nMaxCount)
{
// the last one needs to be removed
// so that there is space for the first one
SwAutoCompleteString* pDel = aLRULst.back();
aLRULst.pop_back();
SwAutoCompleteString* pDel = m_aLRUList.back();
m_aLRUList.pop_back();
m_WordList.erase(pDel);
delete pDel;
}
aLRULst.push_front(pNew);
m_aLRUList.push_front(pNew);
}
else
{
......@@ -277,12 +277,12 @@ bool SwAutoCompleteWord::InsertWord( const OUString& rWord, SwDoc& rDoc )
pNew->AddDocument(rDoc);
// move pNew to the front of the LRU list
SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pNew );
OSL_ENSURE( aLRULst.end() != it, "String not found" );
if ( aLRULst.begin() != it && aLRULst.end() != it )
SwAutoCompleteStringPtrDeque::iterator it = std::find( m_aLRUList.begin(), m_aLRUList.end(), pNew );
OSL_ENSURE( m_aLRUList.end() != it, "String not found" );
if ( m_aLRUList.begin() != it && m_aLRUList.end() != it )
{
aLRULst.erase( it );
aLRULst.push_front( pNew );
m_aLRUList.erase( it );
m_aLRUList.push_front( pNew );
}
}
}
......@@ -292,28 +292,28 @@ bool SwAutoCompleteWord::InsertWord( const OUString& rWord, SwDoc& rDoc )
void SwAutoCompleteWord::SetMaxCount(
editeng::SortedAutoCompleteStrings::size_type nNewMax )
{
if( nNewMax < nMaxCount && aLRULst.size() > nNewMax )
if( nNewMax < m_nMaxCount && m_aLRUList.size() > nNewMax )
{
// remove the trailing ones
SwAutoCompleteStringPtrDeque::size_type nLRUIndex = nNewMax-1;
while (nNewMax < m_WordList.size() && nLRUIndex < aLRULst.size())
while (nNewMax < m_WordList.size() && nLRUIndex < m_aLRUList.size())
{
editeng::SortedAutoCompleteStrings::const_iterator it =
m_WordList.find(aLRULst[ nLRUIndex++ ]);
m_WordList.find(m_aLRUList[ nLRUIndex++ ]);
OSL_ENSURE( m_WordList.end() != it, "String not found" );
editeng::IAutoCompleteString *const pDel = *it;
m_WordList.erase(it - m_WordList.begin());
delete pDel;
}
aLRULst.erase( aLRULst.begin() + nNewMax - 1, aLRULst.end() );
m_aLRUList.erase( m_aLRUList.begin() + nNewMax - 1, m_aLRUList.end() );
}
nMaxCount = nNewMax;
m_nMaxCount = nNewMax;
}
void SwAutoCompleteWord::SetMinWordLen( sal_uInt16 n )
{
// Do you really want to remove all words that are less than the minWrdLen?
if( n < nMinWrdLen )
if( n < m_nMinWordLen )
{
for (size_t nPos = 0; nPos < m_WordList.size(); ++nPos)
if (m_WordList[ nPos ]->GetAutoCompleteString().getLength() < n)
......@@ -322,15 +322,15 @@ void SwAutoCompleteWord::SetMinWordLen( sal_uInt16 n )
dynamic_cast<SwAutoCompleteString*>(m_WordList[nPos]);
m_WordList.erase(nPos);
SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pDel );
OSL_ENSURE( aLRULst.end() != it, "String not found" );
aLRULst.erase( it );
SwAutoCompleteStringPtrDeque::iterator it = std::find( m_aLRUList.begin(), m_aLRUList.end(), pDel );
OSL_ENSURE( m_aLRUList.end() != it, "String not found" );
m_aLRUList.erase( it );
--nPos;
delete pDel;
}
}
nMinWrdLen = n;
m_nMinWordLen = n;
}
/** Return all words matching a given prefix
......@@ -359,9 +359,9 @@ void SwAutoCompleteWord::CheckChangedList(
SwAutoCompleteString *const pDel =
dynamic_cast<SwAutoCompleteString*>(m_WordList[nMyPos]);
m_WordList.erase(nMyPos);
SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pDel );
OSL_ENSURE( aLRULst.end() != it, "String not found" );
aLRULst.erase( it );
SwAutoCompleteStringPtrDeque::iterator it = std::find( m_aLRUList.begin(), m_aLRUList.end(), pDel );
OSL_ENSURE( m_aLRUList.end() != it, "String not found" );
m_aLRUList.erase( it );
delete pDel;
if( nMyPos >= --nMyLen )
break;
......@@ -375,9 +375,9 @@ void SwAutoCompleteWord::CheckChangedList(
{
SwAutoCompleteString *const pDel =
dynamic_cast<SwAutoCompleteString*>(m_WordList[nNewPos]);
SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pDel );
OSL_ENSURE( aLRULst.end() != it, "String not found" );
aLRULst.erase( it );
SwAutoCompleteStringPtrDeque::iterator it = std::find( m_aLRUList.begin(), m_aLRUList.end(), pDel );
OSL_ENSURE( m_aLRUList.end() != it, "String not found" );
m_aLRUList.erase( it );
delete pDel;
}
// remove from array
......@@ -388,7 +388,7 @@ void SwAutoCompleteWord::CheckChangedList(
void SwAutoCompleteWord::DocumentDying(const SwDoc& rDoc)
{
pImpl->RemoveDocument(rDoc);
m_pImpl->RemoveDocument(rDoc);
SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get().GetAutoCorrect();
const bool bDelete = !pACorr->GetSwFlags().bAutoCmpltKeepList;
......@@ -398,9 +398,9 @@ void SwAutoCompleteWord::DocumentDying(const SwDoc& rDoc)
if(pCurrent && pCurrent->RemoveDocument(rDoc) && bDelete)
{
m_WordList.erase(nPos - 1);
SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pCurrent );
OSL_ENSURE( aLRULst.end() != it, "word not found in LRU list" );
aLRULst.erase( it );
SwAutoCompleteStringPtrDeque::iterator it = std::find( m_aLRUList.begin(), m_aLRUList.end(), pCurrent );
OSL_ENSURE( m_aLRUList.end() != it, "word not found in LRU list" );
m_aLRUList.erase( it );
delete pCurrent;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment