/[packages]/cauldron/libreoffice/current/SOURCES/0001-add-char-highlighting-background-tab-to-graphics-sty.patch
ViewVC logotype

Contents of /cauldron/libreoffice/current/SOURCES/0001-add-char-highlighting-background-tab-to-graphics-sty.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1151336 - (show annotations) (download)
Tue Sep 5 06:35:26 2017 UTC (6 years, 7 months ago) by tv
File size: 16493 byte(s)
new release
1 From 79aa7096421965e6931a893186a64dee6d9c6400 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
3 Date: Fri, 11 Aug 2017 11:51:09 +0100
4 Subject: [PATCH] add char highlighting (background) tab to graphics styles
5 dialog
6
7 move the SvxBackgroundColorItem<->SvxBrushItem conversion
8
9 into the dialog itself
10
11 Change-Id: I83db9f02145a4927257dd5691f82dad1a11eaea6
12
13 improve scoping a little
14
15 Change-Id: Ie2e86852f7c4754070d3eb7e8981d674f04a6d80
16 (cherry picked from commit a162b21c2b393534a9f6433c9b2b674aaaecf1a7)
17
18 Change-Id: I2cf3872116ae59051847d73612a2f4f8385d34d8
19 ---
20 cui/source/inc/backgrnd.hxx | 1 +
21 cui/source/tabpages/backgrnd.cxx | 104 +++++++++++++++++++++++-------
22 include/svx/flagsdef.hxx | 11 ++--
23 sd/source/ui/dlg/dlgchar.cxx | 2 +-
24 sd/source/ui/dlg/tabtempl.cxx | 7 ++
25 sd/source/ui/func/fuchar.cxx | 26 +-------
26 sd/source/ui/inc/tabtempl.hxx | 1 +
27 sd/uiconfig/simpress/ui/templatedialog.ui | 14 ++++
28 8 files changed, 113 insertions(+), 53 deletions(-)
29
30 diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
31 index d95fe60..351477f 100644
32 --- a/cui/source/inc/backgrnd.hxx
33 +++ b/cui/source/inc/backgrnd.hxx
34 @@ -107,6 +107,7 @@ private:
35 bool bIsGraphicValid : 1;
36 bool bLinkOnly : 1;
37 bool bHighlighting : 1;
38 + bool bCharBackColor : 1;
39 bool m_bColorSelected : 1;
40 Graphic aBgdGraphic;
41 OUString aBgdGraphicPath;
42 diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
43 index d5acbd4..762edcf 100644
44 --- a/cui/source/tabpages/backgrnd.cxx
45 +++ b/cui/source/tabpages/backgrnd.cxx
46 @@ -39,6 +39,7 @@
47 #include <editeng/eerdll.hxx>
48
49 #include <editeng/brushitem.hxx>
50 +#include <editeng/colritem.hxx>
51 #include "backgrnd.hxx"
52
53 #include <svx/xtable.hxx>
54 @@ -331,6 +332,7 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe
55 , bIsGraphicValid(false)
56 , bLinkOnly(false)
57 , bHighlighting(false)
58 + , bCharBackColor(false)
59 , m_bColorSelected(false)
60 , pPageImpl(new SvxBackgroundPage_Impl)
61 , pImportDlg(nullptr)
62 @@ -461,7 +463,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet )
63
64
65 // get and evaluate Input-BrushItem
66 - const SvxBrushItem* pBgdAttr = nullptr;
67 + bool bBrushItemSet = false;
68 sal_uInt16 nSlot = SID_ATTR_BRUSH;
69 const SfxPoolItem* pItem;
70 sal_uInt16 nDestValue = USHRT_MAX;
71 @@ -489,20 +491,39 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet )
72 {
73 nSlot = SID_ATTR_BRUSH_CHAR;
74 }
75 + else if( bCharBackColor )
76 + {
77 + nSlot = SID_ATTR_CHAR_BACK_COLOR;
78 + }
79 +
80 //#111173# the destination item is missing when the parent style has been changed
81 if(USHRT_MAX == nDestValue && m_pTblLBox->IsVisible())
82 nDestValue = 0;
83 - sal_uInt16 nWhich = GetWhich( nSlot );
84 + sal_uInt16 nWhich = GetWhich(nSlot);
85 + SvxBrushItem aBgdAttr(nWhich);
86
87 - if ( rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT )
88 - pBgdAttr = static_cast<const SvxBrushItem*>(&( rSet->Get( nWhich ) ));
89 + if (rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT)
90 + {
91 + if (!bCharBackColor)
92 + aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(nWhich));
93 + else
94 + {
95 + // EE_CHAR_BKGCOLOR is SvxBackgroundColorItem, but char background tabpage
96 + // can only work with SvxBrushItems
97 + // extract Color out of SvxBackColorItem
98 + Color aBackColor = static_cast<const SvxBackgroundColorItem&>(rSet->Get(nWhich)).GetValue();
99 + // make new SvxBrushItem with this Color
100 + aBgdAttr = SvxBrushItem(aBackColor, SID_ATTR_BRUSH_CHAR);
101 + }
102 + bBrushItemSet = true;
103 + }
104
105 m_pBtnTile->Check();
106
107 - if ( pBgdAttr )
108 + if (bBrushItemSet)
109 {
110 - FillControls_Impl(*pBgdAttr, aUserData);
111 - aBgdColor = const_cast<SvxBrushItem*>(pBgdAttr)->GetColor();
112 + FillControls_Impl(aBgdAttr, aUserData);
113 + aBgdColor = const_cast<SvxBrushItem&>(aBgdAttr).GetColor();
114 }
115 else
116 {
117 @@ -537,22 +558,22 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet )
118 nWhich = GetWhich( SID_ATTR_BRUSH );
119 if ( rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT )
120 {
121 - pBgdAttr = static_cast<const SvxBrushItem*>(&( rSet->Get( nWhich ) ));
122 - pTableBck_Impl->pCellBrush = new SvxBrushItem(*pBgdAttr);
123 + aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(nWhich));
124 + pTableBck_Impl->pCellBrush = new SvxBrushItem(aBgdAttr);
125 }
126 pTableBck_Impl->nCellWhich = nWhich;
127
128 if ( rSet->GetItemState( SID_ATTR_BRUSH_ROW, false ) >= SfxItemState::DEFAULT )
129 {
130 - pBgdAttr = static_cast<const SvxBrushItem*>(&( rSet->Get( SID_ATTR_BRUSH_ROW ) ));
131 - pTableBck_Impl->pRowBrush = new SvxBrushItem(*pBgdAttr);
132 + aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(SID_ATTR_BRUSH_ROW));
133 + pTableBck_Impl->pRowBrush = new SvxBrushItem(aBgdAttr);
134 }
135 pTableBck_Impl->nRowWhich = SID_ATTR_BRUSH_ROW;
136
137 if ( rSet->GetItemState( SID_ATTR_BRUSH_TABLE, false ) >= SfxItemState::DEFAULT )
138 {
139 - pBgdAttr = static_cast<const SvxBrushItem*>(&( rSet->Get( SID_ATTR_BRUSH_TABLE ) ));
140 - pTableBck_Impl->pTableBrush = new SvxBrushItem(*pBgdAttr);
141 + aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(SID_ATTR_BRUSH_TABLE));
142 + pTableBck_Impl->pTableBrush = new SvxBrushItem(aBgdAttr);
143 }
144 pTableBck_Impl->nTableWhich = SID_ATTR_BRUSH_TABLE;
145
146 @@ -564,8 +585,22 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet )
147 nWhich = GetWhich( SID_ATTR_BRUSH_CHAR );
148 if ( rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT )
149 {
150 - pBgdAttr = static_cast<const SvxBrushItem*>(&( rSet->Get( nWhich ) ));
151 - pHighlighting.reset(new SvxBrushItem(*pBgdAttr));
152 + aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(nWhich));
153 + pHighlighting.reset(new SvxBrushItem(aBgdAttr));
154 + }
155 + }
156 + else if( bCharBackColor )
157 + {
158 + nWhich = GetWhich(SID_ATTR_CHAR_BACK_COLOR);
159 + if ( rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT )
160 + {
161 + // EE_CHAR_BKGCOLOR is SvxBackgroundColorItem, but char background tabpage
162 + // can only work with SvxBrushItems
163 + // extract Color out of SvxBackColorItem
164 + Color aBackColor = static_cast<const SvxBackgroundColorItem&>(rSet->Get(nWhich)).GetValue();
165 + // make new SvxBrushItem with this Color
166 + aBgdAttr = SvxBrushItem(aBackColor, SID_ATTR_BRUSH_CHAR);
167 + pHighlighting.reset(new SvxBrushItem(aBgdAttr));
168 }
169 }
170 }
171 @@ -644,6 +679,7 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
172 return FillItemSetWithWallpaperItem( *rCoreSet, SID_VIEW_FLD_PIC );
173
174 bool bModified = false;
175 + bool bCompareOldBrush = true;
176 sal_uInt16 nSlot = SID_ATTR_BRUSH;
177
178 if ( m_pTblLBox->IsVisible() )
179 @@ -665,15 +701,21 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
180 {
181 nSlot = SID_ATTR_BRUSH_CHAR;
182 }
183 - sal_uInt16 nWhich = GetWhich( nSlot );
184 + else if( bCharBackColor )
185 + {
186 + nSlot = SID_ATTR_CHAR_BACK_COLOR;
187 + bCompareOldBrush = false;
188 + }
189
190 - const SfxPoolItem* pOld = GetOldItem( *rCoreSet, nSlot );
191 - SfxItemState eOldItemState = rCoreSet->GetItemState(nSlot, false);
192 - const SfxItemSet& rOldSet = GetItemSet();
193 + sal_uInt16 nWhich = GetWhich( nSlot );
194
195 - if ( pOld )
196 + const SfxPoolItem* pOld = GetOldItem(*rCoreSet, nSlot);
197 + if (pOld && bCompareOldBrush)
198 {
199 + SfxItemState eOldItemState = rCoreSet->GetItemState(nSlot, false);
200 + const SfxItemSet& rOldSet = GetItemSet();
201 const SvxBrushItem& rOldItem = static_cast<const SvxBrushItem&>(*pOld);
202 +
203 SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos();
204 const bool bIsBrush = ( drawing::FillStyle_SOLID == lcl_getFillStyle(m_pLbSelect) );
205
206 @@ -774,6 +816,22 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
207 bModified = ( bIsBrush || m_pBtnLink->IsChecked() || bIsGraphicValid );
208 }
209 }
210 + else if (pOld && SID_ATTR_CHAR_BACK_COLOR == nSlot)
211 + {
212 + SfxItemState eOldItemState = rCoreSet->GetItemState(nSlot, false);
213 + const SfxItemSet& rOldSet = GetItemSet();
214 + const SvxBackgroundColorItem& rOldItem = static_cast<const SvxBackgroundColorItem&>(*pOld);
215 +
216 + // Brush-treatment:
217 + if ( rOldItem.GetValue() != aBgdColor ||
218 + (SfxItemState::DEFAULT >= eOldItemState && m_bColorSelected))
219 + {
220 + bModified = true;
221 + rCoreSet->Put(SvxBackgroundColorItem(aBgdColor, nWhich));
222 + }
223 + else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
224 + rCoreSet->ClearItem( nWhich );
225 + }
226 else if ( SID_ATTR_BRUSH_CHAR == nSlot && aBgdColor != Color( COL_WHITE ) )
227 {
228 rCoreSet->Put( SvxBrushItem( aBgdColor, nWhich ) );
229 @@ -1526,10 +1584,12 @@ void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet)
230 {
231 ShowSelector();
232 }
233 - if ( nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING )
234 + if ((nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING) ||
235 + (nFlags & SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR))
236 {
237 m_pBackGroundColorLabelFT->SetText(CuiResId(RID_SVXSTR_CHARNAME_HIGHLIGHTING));
238 - bHighlighting = true;
239 + bHighlighting = bool(nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING);
240 + bCharBackColor = bool(nFlags & SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR);
241 }
242 }
243 }
244 diff --git a/include/svx/flagsdef.hxx b/include/svx/flagsdef.hxx
245 index 0207a0e..30b1ff4 100644
246 --- a/include/svx/flagsdef.hxx
247 +++ b/include/svx/flagsdef.hxx
248 @@ -39,14 +39,15 @@ namespace o3tl
249 // flags for SvxBackgroundTabPage
250 enum class SvxBackgroundTabFlags
251 {
252 - NONE = 0x00,
253 - SHOW_SELECTOR = 0x01,
254 - SHOW_TBLCTL = 0x08,
255 - SHOW_HIGHLIGHTING = 0x10,
256 + NONE = 0x00,
257 + SHOW_SELECTOR = 0x01,
258 + SHOW_TBLCTL = 0x08,
259 + SHOW_HIGHLIGHTING = 0x10,
260 + SHOW_CHAR_BKGCOLOR = 0x20,
261 };
262 namespace o3tl
263 {
264 - template<> struct typed_flags<SvxBackgroundTabFlags> : is_typed_flags<SvxBackgroundTabFlags, 0x19> {};
265 + template<> struct typed_flags<SvxBackgroundTabFlags> : is_typed_flags<SvxBackgroundTabFlags, 0x39> {};
266 }
267
268 // flags for SvxBorderTabPage
269 diff --git a/sd/source/ui/dlg/dlgchar.cxx b/sd/source/ui/dlg/dlgchar.cxx
270 index bcf4437..cb37af4 100644
271 --- a/sd/source/ui/dlg/dlgchar.cxx
272 +++ b/sd/source/ui/dlg/dlgchar.cxx
273 @@ -65,7 +65,7 @@ void SdCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
274 }
275 else if (nId == mnCharBackground)
276 {
277 - aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_HIGHLIGHTING)));
278 + aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR)));
279 rPage.PageCreated(aSet);
280 }
281 }
282 diff --git a/sd/source/ui/dlg/tabtempl.cxx b/sd/source/ui/dlg/tabtempl.cxx
283 index 17e962b..9042bf5 100644
284 --- a/sd/source/ui/dlg/tabtempl.cxx
285 +++ b/sd/source/ui/dlg/tabtempl.cxx
286 @@ -71,6 +71,7 @@ SdTabTemplateDlg::SdTabTemplateDlg( vcl::Window* pParent,
287 , m_nFontId(0)
288 , m_nFontEffectId(0)
289 , m_nIndentsId(0)
290 + , m_nBackgroundId(0)
291 , m_nTextId(0)
292 , m_nAnimationId(0)
293 , m_nDimensionId(0)
294 @@ -88,6 +89,7 @@ SdTabTemplateDlg::SdTabTemplateDlg( vcl::Window* pParent,
295 m_nFontId = AddTabPage("font", RID_SVXPAGE_CHAR_NAME);
296 m_nFontEffectId = AddTabPage("fonteffect", RID_SVXPAGE_CHAR_EFFECTS);
297 m_nIndentsId = AddTabPage("indents", RID_SVXPAGE_STD_PARAGRAPH);
298 + m_nBackgroundId = AddTabPage("background", RID_SVXPAGE_BACKGROUND);
299 m_nTextId = AddTabPage("text", RID_SVXPAGE_TEXTATTR);
300 m_nAnimationId = AddTabPage("animation", RID_SVXPAGE_TEXTANIMATION);
301 m_nDimensionId = AddTabPage("dimensioning", RID_SVXPAGE_MEASURE);
302 @@ -149,6 +151,11 @@ void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
303 {
304 rPage.PageCreated(aSet);
305 }
306 + else if (nId == m_nBackgroundId)
307 + {
308 + aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR)));
309 + rPage.PageCreated(aSet);
310 + }
311 else if (nId == m_nTextId)
312 {
313 rPage.PageCreated(aSet);
314 diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx
315 index 4a8aedd..1ffa757 100644
316 --- a/sd/source/ui/func/fuchar.cxx
317 +++ b/sd/source/ui/func/fuchar.cxx
318 @@ -68,33 +68,9 @@ void FuChar::DoExecute( SfxRequest& rReq )
319 SfxItemSet aEditAttr( mpDoc->GetPool() );
320 mpView->GetAttributes( aEditAttr );
321
322 - static const sal_uInt16 aRanges[] =
323 - {
324 - EE_ITEMS_START, EE_ITEMS_END,
325 - SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR,
326 - 0
327 - };
328 -
329 - SfxItemSet aNewAttr( mpViewShell->GetPool(),
330 - aRanges );
331 + SfxItemSet aNewAttr(mpViewShell->GetPool(), EE_ITEMS_START, EE_ITEMS_END);
332 aNewAttr.Put( aEditAttr, false );
333
334 - // EE_CHAR_BKGCOLOR is SvxBackgroundColorItem, but char background tabpage
335 - // can only work with SvxBrushItems (it requires major undertaking to have
336 - // it support anything else). Do the following then:
337 - const SfxPoolItem* pItem;
338 - if ( aNewAttr.GetItemState( EE_CHAR_BKGCOLOR, true, &pItem ) == SfxItemState::SET )
339 - {
340 - // extract Color outta SvxBackColorItem
341 - Color aBackColor = static_cast<const SvxBackgroundColorItem*>(pItem)->GetValue();
342 - // make new SvxBrushItem with this Color
343 - SvxBrushItem aBrushItem( aBackColor, SID_ATTR_BRUSH_CHAR );
344 -
345 - aNewAttr.ClearItem( EE_CHAR_BKGCOLOR );
346 - // and stick it into the set
347 - aNewAttr.Put( aBrushItem );
348 - }
349 -
350 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
351 ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdTabCharDialog(mpViewShell->GetActiveWindow(), &aNewAttr, mpDoc->GetDocSh() ) : nullptr);
352 sal_uInt16 nResult = RET_CANCEL;
353 diff --git a/sd/source/ui/inc/tabtempl.hxx b/sd/source/ui/inc/tabtempl.hxx
354 index d5c2f5e..bc00417 100644
355 --- a/sd/source/ui/inc/tabtempl.hxx
356 +++ b/sd/source/ui/inc/tabtempl.hxx
357 @@ -50,6 +50,7 @@ private:
358 sal_uInt16 m_nFontId;
359 sal_uInt16 m_nFontEffectId;
360 sal_uInt16 m_nIndentsId;
361 + sal_uInt16 m_nBackgroundId;
362 sal_uInt16 m_nTextId;
363 sal_uInt16 m_nAnimationId;
364 sal_uInt16 m_nDimensionId;
365 diff --git a/sd/uiconfig/simpress/ui/templatedialog.ui b/sd/uiconfig/simpress/ui/templatedialog.ui
366 index 961a0bb..380f9f0 100644
367 --- a/sd/uiconfig/simpress/ui/templatedialog.ui
368 +++ b/sd/uiconfig/simpress/ui/templatedialog.ui
369 @@ -204,6 +204,20 @@
370 <placeholder/>
371 </child>
372 <child type="tab">
373 + <object class="GtkLabel" id="background">
374 + <property name="visible">True</property>
375 + <property name="can_focus">False</property>
376 + <property name="label" translatable="yes" context="templatedialog|background">Highlighting</property>
377 + </object>
378 + <packing>
379 + <property name="position">6</property>
380 + <property name="tab_fill">False</property>
381 + </packing>
382 + </child>
383 + <child>
384 + <placeholder/>
385 + </child>
386 + <child type="tab">
387 <object class="GtkLabel" id="indents">
388 <property name="visible">True</property>
389 <property name="can_focus">False</property>
390 --
391 2.9.4
392

  ViewVC Help
Powered by ViewVC 1.1.30