Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <hintids.hxx>
21 : #include <svl/zforlist.hxx>
22 : #include <svl/stritem.hxx>
23 : #include <svl/whiter.hxx>
24 : #include <unotools/moduleoptions.hxx>
25 : #include <svx/rulritem.hxx>
26 : #include <svl/srchitem.hxx>
27 : #include <editeng/lrspitem.hxx>
28 : #include <editeng/ulspitem.hxx>
29 : #include <editeng/brushitem.hxx>
30 : #include <editeng/boxitem.hxx>
31 : #include <editeng/shaditem.hxx>
32 : #include <editeng/spltitem.hxx>
33 : #include <editeng/langitem.hxx>
34 : #include <editeng/keepitem.hxx>
35 : #include <editeng/lineitem.hxx>
36 : #include <editeng/colritem.hxx>
37 : #include <editeng/frmdiritem.hxx>
38 : #include <svx/numinf.hxx>
39 : #include <svx/svddef.hxx>
40 : #include <svx/svxdlg.hxx>
41 : #include <svl/zformat.hxx>
42 : #include <sfx2/bindings.hxx>
43 : #include <vcl/msgbox.hxx>
44 : #include <sfx2/request.hxx>
45 : #include <sfx2/dispatch.hxx>
46 : #include <sfx2/objface.hxx>
47 : #include <sfx2/sidebar/EnumContext.hxx>
48 :
49 : #include <fmtornt.hxx>
50 : #include <fmtclds.hxx>
51 : #include <fmtlsplt.hxx>
52 : #include <fmtrowsplt.hxx>
53 : #include <fmtfsize.hxx>
54 : #include <swmodule.hxx>
55 : #include <wrtsh.hxx>
56 : #include <wview.hxx>
57 : #include <frmatr.hxx>
58 : #include <uitool.hxx>
59 : #include <inputwin.hxx>
60 : #include <uiitems.hxx>
61 : #include <usrpref.hxx>
62 : #include <tabsh.hxx>
63 : #include "swtablerep.hxx"
64 : #include <tablemgr.hxx>
65 : #include <cellatr.hxx>
66 : #include <frmfmt.hxx>
67 : #include <swundo.hxx>
68 : #include <swtable.hxx>
69 : #include <docsh.hxx>
70 : #include <tblsel.hxx>
71 :
72 : #include <dialog.hrc>
73 : #include <popup.hrc>
74 : #include <shells.hrc>
75 : #include <cmdid.h>
76 : #include <globals.hrc>
77 : #include <helpid.h>
78 : #include <unobaseclass.hxx>
79 :
80 : #define SwTableShell
81 : #include <sfx2/msg.hxx>
82 : #include <swslots.hxx>
83 :
84 : #include "swabstdlg.hxx"
85 : #include <table.hrc>
86 :
87 : #include <boost/scoped_ptr.hpp>
88 :
89 : using ::editeng::SvxBorderLine;
90 : using namespace ::com::sun::star;
91 :
92 0 : SFX_IMPL_INTERFACE(SwTableShell, SwBaseShell, SW_RES(STR_SHELLNAME_TABLE))
93 : {
94 0 : SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TAB_POPUPMENU));
95 0 : SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TABLE_TOOLBOX));
96 0 : }
97 :
98 0 : TYPEINIT1(SwTableShell,SwBaseShell)
99 :
100 : const sal_uInt16 aUITableAttrRange[] =
101 : {
102 : FN_PARAM_TABLE_NAME, FN_PARAM_TABLE_NAME,
103 : FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE,
104 : FN_PARAM_TABLE_SPACE, FN_PARAM_TABLE_SPACE,
105 : FN_TABLE_REP, FN_TABLE_REP,
106 : SID_RULER_BORDERS, SID_RULER_BORDERS,
107 : RES_LR_SPACE, RES_UL_SPACE,
108 : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
109 : RES_BOX, RES_SHADOW,
110 : RES_BACKGROUND, RES_BACKGROUND,
111 : SID_BACKGRND_DESTINATION, SID_BACKGRND_DESTINATION,
112 : SID_HTML_MODE, SID_HTML_MODE,
113 : SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE,
114 : RES_PAGEDESC, RES_BREAK,
115 : RES_KEEP, RES_KEEP,
116 : RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
117 : FN_TABLE_SET_VERT_ALIGN, FN_TABLE_SET_VERT_ALIGN,
118 : RES_FRAMEDIR, RES_FRAMEDIR,
119 : RES_ROW_SPLIT, RES_ROW_SPLIT,
120 : FN_TABLE_BOX_TEXTORIENTATION, FN_TABLE_BOX_TEXTORIENTATION,
121 : // #i29550#
122 : RES_COLLAPSING_BORDERS, RES_COLLAPSING_BORDERS,
123 : // <-- collapsing borders
124 : 0
125 : };
126 :
127 0 : const sal_uInt16* SwuiGetUITableAttrRange()
128 : {
129 0 : return aUITableAttrRange;
130 : }
131 :
132 0 : static void lcl_SetAttr( SwWrtShell &rSh, const SfxPoolItem &rItem )
133 : {
134 0 : SfxItemSet aSet( rSh.GetView().GetPool(), rItem.Which(), rItem.Which(), 0);
135 0 : aSet.Put( rItem );
136 0 : rSh.SetTblAttr( aSet );
137 0 : }
138 :
139 0 : static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
140 : {
141 0 : SwFrmFmt *pFmt = rSh.GetTableFmt();
142 0 : SwTabCols aCols;
143 0 : rSh.GetTabCols( aCols );
144 :
145 : //At first get the simple attributes.
146 0 : rSet.Put( SfxStringItem( FN_PARAM_TABLE_NAME, pFmt->GetName()));
147 0 : rSet.Put( SfxUInt16Item( FN_PARAM_TABLE_HEADLINE, rSh.GetRowsToRepeat() ) );
148 0 : rSet.Put( pFmt->GetShadow() );
149 0 : rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, rSh.GetBoxAlign()));
150 0 : rSet.Put( pFmt->GetFrmDir() );
151 :
152 0 : SvxULSpaceItem aULSpace( pFmt->GetULSpace() );
153 0 : rSet.Put( aULSpace );
154 :
155 0 : sal_uInt16 nBackgroundDestination = rSh.GetViewOptions()->GetTblDest();
156 0 : rSet.Put(SwBackgroundDestinationItem(SID_BACKGRND_DESTINATION, nBackgroundDestination ));
157 0 : SvxBrushItem aBrush( RES_BACKGROUND );
158 0 : if(rSh.GetRowBackground(aBrush))
159 0 : rSet.Put( aBrush, SID_ATTR_BRUSH_ROW );
160 : else
161 0 : rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
162 0 : rSh.GetTabBackground(aBrush);
163 0 : rSet.Put( aBrush, SID_ATTR_BRUSH_TABLE );
164 :
165 : // text direction in boxes
166 0 : SvxFrameDirectionItem aBoxDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
167 0 : if(rSh.GetBoxDirection( aBoxDirection ))
168 0 : rSet.Put(aBoxDirection, FN_TABLE_BOX_TEXTORIENTATION);
169 :
170 0 : bool bSelectAll = rSh.StartsWithTable() && rSh.ExtendedSelectedAll(/*bFootnotes=*/false);
171 0 : sal_Bool bTableSel = rSh.IsTableMode() || bSelectAll;
172 0 : if(!bTableSel)
173 : {
174 0 : rSh.StartAllAction();
175 0 : rSh.Push();
176 0 : rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_TABLE_SELECT_ALL, sal_False );
177 : }
178 0 : SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
179 :
180 : // Table variant: If multiple table cells are selected.
181 0 : rSh.GetCrsr(); //Thus GetCrsrCnt() returns the right thing
182 0 : aBoxInfo.SetTable ((rSh.IsTableMode() && rSh.GetCrsrCnt() > 1) ||
183 0 : !bTableSel);
184 : // Always show distance field.
185 0 : aBoxInfo.SetDist (true);
186 : // Set minimum size in tables and paragraphs.
187 0 : aBoxInfo.SetMinDist( !bTableSel || rSh.IsTableMode() ||
188 0 : rSh.GetSelectionType() &
189 0 : (nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL));
190 : // Always set the default spacing.
191 0 : aBoxInfo.SetDefDist (MIN_BORDER_DIST);
192 : // Individual lines can have DontCare status only in tables.
193 0 : aBoxInfo.SetValid( VALID_DISABLE, !bTableSel || !rSh.IsTableMode() );
194 :
195 0 : rSet.Put(aBoxInfo);
196 0 : rSh.GetTabBorders( rSet );
197 :
198 : //row split
199 0 : SwFmtRowSplit* pSplit = 0;
200 0 : rSh.GetRowSplit(pSplit);
201 0 : if(pSplit)
202 : {
203 0 : rSet.Put(*pSplit);
204 0 : delete pSplit;
205 : }
206 :
207 0 : if(!bTableSel)
208 : {
209 0 : rSh.ClearMark();
210 0 : rSh.Pop(sal_False);
211 0 : rSh.EndAllAction();
212 : }
213 :
214 0 : SwTabCols aTabCols;
215 0 : rSh.GetTabCols( aTabCols );
216 0 : SvxColumnItem aColItem;
217 :
218 : // Pointer will be deleted after the dialogue execution.
219 0 : SwTableRep* pRep = new SwTableRep( aTabCols );
220 0 : pRep->SetSpace(aCols.GetRightMax());
221 :
222 0 : sal_uInt16 nPercent = 0;
223 0 : long nWidth = ::GetTableWidth(pFmt, aCols, &nPercent, &rSh );
224 : // The table width is wrong for relative values.
225 0 : if(nPercent)
226 0 : nWidth = pRep->GetSpace() * nPercent / 100;
227 0 : sal_uInt16 nAlign = pFmt->GetHoriOrient().GetHoriOrient();
228 0 : pRep->SetAlign(nAlign);
229 0 : SvxLRSpaceItem aLRSpace( pFmt->GetLRSpace() );
230 0 : SwTwips nLeft = aLRSpace.GetLeft();
231 0 : SwTwips nRight = aLRSpace.GetRight();
232 0 : SwTwips nDiff = pRep->GetSpace() - nRight - nLeft - nWidth;
233 0 : if(nAlign != text::HoriOrientation::FULL && std::abs(nDiff) > 2)
234 : {
235 0 : SwTwips nLR = pRep->GetSpace() - nWidth;
236 0 : switch ( nAlign )
237 : {
238 0 : case text::HoriOrientation::CENTER: nLeft = nRight = nLR / 2;
239 0 : break;
240 0 : case text::HoriOrientation::LEFT: nRight = nLR; nLeft = 0;
241 0 : break;
242 0 : case text::HoriOrientation::RIGHT: nLeft = nLR, nRight = 0;
243 0 : break;
244 : case text::HoriOrientation::LEFT_AND_WIDTH:
245 0 : nRight = nLR - nLeft;
246 0 : break;
247 : case text::HoriOrientation::NONE:
248 0 : if(!nPercent)
249 0 : nWidth = pRep->GetSpace() - nLeft - nRight;
250 0 : break;
251 : }
252 : }
253 0 : pRep->SetLeftSpace(nLeft);
254 0 : pRep->SetRightSpace(nRight);
255 :
256 0 : pRep->SetWidth(nWidth);
257 0 : pRep->SetWidthPercent(nPercent);
258 : // Are individual rows / cells are selected, the column processing will be changed.
259 0 : pRep->SetLineSelected(bTableSel && ! rSh.HasWholeTabSelection());
260 0 : rSet.Put(SwPtrItem(FN_TABLE_REP, pRep));
261 0 : return pRep;
262 : }
263 :
264 0 : void ItemSetToTableParam( const SfxItemSet& rSet,
265 : SwWrtShell &rSh )
266 : {
267 0 : rSh.StartAllAction();
268 0 : rSh.StartUndo( UNDO_TABLE_ATTR );
269 0 : const SfxPoolItem* pItem = 0;
270 :
271 0 : SwViewOption aUsrPref( *rSh.GetViewOptions() );
272 0 : sal_uInt16 nBackgroundDestination = aUsrPref.GetTblDest();
273 0 : if(SFX_ITEM_SET == rSet.GetItemState(SID_BACKGRND_DESTINATION, false, &pItem))
274 : {
275 0 : nBackgroundDestination = ((SfxUInt16Item*)pItem)->GetValue();
276 0 : aUsrPref.SetTblDest((sal_uInt8)nBackgroundDestination);
277 0 : SW_MOD()->ApplyUsrPref(aUsrPref, &rSh.GetView());
278 : }
279 0 : bool bBorder = ( SFX_ITEM_SET == rSet.GetItemState( RES_BOX ) ||
280 0 : SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER ) );
281 0 : pItem = 0;
282 0 : bool bBackground = SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, false, &pItem );
283 0 : const SfxPoolItem* pRowItem = 0, *pTableItem = 0;
284 0 : bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_ROW, false, &pRowItem );
285 0 : bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_TABLE, false, &pTableItem );
286 0 : const SfxPoolItem* pSplit = 0;
287 0 : bool bRowSplit = SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, false, &pSplit );
288 0 : const SfxPoolItem* pBoxDirection = 0;
289 0 : bool bBoxDirection = SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_BOX_TEXTORIENTATION, false, &pBoxDirection );
290 0 : if( bBackground || bBorder || bRowSplit || bBoxDirection)
291 : {
292 : // The border will be applied to the present selection.
293 : // If there is no selection, the table will be completely selected.
294 : // The background will always be applied to the current state.
295 0 : sal_Bool bTableSel = rSh.IsTableMode();
296 0 : rSh.StartAllAction();
297 :
298 0 : if(bBackground)
299 : {
300 0 : if(pItem)
301 0 : rSh.SetBoxBackground( *(const SvxBrushItem*)pItem );
302 0 : if(pRowItem)
303 : {
304 0 : SvxBrushItem aBrush(*(const SvxBrushItem*)pRowItem);
305 0 : aBrush.SetWhich(RES_BACKGROUND);
306 0 : rSh.SetRowBackground(aBrush);
307 : }
308 0 : if(pTableItem)
309 : {
310 0 : SvxBrushItem aBrush(*(const SvxBrushItem*)pTableItem);
311 0 : aBrush.SetWhich(RES_BACKGROUND);
312 0 : rSh.SetTabBackground( aBrush );
313 : }
314 : }
315 :
316 0 : if(bBoxDirection)
317 : {
318 0 : SvxFrameDirectionItem aDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
319 0 : aDirection.SetValue(static_cast< const SvxFrameDirectionItem* >(pBoxDirection)->GetValue());
320 0 : rSh.SetBoxDirection(aDirection);
321 : }
322 :
323 0 : if(bBorder || bRowSplit)
324 : {
325 0 : rSh.Push();
326 0 : if(!bTableSel)
327 : {
328 0 : rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_TABLE_SELECT_ALL );
329 : }
330 0 : if(bBorder)
331 0 : rSh.SetTabBorders( rSet );
332 :
333 0 : if(bRowSplit)
334 : {
335 0 : rSh.SetRowSplit(*static_cast<const SwFmtRowSplit*>(pSplit));
336 : }
337 :
338 0 : if(!bTableSel)
339 : {
340 0 : rSh.ClearMark();
341 : }
342 0 : rSh.Pop(sal_False);
343 : }
344 :
345 0 : rSh.EndAllAction();
346 : }
347 :
348 0 : SwTabCols aTabCols;
349 0 : bool bTabCols = false;
350 0 : sal_Bool bSingleLine = sal_False;
351 0 : SwTableRep* pRep = 0;
352 0 : SwFrmFmt *pFmt = rSh.GetTableFmt();
353 0 : SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
354 0 : if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, false, &pItem ))
355 : {
356 0 : pRep = (SwTableRep*)((const SwPtrItem*)pItem)->GetValue();
357 :
358 0 : const SwTwips nWidth = pRep->GetWidth();
359 0 : if ( text::HoriOrientation::FULL == pRep->GetAlign() )
360 : {
361 0 : SwFmtHoriOrient aAttr( pFmt->GetHoriOrient() );
362 0 : aAttr.SetHoriOrient( text::HoriOrientation::FULL );
363 0 : aSet.Put( aAttr );
364 : }
365 : else
366 : {
367 0 : SwFmtFrmSize aSz( ATT_VAR_SIZE, nWidth );
368 0 : if(pRep->GetWidthPercent())
369 : {
370 0 : aSz.SetWidthPercent( (sal_uInt8)pRep->GetWidthPercent() );
371 : }
372 0 : aSet.Put(aSz);
373 : }
374 :
375 0 : SvxLRSpaceItem aLRSpace( RES_LR_SPACE );
376 0 : aLRSpace.SetLeft(pRep->GetLeftSpace());
377 0 : aLRSpace.SetRight(pRep->GetRightSpace());
378 0 : aSet.Put( aLRSpace );
379 :
380 0 : sal_Int16 eOrient = pRep->GetAlign();
381 0 : SwFmtHoriOrient aAttr( 0, eOrient );
382 0 : aSet.Put( aAttr );
383 : // The item must only be recorded while manual alignment, so that the
384 : // alignment is not overwritten by the distances while recording.
385 0 : if(eOrient != text::HoriOrientation::NONE)
386 0 : ((SfxItemSet&)rSet).ClearItem( SID_ATTR_LRSPACE );
387 :
388 0 : if(pRep->HasColsChanged())
389 : {
390 0 : bTabCols = true;
391 0 : }
392 : }
393 :
394 0 : if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem))
395 0 : rSh.SetRowsToRepeat( ((SfxUInt16Item*)pItem)->GetValue() );
396 :
397 0 : if( SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, false, &pItem))
398 0 : rSh.SetBoxAlign(((SfxUInt16Item*)(pItem))->GetValue());
399 :
400 0 : if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, false, &pItem ))
401 0 : rSh.SetTableName( *pFmt, ((const SfxStringItem*)pItem)->GetValue() );
402 :
403 : // Copy the chosen attributes in the ItemSet.
404 : static const sal_uInt16 aIds[] =
405 : {
406 : RES_PAGEDESC,
407 : RES_BREAK,
408 : RES_KEEP,
409 : RES_LAYOUT_SPLIT,
410 : RES_UL_SPACE,
411 : RES_SHADOW,
412 : RES_FRAMEDIR,
413 : // #i29550#
414 : RES_COLLAPSING_BORDERS,
415 : // <-- collapsing borders
416 : 0
417 : };
418 0 : for( const sal_uInt16* pIds = aIds; *pIds; ++pIds )
419 0 : if( SFX_ITEM_SET == rSet.GetItemState( *pIds, false, &pItem))
420 0 : aSet.Put( *pItem );
421 :
422 0 : if( aSet.Count() )
423 0 : rSh.SetTblAttr( aSet );
424 :
425 0 : if(bTabCols)
426 : {
427 0 : rSh.GetTabCols( aTabCols );
428 0 : bSingleLine = pRep->FillTabCols( aTabCols );
429 0 : rSh.SetTabCols( aTabCols, bSingleLine );
430 : }
431 :
432 0 : rSh.EndUndo( UNDO_TABLE_ATTR );
433 0 : rSh.EndAllAction();
434 0 : }
435 :
436 0 : static void lcl_TabGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
437 : {
438 0 : if(pBorderLine->GetWidth() > rBorderLine.GetWidth())
439 0 : rBorderLine.SetWidth(pBorderLine->GetWidth());
440 :
441 0 : rBorderLine.SetBorderLineStyle(pBorderLine->GetBorderLineStyle());
442 0 : rBorderLine.SetColor(pBorderLine->GetColor());
443 0 : }
444 :
445 0 : void SwTableShell::Execute(SfxRequest &rReq)
446 : {
447 0 : const SfxItemSet* pArgs = rReq.GetArgs();
448 0 : SwWrtShell &rSh = GetShell();
449 :
450 : // At first the slots which doesn't need a FrmMgr.
451 0 : bool bMore = false;
452 0 : const SfxPoolItem* pItem = 0;
453 0 : sal_uInt16 nSlot = rReq.GetSlot();
454 0 : if(pArgs)
455 0 : pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
456 0 : bool bCallDone = false;
457 0 : switch ( nSlot )
458 : {
459 : case SID_ATTR_BORDER:
460 : {
461 0 : if(!pArgs)
462 0 : break;
463 : // Create items, because we have to rework anyway.
464 0 : SvxBoxItem aBox( RES_BOX );
465 0 : SfxItemSet aCoreSet( GetPool(),
466 : RES_BOX, RES_BOX,
467 : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
468 0 : 0);
469 0 : SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
470 0 : aCoreSet.Put(aCoreInfo);
471 0 : rSh.GetTabBorders( aCoreSet );
472 : const SvxBoxItem& rCoreBox = (const SvxBoxItem&)
473 0 : aCoreSet.Get(RES_BOX);
474 0 : const SfxPoolItem *pBoxItem = 0;
475 0 : if ( pArgs->GetItemState(RES_BOX, true, &pBoxItem) == SFX_ITEM_SET )
476 : {
477 0 : aBox = *(SvxBoxItem*)pBoxItem;
478 0 : if ( !rReq.IsAPI() )
479 0 : aBox.SetDistance( std::max(rCoreBox.GetDistance(),sal_uInt16(55)) );
480 0 : else if ( aBox.GetDistance() < MIN_BORDER_DIST )
481 0 : aBox.SetDistance( std::max(rCoreBox.GetDistance(),(sal_uInt16)MIN_BORDER_DIST) );
482 : }
483 : else
484 : OSL_ENSURE( !this, "where is BoxItem?" );
485 :
486 : //since the drawing layer also supports borders the which id might be a different one
487 0 : SvxBoxInfoItem aInfo( SID_ATTR_BORDER_INNER );
488 0 : if (pArgs->GetItemState(SID_ATTR_BORDER_INNER, true, &pBoxItem) == SFX_ITEM_SET)
489 0 : aInfo = *(SvxBoxInfoItem*)pBoxItem;
490 0 : else if( pArgs->GetItemState(SDRATTR_TABLE_BORDER_INNER, true, &pBoxItem) == SFX_ITEM_SET )
491 : {
492 0 : aInfo = *(SvxBoxInfoItem*)pBoxItem;
493 0 : aInfo.SetWhich(SID_ATTR_BORDER_INNER);
494 : }
495 :
496 0 : aInfo.SetTable( true );
497 0 : aInfo.SetValid( VALID_DISABLE, false );
498 :
499 : // The attributes of all lines will be read and the strongest wins.
500 : const SvxBorderLine* pBorderLine;
501 0 : SvxBorderLine aBorderLine;
502 0 : if ((pBorderLine = rCoreBox.GetTop()) != NULL)
503 0 : lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
504 0 : if ((pBorderLine = rCoreBox.GetBottom()) != NULL)
505 0 : lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
506 0 : if ((pBorderLine = rCoreBox.GetLeft()) != NULL)
507 0 : lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
508 0 : if ((pBorderLine = rCoreBox.GetRight()) != NULL)
509 0 : lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
510 0 : if ((pBorderLine = aCoreInfo.GetHori()) != NULL)
511 0 : lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
512 0 : if ((pBorderLine = aCoreInfo.GetVert()) != NULL)
513 0 : lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
514 :
515 0 : if(aBorderLine.GetOutWidth() == 0)
516 : {
517 0 : aBorderLine.SetBorderLineStyle(table::BorderLineStyle::SOLID);
518 0 : aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
519 : }
520 :
521 0 : sal_Bool bLine = sal_False;
522 0 : if( aBox.GetTop() != NULL )
523 0 : aBox.SetLine(&aBorderLine, BOX_LINE_TOP), bLine |= sal_True;
524 0 : if( aBox.GetBottom() != NULL )
525 0 : aBox.SetLine(&aBorderLine, BOX_LINE_BOTTOM), bLine |= sal_True;
526 0 : if( aBox.GetLeft() != NULL )
527 0 : aBox.SetLine(&aBorderLine, BOX_LINE_LEFT), bLine |= sal_True;
528 0 : if( aBox.GetRight() != NULL )
529 0 : aBox.SetLine(&aBorderLine, BOX_LINE_RIGHT), bLine |= sal_True;
530 0 : if( aInfo.GetHori() != NULL )
531 0 : aInfo.SetLine(&aBorderLine, BOXINFO_LINE_HORI), bLine |= sal_True;
532 0 : if( aInfo.GetVert() != NULL )
533 0 : aInfo.SetLine(&aBorderLine, BOXINFO_LINE_VERT), bLine |= sal_True;
534 :
535 0 : aCoreSet.Put( aBox );
536 0 : aCoreSet.Put( aInfo );
537 0 : rSh.SetTabBorders( aCoreSet );
538 :
539 : // we must record the "real" values because otherwise the lines can't be reconstructed on playtime
540 : // the coding style of the controller (setting lines with width 0) is not transportable via Query/PutValue in
541 : // the SvxBoxItem
542 0 : rReq.AppendItem( aBox );
543 0 : rReq.AppendItem( aInfo );
544 0 : bCallDone = true;
545 :
546 : }
547 0 : break;
548 : case FN_INSERT_TABLE:
549 0 : InsertTable( rReq );
550 0 : break;
551 : case FN_FORMAT_TABLE_DLG:
552 : {
553 : //#127012# get the bindings before the dialog is called
554 : // it might happen that this shell is removed after closing the dialog
555 0 : SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
556 0 : SfxItemSet aCoreSet( GetPool(), aUITableAttrRange);
557 :
558 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
559 0 : SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
560 0 : SwTableRep* pTblRep = ::lcl_TableParamToItemSet( aCoreSet, rSh );
561 0 : SfxAbstractTabDialog * pDlg = NULL;
562 : {
563 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
564 : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
565 :
566 0 : pDlg = pFact->CreateSwTableTabDlg(GetView().GetWindow(), GetPool(), &aCoreSet, &rSh);
567 : OSL_ENSURE(pDlg, "Dialogdiet fail!");
568 :
569 0 : if (pItem)
570 0 : pDlg->SetCurPageId(OUStringToOString(((SfxStringItem *)pItem)->GetValue(), RTL_TEXTENCODING_UTF8));
571 : }
572 0 : aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
573 0 : rSh.GetTblAttr(aCoreSet);
574 : // GetTblAttr overwrites the background!
575 0 : SvxBrushItem aBrush( RES_BACKGROUND );
576 0 : if(rSh.GetBoxBackground(aBrush))
577 0 : aCoreSet.Put( aBrush );
578 : else
579 0 : aCoreSet.InvalidateItem( RES_BACKGROUND );
580 :
581 0 : if ( (!pDlg && rReq.GetArgs()) || (pDlg && pDlg->Execute() == RET_OK) )
582 : {
583 0 : const SfxItemSet* pOutSet = pDlg ? pDlg->GetOutputItemSet() : rReq.GetArgs();
584 0 : if ( pDlg )
585 : {
586 : //to record FN_INSERT_TABLE correctly
587 0 : rReq.SetSlot(FN_FORMAT_TABLE_DLG);
588 0 : rReq.Done( *pOutSet );
589 : }
590 0 : ItemSetToTableParam( *pOutSet, rSh );
591 : }
592 :
593 0 : delete pDlg;
594 0 : delete pTblRep;
595 0 : rBindings.Update(SID_RULER_BORDERS);
596 0 : rBindings.Update(SID_ATTR_TABSTOP);
597 0 : rBindings.Update(SID_RULER_BORDERS_VERTICAL);
598 0 : rBindings.Update(SID_ATTR_TABSTOP_VERTICAL);
599 : }
600 0 : break;
601 : case SID_ATTR_BRUSH:
602 : case SID_ATTR_BRUSH_ROW :
603 : case SID_ATTR_BRUSH_TABLE :
604 0 : if(rReq.GetArgs())
605 0 : ItemSetToTableParam(*rReq.GetArgs(), rSh);
606 0 : break;
607 : case FN_NUM_FORMAT_TABLE_DLG:
608 : {
609 0 : SwView* pView = GetActiveView();
610 0 : if(pView)
611 : {
612 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
613 0 : SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
614 0 : SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
615 0 : SfxItemSet aCoreSet( GetPool(),
616 : SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE,
617 : SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
618 0 : 0 );
619 :
620 0 : SfxItemSet aBoxSet( *aCoreSet.GetPool(),
621 : RES_BOXATR_FORMAT, RES_BOXATR_FORMAT,
622 : RES_BOXATR_VALUE, RES_BOXATR_VALUE,
623 0 : 0 );
624 0 : rSh.GetTblBoxFormulaAttrs( aBoxSet );
625 :
626 0 : SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
627 0 : if(eState == SFX_ITEM_DEFAULT)
628 : {
629 : aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
630 0 : pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));
631 : }
632 : else
633 : aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
634 : ((SwTblBoxNumFormat&)aBoxSet.Get(
635 0 : RES_BOXATR_FORMAT )).GetValue() ));
636 :
637 0 : OUString sCurText( rSh.GetTableBoxText() );
638 : aCoreSet.Put( SvxNumberInfoItem( pFormatter,
639 : ((SwTblBoxValue&)aBoxSet.Get(
640 0 : RES_BOXATR_VALUE)).GetValue(),
641 0 : sCurText, SID_ATTR_NUMBERFORMAT_INFO ));
642 :
643 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
644 : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
645 :
646 0 : SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet,
647 0 : pView->GetViewFrame()->GetFrame().GetFrameInterface(),
648 0 : RC_DLG_SWNUMFMTDLG );
649 : OSL_ENSURE(pDlg, "Dialogdiet fail!");
650 :
651 0 : if (RET_OK == pDlg->Execute())
652 : {
653 0 : const SfxPoolItem* pNumberFormatItem = GetView().GetDocShell()->
654 0 : GetItem( SID_ATTR_NUMBERFORMAT_INFO );
655 :
656 0 : if( pNumberFormatItem && 0 != ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount() )
657 : {
658 : const sal_uInt32* pDelArr = ((SvxNumberInfoItem*)
659 0 : pNumberFormatItem)->GetDelArray();
660 :
661 0 : for ( sal_uInt16 i = 0; i < ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount(); i++ )
662 : ((SvxNumberInfoItem*)pNumberFormatItem)->
663 0 : GetNumberFormatter()->DeleteEntry( pDelArr[i] );
664 : }
665 :
666 0 : if( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState(
667 0 : SID_ATTR_NUMBERFORMAT_VALUE, false, &pNumberFormatItem ))
668 : {
669 0 : SfxItemSet aBoxFormatSet( *aCoreSet.GetPool(),
670 0 : RES_BOXATR_FORMAT, RES_BOXATR_FORMAT );
671 : aBoxFormatSet.Put( SwTblBoxNumFormat(
672 0 : ((SfxUInt32Item*)pNumberFormatItem)->GetValue() ));
673 0 : rSh.SetTblBoxFormulaAttrs( aBoxFormatSet );
674 :
675 : }
676 : }
677 0 : delete pDlg;
678 : }
679 : }
680 0 : break;
681 : case FN_CALC_TABLE:
682 0 : rSh.UpdateTable();
683 0 : bCallDone = true;
684 0 : break;
685 : case FN_TABLE_OPTIMAL_HEIGHT:
686 : {
687 0 : const SwFmtFrmSize aSz;
688 0 : rSh.SetRowHeight( aSz );
689 0 : bCallDone = true;
690 : }
691 0 : break;
692 : case FN_TABLE_DELETE_COL:
693 0 : if ( rSh.DeleteCol() && rSh.HasSelection() )
694 0 : rSh.EnterStdMode();
695 0 : bCallDone = true;
696 0 : break;
697 : case FN_END_TABLE:
698 0 : rSh.MoveTable( fnTableCurr, fnTableEnd );
699 0 : bCallDone = true;
700 0 : break;
701 : case FN_START_TABLE:
702 0 : rSh.MoveTable( fnTableCurr, fnTableStart );
703 0 : bCallDone = true;
704 0 : break;
705 : case FN_GOTO_NEXT_CELL:
706 : {
707 0 : sal_Bool bAppendLine = sal_True;
708 0 : if( pItem )
709 0 : bAppendLine = ((SfxBoolItem*)pItem)->GetValue();
710 : rReq.SetReturnValue( SfxBoolItem( nSlot,
711 0 : rSh.GoNextCell( bAppendLine ) ) );
712 0 : bCallDone = true;
713 : }
714 0 : break;
715 : case FN_GOTO_PREV_CELL:
716 0 : rReq.SetReturnValue( SfxBoolItem( nSlot, rSh.GoPrevCell() ) );
717 0 : bCallDone = true;
718 0 : break;
719 : case FN_TABLE_DELETE_ROW:
720 0 : if ( rSh.DeleteRow() && rSh.HasSelection() )
721 0 : rSh.EnterStdMode();
722 0 : bCallDone = true;
723 0 : break;
724 : case FN_TABLE_MERGE_CELLS:
725 0 : if ( rSh.IsTableMode() )
726 0 : switch ( rSh.MergeTab() )
727 : {
728 : case TBLMERGE_OK:
729 0 : bCallDone = true;
730 : //no break;
731 0 : case TBLMERGE_NOSELECTION: break;
732 : case TBLMERGE_TOOCOMPLEX:
733 : {
734 0 : InfoBox aInfoBox( GetView().GetWindow(),
735 0 : SW_RES( MSG_ERR_TABLE_MERGE ) );
736 0 : aInfoBox.Execute();
737 0 : break;
738 : }
739 : default: OSL_ENSURE( !this, "unknown return value MergeTab.");
740 : }
741 0 : break;
742 : case FN_TABLE_ADJUST_CELLS:
743 : case FN_TABLE_BALANCE_CELLS:
744 : {
745 0 : sal_Bool bBalance = (FN_TABLE_BALANCE_CELLS == nSlot);
746 0 : if ( rSh.IsAdjustCellWidthAllowed(bBalance) )
747 : {
748 : {
749 : // remove actions to make a valid table selection
750 0 : UnoActionRemoveContext aRemoveContext(rSh.GetDoc());
751 : }
752 0 : rSh.AdjustCellWidth(bBalance);
753 : }
754 0 : bCallDone = true;
755 : }
756 0 : break;
757 : case FN_TABLE_BALANCE_ROWS:
758 0 : if ( rSh.BalanceRowHeight(sal_True) )
759 0 : rSh.BalanceRowHeight(sal_False);
760 0 : bCallDone = true;
761 0 : break;
762 : case FN_TABLE_SELECT_ALL:
763 0 : rSh.EnterStdMode();
764 0 : rSh.MoveTable( fnTableCurr, fnTableStart );
765 0 : rSh.SttSelect();
766 0 : rSh.MoveTable( fnTableCurr, fnTableEnd );
767 0 : rSh.EndSelect();
768 0 : bCallDone = true;
769 0 : break;
770 : case FN_TABLE_SELECT_COL:
771 0 : rSh.EnterStdMode();
772 0 : rSh.SelectTableCol();
773 0 : bCallDone = true;
774 0 : break;
775 : case FN_TABLE_SELECT_ROW:
776 0 : rSh.EnterStdMode();
777 0 : rSh.SelectTableRow();
778 0 : bCallDone = true;
779 0 : break;
780 : case FN_TABLE_SET_READ_ONLY_CELLS:
781 0 : rSh.ProtectCells();
782 0 : rSh.ResetSelect( 0, sal_False );
783 0 : bCallDone = true;
784 0 : break;
785 : case FN_TABLE_UNSET_READ_ONLY_CELLS:
786 0 : rSh.UnProtectCells();
787 0 : bCallDone = true;
788 0 : break;
789 : case SID_AUTOFORMAT:
790 : {
791 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
792 : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
793 :
794 0 : AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(&GetView().GetViewFrame()->GetWindow(), &rSh);
795 : OSL_ENSURE(pDlg, "Dialogdiet fail!");
796 0 : pDlg->Execute();
797 0 : delete pDlg;
798 : }
799 0 : break;
800 : case FN_TABLE_SET_ROW_HEIGHT:
801 : {
802 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
803 : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
804 :
805 0 : VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rSh, DLG_ROW_HEIGHT );
806 : OSL_ENSURE(pDlg, "Dialogdiet fail!");
807 0 : pDlg->Execute();
808 0 : delete pDlg;
809 : }
810 0 : break;
811 : case FN_NUMBER_BULLETS:
812 : case FN_NUM_BULLET_ON:
813 : OSL_ENSURE( !this, "function may not be called now." );
814 0 : break;
815 :
816 : case FN_TABLE_INSERT_COL:
817 : case FN_TABLE_INSERT_ROW:
818 : {
819 0 : bool bColumn = rReq.GetSlot() == FN_TABLE_INSERT_COL;
820 0 : sal_uInt16 nCount = 0;
821 0 : sal_Bool bAfter = sal_True;
822 0 : if (pItem)
823 : {
824 0 : nCount = ((const SfxInt16Item* )pItem)->GetValue();
825 0 : if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_INSERT_AFTER, true, &pItem))
826 0 : bAfter = ((const SfxBoolItem* )pItem)->GetValue();
827 : }
828 0 : else if( !rReq.IsAPI() )
829 0 : ++nCount;
830 :
831 0 : if( nCount )
832 : {
833 : // i74180: Table border patch submitted by chensuchun:
834 : // -->get the SvxBoxInfoItem of the table before insert
835 0 : SfxItemSet aCoreSet( GetPool(), aUITableAttrRange);
836 0 : ::lcl_TableParamToItemSet( aCoreSet, rSh );
837 0 : bool bSetInnerBorders = false;
838 0 : SwUndoId nUndoId = UNDO_EMPTY;
839 : // <--End
840 :
841 0 : if( bColumn )
842 : {
843 0 : rSh.StartUndo( UNDO_TABLE_INSCOL );
844 0 : rSh.InsertCol( nCount, bAfter );
845 0 : bSetInnerBorders = true;
846 0 : nUndoId = UNDO_TABLE_INSCOL;
847 : }
848 0 : else if ( !rSh.IsInRepeatedHeadline() )
849 : {
850 0 : rSh.StartUndo( UNDO_TABLE_INSROW );
851 0 : rSh.InsertRow( nCount, bAfter );
852 0 : bSetInnerBorders = true;
853 0 : nUndoId = UNDO_TABLE_INSROW;
854 : }
855 :
856 : // -->after inserting,reset the inner table borders
857 0 : if ( bSetInnerBorders )
858 : {
859 : const SvxBoxInfoItem aBoxInfo((const SvxBoxInfoItem&)
860 0 : aCoreSet.Get(SID_ATTR_BORDER_INNER));
861 0 : SfxItemSet aSet( GetPool(), SID_ATTR_BORDER_INNER,
862 0 : SID_ATTR_BORDER_INNER, 0);
863 0 : aSet.Put( aBoxInfo );
864 0 : ItemSetToTableParam( aSet, rSh );
865 0 : rSh.EndUndo( nUndoId );
866 : }
867 :
868 0 : bCallDone = true;
869 0 : break;
870 : }
871 :
872 0 : nSlot = bColumn ? FN_TABLE_INSERT_COL_DLG : FN_TABLE_INSERT_ROW_DLG;
873 : }
874 : // No break; on Count = 0 appears the dialog
875 : case FN_TABLE_INSERT_COL_DLG:
876 : case FN_TABLE_INSERT_ROW_DLG:
877 : {
878 0 : const SfxSlot* pSlot = GetStaticInterface()->GetSlot(nSlot);
879 0 : if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline())
880 : {
881 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
882 0 : boost::scoped_ptr<SvxAbstractInsRowColDlg> pDlg( pFact ? pFact->CreateSvxInsRowColDlg( GetView().GetWindow(), nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand() ) : 0);
883 :
884 0 : if( pDlg.get() && (pDlg->Execute() == 1) )
885 : {
886 0 : sal_uInt16 nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG) ? FN_TABLE_INSERT_COL : FN_TABLE_INSERT_ROW;
887 0 : SfxUInt16Item aCountItem( nDispatchSlot, static_cast< sal_uInt16 >(pDlg->getInsertCount()) );
888 0 : SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() );
889 0 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
890 0 : if( pVFrame )
891 0 : pVFrame->GetDispatcher()->Execute( nDispatchSlot, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aCountItem, &aAfter, 0L);
892 0 : }
893 : }
894 : }
895 0 : break;
896 : case FN_TABLE_SPLIT_CELLS:
897 : {
898 0 : long nCount=0;
899 0 : sal_Bool bHorizontal=sal_True;
900 0 : sal_Bool bProportional = sal_False;
901 0 : SFX_REQUEST_ARG( rReq, pSplit, SfxInt32Item, FN_TABLE_SPLIT_CELLS, false );
902 0 : SFX_REQUEST_ARG( rReq, pHor, SfxBoolItem, FN_PARAM_1, false );
903 0 : SFX_REQUEST_ARG( rReq, pProp, SfxBoolItem, FN_PARAM_2, false );
904 0 : if ( pSplit )
905 : {
906 0 : nCount = pSplit->GetValue();
907 0 : if ( pHor )
908 0 : bHorizontal = pHor->GetValue();
909 0 : if ( pProp )
910 0 : bProportional = pProp->GetValue();
911 : }
912 : else
913 : {
914 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
915 0 : if( pFact )
916 : {
917 0 : const long nMaxVert = rSh.GetAnyCurRect( RECT_FRM ).Width() / MINLAY;
918 0 : SvxAbstractSplittTableDialog* pDlg = pFact->CreateSvxSplittTableDialog( GetView().GetWindow(), rSh.IsTableVertical(), nMaxVert, 99 );
919 0 : if( pDlg && (pDlg->Execute() == RET_OK) )
920 : {
921 0 : nCount = pDlg->GetCount();
922 0 : bHorizontal = pDlg->IsHorizontal();
923 0 : bProportional = pDlg->IsProportional();
924 0 : rReq.AppendItem( SfxInt32Item( FN_TABLE_SPLIT_CELLS, nCount ) );
925 0 : rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bHorizontal ) );
926 0 : rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bProportional ) );
927 : }
928 0 : delete pDlg;
929 : }
930 : }
931 :
932 0 : if ( nCount>1 )
933 : {
934 0 : rSh.SplitTab(!bHorizontal, static_cast< sal_uInt16 >( nCount-1 ), bProportional );
935 0 : bCallDone = true;
936 : }
937 : else
938 0 : rReq.Ignore();
939 : }
940 0 : break;
941 :
942 : case FN_TABLE_SPLIT_TABLE:
943 : {
944 0 : SFX_REQUEST_ARG( rReq, pType, SfxUInt16Item, FN_PARAM_1, false );
945 0 : if( pType )
946 : {
947 0 : switch( pType->GetValue() )
948 : {
949 : case HEADLINE_NONE :
950 : case HEADLINE_BORDERCOPY:
951 : case HEADLINE_CNTNTCOPY:
952 : case HEADLINE_BOXATTRCOPY:
953 : case HEADLINE_BOXATRCOLLCOPY:
954 0 : rSh.SplitTable(pType->GetValue()) ;
955 : default: ;//wrong parameter, do nothing
956 : }
957 : }
958 : else
959 : {
960 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
961 : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
962 :
963 0 : AbstractSplitTableDialog* pDlg = pFact->CreateSplitTblDialog( GetView().GetWindow(), rSh );
964 : OSL_ENSURE(pDlg, "Dialogdiet fail!");
965 0 : pDlg->Execute();
966 0 : rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, pDlg->GetSplitMode() ) );
967 0 : delete pDlg;
968 0 : bCallDone = true;
969 : }
970 : }
971 0 : break;
972 :
973 : case FN_TABLE_MERGE_TABLE:
974 : {
975 0 : sal_Bool bPrev = rSh.CanMergeTable( sal_True );
976 0 : sal_Bool bNext = rSh.CanMergeTable( sal_False );
977 :
978 0 : if( bPrev && bNext )
979 : {
980 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
981 : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
982 0 : VclAbstractDialog* pDlg = pFact->CreateTblMergeDialog(GetView().GetWindow(), bPrev);
983 : OSL_ENSURE(pDlg, "dialogdiet pDlg fail!");
984 0 : if( RET_OK != pDlg->Execute())
985 0 : bPrev = bNext = sal_False;
986 0 : delete pDlg;
987 : }
988 :
989 0 : if( bPrev || bNext )
990 0 : rSh.MergeTable( bPrev );
991 : }
992 0 : break;
993 :
994 : case FN_TABLE_MODE_FIX :
995 : case FN_TABLE_MODE_FIX_PROP :
996 : case FN_TABLE_MODE_VARIABLE :
997 : {
998 : rSh.SetTblChgMode( ( FN_TABLE_MODE_FIX == nSlot ? TBLFIX_CHGABS
999 : : FN_TABLE_MODE_FIX_PROP == nSlot
1000 : ? TBLFIX_CHGPROP
1001 0 : : TBLVAR_CHGABS ) );
1002 :
1003 0 : SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
1004 : static sal_uInt16 aInva[] =
1005 : { FN_TABLE_MODE_FIX,
1006 : FN_TABLE_MODE_FIX_PROP,
1007 : FN_TABLE_MODE_VARIABLE,
1008 : 0
1009 : };
1010 0 : rBind.Invalidate( aInva );
1011 0 : bCallDone = true;
1012 : }
1013 0 : break;
1014 : case FN_TABLE_AUTOSUM:
1015 : {
1016 0 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
1017 0 : pVFrame->GetDispatcher()->Execute(FN_EDIT_FORMULA, SFX_CALLMODE_SYNCHRON);
1018 0 : const sal_uInt16 nId = SwInputChild::GetChildWindowId();
1019 : SwInputChild* pChildWin = (SwInputChild*)pVFrame->
1020 0 : GetChildWindow( nId );
1021 0 : OUString sSum;
1022 0 : GetShell().GetAutoSum(sSum);
1023 0 : if( pChildWin )
1024 0 : pChildWin->SetFormula( sSum );
1025 :
1026 : }
1027 0 : break;
1028 : case FN_TABLE_HEADLINE_REPEAT:
1029 0 : if(0 != rSh.GetRowsToRepeat())
1030 0 : rSh.SetRowsToRepeat( 0 );
1031 : else
1032 0 : rSh.SetRowsToRepeat(rSh.GetRowSelectionFromTop());
1033 0 : break;
1034 : case FN_TABLE_SELECT_CELL :
1035 0 : rSh.SelectTableCell();
1036 0 : break;
1037 : case FN_TABLE_DELETE_TABLE :
1038 : {
1039 0 : rSh.StartAction();
1040 0 : rSh.StartUndo();
1041 0 : rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_TABLE_SELECT_ALL);
1042 0 : rSh.DeleteTable();
1043 0 : rSh.EndUndo();
1044 0 : rSh.EndAction();
1045 : }
1046 : //'this' is already destroyed
1047 0 : return;
1048 : //break;
1049 : default:
1050 0 : bMore = true;
1051 : }
1052 :
1053 0 : if ( !bMore )
1054 : {
1055 0 : if(bCallDone)
1056 0 : rReq.Done();
1057 0 : return;
1058 : }
1059 : else
1060 0 : bMore = false;
1061 : // Now the slots which are working directly on the TableFmt.
1062 0 : SwFrmFmt *pFmt = rSh.GetTableFmt();
1063 0 : switch ( nSlot )
1064 : {
1065 : case SID_ATTR_ULSPACE:
1066 : {
1067 0 : if(pItem)
1068 : {
1069 0 : SvxULSpaceItem aULSpace( *(const SvxULSpaceItem*)pItem );
1070 0 : aULSpace.SetWhich( RES_UL_SPACE );
1071 0 : ::lcl_SetAttr( rSh, aULSpace );
1072 : }
1073 : }
1074 0 : break;
1075 :
1076 : case SID_ATTR_LRSPACE:
1077 : {
1078 0 : if(pItem)
1079 : {
1080 0 : SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE,
1081 0 : RES_HORI_ORIENT, RES_HORI_ORIENT, 0 );
1082 0 : SvxLRSpaceItem aLRSpace( *(const SvxLRSpaceItem*)pItem );
1083 0 : aLRSpace.SetWhich( RES_LR_SPACE );
1084 0 : aSet.Put( aLRSpace );
1085 0 : SwFmtHoriOrient aHori( pFmt->GetHoriOrient() );
1086 0 : aHori.SetHoriOrient( text::HoriOrientation::NONE );
1087 0 : aSet.Put( aLRSpace );
1088 0 : rSh.SetTblAttr( aSet );
1089 : }
1090 : }
1091 0 : break;
1092 : // The last case branch which needs a table manager!!
1093 : case FN_TABLE_SET_COL_WIDTH:
1094 : {
1095 0 : SwTableFUNC aMgr( &rSh, sal_False);
1096 0 : aMgr.ColWidthDlg(GetView().GetWindow());
1097 : }
1098 0 : break;
1099 : case SID_TABLE_VERT_NONE:
1100 : case SID_TABLE_VERT_CENTER:
1101 : case SID_TABLE_VERT_BOTTOM:
1102 : {
1103 : sal_uInt16 nAlign = nSlot == SID_TABLE_VERT_NONE ?
1104 : text::VertOrientation::NONE :
1105 : nSlot == SID_TABLE_VERT_CENTER ?
1106 0 : text::VertOrientation::CENTER : text::VertOrientation::BOTTOM;
1107 0 : rSh.SetBoxAlign(nAlign);
1108 0 : bCallDone = true;
1109 : }
1110 0 : break;
1111 :
1112 : case SID_ATTR_PARA_SPLIT:
1113 0 : if ( pItem )
1114 : {
1115 0 : SwFmtLayoutSplit aSplit( ((const SvxFmtSplitItem*)pItem)->GetValue());
1116 0 : SfxItemSet aSet(GetPool(), RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT, 0 );
1117 0 : aSet.Put(aSplit);
1118 0 : rSh.SetTblAttr(aSet);
1119 : }
1120 0 : break;
1121 :
1122 : case SID_ATTR_PARA_KEEP:
1123 0 : if ( pItem )
1124 : {
1125 0 : SvxFmtKeepItem aKeep( *(const SvxFmtKeepItem*)pItem );
1126 0 : aKeep.SetWhich( RES_KEEP );
1127 0 : SfxItemSet aSet(GetPool(), RES_KEEP, RES_KEEP, 0 );
1128 0 : aSet.Put(aKeep);
1129 0 : rSh.SetTblAttr(aSet);
1130 : }
1131 0 : break;
1132 : case FN_TABLE_ROW_SPLIT :
1133 : {
1134 0 : const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(pItem);
1135 0 : SwFmtRowSplit* pSplit = 0;
1136 0 : if(!pBool)
1137 : {
1138 0 : rSh.GetRowSplit(pSplit);
1139 0 : if(pSplit)
1140 0 : pSplit->SetValue(!pSplit->GetValue());
1141 : else
1142 0 : pSplit = new SwFmtRowSplit(sal_True);
1143 : }
1144 : else
1145 : {
1146 0 : pSplit = new SwFmtRowSplit(pBool->GetValue());
1147 : }
1148 0 : rSh.SetRowSplit( *pSplit );
1149 0 : delete pSplit;
1150 : }
1151 0 : break;
1152 :
1153 : default:
1154 : OSL_ENSURE( !this, "wrong Dispatcher" );
1155 0 : return;
1156 : }
1157 0 : if(bCallDone)
1158 0 : rReq.Done();
1159 : }
1160 :
1161 0 : void SwTableShell::GetState(SfxItemSet &rSet)
1162 : {
1163 0 : SfxWhichIter aIter( rSet );
1164 0 : SwWrtShell &rSh = GetShell();
1165 0 : SwFrmFmt *pFmt = rSh.GetTableFmt();
1166 : // os #124829# crash report: in case of an invalid shell selection return immediately
1167 0 : if(!pFmt)
1168 0 : return;
1169 0 : sal_uInt16 nSlot = aIter.FirstWhich();
1170 0 : while ( nSlot )
1171 : {
1172 0 : switch ( nSlot )
1173 : {
1174 : case FN_TABLE_MERGE_CELLS:
1175 0 : if ( !rSh.IsTableMode() )
1176 0 : rSet.DisableItem(FN_TABLE_MERGE_CELLS);
1177 0 : break;
1178 : case FN_TABLE_ADJUST_CELLS:
1179 0 : if ( !rSh.IsAdjustCellWidthAllowed() )
1180 0 : rSet.DisableItem(FN_TABLE_ADJUST_CELLS);
1181 0 : break;
1182 :
1183 : case FN_TABLE_BALANCE_CELLS:
1184 0 : if ( !rSh.IsAdjustCellWidthAllowed(sal_True) )
1185 0 : rSet.DisableItem(FN_TABLE_BALANCE_CELLS);
1186 0 : break;
1187 :
1188 : case FN_TABLE_BALANCE_ROWS:
1189 0 : if ( !rSh.BalanceRowHeight(sal_True) )
1190 0 : rSet.DisableItem(FN_TABLE_BALANCE_ROWS);
1191 0 : break;
1192 : case FN_OPTIMIZE_TABLE:
1193 0 : if ( !rSh.IsTableMode() &&
1194 0 : !rSh.IsAdjustCellWidthAllowed() &&
1195 0 : !rSh.IsAdjustCellWidthAllowed(sal_True) &&
1196 0 : !rSh.BalanceRowHeight(sal_True) )
1197 0 : rSet.DisableItem(FN_OPTIMIZE_TABLE);
1198 0 : break;
1199 : case SID_INSERT_DIAGRAM:
1200 : {
1201 0 : SvtModuleOptions aMOpt;
1202 0 : if ( !aMOpt.IsMath() || rSh.IsTblComplexForChart() )
1203 0 : rSet.DisableItem(nSlot);
1204 : }
1205 0 : break;
1206 :
1207 : case FN_INSERT_TABLE:
1208 0 : if ( rSh.CrsrInsideInputFld() )
1209 : {
1210 0 : rSet.DisableItem( nSlot );
1211 : }
1212 0 : break;
1213 :
1214 : case FN_TABLE_OPTIMAL_HEIGHT:
1215 : {
1216 : // Disable if auto height already is enabled.
1217 : SwFmtFrmSize *pSz;
1218 0 : rSh.GetRowHeight( pSz );
1219 0 : if ( pSz )
1220 : {
1221 0 : if ( ATT_VAR_SIZE == pSz->GetHeightSizeType() )
1222 0 : rSet.DisableItem( nSlot );
1223 0 : delete pSz;
1224 : }
1225 : }
1226 0 : break;
1227 : case FN_TABLE_INSERT_ROW:
1228 : case FN_TABLE_INSERT_ROW_DLG:
1229 : {
1230 0 : if ( rSh.IsInRepeatedHeadline() )
1231 0 : rSet.DisableItem( nSlot );
1232 : }
1233 0 : break;
1234 : case RES_LR_SPACE:
1235 0 : rSet.Put(pFmt->GetLRSpace());
1236 0 : break;
1237 : case RES_UL_SPACE:
1238 0 : rSet.Put(pFmt->GetULSpace());
1239 0 : break;
1240 :
1241 : case SID_TABLE_VERT_NONE:
1242 : case SID_TABLE_VERT_CENTER:
1243 : case SID_TABLE_VERT_BOTTOM:
1244 : {
1245 0 : sal_uInt16 nAlign = rSh.GetBoxAlign();
1246 0 : sal_Bool bSet = (nSlot == SID_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) ||
1247 0 : (nSlot == SID_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) ||
1248 0 : (nSlot == SID_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM);
1249 0 : rSet.Put(SfxBoolItem(nSlot, bSet));
1250 : }
1251 0 : break;
1252 :
1253 : case FN_TABLE_MODE_FIX :
1254 : case FN_TABLE_MODE_FIX_PROP :
1255 : case FN_TABLE_MODE_VARIABLE :
1256 : {
1257 0 : TblChgMode nMode = rSh.GetTblChgMode();
1258 0 : sal_Bool bSet = (nSlot == FN_TABLE_MODE_FIX && nMode == TBLFIX_CHGABS) ||
1259 0 : (nSlot == FN_TABLE_MODE_FIX_PROP && nMode == TBLFIX_CHGPROP) ||
1260 0 : (nSlot == FN_TABLE_MODE_VARIABLE && nMode == TBLVAR_CHGABS);
1261 0 : rSet.Put(SfxBoolItem(nSlot, bSet));
1262 : }
1263 0 : break;
1264 :
1265 : case SID_ATTR_PARA_SPLIT:
1266 0 : rSet.Put( pFmt->GetKeep() );
1267 0 : break;
1268 :
1269 : case SID_ATTR_PARA_KEEP:
1270 0 : rSet.Put( pFmt->GetLayoutSplit() );
1271 0 : break;
1272 : case FN_TABLE_SPLIT_TABLE:
1273 : {
1274 0 : if ( rSh.IsInHeadline() )
1275 0 : rSet.DisableItem( nSlot );
1276 : }
1277 0 : break;
1278 : case FN_TABLE_MERGE_TABLE:
1279 : {
1280 : sal_Bool bAsk;
1281 0 : if( !rSh.CanMergeTable( sal_True, &bAsk ))
1282 0 : rSet.DisableItem( nSlot );
1283 : }
1284 0 : break;
1285 :
1286 : case FN_TABLE_DELETE_ROW:
1287 : {
1288 0 : SwSelBoxes aBoxes;
1289 0 : ::GetTblSel( rSh, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
1290 0 : if( ::HasProtectedCells( aBoxes ))
1291 0 : rSet.DisableItem( nSlot );
1292 : }
1293 0 : break;
1294 : case FN_TABLE_DELETE_COL:
1295 : {
1296 0 : SwSelBoxes aBoxes;
1297 0 : ::GetTblSel( rSh, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
1298 0 : if( ::HasProtectedCells( aBoxes ))
1299 0 : rSet.DisableItem( nSlot );
1300 : }
1301 0 : break;
1302 :
1303 : case FN_TABLE_UNSET_READ_ONLY_CELLS:
1304 : // disable in readonly sections, but enable in protected cells
1305 0 : if( !rSh.CanUnProtectCells() )
1306 0 : rSet.DisableItem( nSlot );
1307 0 : break;
1308 : case RES_ROW_SPLIT:
1309 : {
1310 0 : const SwFmtLayoutSplit& rTabSplit = pFmt->GetLayoutSplit();
1311 0 : if ( !rTabSplit.GetValue() )
1312 : {
1313 0 : rSet.DisableItem( nSlot );
1314 : }
1315 : else
1316 : {
1317 0 : SwFmtRowSplit* pSplit = 0;
1318 0 : rSh.GetRowSplit(pSplit);
1319 0 : if(pSplit)
1320 0 : rSet.Put(*pSplit);
1321 : else
1322 0 : rSet.InvalidateItem( nSlot );
1323 0 : delete pSplit;
1324 : }
1325 : }
1326 0 : break;
1327 : case FN_TABLE_HEADLINE_REPEAT:
1328 0 : if(0 != rSh.GetRowsToRepeat())
1329 0 : rSet.Put(SfxBoolItem(nSlot, true));
1330 0 : else if(!rSh.GetRowSelectionFromTop())
1331 0 : rSet.DisableItem( nSlot );
1332 : else
1333 0 : rSet.Put(SfxBoolItem(nSlot, false));
1334 0 : break;
1335 : case FN_TABLE_SELECT_CELL :
1336 0 : if(rSh.HasBoxSelection())
1337 0 : rSet.DisableItem( nSlot );
1338 0 : break;
1339 : }
1340 0 : nSlot = aIter.NextWhich();
1341 0 : }
1342 : }
1343 :
1344 0 : SwTableShell::SwTableShell(SwView &_rView) :
1345 0 : SwBaseShell(_rView)
1346 : {
1347 0 : SetName(OUString("Table"));
1348 0 : SetHelpId(SW_TABSHELL);
1349 0 : SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table));
1350 0 : }
1351 :
1352 0 : void SwTableShell::GetFrmBorderState(SfxItemSet &rSet)
1353 : {
1354 0 : SfxItemSet aCoreSet( GetPool(),
1355 : RES_BOX, RES_BOX,
1356 0 : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
1357 0 : SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1358 0 : aCoreSet.Put( aBoxInfo );
1359 0 : GetShell().GetTabBorders( aCoreSet );
1360 0 : rSet.Put( aCoreSet );
1361 0 : }
1362 :
1363 0 : void SwTableShell::ExecTableStyle(SfxRequest& rReq)
1364 : {
1365 0 : SwWrtShell &rSh = GetShell();
1366 0 : const SfxItemSet *pArgs = rReq.GetArgs();
1367 0 : if(pArgs)
1368 0 : switch ( rReq.GetSlot() )
1369 : {
1370 : case SID_FRAME_LINESTYLE:
1371 : case SID_FRAME_LINECOLOR:
1372 : {
1373 0 : if ( rReq.GetSlot() == SID_FRAME_LINESTYLE )
1374 : {
1375 : const SvxLineItem &rLineItem = (const SvxLineItem&)pArgs->
1376 0 : Get( SID_FRAME_LINESTYLE );
1377 0 : const SvxBorderLine* pBorderLine = rLineItem.GetLine();
1378 0 : rSh.SetTabLineStyle( 0, sal_True, pBorderLine);
1379 : }
1380 : else
1381 : {
1382 : const SvxColorItem &rNewColorItem = (const SvxColorItem&)pArgs->
1383 0 : Get( SID_FRAME_LINECOLOR );
1384 0 : rSh.SetTabLineStyle( &rNewColorItem.GetValue() );
1385 : }
1386 :
1387 0 : rReq.Done();
1388 :
1389 0 : break;
1390 : }
1391 : }
1392 0 : }
1393 :
1394 0 : void SwTableShell::GetLineStyleState(SfxItemSet &rSet)
1395 : {
1396 0 : SfxItemSet aCoreSet( GetPool(),
1397 : RES_BOX, RES_BOX,
1398 0 : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0);
1399 0 : SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
1400 0 : aCoreSet.Put(aCoreInfo);
1401 0 : GetShell().GetTabBorders( aCoreSet );
1402 :
1403 0 : const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aCoreSet.Get( RES_BOX );
1404 0 : const SvxBorderLine* pLine = rBoxItem.GetTop();
1405 :
1406 0 : rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) );
1407 0 : SvxLineItem aLine( SID_FRAME_LINESTYLE );
1408 0 : aLine.SetLine(pLine);
1409 0 : rSet.Put( aLine );
1410 0 : }
1411 :
1412 0 : void SwTableShell::ExecNumberFormat(SfxRequest& rReq)
1413 : {
1414 0 : const SfxItemSet* pArgs = rReq.GetArgs();
1415 0 : SwWrtShell &rSh = GetShell();
1416 :
1417 : // At first the slots, which doesn't need a FrmMgr.
1418 0 : const SfxPoolItem* pItem = 0;
1419 0 : sal_uInt16 nSlot = rReq.GetSlot();
1420 0 : if(pArgs)
1421 0 : pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
1422 :
1423 : // Always aquire the language from the current cursor position.
1424 0 : LanguageType eLang = rSh.GetCurLang();
1425 0 : SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
1426 0 : sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
1427 0 : sal_uInt16 nFmtType = 0, nOffset = 0;
1428 :
1429 0 : switch ( nSlot )
1430 : {
1431 : case FN_NUMBER_FORMAT:
1432 0 : if( pItem )
1433 : {
1434 : // Determine index for string.
1435 0 : OUString aCode( ((const SfxStringItem*)pItem)->GetValue() );
1436 0 : nNumberFormat = pFormatter->GetEntryKey( aCode, eLang );
1437 0 : if( NUMBERFORMAT_ENTRY_NOT_FOUND == nNumberFormat )
1438 : {
1439 : // Re-enter
1440 : sal_Int32 nErrPos;
1441 : short nType;
1442 0 : if( !pFormatter->PutEntry( aCode, nErrPos, nType,
1443 0 : nNumberFormat, eLang ))
1444 0 : nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
1445 0 : }
1446 : }
1447 0 : break;
1448 0 : case FN_NUMBER_STANDARD: nFmtType = NUMBERFORMAT_NUMBER; break;
1449 0 : case FN_NUMBER_SCIENTIFIC: nFmtType = NUMBERFORMAT_SCIENTIFIC; break;
1450 0 : case FN_NUMBER_DATE: nFmtType = NUMBERFORMAT_DATE; break;
1451 0 : case FN_NUMBER_TIME: nFmtType = NUMBERFORMAT_TIME; break;
1452 0 : case FN_NUMBER_CURRENCY: nFmtType = NUMBERFORMAT_CURRENCY; break;
1453 0 : case FN_NUMBER_PERCENT: nFmtType = NUMBERFORMAT_PERCENT; break;
1454 :
1455 : case FN_NUMBER_TWODEC: // #.##0,00
1456 0 : nFmtType = NUMBERFORMAT_NUMBER;
1457 0 : nOffset = NF_NUMBER_1000DEC2;
1458 0 : break;
1459 :
1460 : default:
1461 : OSL_FAIL("wrong dispatcher");
1462 0 : return;
1463 : }
1464 :
1465 0 : if( nFmtType )
1466 0 : nNumberFormat = pFormatter->GetStandardFormat( nFmtType, eLang ) + nOffset;
1467 :
1468 0 : if( NUMBERFORMAT_ENTRY_NOT_FOUND != nNumberFormat )
1469 : {
1470 0 : SfxItemSet aBoxSet( GetPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMAT );
1471 0 : aBoxSet.Put( SwTblBoxNumFormat( nNumberFormat ));
1472 0 : rSh.SetTblBoxFormulaAttrs( aBoxSet );
1473 : }
1474 :
1475 0 : }
1476 :
1477 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|