summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-10-29 18:17:18 +0100
committerEike Rathke <erack@redhat.com>2013-10-29 19:15:01 +0100
commit2f29e544932633a01162ecb80e50872eabdd2bc1 (patch)
treead012cfc43b6dde1de7dae177a418dac0d22666c
parentc2b8170cbdac557bdd63a467be8bf4f124e74702 (diff)
Revert "fdo#63546: set appropriate alignment when wrt direction of cells is changed."
This reverts commit 706e3b8e43df94310b2fe8458da67875073a046c. Related previous commits that commit depends on will also be reverted. Triggered by fdo#70750 inspecting the code it turned out that the changes for fdo#63546 did several things wrong: * looping over individual cells of a large selected range results in slicing and merging ScAttrArray for each row in each column which is utterly slow (the reason for fdo#70750) * instead of executing the changes in ScFormatShell calls should had been forwarded through ScTabViewShell to be passed down to ScViewFunc, ScDocFunc, ScDocument, ... * setting hard attributes on all cells (except if already centered or block justified) is not wanted * value cells for example should stay automatically right justified if no justification is given yet * overwriting already existing left or right justification may not be what the user expects * applied styles' justification is overridden this way
-rw-r--r--sc/source/ui/view/formatsh.cxx55
1 files changed, 13 insertions, 42 deletions
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 3c3e6db4f276..b2116179538f 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2614,55 +2614,26 @@ void ScFormatShell::ExecuteTextDirection( SfxRequest& rReq )
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;
- ScRange aRange;
- GetViewData()->GetMarkData().GetMarkArea(aRange);
- ScMarkData aMark = GetViewData()->GetMarkData();
- ScDocument * pDoc = GetViewData()->GetDocument();
- if (aMark.IsMultiMarked())
- {
- SCCOL nCol = aRange.aStart.Col();
- SCROW nRow = aRange.aStart.Row();
- for ( ; nCol <= aRange.aEnd.Col(); nCol++ )
- {
- for ( ; nRow <= aRange.aEnd.Row(); nRow++ )
- {
- pItem = pDoc->GetAttr( nCol, nRow, 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( nCol, nRow, aMark.GetFirstSelected(), SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY ) );
- else
- pDoc->ApplyAttr( nCol, nRow, aMark.GetFirstSelected(), SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY ) );
- }
- }
- nRow = 0;
- }
- }
- else
+ if( rAttrSet.GetItemState(ATTR_HOR_JUSTIFY, sal_True, &pItem) == SFX_ITEM_SET )
{
- 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() );
- }
+ 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 )
- rReq.AppendItem( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, SID_H_ALIGNCELL ) );
- else
- rReq.AppendItem( SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, SID_H_ALIGNCELL ) );
+ 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() );
- }
+ rReq.SetSlot( SID_H_ALIGNCELL );
+ ExecuteSlot( rReq, GetInterface() );
}
pDocSh->GetUndoManager()->LeaveListAction();