tdf#148629 - Disable demote command on non-list paragraphs
Change-Id: I04fe77233539ecaa614eed3e28d4243e41392432 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205158 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
This commit is contained in:
@@ -550,6 +550,38 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf169813_prevent_unintended_dashed_li
|
||||
CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, rStyleItem.GetValue());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf148629_disabled_demote_command)
|
||||
{
|
||||
createSdImpressDoc();
|
||||
SdXImpressDocument* pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
|
||||
CPPUNIT_ASSERT(pXImpressDocument);
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
CPPUNIT_ASSERT(pViewShell);
|
||||
|
||||
// Start text edit of the empty content shape
|
||||
SdPage* pActualPage = pViewShell->GetActualPage();
|
||||
pActualPage->SetAutoLayout(AUTOLAYOUT_TITLE_CONTENT, true);
|
||||
insertStringToObject(1, u"List Item", /*bUseEscape*/ false);
|
||||
|
||||
// Check that the demote command is enabled
|
||||
std::unique_ptr<SfxPoolItem> pItem;
|
||||
CPPUNIT_ASSERT_EQUAL(
|
||||
SfxItemState::DEFAULT,
|
||||
pViewShell->GetViewFrame()->GetBindings().QueryState(SID_OUTLINE_RIGHT, pItem));
|
||||
|
||||
// Start text edit of the empty title shape
|
||||
typeKey(pXImpressDocument, KEY_ESCAPE);
|
||||
insertStringToObject(0, u"Title", /*bUseEscape*/ false);
|
||||
|
||||
// Without the fix in place, this test would have failed with:
|
||||
// - Expected: 1 (SfxItemState::DISABLED)
|
||||
// - Actual : 32 (SfxItemState::DEFAULT)
|
||||
// i.e. the demote command was not disabled
|
||||
CPPUNIT_ASSERT_EQUAL(
|
||||
SfxItemState::DISABLED,
|
||||
pViewShell->GetViewFrame()->GetBindings().QueryState(SID_OUTLINE_RIGHT, pItem));
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf162455)
|
||||
{
|
||||
createSdImpressDoc();
|
||||
|
||||
@@ -314,7 +314,8 @@ void TextObjectBar::GetAttrStateImpl(const ViewShell& rViewShell, ::sd::View* pV
|
||||
bDisableLeft = false;
|
||||
}
|
||||
|
||||
if( (nDepth < pOLV->GetOutliner().GetMaxDepth() && ( !bOutlineViewSh || rOutl.GetAbsPos(pPara) != 0 )) ||
|
||||
// tdf#148629 - disable demote command on non-list paragraphs
|
||||
if( (nDepth >= 0 && nDepth < pOLV->GetOutliner().GetMaxDepth() && ( !bOutlineViewSh || rOutl.GetAbsPos(pPara) != 0 )) ||
|
||||
(bOutlineViewSh && (nDepth <= 0) && ::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) && rOutl.GetAbsPos(pPara) != 0) )
|
||||
{
|
||||
// not maximum depth and not at top
|
||||
|
||||
Reference in New Issue
Block a user