summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2024-02-06 14:08:12 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-02-09 00:05:39 +0100
commitbbe1f37645cf864c7c974d36cf2fe3a73d0c085f (patch)
treec07a796e9d49b3e12c016e2bcb506d3ff59cc918 /svx
parentad4a06692b05c4312c1c7c8a8ff38cf12422e692 (diff)
Clone Formatting in Impress: Include list attribute
Copies list type and list level from source to target paragraph(s). Also switches off lists, if source is not in a list. Change-Id: I260f1d7d9936476f16c355a3a09204b3fb4592d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163054 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/selectioncontroller.cxx4
-rw-r--r--svx/source/svdraw/svdedxv.cxx29
-rw-r--r--svx/source/table/tablecontroller.cxx5
3 files changed, 26 insertions, 12 deletions
diff --git a/svx/source/svdraw/selectioncontroller.cxx b/svx/source/svdraw/selectioncontroller.cxx
index 43112953fad7..1fcac6b87ea0 100644
--- a/svx/source/svdraw/selectioncontroller.cxx
+++ b/svx/source/svdraw/selectioncontroller.cxx
@@ -95,7 +95,9 @@ bool SelectionController::PasteObjModel( const SdrModel& /*rModel*/ )
return false;
}
-bool SelectionController::ApplyFormatPaintBrush( SfxItemSet& /*rFormatSet*/, bool /*bNoCharacterFormats*/, bool /*bNoParagraphFormats*/ )
+bool SelectionController::ApplyFormatPaintBrush(SfxItemSet& /*rFormatSet*/, sal_Int16 /*nDepth*/,
+ bool /*bNoCharacterFormats*/,
+ bool /*bNoParagraphFormats*/)
{
return false;
}
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index f2ea7c9ddeeb..dbcc73a63cf1 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -2797,11 +2797,12 @@ static const WhichRangesContainer& GetFormatRangeImpl(bool bTextOnly)
return bTextOnly ? gTextOnly : gFull;
}
-void SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& rFormatSet)
+sal_Int32 SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& rFormatSet)
{
+ sal_Int32 nDepth = -2;
const SdrMarkList& rMarkList = GetMarkedObjectList();
if (rMarkList.GetMarkCount() <= 0)
- return;
+ return nDepth;
OutlinerView* pOLV = GetTextEditOutlinerView();
@@ -2810,6 +2811,7 @@ void SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& rFormatSe
if (pOLV)
{
rFormatSet->Put(pOLV->GetAttribs());
+ nDepth = pOLV->GetDepth();
}
else
{
@@ -2828,6 +2830,7 @@ void SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& rFormatSe
mxSelectionController->GetAttributes(*rFormatSet, false);
}
}
+ return nDepth;
}
static SfxItemSet CreatePaintSet(const WhichRangesContainer& pRanges, SfxItemPool& rPool,
@@ -2863,8 +2866,8 @@ static SfxItemSet CreatePaintSet(const WhichRangesContainer& pRanges, SfxItemPoo
}
void SdrObjEditView::ApplyFormatPaintBrushToText(SfxItemSet const& rFormatSet, SdrTextObj& rTextObj,
- SdrText* pText, bool bNoCharacterFormats,
- bool bNoParagraphFormats)
+ SdrText* pText, sal_Int16 nDepth,
+ bool bNoCharacterFormats, bool bNoParagraphFormats)
{
OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr;
if (!pParaObj)
@@ -2887,6 +2890,9 @@ void SdrObjEditView::ApplyFormatPaintBrushToText(SfxItemSet const& rFormatSet, S
aSet.Put(CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet,
bNoCharacterFormats, bNoParagraphFormats));
rOutliner.SetParaAttribs(nPara, aSet);
+ Paragraph* pParagraph = rOutliner.GetParagraph(nPara);
+ if (nDepth > -2)
+ rOutliner.SetDepth(pParagraph, nDepth);
}
std::optional<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
@@ -2909,11 +2915,11 @@ void SdrObjEditView::DisposeUndoManager()
mpOldTextEditUndoManager = nullptr;
}
-void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, bool bNoCharacterFormats,
- bool bNoParagraphFormats)
+void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, sal_Int16 nDepth,
+ bool bNoCharacterFormats, bool bNoParagraphFormats)
{
if (mxSelectionController.is()
- && mxSelectionController->ApplyFormatPaintBrush(rFormatSet, bNoCharacterFormats,
+ && mxSelectionController->ApplyFormatPaintBrush(rFormatSet, nDepth, bNoCharacterFormats,
bNoParagraphFormats))
{
return;
@@ -2960,8 +2966,8 @@ void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, bool bNoChara
while (--nText >= 0)
{
SdrText* pText = pTextObj->getText(nText);
- ApplyFormatPaintBrushToText(rFormatSet, *pTextObj, pText, bNoCharacterFormats,
- bNoParagraphFormats);
+ ApplyFormatPaintBrushToText(rFormatSet, *pTextObj, pText, nDepth,
+ bNoCharacterFormats, bNoParagraphFormats);
}
}
}
@@ -2983,6 +2989,11 @@ void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, bool bNoChara
rFormatSet, aSet, bNoCharacterFormats,
bNoParagraphFormats));
pOLV->SetAttribs(aPaintSet);
+ if (!bNoParagraphFormats && nDepth > -2)
+ {
+ for (sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; ++nPara)
+ pOLV->SetDepth(nPara, nDepth);
+ }
}
}
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 78363db198a4..874fd1cfee81 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -2922,7 +2922,8 @@ bool SvxTableController::PasteObject( SdrTableObj const * pPasteTableObj )
return true;
}
-bool SvxTableController::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
+bool SvxTableController::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, sal_Int16 nDepth,
+ bool bNoCharacterFormats, bool bNoParagraphFormats)
{
if(!mbCellSelectionMode)
{
@@ -2953,7 +2954,7 @@ bool SvxTableController::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNo
if (bUndo)
xCell->AddUndo();
SdrText* pText = xCell.get();
- SdrObjEditView::ApplyFormatPaintBrushToText( rFormatSet, rTableObj, pText, bNoCharacterFormats, bNoParagraphFormats );
+ SdrObjEditView::ApplyFormatPaintBrushToText( rFormatSet, rTableObj, pText, nDepth, bNoCharacterFormats, bNoParagraphFormats );
}
}
}