summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/uibase/app/docst.cxx5
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx56
2 files changed, 34 insertions, 27 deletions
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 3581cac6d09b..baa2a4ca74ef 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1157,6 +1157,11 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString &rName, SfxStyleFamily nFa
}
case SfxStyleFamily::Para:
{
+ // When outline-folding is enabled, MakeAllOutlineContentTemporarilyVisible makes
+ // application of a paragraph style that has an outline-level greater than the previous
+ // outline node become folded content of the previous outline node if the previous
+ // outline node's content is folded.
+ MakeAllOutlineContentTemporarilyVisible a(GetDoc());
// #i62675#
// clear also list attributes at affected text nodes, if paragraph
// style has the list style attribute set.
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index d9374e18a66b..8bbdb869e539 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -2491,30 +2491,6 @@ void SwWrtShell::InvalidateOutlineContentVisibility()
void SwWrtShell::MakeAllFoldedOutlineContentVisible(bool bMakeVisible)
{
- // deselect any drawing or frame and leave editing mode
- SdrView* pSdrView = GetDrawView();
- if (pSdrView && pSdrView->IsTextEdit() )
- {
- bool bLockView = IsViewLocked();
- LockView(true);
- EndTextEdit();
- LockView(bLockView);
- }
-
- if (IsSelFrameMode() || IsObjSelected())
- {
- UnSelectFrame();
- LeaveSelFrameMode();
- GetView().LeaveDrawCreate();
- EnterStdMode();
- DrawSelChanged();
- GetView().StopShellTimer();
- }
- else
- EnterStdMode();
-
- SwOutlineNodes::size_type nPos = GetOutlinePos();
-
if (bMakeVisible)
{
// make all content visible
@@ -2548,17 +2524,43 @@ void SwWrtShell::MakeAllFoldedOutlineContentVisible(bool bMakeVisible)
}
else
{
+ if (SdrView* pSdrView = GetDrawView(); pSdrView && pSdrView->IsTextEdit() )
+ {
+ bool bLockView = IsViewLocked();
+ LockView(true);
+ EndTextEdit();
+ LockView(bLockView);
+ }
+ if (IsSelFrameMode() || IsObjSelected())
+ {
+ UnSelectFrame();
+ LeaveSelFrameMode();
+ GetView().LeaveDrawCreate();
+ EnterStdMode();
+ }
+
+ // Get current frame in which the cursor is positioned for use in placing the cursor.
+ const SwFrame* pCurrFrame = GetCurrFrame(false);
+
+ SwOutlineNodes::size_type nPos = GetOutlinePos();
+
StartAction();
InvalidateOutlineContentVisibility();
EndAction();
- // If needed, find visible outline node to place cursor.
- if (nPos != SwOutlineNodes::npos && !IsOutlineContentVisible(nPos))
+ // If needed, find visible outline node frame to place cursor.
+ if (!pCurrFrame || !pCurrFrame->isFrameAreaDefinitionValid() || pCurrFrame->IsInDtor() ||
+ (nPos != SwOutlineNodes::npos &&
+ !GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(nullptr)))
{
- while (nPos != SwOutlineNodes::npos && !GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(nullptr))
+ while (nPos != SwOutlineNodes::npos &&
+ !GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(nullptr))
--nPos;
if (nPos != SwOutlineNodes::npos)
+ {
+ EnterStdMode();
GotoOutline(nPos);
+ }
}
}
GetView().GetDocShell()->Broadcast(SfxHint(SfxHintId::DocChanged));