1 |
From 84cce94c86c3357b88017f29b84b3c19bd1ab731 Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> |
3 |
Date: Thu, 20 Nov 2014 15:53:14 +0000 |
4 |
Subject: [PATCH] Resolves: fdo#86466 Wrong background color shown in format |
5 |
table in impress |
6 |
|
7 |
regression from |
8 |
|
9 |
commit 440e2031ce8cffc8dc573e359a330236f9c11dfb |
10 |
bnc#882627: Allow to edit spacing to contents even with no borders visible. |
11 |
|
12 |
which was an attempt to fix regression from |
13 |
|
14 |
commit 9e5342509b302ba1f816f21cc3ad1cb7093982e0 |
15 |
Date: Mon Jun 3 14:22:07 2013 +0200 |
16 |
|
17 |
copy values from the original item set |
18 |
|
19 |
... because SfxAbstractDialog::GetOutputItemSet() only contains the |
20 |
items that have been _changed_ in the dialog. |
21 |
|
22 |
Now format color shows the expected color, and loading the sample for |
23 |
bnc#882627 and selecting cells and changing the border distance (etc) doesn't |
24 |
cause bulleting and paragraph alignment properties to be stripped away |
25 |
|
26 |
(cherry picked from commit e91ab2104b62b689dca2c565cd81a8cb40885822) |
27 |
|
28 |
Conflicts: |
29 |
svx/source/table/tablecontroller.cxx |
30 |
|
31 |
Change-Id: Id414e09faa221d151f393971654b17bbe9f46d81 |
32 |
--- |
33 |
svx/source/table/tablecontroller.cxx | 44 ++++++++++++++++++++++++++---------- |
34 |
1 file changed, 32 insertions(+), 12 deletions(-) |
35 |
|
36 |
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx |
37 |
index 0b239e1..f7a5468 100644 |
38 |
--- a/svx/source/table/tablecontroller.cxx |
39 |
+++ b/svx/source/table/tablecontroller.cxx |
40 |
@@ -858,6 +858,19 @@ void SvxTableController::onSelect( sal_uInt16 nSId ) |
41 |
} |
42 |
} |
43 |
|
44 |
+namespace |
45 |
+{ |
46 |
+ SvxBoxItem mergeDrawinglayerTextDistancesAndSvxBoxItem(const SfxItemSet& rAttrSet) |
47 |
+ { |
48 |
+ // merge drawing layer text distance items into SvxBoxItem used by the dialog |
49 |
+ SvxBoxItem aBoxItem( static_cast< const SvxBoxItem& >( rAttrSet.Get( SDRATTR_TABLE_BORDER ) ) ); |
50 |
+ aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_LEFTDIST)).GetValue()), BOX_LINE_LEFT ); |
51 |
+ aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_RIGHTDIST)).GetValue()), BOX_LINE_RIGHT ); |
52 |
+ aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_UPPERDIST)).GetValue()), BOX_LINE_TOP ); |
53 |
+ aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(rAttrSet.Get(SDRATTR_TEXT_LOWERDIST)).GetValue()), BOX_LINE_BOTTOM ); |
54 |
+ return aBoxItem; |
55 |
+ } |
56 |
+} |
57 |
|
58 |
void SvxTableController::onFormatTable( SfxRequest& rReq ) |
59 |
{ |
60 |
@@ -872,15 +885,11 @@ void SvxTableController::onFormatTable( SfxRequest& rReq ) |
61 |
SfxItemSet aNewAttr( pTableObj->GetModel()->GetItemPool() ); |
62 |
|
63 |
// merge drawing layer text distance items into SvxBoxItem used by the dialog |
64 |
- SvxBoxItem aBoxItem( static_cast< const SvxBoxItem& >( aNewAttr.Get( SDRATTR_TABLE_BORDER ) ) ); |
65 |
- aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrTextLeftDistItem&)(aNewAttr.Get(SDRATTR_TEXT_LEFTDIST))).GetValue()), BOX_LINE_LEFT ); |
66 |
- aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrTextRightDistItem&)(aNewAttr.Get(SDRATTR_TEXT_RIGHTDIST))).GetValue()), BOX_LINE_RIGHT ); |
67 |
- aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrTextUpperDistItem&)(aNewAttr.Get(SDRATTR_TEXT_UPPERDIST))).GetValue()), BOX_LINE_TOP ); |
68 |
- aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrTextLowerDistItem&)(aNewAttr.Get(SDRATTR_TEXT_LOWERDIST))).GetValue()), BOX_LINE_BOTTOM ); |
69 |
+ SvxBoxItem aBoxItem(mergeDrawinglayerTextDistancesAndSvxBoxItem(aNewAttr)); |
70 |
|
71 |
SvxBoxInfoItem aBoxInfoItem( static_cast< const SvxBoxInfoItem& >( aNewAttr.Get( SDRATTR_TABLE_BORDER_INNER ) ) ); |
72 |
|
73 |
- MergeAttrFromSelectedCells(aNewAttr, true); |
74 |
+ MergeAttrFromSelectedCells(aNewAttr, false); |
75 |
FillCommonBorderAttrFromSelectedCells( aBoxItem, aBoxInfoItem ); |
76 |
aNewAttr.Put( aBoxItem ); |
77 |
aNewAttr.Put( aBoxInfoItem ); |
78 |
@@ -890,8 +899,21 @@ void SvxTableController::onFormatTable( SfxRequest& rReq ) |
79 |
// Even Cancel Button is returning positive(101) value, |
80 |
if( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) |
81 |
{ |
82 |
- SfxItemSet aNewSet( aNewAttr ); |
83 |
- aNewSet.Put( *(pDlg->GetOutputItemSet ()) ); |
84 |
+ SfxItemSet aNewSet( *(pDlg->GetOutputItemSet ()) ); |
85 |
+ |
86 |
+ //Only properties that were unchanged by the dialog appear in this |
87 |
+ //itemset. We had constructed these two properties from other |
88 |
+ //ones, so if they were not changed, then forcible set them back to |
89 |
+ //their originals in the new result set so we can decompose that |
90 |
+ //unchanged state back to their input properties |
91 |
+ if (aNewSet.GetItemState(SDRATTR_TABLE_BORDER, false) != SFX_ITEM_SET) |
92 |
+ { |
93 |
+ aNewSet.Put(aBoxItem); |
94 |
+ } |
95 |
+ if (aNewSet.GetItemState(SDRATTR_TABLE_BORDER_INNER, false) != SFX_ITEM_SET) |
96 |
+ { |
97 |
+ aNewSet.Put(aBoxInfoItem); |
98 |
+ } |
99 |
|
100 |
SvxBoxItem aNewBoxItem( static_cast< const SvxBoxItem& >( aNewSet.Get( SDRATTR_TABLE_BORDER ) ) ); |
101 |
|
102 |
@@ -912,8 +934,6 @@ void SvxTableController::onFormatTable( SfxRequest& rReq ) |
103 |
} |
104 |
} |
105 |
|
106 |
- |
107 |
- |
108 |
void SvxTableController::Execute( SfxRequest& rReq ) |
109 |
{ |
110 |
const sal_uInt16 nSId = rReq.GetSlot(); |
111 |
@@ -2951,8 +2971,8 @@ void SvxTableController::FillCommonBorderAttrFromSelectedCells( SvxBoxItem& rBox |
112 |
nCellFlags |= (nCol > aEnd.mnCol) ? CELL_AFTER : 0; |
113 |
|
114 |
const SfxItemSet& rSet = xCell->GetItemSet(); |
115 |
- const SvxBoxItem& rCellBoxItem = static_cast< const SvxBoxItem& >( rSet.Get(SDRATTR_TABLE_BORDER ) ); |
116 |
- lcl_MergeCommonBorderAttr( aLinesState, rCellBoxItem, nCellFlags ); |
117 |
+ SvxBoxItem aCellBoxItem(mergeDrawinglayerTextDistancesAndSvxBoxItem(rSet)); |
118 |
+ lcl_MergeCommonBorderAttr( aLinesState, aCellBoxItem, nCellFlags ); |
119 |
} |
120 |
} |
121 |
|
122 |
-- |
123 |
1.9.3 |
124 |
|