Rohan_Kanojia

Untitled

May 16th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.12 KB | None | 0 0
  1.     const SfxPoolItem *pItem = nullptr;
  2.     SfxItemSet aTempItem(*pOrgSet);
  3.     /*
  4.     static const sal_uInt16 aRanges[] = {
  5.         SDRATTR_START, SDRATTR_END,
  6.         EE_ITEMS_START, EE_ITEMS_END,
  7.         SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR, 0
  8.     };
  9.     */
  10.  
  11.     if( IS_OUTLINE(ePO))
  12.     {
  13.         // Unfortunately, the Itemsets of our style sheets are not discreet..
  14.         const sal_uInt16* pPtr = pOrgSet->GetRanges();
  15.         sal_uInt16 p1, p2;
  16.         while( *pPtr )
  17.         {
  18.             p1 = pPtr[0];
  19.             p2 = pPtr[1];
  20.  
  21.             // first, we make it discreet
  22.             while(pPtr[2] && (pPtr[2] - p2 == 1))
  23.             {
  24.                 p2 = pPtr[3];
  25.                 pPtr += 2;
  26.             }
  27.             aInputSet.MergeRange( p1, p2 );
  28.             pPtr += 2;
  29.         }
  30.  
  31.         aInputSet.Put( rStyleBase.GetItemSet() );
  32.  
  33.         // need parent-relationship
  34.         const SfxItemSet* pParentItemSet = rStyleBase.GetItemSet().GetParent();
  35.         if( pParentItemSet )
  36.             aInputSet.SetParent( pParentItemSet );
  37.  
  38.         pOutSet = new SfxItemSet( rStyleBase.GetItemSet() );
  39.         pOutSet->ClearItem();
  40.  
  41.  
  42.         // If there is no bullet item in this stylesheet, we get it
  43.         // from 'Outline 1' style sheet.
  44.         if( SfxItemState::SET != aInputSet.GetItemState(EE_PARA_NUMBULLET, false, &pItem ))
  45.         {
  46.             OUString aStyleName(SD_RESSTR(STR_PSEUDOSHEET_OUTLINE) + " 1");
  47.             SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
  48.  
  49.             if(pFirstStyleSheet)
  50.                 if( SfxItemState::SET == pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, &pItem) )
  51.                     aInputSet.Put( *pItem );
  52.         }
  53.  
  54.         // preselect selected layer in dialog
  55.         aInputSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, 1<<GetOutlineLevel()));
  56.  
  57.         SetInputSet( &aInputSet );
  58.     }
  59.     else
  60.         SetInputSet( pOrgSet );
  61.  
  62.     /*
  63.      * Adjusting item set since background tabpage can only work
  64.      * with SvxBrushItems, EE_CHAR_BKGCOLOR is SvxBackgroundColorItem.
  65.      */
  66.     if ( pOrgSet->GetItemState( EE_CHAR_BKGCOLOR, true, &pItem ) == SfxItemState::SET )
  67.     {
  68.         aInputSet.SetRanges(pOrgSet->GetRanges());
  69.         aInputSet.MergeRange(EE_ITEMS_START, EE_ITEMS_END);
  70.         aInputSet.MergeRange(SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR+1);
  71.         aInputSet.Put(rStyleBase.GetItemSet());
  72.         /* extract Color outta SvxBackColorItem */
  73.         Color aBackColor = static_cast<const SvxBackgroundColorItem*>(pItem)->GetValue();
  74.         /* make new SvxBrushItem with this Color */
  75.         SvxBrushItem aBrushItem( aBackColor, SID_ATTR_BRUSH_CHAR );
  76.  
  77.         aInputSet.ClearItem( EE_CHAR_BKGCOLOR);
  78.         /* and stick it into the set */
  79.         aInputSet.Put( aBrushItem );
  80.  
  81.         SetInputSet(&aInputSet);
  82.     }
  83.     SvxColorListItem aColorListItem(*static_cast<const SvxColorListItem*>( mpDocShell->GetItem( SID_COLOR_TABLE ) ) );
  84.     SvxGradientListItem aGradientListItem(*static_cast<const SvxGradientListItem*>( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) );
Add Comment
Please, Sign In to add comment