txtnum.cxx (efeef26f) txtnum.cxx (766ce4d0)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 32 unchanged lines hidden (view full) ---

41#include "view.hxx"
42#include "viewopt.hxx"
43#include "wdocsh.hxx"
44#include "textsh.hxx"
45#include "uiitems.hxx"
46#include "swabstdlg.hxx"
47#include <globals.hrc>
48#include <sfx2/tabdlg.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 32 unchanged lines hidden (view full) ---

41#include "view.hxx"
42#include "viewopt.hxx"
43#include "wdocsh.hxx"
44#include "textsh.hxx"
45#include "uiitems.hxx"
46#include "swabstdlg.hxx"
47#include <globals.hrc>
48#include <sfx2/tabdlg.hxx>
49#include <svx/nbdtmg.hxx>
50#include <svx/nbdtmgfact.hxx>
49
51
52using namespace svx::sidebar;
53
50void SwTextShell::ExecEnterNum(SfxRequest &rReq)
51{
52 //wg. Aufzeichnung schon vor dem evtl. Shellwechsel
53 switch(rReq.GetSlot())
54 {
55 case FN_NUM_NUMBERING_ON:
56 {
57 SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );

--- 28 unchanged lines hidden (view full) ---

86 if( bMode )
87 GetShell().BulletOn();
88 else
89 GetShell().NumOrBulletOff(); // #i29560#
90 }
91 }
92 break;
93 case FN_NUMBER_BULLETS:
54void SwTextShell::ExecEnterNum(SfxRequest &rReq)
55{
56 //wg. Aufzeichnung schon vor dem evtl. Shellwechsel
57 switch(rReq.GetSlot())
58 {
59 case FN_NUM_NUMBERING_ON:
60 {
61 SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );

--- 28 unchanged lines hidden (view full) ---

90 if( bMode )
91 GetShell().BulletOn();
92 else
93 GetShell().NumOrBulletOff(); // #i29560#
94 }
95 }
96 break;
97 case FN_NUMBER_BULLETS:
98 case SID_OUTLINE_BULLET:
94 {
95 // --> OD 2008-02-29 #refactorlists#
96// // per default sal_True, damit die Schleife im Dialog richtig arbeitet!
97// sal_Bool bHasChild = sal_True;
98 // <--
99 SfxItemSet aSet(GetPool(),
100 SID_HTML_MODE, SID_HTML_MODE,
101 SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,

--- 137 unchanged lines hidden (view full) ---

239 }
240 break;
241 default:
242 ASSERT(sal_False, falscher Dispatcher);
243 return;
244 }
245}
246
99 {
100 // --> OD 2008-02-29 #refactorlists#
101// // per default sal_True, damit die Schleife im Dialog richtig arbeitet!
102// sal_Bool bHasChild = sal_True;
103 // <--
104 SfxItemSet aSet(GetPool(),
105 SID_HTML_MODE, SID_HTML_MODE,
106 SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,

--- 137 unchanged lines hidden (view full) ---

244 }
245 break;
246 default:
247 ASSERT(sal_False, falscher Dispatcher);
248 return;
249 }
250}
251
252void SwTextShell::ExecSetNumber(SfxRequest &rReq)
253{
254 SwNumRule aRule( GetShell().GetUniqueNumRuleName(),
255 // --> OD 2008-06-06 #i89178#
256 numfunc::GetDefaultPositionAndSpaceMode() );
257 // <--
258
259 SvxNumRule aSvxRule = aRule.MakeSvxNumRule();
260 const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 );
247
261
262 if( bRightToLeft )
263 {
264 for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
265 {
266 SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) );
267 /* if ( n && bHtml )
268 {
269 // 1/2" fuer HTML
270 aFmt.SetLSpace(720);
271 aFmt.SetAbsLSpace(n * 720);
272 }*/
273 // --> FME 2005-01-21 #i38904# Default alignment for
274 // numbering/bullet should be rtl in rtl paragraph:
275 if ( bRightToLeft )
276 {
277 aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
278 }
279 // <--
280 aSvxRule.SetLevel( n, aFmt, sal_False );
281 }
282 aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False);
283 }
284
285 const SwNumRule* pCurRule = GetShell().GetCurNumRule();
286 sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
287 if( pCurRule )
288 {
289 sal_uInt16 nLevel = GetShell().GetNumLevel();
290 if( nLevel < MAXLEVEL )
291 {
292 nActNumLvl = 1<<nLevel;
293 }
294
295 aSvxRule = pCurRule->MakeSvxNumRule();
296
297 //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN)
298 for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
299 {
300 SvxNumberFormat aFmt(aSvxRule.GetLevel(i));
301 if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
302 {
303 const SvxBrushItem* pBrush = aFmt.GetBrush();
304 const String* pLinkStr;
305 if(pBrush &&
306 0 != (pLinkStr = pBrush->GetGraphicLink()) &&
307 pLinkStr->Len())
308 aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
309 aSvxRule.SetLevel(i, aFmt, aSvxRule.Get(i) != 0);
310 }
311 }
312 }
313
314
315 switch(rReq.GetSlot())
316 {
317 case FN_SVX_SET_NUMBER:
318 {
319 SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False );
320 if (pItem)
321 {
322 sal_uInt16 nIdx = pItem->GetValue();
323 if (nIdx==DEFAULT_NONE) {
324 GetShell().DelNumRules();
325 break;
326 }
327 --nIdx;
328
329 NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
330 if ( pNumbering )
331 {
332 SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(),
333 numfunc::GetDefaultPositionAndSpaceMode() );
334
335 SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
336 //Sym3_2508, set unit attribute to NB Manager
337 SfxItemSet aSet(GetPool(),
338 SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
339 0 );
340 aSet.Put(SvxNumBulletItem(aTempRule));
341 pNumbering->SetItems(&aSet);
342 pNumbering->ApplyNumRule(aTempRule,nIdx,nActNumLvl);
343
344 sal_uInt16 nMask = 1;
345 for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
346 {
347 if(nActNumLvl & nMask)
348 {
349 SvxNumberFormat aFmt(aTempRule.GetLevel(i));
350 aSvxRule.SetLevel(i, aFmt);
351 }
352 nMask <<= 1 ;
353 }
354
355 aSvxRule.UnLinkGraphics();
356 SwNumRule aSetRule( pCurRule
357 ? pCurRule->GetName()
358 : GetShell().GetUniqueNumRuleName(),
359 numfunc::GetDefaultPositionAndSpaceMode() );
360 aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());
361
362 aSetRule.SetAutoRule( sal_True );
363 const bool bCreateList = (pCurRule == 0);
364 GetShell().SetCurNumRule( aSetRule, bCreateList );
365 }
366 //End
367 }
368 break;
369 }
370 case FN_SVX_SET_BULLET:
371 {
372 SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False );
373 if (pItem)
374 {
375 sal_uInt16 nIdx = pItem->GetValue();
376 if (nIdx==DEFAULT_NONE) {
377 GetShell().DelNumRules();
378 break;
379 }
380 nIdx--;
381
382 NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
383 if ( pBullets )
384 {
385 SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(),
386 numfunc::GetDefaultPositionAndSpaceMode() );
387
388 SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
389 //Sym3_2508, set unit attribute to NB Manager
390 SfxItemSet aSet(GetPool(),
391 SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
392 0 );
393 aSet.Put(SvxNumBulletItem(aTempRule));
394 pBullets->SetItems(&aSet);
395
396 //SvxNumRule aTempRule( 0, 10, false );
397 pBullets->ApplyNumRule(aTempRule,nIdx,nActNumLvl);
398 sal_uInt16 nMask = 1;
399 for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
400 {
401 if(nActNumLvl & nMask)
402 {
403 SvxNumberFormat aFmt(aTempRule.GetLevel(i));
404 aSvxRule.SetLevel(i, aFmt);
405 }
406 nMask <<= 1;
407 }
408 aSvxRule.UnLinkGraphics();
409
410 SwNumRule aSetRule( pCurRule
411 ? pCurRule->GetName()
412 : GetShell().GetUniqueNumRuleName(),
413 numfunc::GetDefaultPositionAndSpaceMode() );
414
415 aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());
416
417 aSetRule.SetAutoRule( sal_True );
418 const bool bCreateList = (pCurRule == 0);
419 GetShell().SetCurNumRule( aSetRule, bCreateList );
420 }
421 //End
422 }
423
424 }
425 break;
426 }
427}