Kaydet (Commit) 039b7c50 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: use std::unique_ptr in crsr code

Change-Id: I108683bc2548c9572d2800c062a2e036808464a8
üst e7c134af
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <memory>
#include <bookmrk.hxx> #include <bookmrk.hxx>
#include <IDocumentMarkAccess.hxx> #include <IDocumentMarkAccess.hxx>
#include <IDocumentUndoRedo.hxx> #include <IDocumentUndoRedo.hxx>
...@@ -160,13 +161,13 @@ namespace sw { namespace mark ...@@ -160,13 +161,13 @@ namespace sw { namespace mark
void MarkBase::SetMarkPos(const SwPosition& rNewPos) void MarkBase::SetMarkPos(const SwPosition& rNewPos)
{ {
::boost::scoped_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos1); std::unique_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos1);
m_pPos1->nContent.SetMark(this); m_pPos1->nContent.SetMark(this);
} }
void MarkBase::SetOtherMarkPos(const SwPosition& rNewPos) void MarkBase::SetOtherMarkPos(const SwPosition& rNewPos)
{ {
::boost::scoped_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos2); std::unique_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos2);
m_pPos2->nContent.SetMark(this); m_pPos2->nContent.SetMark(this);
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include <swundo.hxx> #include <swundo.hxx>
#include <crsskip.hxx> #include <crsskip.hxx>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/scoped_ptr.hpp> #include <memory>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
...@@ -888,7 +888,7 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFn fnMove, ...@@ -888,7 +888,7 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFn fnMove,
const sal_uInt16 nWhich = rAttr.Which(); const sal_uInt16 nWhich = rAttr.Which();
bool bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich); bool bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich);
boost::scoped_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion )); std::unique_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion ));
bool bFound = false; bool bFound = false;
bool bFirst = true; bool bFirst = true;
...@@ -966,7 +966,7 @@ typedef bool (*FnSearchAttr)( const SwTextNode&, SwAttrCheckArr&, SwPaM& ); ...@@ -966,7 +966,7 @@ typedef bool (*FnSearchAttr)( const SwTextNode&, SwAttrCheckArr&, SwPaM& );
bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFn fnMove, bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFn fnMove,
const SwPaM *pRegion, bool bInReadOnly, bool bMoveFirst ) const SwPaM *pRegion, bool bInReadOnly, bool bMoveFirst )
{ {
boost::scoped_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion )); std::unique_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion ));
bool bFound = false; bool bFound = false;
bool bFirst = true; bool bFirst = true;
...@@ -1153,7 +1153,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, ...@@ -1153,7 +1153,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
const_cast< SwPaM* >(pRegion)->GetRingContainer().merge( rCursor.GetRingContainer() ); const_cast< SwPaM* >(pRegion)->GetRingContainer().merge( rCursor.GetRingContainer() );
} }
boost::scoped_ptr<OUString> pRepl( (bRegExp) ? std::unique_ptr<OUString> pRepl( (bRegExp) ?
ReplaceBackReferences( *pSearchOpt, pCrsr ) : 0 ); ReplaceBackReferences( *pSearchOpt, pCrsr ) : 0 );
rCursor.GetDoc()->getIDocumentContentOperations().ReplaceRange( *pCrsr, rCursor.GetDoc()->getIDocumentContentOperations().ReplaceRange( *pCrsr,
(pRepl.get()) ? *pRepl : pSearchOpt->replaceString, (pRepl.get()) ? *pRepl : pSearchOpt->replaceString,
......
...@@ -19,14 +19,14 @@ ...@@ -19,14 +19,14 @@
#include <doc.hxx> #include <doc.hxx>
#include <pamtyp.hxx> #include <pamtyp.hxx>
#include <boost/scoped_ptr.hpp> #include <memory>
bool SwPaM::Find( const SwFormat& rFormat, SwMoveFn fnMove, bool SwPaM::Find( const SwFormat& rFormat, SwMoveFn fnMove,
const SwPaM *pRegion, bool bInReadOnly ) const SwPaM *pRegion, bool bInReadOnly )
{ {
bool bFound = false; bool bFound = false;
const bool bSrchForward = (fnMove == fnMoveForward); const bool bSrchForward = (fnMove == fnMoveForward);
boost::scoped_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion )); std::unique_ptr<SwPaM> pPam(MakeRegion( fnMove, pRegion ));
// if at beginning/end then move it out of the node // if at beginning/end then move it out of the node
if( bSrchForward if( bSrchForward
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#include <svx/sdr/overlay/overlayselection.hxx> #include <svx/sdr/overlay/overlayselection.hxx>
#include <overlayrangesoutline.hxx> #include <overlayrangesoutline.hxx>
#include <boost/scoped_ptr.hpp> #include <memory>
#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <paintfrm.hxx> #include <paintfrm.hxx>
...@@ -410,7 +410,7 @@ void SwSelPaintRects::HighlightInputField() ...@@ -410,7 +410,7 @@ void SwSelPaintRects::HighlightInputField()
if ( pCurTextInputFieldAtCrsr != NULL ) if ( pCurTextInputFieldAtCrsr != NULL )
{ {
SwTextNode* pTextNode = pCurTextInputFieldAtCrsr->GetpTextNode(); SwTextNode* pTextNode = pCurTextInputFieldAtCrsr->GetpTextNode();
::boost::scoped_ptr<SwShellCrsr> pCrsrForInputTextField( std::unique_ptr<SwShellCrsr> pCrsrForInputTextField(
new SwShellCrsr( *GetShell(), SwPosition( *pTextNode, pCurTextInputFieldAtCrsr->GetStart() ) ) ); new SwShellCrsr( *GetShell(), SwPosition( *pTextNode, pCurTextInputFieldAtCrsr->GetStart() ) ) );
pCrsrForInputTextField->SetMark(); pCrsrForInputTextField->SetMark();
pCrsrForInputTextField->GetMark()->nNode = *pTextNode; pCrsrForInputTextField->GetMark()->nNode = *pTextNode;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <cppuhelper/weakref.hxx> #include <cppuhelper/weakref.hxx>
#include <sfx2/Metadatable.hxx> #include <sfx2/Metadatable.hxx>
#include <vcl/keycod.hxx> #include <vcl/keycod.hxx>
#include <boost/scoped_ptr.hpp> #include <memory>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <map> #include <map>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
...@@ -114,8 +114,8 @@ namespace sw { ...@@ -114,8 +114,8 @@ namespace sw {
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) SAL_OVERRIDE; virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) SAL_OVERRIDE;
MarkBase(const SwPaM& rPaM, const OUString& rName); MarkBase(const SwPaM& rPaM, const OUString& rName);
::boost::scoped_ptr<SwPosition> m_pPos1; std::unique_ptr<SwPosition> m_pPos1;
::boost::scoped_ptr<SwPosition> m_pPos2; std::unique_ptr<SwPosition> m_pPos2;
OUString m_aName; OUString m_aName;
static OUString GenerateNewName(const OUString& rPrefix); static OUString GenerateNewName(const OUString& rPrefix);
......
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