[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 2 commits - sd/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 27 12:29:58 UTC 2020
sd/source/ui/view/Outliner.cxx | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
New commits:
commit 3fe25e8349f6dfdcf5784928309e9d2eee342ba0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 27 14:27:30 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 27 14:27:30 2020 +0200
sd: some style fixes in Outliner.cxx
Also no need to reset the mpImpl in destructor when it will be
reset and destroyed in the next step anyway.
Change-Id: I5027f962efc4159e61aa7eda26619db2e3b9434c
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index e98c1bde5795..6a72dbcf1327 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -211,7 +211,6 @@ SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode )
/// Nothing spectacular in the destructor.
SdOutliner::~SdOutliner()
{
- mpImpl.reset();
}
/** Prepare find&replace or spellchecking. This distinguishes between three
@@ -467,7 +466,9 @@ bool SdOutliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem)
const SvxSearchCmd nCommand (mpSearchItem->GetCommand());
if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL)
+ {
bEndOfSearch = SearchAndReplaceAll ();
+ }
else
{
RememberStartPosition ();
@@ -573,6 +574,7 @@ void SdOutliner::Initialize (bool bDirectionIsForward)
bool SdOutliner::SearchAndReplaceAll()
{
bool bRet = true;
+
// Save the current position to be restored after having replaced all
// matches.
RememberStartPosition ();
@@ -756,13 +758,13 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
pOutlinerView = mpImpl->GetOutlinerView();
}
- if (pViewShell != nullptr)
+ if (pViewShell)
{
mpView = pViewShell->GetView();
mpWindow = pViewShell->GetActiveWindow();
pOutlinerView->SetWindow(mpWindow);
- if( nullptr != dynamic_cast< const sd::DrawViewShell *>( pViewShell.get() ))
+ if (nullptr != dynamic_cast<const sd::DrawViewShell*>(pViewShell.get()))
{
// When replacing we first check if there is a selection
// indicating a match. If there is then replace it. The
@@ -785,7 +787,7 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
{
ProvideNextTextObject ();
- if ( ! mbEndOfSearch)
+ if (!mbEndOfSearch)
{
// Remember the current position as the last one with a
// text object.
commit 78be6a72950450e2ed419338d6dc18d1306d56f2
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 27 14:20:44 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 27 14:20:44 2020 +0200
sd: in Outline add getViewShellBase to simplify code
This simplifies constant casting of SfxViewShell::Current to
sd::ViewShellBase. Instead of doing it in every method, let's
have a dedicated function for that.
Change-Id: Iadbe446c7edce5df40c2da14e3eee65012dd4d77
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index e77e60c5d305..e98c1bde5795 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -111,6 +111,16 @@ private:
OutlinerView* mpOutlineView;
};
+namespace
+{
+
+sd::ViewShellBase* getViewShellBase()
+{
+ return dynamic_cast<sd::ViewShellBase*>(SfxViewShell::Current());
+}
+
+} // end anonymous namespace
+
SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode )
: SdrOutliner( &pDoc->GetItemPool(), nMode ),
mpImpl(new Implementation()),
@@ -228,7 +238,7 @@ void SdOutliner::PrepareSpelling()
{
mbPrepareSpellingPending = false;
- sd::ViewShellBase* pBase = dynamic_cast< sd::ViewShellBase *>( SfxViewShell::Current() );
+ sd::ViewShellBase* pBase = getViewShellBase();
if (pBase != nullptr)
SetViewShell (pBase->GetMainViewShell());
SetRefDevice( SD_MOD()->GetVirtualRefDevice() );
@@ -270,7 +280,7 @@ void SdOutliner::EndSpelling()
std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
std::shared_ptr<sd::ViewShell> pOldViewShell (pViewShell);
- sd::ViewShellBase* pBase = dynamic_cast< sd::ViewShellBase *>( SfxViewShell::Current() );
+ sd::ViewShellBase* pBase = getViewShellBase();
if (pBase != nullptr)
pViewShell = pBase->GetMainViewShell();
else
@@ -413,7 +423,7 @@ bool SdOutliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem)
mpDrawDocument->GetDocSh()->SetWaitCursor( true );
if (mbPrepareSpellingPending)
PrepareSpelling();
- sd::ViewShellBase* pBase = dynamic_cast< sd::ViewShellBase *>( SfxViewShell::Current() );
+ sd::ViewShellBase* pBase = getViewShellBase();
// Determine whether we have to abort the search. This is necessary
// when the main view shell does not support searching.
bool bAbort = false;
@@ -1618,7 +1628,7 @@ void SdOutliner::BeginConversion()
{
SetRefDevice( SD_MOD()->GetVirtualRefDevice() );
- sd::ViewShellBase* pBase = dynamic_cast<sd::ViewShellBase*>( SfxViewShell::Current() );
+ sd::ViewShellBase* pBase = getViewShellBase();
if (pBase != nullptr)
SetViewShell (pBase->GetMainViewShell());
More information about the Libreoffice-commits
mailing list