' Name:  Labeling.CreateTextMasks
'
' Author: ESRI 1998-10-01
'
' Title:  Create text masks for a theme's labels (ESRI)
'
' Topics:  Graphics & Symbols
'
' Description:  Adds a text mask polygon for each piece of GraphicText
' associated with a theme.  Use the symbol window to customize the
' text masks.
'
' Requires:  
'
' Self:  
'
' Returns:  

theView = av.GetActiveDoc
theView.GetGraphics.UnSelectAll
tmlist = {}
for each t in theView.GetActiveThemes
  gs = t.GetGraphics
  for each g in gs
    if (g.Is(graphicText)) then
      br = g.GetBounds.Clone
      bg = GraphicShape.Make(br)
      bg.SetObjectTag(t.GetName)
      tmlist.Add(bg)
    end
  end
end
tmFill = RasterFill.Make
tmFill.SetStyle(#RASTERFILL_STYLE_STIPPLE)
tmFill.SetColor(Color.GetWhite)
for each tm in tmlist
  ThemeName = tm.GetObjectTag
  tmHeight = tm.GetShape.GetHeight
  tmWidth = tm.GetShape.GetWidth
  tm.GetShape.SetOrigin(tm.GetOrigin-((tmHeight/5)@(tmHeight/5)))
  tm.GetShape.SetSize(tmWidth@tmHeight+((tmHeight/2.5)@(tmHeight/5)))
  theView.FindTheme(ThemeName).GetGraphics.Add(tm)
  theView.GetGraphics.AddBatch(tm)
  tm.SetSymbol(tmFill)
  tm.SetSelected(true)
end
theView.GetGraphics.MoveSelectedToBack
theView.GetGraphics.EndBatch
theView.GetGraphics.Invalidate