Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3549
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/49/3549/1
related to fdo#63546.
set appropriate alignment when wrt direction of selected cells is changed.
Change-Id: Ie98a46af97236ab4303d030f11bd167939dde32b
---
M sc/source/ui/view/formatsh.cxx
1 file changed, 41 insertions(+), 13 deletions(-)
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 3f2b26d..3f54bcb 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2086,26 +2086,54 @@
pTabViewShell->ApplyAttr( SvxFrameDirectionItem( eDirection, ATTR_WRITINGDIR ) );
- const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
const SfxPoolItem* pItem = NULL;
const SvxHorJustifyItem* pHorJustify = NULL;
SvxCellHorJustify eHorJustify = SVX_HOR_JUSTIFY_STANDARD;
-
- if( rAttrSet.GetItemState(ATTR_HOR_JUSTIFY, sal_True, &pItem) == SFX_ITEM_SET )
+ ScRange aRange;
+ GetViewData()->GetMarkData().GetMarkArea(aRange);
+ ScMarkData aMark = GetViewData()->GetMarkData();
+ ScDocument * pDoc = GetViewData()->GetDocument();
+ if (aMark.IsMultiMarked())
{
- pHorJustify = (const SvxHorJustifyItem*)pItem;
- eHorJustify = SvxCellHorJustify( pHorJustify->GetValue() );
+ int i = 0, j = 0;
+ for ( ; aRange.aStart.Col()+i <= aRange.aEnd.Col() ; i++ )
+ {
+ for ( ; aRange.aStart.Row()+j <= aRange.aEnd.Row() ; j++ )
+ {
+ pItem = pDoc->GetAttr( aRange.aStart.Col()+i, aRange.aStart.Row()+j,
aMark.GetFirstSelected(), ATTR_HOR_JUSTIFY );
+ pHorJustify = (const SvxHorJustifyItem*)pItem;
+ eHorJustify = SvxCellHorJustify( pHorJustify->GetValue() );
+
+ if( eHorJustify != SVX_HOR_JUSTIFY_CENTER && eHorJustify !=
SVX_HOR_JUSTIFY_BLOCK )
+ {
+ if( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT )
+ pDoc->ApplyAttr( aRange.aStart.Col()+i, aRange.aStart.Row()+j,
aMark.GetFirstSelected(), SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY ) );
+ else
+ pDoc->ApplyAttr( aRange.aStart.Col()+i, aRange.aStart.Row()+j,
aMark.GetFirstSelected(), SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY ) );
+ }
+ }
+ j = 0;
+ }
}
-
- if( eHorJustify != SVX_HOR_JUSTIFY_CENTER && eHorJustify != SVX_HOR_JUSTIFY_BLOCK )
+ else
{
- if( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT )
- rReq.AppendItem( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, SID_H_ALIGNCELL ) );
- else
- rReq.AppendItem( SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, SID_H_ALIGNCELL )
);
+ const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
+ if( rAttrSet.GetItemState(ATTR_HOR_JUSTIFY, sal_True, &pItem) == SFX_ITEM_SET )
+ {
+ pHorJustify = (const SvxHorJustifyItem*)pItem;
+ eHorJustify = SvxCellHorJustify( pHorJustify->GetValue() );
+ }
- rReq.SetSlot( SID_H_ALIGNCELL );
- ExecuteSlot( rReq, GetInterface() );
+ if( eHorJustify != SVX_HOR_JUSTIFY_CENTER && eHorJustify != SVX_HOR_JUSTIFY_BLOCK )
+ {
+ if( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT )
+ rReq.AppendItem( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, SID_H_ALIGNCELL
) );
+ else
+ rReq.AppendItem( SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT,
SID_H_ALIGNCELL ) );
+
+ rReq.SetSlot( SID_H_ALIGNCELL );
+ ExecuteSlot( rReq, GetInterface() );
+ }
}
pDocSh->GetUndoManager()->LeaveListAction();
--
To view, visit https://gerrit.libreoffice.org/3549
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie98a46af97236ab4303d030f11bd167939dde32b
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: navin patidar <patidar@kacst.edu.sa>
Context
- [PATCH] related to fdo#63546. · navin patidar (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.