LCOV - code coverage report
Current view: top level - svx/source/dialog - charmap.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 874 0.0 %
Date: 2014-04-14 Functions: 0 46 0.0 %
Legend: Lines: hit not hit

          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 <stdio.h>
      21             : 
      22             : #include <vcl/svapp.hxx>
      23             : #include <vcl/settings.hxx>
      24             : #include <svtools/colorcfg.hxx>
      25             : 
      26             : #include <rtl/textenc.h>
      27             : #include <svx/ucsubset.hxx>
      28             : 
      29             : #include <svx/dialogs.hrc>
      30             : 
      31             : #include <svx/charmap.hxx>
      32             : #include <svx/dialmgr.hxx>
      33             : #include <svx/svxdlg.hxx>
      34             : 
      35             : #include "charmapacc.hxx"
      36             : #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
      37             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      38             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      39             : #include <comphelper/types.hxx>
      40             : #include <svl/itemset.hxx>
      41             : #include <unicode/uchar.h>
      42             : 
      43             : #include "rtl/ustrbuf.hxx"
      44             : 
      45             : using namespace ::com::sun::star::accessibility;
      46             : using namespace ::com::sun::star::uno;
      47             : using namespace ::com::sun::star;
      48             : 
      49             : 
      50           0 : sal_uInt32& SvxShowCharSet::getSelectedChar()
      51             : {
      52             :     static sal_uInt32 cSelectedChar = ' '; // keeps selected character over app livetime
      53           0 :     return cSelectedChar;
      54             : }
      55             : 
      56             : // class SvxShowCharSet ==================================================
      57             : 
      58           0 : SvxShowCharSet::SvxShowCharSet(Window* pParent)
      59             :     : Control(pParent, WB_TABSTOP | WB_BORDER)
      60             :     , m_pAccessible(NULL)
      61           0 :     , aVscrollSB( this, WB_VERT)
      62             : {
      63           0 :     init();
      64           0 :     InitSettings( true, true );
      65           0 : }
      66             : 
      67           0 : void SvxShowCharSet::init()
      68             : {
      69           0 :     nSelectedIndex = -1;    // TODO: move into init list when it is no longer static
      70           0 :     m_nXGap = 0;
      71           0 :     m_nYGap = 0;
      72             : 
      73           0 :     SetStyle( GetStyle() | WB_CLIPCHILDREN );
      74           0 :     aVscrollSB.SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) );
      75           0 :     aVscrollSB.EnableDrag( true );
      76             :     // other settings like aVscroll depend on selected font => see SetFont
      77             : 
      78           0 :     bDrag = false;
      79           0 : }
      80             : 
      81           0 : void SvxShowCharSet::Resize()
      82             : {
      83           0 :     Control::Resize();
      84           0 :     SetFont(GetFont()); //force recalculation of correct fontsize
      85           0 : }
      86             : 
      87           0 : extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxShowCharSet(Window *pParent, VclBuilder::stringmap &)
      88             : {
      89           0 :     return new SvxShowCharSet(pParent);
      90             : }
      91             : 
      92             : 
      93             : 
      94           0 : void SvxShowCharSet::GetFocus()
      95             : {
      96           0 :     Control::GetFocus();
      97           0 :     SelectIndex( nSelectedIndex, true );
      98           0 : }
      99             : 
     100             : 
     101             : 
     102           0 : void SvxShowCharSet::LoseFocus()
     103             : {
     104           0 :     Control::LoseFocus();
     105           0 :     SelectIndex( nSelectedIndex, false );
     106           0 : }
     107             : 
     108             : 
     109             : 
     110           0 : void SvxShowCharSet::StateChanged( StateChangedType nType )
     111             : {
     112           0 :     if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
     113           0 :         InitSettings( true, false );
     114           0 :     else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
     115           0 :         InitSettings( false, true );
     116             : 
     117           0 :     Control::StateChanged( nType );
     118           0 : }
     119             : 
     120             : 
     121             : 
     122           0 : void SvxShowCharSet::DataChanged( const DataChangedEvent& rDCEvt )
     123             : {
     124           0 :     if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS )
     125           0 :       && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
     126           0 :         InitSettings( true, true );
     127             :     else
     128           0 :         Control::DataChanged( rDCEvt );
     129           0 : }
     130             : 
     131             : 
     132             : 
     133           0 : void SvxShowCharSet::MouseButtonDown( const MouseEvent& rMEvt )
     134             : {
     135           0 :     if ( rMEvt.IsLeft() )
     136             :     {
     137           0 :         if ( rMEvt.GetClicks() == 1 )
     138             :         {
     139           0 :             GrabFocus();
     140           0 :             bDrag = true;
     141           0 :             CaptureMouse();
     142             : 
     143           0 :             int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() );
     144             :         // Fire the focus event
     145           0 :             SelectIndex( nIndex, true);
     146             :         }
     147             : 
     148           0 :         if ( !(rMEvt.GetClicks() % 2) )
     149           0 :             aDoubleClkHdl.Call( this );
     150             :     }
     151           0 : }
     152             : 
     153             : 
     154             : 
     155           0 : void SvxShowCharSet::MouseButtonUp( const MouseEvent& rMEvt )
     156             : {
     157           0 :     if ( bDrag && rMEvt.IsLeft() )
     158             :     {
     159             :         // released mouse over character map
     160           0 :         if ( Rectangle(Point(), GetOutputSize()).IsInside(rMEvt.GetPosPixel()))
     161           0 :             aSelectHdl.Call( this );
     162           0 :         ReleaseMouse();
     163           0 :         bDrag = false;
     164             :     }
     165           0 : }
     166             : 
     167             : 
     168             : 
     169           0 : void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt )
     170             : {
     171           0 :     if ( rMEvt.IsLeft() && bDrag )
     172             :     {
     173           0 :         Point aPos  = rMEvt.GetPosPixel();
     174           0 :         Size  aSize = GetSizePixel();
     175             : 
     176           0 :         if ( aPos.X() < 0 )
     177           0 :             aPos.X() = 0;
     178           0 :         else if ( aPos.X() > aSize.Width()-5 )
     179           0 :             aPos.X() = aSize.Width()-5;
     180           0 :         if ( aPos.Y() < 0 )
     181           0 :             aPos.Y() = 0;
     182           0 :         else if ( aPos.Y() > aSize.Height()-5 )
     183           0 :             aPos.Y() = aSize.Height()-5;
     184             : 
     185           0 :         int nIndex = PixelToMapIndex( aPos );
     186             :     // Fire the focus event.
     187           0 :         SelectIndex( nIndex, true );
     188             :     }
     189           0 : }
     190             : 
     191             : 
     192             : 
     193           0 : void SvxShowCharSet::Command( const CommandEvent& rCEvt )
     194             : {
     195           0 :     if( !HandleScrollCommand( rCEvt, 0, &aVscrollSB ) )
     196           0 :         Control::Command( rCEvt );
     197           0 : }
     198             : 
     199             : 
     200             : 
     201           0 : sal_uInt16 SvxShowCharSet::GetRowPos(sal_uInt16 _nPos) const
     202             : {
     203           0 :     return _nPos / COLUMN_COUNT ;
     204             : }
     205             : 
     206             : 
     207             : 
     208           0 : sal_uInt16 SvxShowCharSet::GetColumnPos(sal_uInt16 _nPos) const
     209             : {
     210           0 :     return _nPos % COLUMN_COUNT ;
     211             : }
     212             : 
     213             : 
     214             : 
     215           0 : int SvxShowCharSet::FirstInView( void ) const
     216             : {
     217           0 :     int nIndex = 0;
     218           0 :     if( aVscrollSB.IsVisible() )
     219           0 :         nIndex += aVscrollSB.GetThumbPos() * COLUMN_COUNT;
     220           0 :     return nIndex;
     221             : }
     222             : 
     223             : 
     224             : 
     225           0 : int SvxShowCharSet::LastInView( void ) const
     226             : {
     227           0 :     sal_uIntPtr nIndex = FirstInView();
     228           0 :     nIndex += ROW_COUNT * COLUMN_COUNT - 1;
     229           0 :     sal_uIntPtr nCompare = sal::static_int_cast<sal_uIntPtr>( maFontCharMap.GetCharCount() - 1 );
     230           0 :     if( nIndex > nCompare )
     231           0 :         nIndex = nCompare;
     232           0 :     return nIndex;
     233             : }
     234             : 
     235             : 
     236             : 
     237           0 : inline Point SvxShowCharSet::MapIndexToPixel( int nIndex ) const
     238             : {
     239           0 :     const int nBase = FirstInView();
     240           0 :     int x = ((nIndex - nBase) % COLUMN_COUNT) * nX;
     241           0 :     int y = ((nIndex - nBase) / COLUMN_COUNT) * nY;
     242           0 :     return Point( x + m_nXGap, y + m_nYGap );
     243             : }
     244             : 
     245             : 
     246           0 : int SvxShowCharSet::PixelToMapIndex( const Point& point) const
     247             : {
     248           0 :     int nBase = FirstInView();
     249           0 :     return (nBase + ((point.X() - m_nXGap)/nX) + ((point.Y() - m_nYGap)/nY) * COLUMN_COUNT);
     250             : }
     251             : 
     252             : 
     253             : 
     254           0 : void SvxShowCharSet::KeyInput( const KeyEvent& rKEvt )
     255             : {
     256           0 :     KeyCode aCode = rKEvt.GetKeyCode();
     257             : 
     258           0 :     if( aCode.GetModifier() )
     259             :     {
     260           0 :         Control::KeyInput( rKEvt );
     261           0 :         return;
     262             :     }
     263             : 
     264           0 :     int tmpSelected = nSelectedIndex;
     265             : 
     266           0 :     switch ( aCode.GetCode() )
     267             :     {
     268             :         case KEY_SPACE:
     269           0 :             aSelectHdl.Call( this );
     270           0 :             break;
     271             :         case KEY_LEFT:
     272           0 :             --tmpSelected;
     273           0 :             break;
     274             :         case KEY_RIGHT:
     275           0 :             ++tmpSelected;
     276           0 :             break;
     277             :         case KEY_UP:
     278           0 :             tmpSelected -= COLUMN_COUNT;
     279           0 :             break;
     280             :         case KEY_DOWN:
     281           0 :             tmpSelected += COLUMN_COUNT;
     282           0 :             break;
     283             :         case KEY_PAGEUP:
     284           0 :             tmpSelected -= ROW_COUNT * COLUMN_COUNT;
     285           0 :             break;
     286             :         case KEY_PAGEDOWN:
     287           0 :             tmpSelected += ROW_COUNT * COLUMN_COUNT;
     288           0 :             break;
     289             :         case KEY_HOME:
     290           0 :             tmpSelected = 0;
     291           0 :             break;
     292             :         case KEY_END:
     293           0 :             tmpSelected = maFontCharMap.GetCharCount() - 1;
     294           0 :             break;
     295             :         case KEY_TAB:   // some fonts have a character at these unicode control codes
     296             :         case KEY_ESCAPE:
     297             :         case KEY_RETURN:
     298           0 :             Control::KeyInput( rKEvt );
     299           0 :             tmpSelected = - 1;  // mark as invalid
     300           0 :             break;
     301             :         default:
     302             :             {
     303           0 :                 sal_UCS4 cChar = rKEvt.GetCharCode();
     304           0 :                 sal_UCS4 cNext = maFontCharMap.GetNextChar( cChar - 1 );
     305           0 :                 tmpSelected = maFontCharMap.GetIndexFromChar( cNext );
     306           0 :                 if( tmpSelected < 0 || (cChar != cNext) )
     307             :                 {
     308           0 :                     Control::KeyInput( rKEvt );
     309           0 :                     tmpSelected = - 1;  // mark as invalid
     310             :                 }
     311             :             }
     312             :     }
     313             : 
     314           0 :     if ( tmpSelected >= 0 )
     315             :     {
     316           0 :         SelectIndex( tmpSelected, true );
     317           0 :         aPreSelectHdl.Call( this );
     318             :     }
     319             : }
     320             : 
     321             : 
     322             : 
     323           0 : void SvxShowCharSet::Paint( const Rectangle& )
     324             : {
     325           0 :     DrawChars_Impl( FirstInView(), LastInView() );
     326           0 : }
     327             : 
     328           0 : void SvxShowCharSet::DeSelect()
     329             : {
     330           0 :     DrawChars_Impl(nSelectedIndex,nSelectedIndex);
     331           0 : }
     332             : 
     333             : // stretch a grid rectangle if its at the edge to fill unused space
     334           0 : Rectangle SvxShowCharSet::getGridRectangle(const Point &rPointUL, const Size &rOutputSize)
     335             : {
     336           0 :     long x = rPointUL.X() - 1;
     337           0 :     long y = rPointUL.Y() - 1;
     338           0 :     Point aPointUL(x+1, y+1);
     339           0 :     Size aGridSize(nX-1, nY-1);
     340             : 
     341           0 :     long nXDistFromLeft = x - m_nXGap;
     342           0 :     if (nXDistFromLeft <= 1)
     343             :     {
     344           0 :         aPointUL.X() = 1;
     345           0 :         aGridSize.Width() += m_nXGap + nXDistFromLeft;
     346             :     }
     347           0 :     long nXDistFromRight = rOutputSize.Width() - m_nXGap - nX - x;
     348           0 :     if (nXDistFromRight <= 1)
     349           0 :         aGridSize.Width() += m_nXGap + nXDistFromRight;
     350             : 
     351           0 :     long nXDistFromTop = y - m_nYGap;
     352           0 :     if (nXDistFromTop <= 1)
     353             :     {
     354           0 :         aPointUL.Y() = 1;
     355           0 :         aGridSize.Height() += m_nYGap + nXDistFromTop;
     356             :     }
     357           0 :     long nXDistFromBottom = rOutputSize.Height() - m_nYGap - nY - y;
     358           0 :     if (nXDistFromBottom <= 1)
     359           0 :         aGridSize.Height() += m_nYGap + nXDistFromBottom;
     360             : 
     361           0 :     return Rectangle(aPointUL, aGridSize);
     362             : }
     363             : 
     364           0 : void SvxShowCharSet::DrawChars_Impl( int n1, int n2 )
     365             : {
     366           0 :     if( n1 > LastInView() || n2 < FirstInView() )
     367           0 :         return;
     368             : 
     369           0 :     Size aOutputSize = GetOutputSizePixel();
     370           0 :     if (aVscrollSB.IsVisible())
     371           0 :         aOutputSize.Width() -= aVscrollSB.GetOptimalSize().Width();
     372             : 
     373             :     int i;
     374           0 :     for ( i = 1; i < COLUMN_COUNT; ++i )
     375           0 :         DrawLine( Point( nX * i + m_nXGap, 0 ), Point( nX * i + m_nXGap, aOutputSize.Height() ) );
     376           0 :     for ( i = 1; i < ROW_COUNT; ++i )
     377           0 :         DrawLine( Point( 0, nY * i + m_nYGap ), Point( aOutputSize.Width(), nY * i + m_nYGap) );
     378             : 
     379           0 :     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
     380           0 :     const Color aWindowTextColor( rStyleSettings.GetFieldTextColor() );
     381           0 :     Color aHighlightColor( rStyleSettings.GetHighlightColor() );
     382           0 :     Color aHighlightTextColor( rStyleSettings.GetHighlightTextColor() );
     383           0 :     Color aFaceColor( rStyleSettings.GetFaceColor() );
     384           0 :     Color aLightColor( rStyleSettings.GetLightColor() );
     385           0 :     Color aShadowColor( rStyleSettings.GetShadowColor() );
     386             : 
     387           0 :     int nTextHeight = GetTextHeight();
     388           0 :     Rectangle aBoundRect;
     389           0 :     for( i = n1; i <= n2; ++i )
     390             :     {
     391           0 :         Point pix = MapIndexToPixel( i );
     392           0 :         int x = pix.X();
     393           0 :         int y = pix.Y();
     394             : 
     395           0 :         OUStringBuffer buf;
     396           0 :         buf.appendUtf32( maFontCharMap.GetCharFromIndex( i ) );
     397           0 :         OUString aCharStr(buf.makeStringAndClear());
     398           0 :         int nTextWidth = GetTextWidth(aCharStr);
     399           0 :         int tx = x + (nX - nTextWidth + 1) / 2;
     400           0 :         int ty = y + (nY - nTextHeight + 1) / 2;
     401           0 :         Point aPointTxTy( tx, ty );
     402             : 
     403             :         // adjust position before it gets out of bounds
     404           0 :         if( GetTextBoundRect( aBoundRect, aCharStr ) && !aBoundRect.IsEmpty() )
     405             :         {
     406             :             // zero advance width => use ink width to center glyph
     407           0 :             if( !nTextWidth )
     408             :             {
     409           0 :                 aPointTxTy.X() = x - aBoundRect.Left()
     410           0 :                                + (nX - aBoundRect.GetWidth() + 1) / 2;
     411             :             }
     412             : 
     413           0 :             aBoundRect += aPointTxTy;
     414             : 
     415             :             // shift back vertically if needed
     416           0 :             int nYLDelta = aBoundRect.Top() - y;
     417           0 :             int nYHDelta = (y + nY) - aBoundRect.Bottom();
     418           0 :             if( nYLDelta <= 0 )
     419           0 :                 aPointTxTy.Y() -= nYLDelta - 1;
     420           0 :             else if( nYHDelta <= 0 )
     421           0 :                 aPointTxTy.Y() += nYHDelta - 1;
     422             : 
     423             :             // shift back horizontally if needed
     424           0 :             int nXLDelta = aBoundRect.Left() - x;
     425           0 :             int nXHDelta = (x + nX) - aBoundRect.Right();
     426           0 :             if( nXLDelta <= 0 )
     427           0 :                 aPointTxTy.X() -= nXLDelta - 1;
     428           0 :             else if( nXHDelta <= 0 )
     429           0 :                 aPointTxTy.X() += nXHDelta - 1;
     430             :         }
     431             : 
     432           0 :         Color aTextCol = GetTextColor();
     433           0 :         if ( i != nSelectedIndex )
     434             :         {
     435           0 :             SetTextColor( aWindowTextColor );
     436           0 :             DrawText( aPointTxTy, aCharStr );
     437             :         }
     438             :         else
     439             :         {
     440           0 :             Color aLineCol = GetLineColor();
     441           0 :             Color aFillCol = GetFillColor();
     442           0 :             SetLineColor();
     443           0 :             Point aPointUL( x + 1, y + 1 );
     444           0 :             if( HasFocus() )
     445             :             {
     446           0 :                 SetFillColor( aHighlightColor );
     447           0 :                 DrawRect( getGridRectangle(aPointUL, aOutputSize) );
     448             : 
     449           0 :                 SetTextColor( aHighlightTextColor );
     450           0 :                 DrawText( aPointTxTy, aCharStr );
     451             :             }
     452             :             else
     453             :             {
     454           0 :                 SetFillColor( aFaceColor );
     455           0 :                 DrawRect( getGridRectangle(aPointUL, aOutputSize) );
     456             : 
     457           0 :                 SetLineColor( aLightColor );
     458           0 :                 DrawLine( aPointUL, Point( x+nX-1, y+1) );
     459           0 :                 DrawLine( aPointUL, Point( x+1, y+nY-1) );
     460             : 
     461           0 :                 SetLineColor( aShadowColor );
     462           0 :                 DrawLine( Point( x+1, y+nY-1), Point( x+nX-1, y+nY-1) );
     463           0 :                 DrawLine( Point( x+nX-1, y+nY-1), Point( x+nX-1, y+1) );
     464             : 
     465           0 :                 DrawText( aPointTxTy, aCharStr );
     466             :             }
     467           0 :             SetLineColor( aLineCol );
     468           0 :             SetFillColor( aFillCol );
     469             :         }
     470           0 :         SetTextColor( aTextCol );
     471           0 :     }
     472             : }
     473             : 
     474             : 
     475             : 
     476           0 : void SvxShowCharSet::InitSettings( bool bForeground, bool bBackground )
     477             : {
     478           0 :     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
     479             : 
     480           0 :     if ( bForeground )
     481             :     {
     482           0 :         Color aTextColor( rStyleSettings.GetDialogTextColor() );
     483             : 
     484           0 :         if ( IsControlForeground() )
     485           0 :             aTextColor = GetControlForeground();
     486           0 :         SetTextColor( aTextColor );
     487             :     }
     488             : 
     489           0 :     if ( bBackground )
     490             :     {
     491           0 :         if ( IsControlBackground() )
     492           0 :             SetBackground( GetControlBackground() );
     493             :         else
     494           0 :             SetBackground( rStyleSettings.GetWindowColor() );
     495             :     }
     496             : 
     497           0 :     Invalidate();
     498           0 : }
     499             : 
     500             : 
     501             : 
     502           0 : sal_UCS4 SvxShowCharSet::GetSelectCharacter() const
     503             : {
     504           0 :     if( nSelectedIndex >= 0 )
     505           0 :         getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
     506           0 :     return getSelectedChar();
     507             : }
     508             : 
     509             : 
     510             : 
     511           0 : void SvxShowCharSet::SetFont( const Font& rFont )
     512             : {
     513             :     // save last selected unicode
     514           0 :     if( nSelectedIndex >= 0 )
     515           0 :         getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
     516             : 
     517           0 :     Size aSize = GetOutputSizePixel();
     518           0 :     long nSBWidth = aVscrollSB.GetOptimalSize().Width();
     519           0 :     aSize.Width() -= nSBWidth;
     520             : 
     521           0 :     Font aFont = rFont;
     522           0 :     aFont.SetWeight( WEIGHT_LIGHT );
     523           0 :     aFont.SetAlign( ALIGN_TOP );
     524           0 :     int nFontHeight = (aSize.Height() - 5) * 2 / (3 * ROW_COUNT);
     525           0 :     aFont.SetSize( PixelToLogic( Size( 0, nFontHeight ) ) );
     526           0 :     aFont.SetTransparent( true );
     527           0 :     Control::SetFont( aFont );
     528           0 :     GetFontCharMap( maFontCharMap );
     529             : 
     530           0 :     nX = aSize.Width() / COLUMN_COUNT;
     531           0 :     nY = aSize.Height() / ROW_COUNT;
     532             : 
     533           0 :     aVscrollSB.setPosSizePixel( aSize.Width(), 0, nSBWidth, aSize.Height() );
     534           0 :     aVscrollSB.SetRangeMin( 0 );
     535           0 :     int nLastRow = (maFontCharMap.GetCharCount() - 1 + COLUMN_COUNT) / COLUMN_COUNT;
     536           0 :     aVscrollSB.SetRangeMax( nLastRow );
     537           0 :     aVscrollSB.SetPageSize( ROW_COUNT-1 );
     538           0 :     aVscrollSB.SetVisibleSize( ROW_COUNT );
     539             : 
     540             :     // restore last selected unicode
     541           0 :     int nMapIndex = maFontCharMap.GetIndexFromChar( getSelectedChar() );
     542           0 :     SelectIndex( nMapIndex );
     543             : 
     544           0 :     aVscrollSB.Show();
     545             : 
     546             :     // rearrange CharSet element in sync with nX- and nY-multiples
     547           0 :     Size aDrawSize(nX * COLUMN_COUNT, nY * ROW_COUNT);
     548           0 :     m_nXGap = (aSize.Width() - aDrawSize.Width()) / 2;
     549           0 :     m_nYGap = (aSize.Height() - aDrawSize.Height()) / 2;
     550             : 
     551           0 :     Invalidate();
     552           0 : }
     553             : 
     554             : 
     555             : 
     556           0 : void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
     557             : {
     558           0 :     if( nNewIndex < 0 )
     559             :     {
     560             :         // need to scroll see closest unicode
     561           0 :         sal_uInt32 cPrev = maFontCharMap.GetPrevChar( getSelectedChar() );
     562           0 :         int nMapIndex = maFontCharMap.GetIndexFromChar( cPrev );
     563           0 :         int nNewPos = nMapIndex / COLUMN_COUNT;
     564           0 :         aVscrollSB.SetThumbPos( nNewPos );
     565           0 :         nSelectedIndex = bFocus ? nMapIndex+1 : -1;
     566           0 :         Invalidate();
     567           0 :         Update();
     568             :     }
     569           0 :     else if( nNewIndex < FirstInView() )
     570             :     {
     571             :         // need to scroll up to see selected item
     572           0 :         int nOldPos = aVscrollSB.GetThumbPos();
     573           0 :         int nDelta = (FirstInView() - nNewIndex + COLUMN_COUNT-1) / COLUMN_COUNT;
     574           0 :         aVscrollSB.SetThumbPos( nOldPos - nDelta );
     575           0 :         nSelectedIndex = nNewIndex;
     576           0 :         Invalidate();
     577           0 :         if( nDelta )
     578           0 :             Update();
     579             :     }
     580           0 :     else if( nNewIndex > LastInView() )
     581             :     {
     582             :         // need to scroll down to see selected item
     583           0 :         int nOldPos = aVscrollSB.GetThumbPos();
     584           0 :         int nDelta = (nNewIndex - LastInView() + COLUMN_COUNT) / COLUMN_COUNT;
     585           0 :         aVscrollSB.SetThumbPos( nOldPos + nDelta );
     586           0 :         if( nNewIndex < maFontCharMap.GetCharCount() )
     587             :         {
     588           0 :             nSelectedIndex = nNewIndex;
     589           0 :             Invalidate();
     590             :         }
     591           0 :         if( nOldPos != aVscrollSB.GetThumbPos() )
     592             :         {
     593           0 :             Invalidate();
     594           0 :             Update();
     595             :         }
     596             :     }
     597             :     else
     598             :     {
     599             :         // remove highlighted view
     600           0 :         Color aLineCol = GetLineColor();
     601           0 :         Color aFillCol = GetFillColor();
     602           0 :         SetLineColor();
     603           0 :         SetFillColor( GetBackground().GetColor() );
     604             : 
     605           0 :         Point aOldPixel = MapIndexToPixel( nSelectedIndex );
     606           0 :         aOldPixel.Move( +1, +1);
     607           0 :         Size aOutputSize = GetOutputSizePixel();
     608           0 :         if (aVscrollSB.IsVisible())
     609           0 :             aOutputSize.Width() -= aVscrollSB.GetOptimalSize().Width();
     610           0 :         DrawRect( getGridRectangle(aOldPixel, aOutputSize) );
     611           0 :         SetLineColor( aLineCol );
     612           0 :         SetFillColor( aFillCol );
     613             : 
     614           0 :         int nOldIndex = nSelectedIndex;
     615           0 :         nSelectedIndex = nNewIndex;
     616           0 :         DrawChars_Impl( nOldIndex, nOldIndex );
     617           0 :         DrawChars_Impl( nNewIndex, nNewIndex );
     618             :     }
     619             : 
     620           0 :     if( nSelectedIndex >= 0 )
     621             :     {
     622           0 :         getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
     623           0 :         if( m_pAccessible )
     624             :         {
     625           0 :             ::svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex);
     626             :             // Don't fire the focus event.
     627           0 :             if ( bFocus )
     628           0 :                 m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
     629             :             else
     630           0 :                 m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
     631             : 
     632             :             OSL_ENSURE(pItem->m_pItem,"No accessible created!");
     633           0 :             Any aOldAny, aNewAny;
     634           0 :             aNewAny <<= AccessibleStateType::FOCUSED;
     635             :             // Don't fire the focus event.
     636           0 :             if ( bFocus )
     637           0 :                 pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
     638             : 
     639           0 :             aNewAny <<= AccessibleStateType::SELECTED;
     640           0 :             pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
     641             :         }
     642             :     }
     643             : 
     644             : 
     645           0 :     aHighHdl.Call( this );
     646           0 : }
     647             : 
     648             : 
     649             : 
     650           0 : void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew, bool bFocus )
     651             : {
     652             :     // get next available char of current font
     653           0 :     sal_UCS4 cNext = maFontCharMap.GetNextChar( (cNew > 0) ? cNew - 1 : cNew );
     654             : 
     655           0 :     int nMapIndex = maFontCharMap.GetIndexFromChar( cNext );
     656           0 :     SelectIndex( nMapIndex, bFocus );
     657           0 :     if( !bFocus )
     658             :     {
     659             :         // move selected item to top row if not in focus
     660           0 :         aVscrollSB.SetThumbPos( nMapIndex / COLUMN_COUNT );
     661           0 :         Invalidate();
     662             :     }
     663           0 : }
     664             : 
     665             : 
     666             : 
     667           0 : IMPL_LINK_NOARG(SvxShowCharSet, VscrollHdl)
     668             : {
     669           0 :     if( nSelectedIndex < FirstInView() )
     670             :     {
     671           0 :         SelectIndex( FirstInView() + (nSelectedIndex % COLUMN_COUNT) );
     672             :     }
     673           0 :     else if( nSelectedIndex > LastInView() )
     674             :     {
     675           0 :         if( m_pAccessible )
     676             :         {
     677           0 :             ::com::sun::star::uno::Any aOldAny, aNewAny;
     678           0 :             int nLast = LastInView();
     679           0 :             for ( ; nLast != nSelectedIndex; ++nLast)
     680             :             {
     681           0 :                 aOldAny <<= ImplGetItem(nLast)->GetAccessible();
     682           0 :                 m_pAccessible ->fireEvent( AccessibleEventId::CHILD, aOldAny, aNewAny );
     683           0 :             }
     684             :         }
     685           0 :         SelectIndex( (LastInView() - COLUMN_COUNT + 1) + (nSelectedIndex % COLUMN_COUNT) );
     686             :     }
     687             : 
     688           0 :     Invalidate();
     689           0 :     return 0;
     690             : }
     691             : 
     692             : 
     693             : 
     694           0 : SvxShowCharSet::~SvxShowCharSet()
     695             : {
     696           0 :     if ( m_pAccessible )
     697           0 :         ReleaseAccessible();
     698           0 : }
     699             : 
     700           0 : void SvxShowCharSet::ReleaseAccessible()
     701             : {
     702           0 :     m_aItems.clear();
     703           0 :     m_pAccessible = NULL;
     704           0 :     m_xAccessible = NULL;
     705           0 : }
     706             : 
     707           0 : ::com::sun::star::uno::Reference< XAccessible > SvxShowCharSet::CreateAccessible()
     708             : {
     709             :     OSL_ENSURE(!m_pAccessible,"Accessible already created!");
     710           0 :     m_pAccessible = new ::svx::SvxShowCharSetVirtualAcc(this);
     711           0 :     m_xAccessible = m_pAccessible;
     712           0 :     return m_xAccessible;
     713             : }
     714             : 
     715           0 : ::svx::SvxShowCharSetItem* SvxShowCharSet::ImplGetItem( int _nPos )
     716             : {
     717           0 :     ItemsMap::iterator aFind = m_aItems.find(_nPos);
     718           0 :     if ( aFind == m_aItems.end() )
     719             :     {
     720             :         OSL_ENSURE(m_pAccessible,"Who wants to create a child of my table without a parent?");
     721             :         boost::shared_ptr<svx::SvxShowCharSetItem> xItem(new svx::SvxShowCharSetItem(*this,
     722           0 :             m_pAccessible->getTable(), sal::static_int_cast< sal_uInt16 >(_nPos)));
     723           0 :         aFind = m_aItems.insert(ItemsMap::value_type(_nPos, xItem)).first;
     724           0 :         OUStringBuffer buf;
     725           0 :         buf.appendUtf32( maFontCharMap.GetCharFromIndex( _nPos ) );
     726           0 :         aFind->second->maText = buf.makeStringAndClear();
     727           0 :         Point pix = MapIndexToPixel( _nPos );
     728           0 :         aFind->second->maRect = Rectangle( Point( pix.X() + 1, pix.Y() + 1 ), Size(nX-1,nY-1) );
     729             :     }
     730             : 
     731           0 :     return aFind->second.get();
     732             : }
     733             : 
     734             : 
     735           0 : ScrollBar* SvxShowCharSet::getScrollBar()
     736             : {
     737           0 :     return &aVscrollSB;
     738             : }
     739             : 
     740           0 : sal_Int32 SvxShowCharSet::getMaxCharCount() const
     741             : {
     742           0 :     return maFontCharMap.GetCharCount();
     743             : }
     744             : 
     745             : 
     746             : // class SubsetMap =======================================================
     747             : // TODO: should be moved into Font Attributes stuff
     748             : // we let it mature here though because it is currently the only use
     749             : 
     750           0 : SubsetMap::SubsetMap( const FontCharMap* pFontCharMap )
     751           0 : :   Resource( SVX_RES(RID_SUBSETMAP) )
     752             : {
     753           0 :     InitList();
     754           0 :     ApplyCharMap( pFontCharMap );
     755           0 :     FreeResource();
     756           0 : }
     757             : 
     758           0 : const Subset* SubsetMap::GetNextSubset( bool bFirst ) const
     759             : {
     760           0 :     if( bFirst )
     761           0 :         maSubsetIterator = maSubsets.begin();
     762           0 :     if( maSubsetIterator == maSubsets.end() )
     763           0 :         return NULL;
     764           0 :     const Subset* s = &*(maSubsetIterator++);
     765           0 :     return s;
     766             : }
     767             : 
     768           0 : const Subset* SubsetMap::GetSubsetByUnicode( sal_UCS4 cChar ) const
     769             : {
     770             :     // TODO: is it worth to avoid a linear search?
     771           0 :     for( const Subset* s = GetNextSubset( true ); s; s = GetNextSubset( false ) )
     772           0 :         if( (s->GetRangeMin() <= cChar) && (cChar <= s->GetRangeMax()) )
     773           0 :             return s;
     774           0 :     return NULL;
     775             : }
     776             : 
     777           0 : inline Subset::Subset( sal_UCS4 nMin, sal_UCS4 nMax, int resId)
     778           0 : :   mnRangeMin(nMin), mnRangeMax(nMax), maRangeName( SVX_RESSTR(resId) )
     779           0 : {}
     780             : 
     781           0 : void SubsetMap::InitList()
     782             : {
     783           0 :     static SubsetList aAllSubsets;
     784             :     static bool bInit = true;
     785           0 :     if( bInit )
     786             :     {
     787           0 :         bInit = false;
     788             :         //I wish icu had a way to give me the block ranges
     789           0 :         for (int i = UBLOCK_BASIC_LATIN; i < UBLOCK_COUNT; ++i)
     790             :         {
     791           0 :             UBlockCode eBlock = static_cast<UBlockCode>(i);
     792           0 :             switch (eBlock)
     793             :             {
     794             :                 case UBLOCK_NO_BLOCK:
     795             :                 case UBLOCK_INVALID_CODE:
     796             :                 case UBLOCK_COUNT:
     797             :                 case UBLOCK_HIGH_SURROGATES:
     798             :                 case UBLOCK_HIGH_PRIVATE_USE_SURROGATES:
     799             :                 case UBLOCK_LOW_SURROGATES:
     800           0 :                     break;
     801             :                 case UBLOCK_BASIC_LATIN:
     802           0 :                     aAllSubsets.push_back( Subset( 0x0000, 0x007F, RID_SUBSETSTR_BASIC_LATIN ) );
     803           0 :                     break;
     804             :                 case UBLOCK_LATIN_1_SUPPLEMENT:
     805           0 :                     aAllSubsets.push_back( Subset( 0x0080, 0x00FF, RID_SUBSETSTR_LATIN_1 ) );
     806           0 :                     break;
     807             :                 case UBLOCK_LATIN_EXTENDED_A:
     808           0 :                     aAllSubsets.push_back( Subset( 0x0100, 0x017F, RID_SUBSETSTR_LATIN_EXTENDED_A ) );
     809           0 :                     break;
     810             :                 case UBLOCK_LATIN_EXTENDED_B:
     811           0 :                     aAllSubsets.push_back( Subset( 0x0180, 0x024F, RID_SUBSETSTR_LATIN_EXTENDED_B ) );
     812           0 :                     break;
     813             :                 case UBLOCK_IPA_EXTENSIONS:
     814           0 :                     aAllSubsets.push_back( Subset( 0x0250, 0x02AF, RID_SUBSETSTR_IPA_EXTENSIONS ) );
     815           0 :                     break;
     816             :                 case UBLOCK_SPACING_MODIFIER_LETTERS:
     817           0 :                     aAllSubsets.push_back( Subset( 0x02B0, 0x02FF, RID_SUBSETSTR_SPACING_MODIFIERS ) );
     818           0 :                     break;
     819             :                 case UBLOCK_COMBINING_DIACRITICAL_MARKS:
     820           0 :                     aAllSubsets.push_back( Subset( 0x0300, 0x036F, RID_SUBSETSTR_COMB_DIACRITICAL ) );
     821           0 :                     break;
     822             :                 case UBLOCK_GREEK:
     823           0 :                     aAllSubsets.push_back( Subset( 0x0370, 0x03FF, RID_SUBSETSTR_BASIC_GREEK ) );
     824           0 :                     break;
     825             :                 case UBLOCK_CYRILLIC:
     826           0 :                     aAllSubsets.push_back( Subset( 0x0400, 0x04FF, RID_SUBSETSTR_CYRILLIC ) );
     827           0 :                     break;
     828             :                 case UBLOCK_ARMENIAN:
     829           0 :                     aAllSubsets.push_back( Subset( 0x0530, 0x058F, RID_SUBSETSTR_ARMENIAN ) );
     830           0 :                     break;
     831             :                 case UBLOCK_HEBREW:
     832           0 :                     aAllSubsets.push_back( Subset( 0x0590, 0x05FF, RID_SUBSETSTR_BASIC_HEBREW ) );
     833           0 :                     break;
     834             :                 case UBLOCK_ARABIC:
     835           0 :                     aAllSubsets.push_back( Subset( 0x0600, 0x065F, RID_SUBSETSTR_BASIC_ARABIC ) );
     836           0 :                     break;
     837             :                 case UBLOCK_SYRIAC:
     838           0 :                     aAllSubsets.push_back( Subset( 0x0700, 0x074F, RID_SUBSETSTR_SYRIAC ) );
     839           0 :                     break;
     840             :                 case UBLOCK_THAANA:
     841           0 :                     aAllSubsets.push_back( Subset( 0x0780, 0x07BF, RID_SUBSETSTR_THAANA ) );
     842           0 :                     break;
     843             :                 case UBLOCK_DEVANAGARI:
     844           0 :                     aAllSubsets.push_back( Subset( 0x0900, 0x097F, RID_SUBSETSTR_DEVANAGARI ) );
     845           0 :                     break;
     846             :                 case UBLOCK_BENGALI:
     847           0 :                     aAllSubsets.push_back( Subset( 0x0980, 0x09FF, RID_SUBSETSTR_BENGALI ) );
     848           0 :                     break;
     849             :                 case UBLOCK_GURMUKHI:
     850           0 :                     aAllSubsets.push_back( Subset( 0x0A00, 0x0A7F, RID_SUBSETSTR_GURMUKHI ) );
     851           0 :                     break;
     852             :                 case UBLOCK_GUJARATI:
     853           0 :                     aAllSubsets.push_back( Subset( 0x0A80, 0x0AFF, RID_SUBSETSTR_GUJARATI ) );
     854           0 :                     break;
     855             :                 case UBLOCK_ORIYA:
     856           0 :                     aAllSubsets.push_back( Subset( 0x0B00, 0x0B7F, RID_SUBSETSTR_ODIA ) );
     857           0 :                     break;
     858             :                 case UBLOCK_TAMIL:
     859           0 :                     aAllSubsets.push_back( Subset( 0x0B80, 0x0BFF, RID_SUBSETSTR_TAMIL ) );
     860           0 :                     break;
     861             :                 case UBLOCK_TELUGU:
     862           0 :                     aAllSubsets.push_back( Subset( 0x0C00, 0x0C7F, RID_SUBSETSTR_TELUGU ) );
     863           0 :                     break;
     864             :                 case UBLOCK_KANNADA:
     865           0 :                     aAllSubsets.push_back( Subset( 0x0C80, 0x0CFF, RID_SUBSETSTR_KANNADA ) );
     866           0 :                     break;
     867             :                 case UBLOCK_MALAYALAM:
     868           0 :                     aAllSubsets.push_back( Subset( 0x0D00, 0x0D7F, RID_SUBSETSTR_MALAYALAM ) );
     869           0 :                     break;
     870             :                 case UBLOCK_SINHALA:
     871           0 :                     aAllSubsets.push_back( Subset( 0x0D80, 0x0DFF, RID_SUBSETSTR_SINHALA ) );
     872           0 :                     break;
     873             :                 case UBLOCK_THAI:
     874           0 :                     aAllSubsets.push_back( Subset( 0x0E00, 0x0E7F, RID_SUBSETSTR_THAI ) );
     875           0 :                     break;
     876             :                 case UBLOCK_LAO:
     877           0 :                     aAllSubsets.push_back( Subset( 0x0E80, 0x0EFF, RID_SUBSETSTR_LAO ) );
     878           0 :                     break;
     879             :                 case UBLOCK_TIBETAN:
     880           0 :                     aAllSubsets.push_back( Subset( 0x0F00, 0x0FBF, RID_SUBSETSTR_TIBETAN ) );
     881           0 :                     break;
     882             :                 case UBLOCK_MYANMAR:
     883           0 :                     aAllSubsets.push_back( Subset( 0x1000, 0x109F, RID_SUBSETSTR_MYANMAR ) );
     884           0 :                     break;
     885             :                 case UBLOCK_GEORGIAN:
     886           0 :                     aAllSubsets.push_back( Subset( 0x10A0, 0x10FF, RID_SUBSETSTR_BASIC_GEORGIAN ) );
     887           0 :                     break;
     888             :                 case UBLOCK_HANGUL_JAMO:
     889           0 :                     aAllSubsets.push_back( Subset( 0x1100, 0x11FF, RID_SUBSETSTR_HANGUL_JAMO ) );
     890           0 :                     break;
     891             :                 case UBLOCK_ETHIOPIC:
     892           0 :                     aAllSubsets.push_back( Subset( 0x1200, 0x137F, RID_SUBSETSTR_ETHIOPIC ) );
     893           0 :                     break;
     894             :                 case UBLOCK_CHEROKEE:
     895           0 :                     aAllSubsets.push_back( Subset( 0x13A0, 0x13FF, RID_SUBSETSTR_CHEROKEE ) );
     896           0 :                     break;
     897             :                 case UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS:
     898           0 :                     aAllSubsets.push_back( Subset( 0x1400, 0x167F, RID_SUBSETSTR_CANADIAN_ABORIGINAL ) );
     899           0 :                     break;
     900             :                 case UBLOCK_OGHAM:
     901           0 :                     aAllSubsets.push_back( Subset( 0x1680, 0x169F, RID_SUBSETSTR_OGHAM ) );
     902           0 :                     break;
     903             :                 case UBLOCK_RUNIC:
     904           0 :                     aAllSubsets.push_back( Subset( 0x16A0, 0x16F0, RID_SUBSETSTR_RUNIC ) );
     905           0 :                     break;
     906             :                 case UBLOCK_KHMER:
     907           0 :                     aAllSubsets.push_back( Subset( 0x1780, 0x17FF, RID_SUBSETSTR_KHMER ) );
     908           0 :                     break;
     909             :                 case UBLOCK_MONGOLIAN:
     910           0 :                     aAllSubsets.push_back( Subset( 0x1800, 0x18AF, RID_SUBSETSTR_MONGOLIAN ) );
     911           0 :                     break;
     912             :                 case UBLOCK_LATIN_EXTENDED_ADDITIONAL:
     913           0 :                     aAllSubsets.push_back( Subset( 0x1E00, 0x1EFF, RID_SUBSETSTR_LATIN_EXTENDED_ADDS ) );
     914           0 :                     break;
     915             :                 case UBLOCK_GREEK_EXTENDED:
     916           0 :                     aAllSubsets.push_back( Subset( 0x1F00, 0x1FFF, RID_SUBSETSTR_GREEK_EXTENDED ) );
     917           0 :                     break;
     918             :                 case UBLOCK_GENERAL_PUNCTUATION:
     919           0 :                     aAllSubsets.push_back( Subset( 0x2000, 0x206F, RID_SUBSETSTR_GENERAL_PUNCTUATION ) );
     920           0 :                     break;
     921             :                 case UBLOCK_SUPERSCRIPTS_AND_SUBSCRIPTS:
     922           0 :                     aAllSubsets.push_back( Subset( 0x2070, 0x209F, RID_SUBSETSTR_SUB_SUPER_SCRIPTS ) );
     923           0 :                     break;
     924             :                 case UBLOCK_CURRENCY_SYMBOLS:
     925           0 :                     aAllSubsets.push_back( Subset( 0x20A0, 0x20CF, RID_SUBSETSTR_CURRENCY_SYMBOLS ) );
     926           0 :                     break;
     927             :                 case UBLOCK_COMBINING_MARKS_FOR_SYMBOLS:
     928           0 :                     aAllSubsets.push_back( Subset( 0x20D0, 0x20FF, RID_SUBSETSTR_COMB_DIACRITIC_SYMS ) );
     929           0 :                     break;
     930             :                 case UBLOCK_LETTERLIKE_SYMBOLS:
     931           0 :                     aAllSubsets.push_back( Subset( 0x2100, 0x214F, RID_SUBSETSTR_LETTERLIKE_SYMBOLS ) );
     932           0 :                     break;
     933             :                 case UBLOCK_NUMBER_FORMS:
     934           0 :                     aAllSubsets.push_back( Subset( 0x2150, 0x218F, RID_SUBSETSTR_NUMBER_FORMS ) );
     935           0 :                     break;
     936             :                 case UBLOCK_ARROWS:
     937           0 :                     aAllSubsets.push_back( Subset( 0x2190, 0x21FF, RID_SUBSETSTR_ARROWS ) );
     938           0 :                     break;
     939             :                 case UBLOCK_MATHEMATICAL_OPERATORS:
     940           0 :                     aAllSubsets.push_back( Subset( 0x2200, 0x22FF, RID_SUBSETSTR_MATH_OPERATORS ) );
     941           0 :                     break;
     942             :                 case UBLOCK_MISCELLANEOUS_TECHNICAL:
     943           0 :                     aAllSubsets.push_back( Subset( 0x2300, 0x23FF, RID_SUBSETSTR_MISC_TECHNICAL ) );
     944           0 :                     break;
     945             :                 case UBLOCK_CONTROL_PICTURES:
     946           0 :                     aAllSubsets.push_back( Subset( 0x2400, 0x243F, RID_SUBSETSTR_CONTROL_PICTURES ) );
     947           0 :                     break;
     948             :                 case UBLOCK_OPTICAL_CHARACTER_RECOGNITION:
     949           0 :                     aAllSubsets.push_back( Subset( 0x2440, 0x245F, RID_SUBSETSTR_OPTICAL_CHAR_REC ) );
     950           0 :                     break;
     951             :                 case UBLOCK_ENCLOSED_ALPHANUMERICS:
     952           0 :                     aAllSubsets.push_back( Subset( 0x2460, 0x24FF, RID_SUBSETSTR_ENCLOSED_ALPHANUM ) );
     953           0 :                     break;
     954             :                 case UBLOCK_BOX_DRAWING:
     955           0 :                     aAllSubsets.push_back( Subset( 0x2500, 0x257F, RID_SUBSETSTR_BOX_DRAWING ) );
     956           0 :                     break;
     957             :                 case UBLOCK_BLOCK_ELEMENTS:
     958           0 :                     aAllSubsets.push_back( Subset( 0x2580, 0x259F, RID_SUBSETSTR_BLOCK_ELEMENTS ) );
     959           0 :                     break;
     960             :                 case UBLOCK_GEOMETRIC_SHAPES:
     961           0 :                     aAllSubsets.push_back( Subset( 0x25A0, 0x25FF, RID_SUBSETSTR_GEOMETRIC_SHAPES ) );
     962           0 :                     break;
     963             :                 case UBLOCK_MISCELLANEOUS_SYMBOLS:
     964           0 :                     aAllSubsets.push_back( Subset( 0x2600, 0x26FF, RID_SUBSETSTR_MISC_DINGBATS ) );
     965           0 :                     break;
     966             :                 case UBLOCK_DINGBATS:
     967           0 :                     aAllSubsets.push_back( Subset( 0x2700, 0x27BF, RID_SUBSETSTR_DINGBATS ) );
     968           0 :                     break;
     969             :                 case UBLOCK_BRAILLE_PATTERNS:
     970           0 :                     aAllSubsets.push_back( Subset( 0x2800, 0x28FF, RID_SUBSETSTR_BRAILLE_PATTERNS ) );
     971           0 :                     break;
     972             :                 case UBLOCK_CJK_RADICALS_SUPPLEMENT:
     973           0 :                     aAllSubsets.push_back( Subset( 0x2E80, 0x2EFF, RID_SUBSETSTR_CJK_RADICAL_SUPPL ) );
     974           0 :                     break;
     975             :                 case UBLOCK_KANGXI_RADICALS:
     976           0 :                     aAllSubsets.push_back( Subset( 0x2F00, 0x2FDF, RID_SUBSETSTR_KANGXI_RADICALS ) );
     977           0 :                     break;
     978             :                 case UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS:
     979           0 :                     aAllSubsets.push_back( Subset( 0x2FF0, 0x2FFF, RID_SUBSETSTR_IDEO_DESC_CHARS ) );
     980           0 :                     break;
     981             :                 case UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION:
     982           0 :                     aAllSubsets.push_back( Subset( 0x3000, 0x303F, RID_SUBSETSTR_CJK_SYMS_PUNCTUATION ) );
     983           0 :                     break;
     984             :                 case UBLOCK_HIRAGANA:
     985           0 :                     aAllSubsets.push_back( Subset( 0x3040, 0x309F, RID_SUBSETSTR_HIRAGANA ) );
     986           0 :                     break;
     987             :                 case UBLOCK_KATAKANA:
     988           0 :                     aAllSubsets.push_back( Subset( 0x30A0, 0x30FF, RID_SUBSETSTR_KATAKANA ) );
     989           0 :                     break;
     990             :                 case UBLOCK_BOPOMOFO:
     991           0 :                     aAllSubsets.push_back( Subset( 0x3100, 0x312F, RID_SUBSETSTR_BOPOMOFO ) );
     992           0 :                     break;
     993             :                 case UBLOCK_HANGUL_COMPATIBILITY_JAMO:
     994           0 :                     aAllSubsets.push_back( Subset( 0x3130, 0x318F, RID_SUBSETSTR_HANGUL_COMPAT_JAMO ) );
     995           0 :                     break;
     996             :                 case UBLOCK_KANBUN:
     997           0 :                     aAllSubsets.push_back( Subset( 0x3190, 0x319F, RID_SUBSETSTR_KANBUN ) );
     998           0 :                     break;
     999             :                 case UBLOCK_BOPOMOFO_EXTENDED:
    1000           0 :                     aAllSubsets.push_back( Subset( 0x31A0, 0x31BF, RID_SUBSETSTR_BOPOMOFO_EXTENDED ) );
    1001           0 :                     break;
    1002             :                 case UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS:
    1003           0 :                     aAllSubsets.push_back( Subset( 0x3200, 0x32FF, RID_SUBSETSTR_ENCLOSED_CJK_LETTERS ) );
    1004           0 :                     break;
    1005             :                 case UBLOCK_CJK_COMPATIBILITY:
    1006           0 :                     aAllSubsets.push_back( Subset( 0x3300, 0x33FF, RID_SUBSETSTR_CJK_COMPATIBILITY ) );
    1007           0 :                     break;
    1008             :                 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A:
    1009           0 :                     aAllSubsets.push_back( Subset( 0x3400, 0x4DBF, RID_SUBSETSTR_CJK_EXT_A_UNIFIED_IDGRAPH ) );
    1010           0 :                     break;
    1011             :                 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS:
    1012           0 :                     aAllSubsets.push_back( Subset( 0x4E00, 0x9FA5, RID_SUBSETSTR_CJK_UNIFIED_IDGRAPH ) );
    1013           0 :                     break;
    1014             :                 case UBLOCK_YI_SYLLABLES:
    1015           0 :                     aAllSubsets.push_back( Subset( 0xA000, 0xA48F, RID_SUBSETSTR_YI_SYLLABLES ) );
    1016           0 :                     break;
    1017             :                 case UBLOCK_YI_RADICALS:
    1018           0 :                     aAllSubsets.push_back( Subset( 0xA490, 0xA4CF, RID_SUBSETSTR_YI_RADICALS ) );
    1019           0 :                     break;
    1020             :                 case UBLOCK_HANGUL_SYLLABLES:
    1021           0 :                     aAllSubsets.push_back( Subset( 0xAC00, 0xD7AF, RID_SUBSETSTR_HANGUL ) );
    1022           0 :                     break;
    1023             :                 case UBLOCK_PRIVATE_USE_AREA:
    1024           0 :                     aAllSubsets.push_back( Subset( 0xE000, 0xF8FF, RID_SUBSETSTR_PRIVATE_USE_AREA ) );
    1025           0 :                     break;
    1026             :                 case UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS:
    1027           0 :                     aAllSubsets.push_back( Subset( 0xF900, 0xFAFF, RID_SUBSETSTR_CJK_COMPAT_IDGRAPHS ) );
    1028           0 :                     break;
    1029             :                 case UBLOCK_ALPHABETIC_PRESENTATION_FORMS:
    1030           0 :                     aAllSubsets.push_back( Subset( 0xFB00, 0xFB4F, RID_SUBSETSTR_ALPHA_PRESENTATION ) );
    1031           0 :                     break;
    1032             :                 case UBLOCK_ARABIC_PRESENTATION_FORMS_A:
    1033           0 :                     aAllSubsets.push_back( Subset( 0xFB50, 0xFDFF, RID_SUBSETSTR_ARABIC_PRESENT_A ) );
    1034           0 :                     break;
    1035             :                 case UBLOCK_COMBINING_HALF_MARKS:
    1036           0 :                     aAllSubsets.push_back( Subset( 0xFE20, 0xFE2F, RID_SUBSETSTR_COMBINING_HALF_MARKS ) );
    1037           0 :                     break;
    1038             :                 case UBLOCK_CJK_COMPATIBILITY_FORMS:
    1039           0 :                     aAllSubsets.push_back( Subset( 0xFE30, 0xFE4F, RID_SUBSETSTR_CJK_COMPAT_FORMS ) );
    1040           0 :                     break;
    1041             :                 case UBLOCK_SMALL_FORM_VARIANTS:
    1042           0 :                     aAllSubsets.push_back( Subset( 0xFE50, 0xFE6F, RID_SUBSETSTR_SMALL_FORM_VARIANTS ) );
    1043           0 :                     break;
    1044             :                 case UBLOCK_ARABIC_PRESENTATION_FORMS_B:
    1045           0 :                     aAllSubsets.push_back( Subset( 0xFE70, 0xFEFF, RID_SUBSETSTR_ARABIC_PRESENT_B ) );
    1046           0 :                     break;
    1047             :                 case UBLOCK_SPECIALS:
    1048           0 :                     aAllSubsets.push_back( Subset( 0xFFF0, 0xFFFF, RID_SUBSETSTR_SPECIALS ) );
    1049           0 :                     break;
    1050             :                 case UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS:
    1051           0 :                     aAllSubsets.push_back( Subset( 0xFF00, 0xFFEF, RID_SUBSETSTR_HALFW_FULLW_FORMS ) );
    1052           0 :                     break;
    1053             :                 case UBLOCK_OLD_ITALIC:
    1054           0 :                     aAllSubsets.push_back( Subset( 0x10300, 0x1032F, RID_SUBSETSTR_OLD_ITALIC ) );
    1055           0 :                     break;
    1056             :                 case UBLOCK_GOTHIC:
    1057           0 :                     aAllSubsets.push_back( Subset( 0x10330, 0x1034F, RID_SUBSETSTR_GOTHIC ) );
    1058           0 :                     break;
    1059             :                 case UBLOCK_DESERET:
    1060           0 :                     aAllSubsets.push_back( Subset( 0x10400, 0x1044F, RID_SUBSETSTR_DESERET ) );
    1061           0 :                     break;
    1062             :                 case UBLOCK_BYZANTINE_MUSICAL_SYMBOLS:
    1063           0 :                     aAllSubsets.push_back( Subset( 0x1D000, 0x1D0FF, RID_SUBSETSTR_BYZANTINE_MUSICAL_SYMBOLS ) );
    1064           0 :                     break;
    1065             :                 case UBLOCK_MUSICAL_SYMBOLS:
    1066           0 :                     aAllSubsets.push_back( Subset( 0x1D100, 0x1D1FF, RID_SUBSETSTR_MUSICAL_SYMBOLS ) );
    1067           0 :                     break;
    1068             :                 case UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS:
    1069           0 :                     aAllSubsets.push_back( Subset( 0x1D400, 0x1D7FF, RID_SUBSETSTR_MATHEMATICAL_ALPHANUMERIC_SYMBOLS ) );
    1070           0 :                     break;
    1071             :                 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B:
    1072           0 :                     aAllSubsets.push_back( Subset( 0x20000, 0x2A6DF, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B ) );
    1073           0 :                     break;
    1074             :                 case UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT:
    1075           0 :                     aAllSubsets.push_back( Subset( 0x2F800, 0x2FA1F, RID_SUBSETSTR_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT ) );
    1076           0 :                     break;
    1077             :                 case UBLOCK_TAGS:
    1078           0 :                     aAllSubsets.push_back( Subset( 0xE0000, 0xE007F, RID_SUBSETSTR_TAGS ) );
    1079           0 :                     break;
    1080             :                 case UBLOCK_CYRILLIC_SUPPLEMENTARY:
    1081           0 :                     aAllSubsets.push_back( Subset( 0x0500, 0x052F, RID_SUBSETSTR_CYRILLIC_SUPPLEMENTARY ) );
    1082           0 :                     break;
    1083             :                 case UBLOCK_TAGALOG:
    1084           0 :                     aAllSubsets.push_back( Subset( 0x1700, 0x171F, RID_SUBSETSTR_TAGALOG ) );
    1085           0 :                     break;
    1086             :                 case UBLOCK_HANUNOO:
    1087           0 :                     aAllSubsets.push_back( Subset( 0x1720, 0x173F, RID_SUBSETSTR_HANUNOO ) );
    1088           0 :                     break;
    1089             :                 case UBLOCK_BUHID:
    1090           0 :                     aAllSubsets.push_back( Subset( 0x1740, 0x175F, RID_SUBSETSTR_BUHID ) );
    1091           0 :                     break;
    1092             :                 case UBLOCK_TAGBANWA:
    1093           0 :                     aAllSubsets.push_back( Subset( 0x1760, 0x177F, RID_SUBSETSTR_TAGBANWA ) );
    1094           0 :                     break;
    1095             :                 case UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A:
    1096           0 :                     aAllSubsets.push_back( Subset( 0x27C0, 0x27EF, RID_SUBSETSTR_MISC_MATH_SYMS_A ) );
    1097           0 :                     break;
    1098             :                 case UBLOCK_SUPPLEMENTAL_ARROWS_A:
    1099           0 :                     aAllSubsets.push_back( Subset( 0x27F0, 0x27FF, RID_SUBSETSTR_SUPPL_ARROWS_A ) );
    1100           0 :                     break;
    1101             :                 case UBLOCK_SUPPLEMENTAL_ARROWS_B:
    1102           0 :                     aAllSubsets.push_back( Subset( 0x2900, 0x297F, RID_SUBSETSTR_SUPPL_ARROWS_B ) );
    1103           0 :                     break;
    1104             :                 case UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B:
    1105           0 :                     aAllSubsets.push_back( Subset( 0x2980, 0x29FF, RID_SUBSETSTR_MISC_MATH_SYMS_B ) );
    1106           0 :                     break;
    1107             :                 case UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS:
    1108           0 :                     aAllSubsets.push_back( Subset( 0x2A00, 0x2AFF, RID_SUBSETSTR_MISC_MATH_SYMS_B ) );
    1109           0 :                     break;
    1110             :                 case UBLOCK_KATAKANA_PHONETIC_EXTENSIONS:
    1111           0 :                     aAllSubsets.push_back( Subset( 0x31F0, 0x31FF, RID_SUBSETSTR_KATAKANA_PHONETIC ) );
    1112           0 :                     break;
    1113             :                 case UBLOCK_VARIATION_SELECTORS:
    1114           0 :                     aAllSubsets.push_back( Subset( 0xFE00, 0xFE0F, RID_SUBSETSTR_VARIATION_SELECTORS ) );
    1115           0 :                     break;
    1116             :                 case UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_A:
    1117           0 :                     aAllSubsets.push_back( Subset( 0xF0000, 0xFFFFF, RID_SUBSETSTR_SUPPLEMENTARY_PRIVATE_USE_AREA_A ) );
    1118           0 :                     break;
    1119             :                 case UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B:
    1120           0 :                     aAllSubsets.push_back( Subset( 0x100000, 0x10FFFF, RID_SUBSETSTR_SUPPLEMENTARY_PRIVATE_USE_AREA_B ) );
    1121           0 :                     break;
    1122             :                 case UBLOCK_LIMBU:
    1123           0 :                     aAllSubsets.push_back( Subset( 0x1900, 0x194F, RID_SUBSETSTR_LIMBU ) );
    1124           0 :                     break;
    1125             :                 case UBLOCK_TAI_LE:
    1126           0 :                     aAllSubsets.push_back( Subset( 0x1950, 0x197F, RID_SUBSETSTR_TAI_LE ) );
    1127           0 :                     break;
    1128             :                 case UBLOCK_KHMER_SYMBOLS:
    1129           0 :                     aAllSubsets.push_back( Subset( 0x19E0, 0x19FF, RID_SUBSETSTR_KHMER_SYMBOLS ) );
    1130           0 :                     break;
    1131             :                 case UBLOCK_PHONETIC_EXTENSIONS:
    1132           0 :                     aAllSubsets.push_back( Subset( 0x1D00, 0x1D7F, RID_SUBSETSTR_PHONETIC_EXTENSIONS ) );
    1133           0 :                     break;
    1134             :                 case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS:
    1135           0 :                     aAllSubsets.push_back( Subset( 0x2B00, 0x2BFF, RID_SUBSETSTR_MISCELLANEOUS_SYMBOLS_AND_ARROWS ) );
    1136           0 :                     break;
    1137             :                 case UBLOCK_YIJING_HEXAGRAM_SYMBOLS:
    1138           0 :                     aAllSubsets.push_back( Subset( 0x4DC0, 0x4DFF, RID_SUBSETSTR_YIJING_HEXAGRAM_SYMBOLS ) );
    1139           0 :                     break;
    1140             :                 case UBLOCK_LINEAR_B_SYLLABARY:
    1141           0 :                     aAllSubsets.push_back( Subset( 0x10000, 0x1007F, RID_SUBSETSTR_LINEAR_B_SYLLABARY ) );
    1142           0 :                     break;
    1143             :                 case UBLOCK_LINEAR_B_IDEOGRAMS:
    1144           0 :                     aAllSubsets.push_back( Subset( 0x10080, 0x100FF, RID_SUBSETSTR_LINEAR_B_IDEOGRAMS ) );
    1145           0 :                     break;
    1146             :                 case UBLOCK_AEGEAN_NUMBERS:
    1147           0 :                     aAllSubsets.push_back( Subset( 0x10100, 0x1013F, RID_SUBSETSTR_AEGEAN_NUMBERS ) );
    1148           0 :                     break;
    1149             :                 case UBLOCK_UGARITIC:
    1150           0 :                     aAllSubsets.push_back( Subset( 0x10380, 0x1039F, RID_SUBSETSTR_UGARITIC ) );
    1151           0 :                     break;
    1152             :                 case UBLOCK_SHAVIAN:
    1153           0 :                     aAllSubsets.push_back( Subset( 0x10450, 0x1047F, RID_SUBSETSTR_SHAVIAN ) );
    1154           0 :                     break;
    1155             :                 case UBLOCK_OSMANYA:
    1156           0 :                     aAllSubsets.push_back( Subset( 0x10480, 0x104AF, RID_SUBSETSTR_OSMANYA ) );
    1157           0 :                     break;
    1158             :                 case UBLOCK_CYPRIOT_SYLLABARY:
    1159           0 :                     aAllSubsets.push_back( Subset( 0x10800, 0x1083F, RID_SUBSETSTR_CYPRIOT_SYLLABARY ) );
    1160           0 :                     break;
    1161             :                 case UBLOCK_TAI_XUAN_JING_SYMBOLS:
    1162           0 :                     aAllSubsets.push_back( Subset( 0x1D300, 0x1D35F, RID_SUBSETSTR_TAI_XUAN_JING_SYMBOLS ) );
    1163           0 :                     break;
    1164             :                 case UBLOCK_VARIATION_SELECTORS_SUPPLEMENT:
    1165           0 :                     aAllSubsets.push_back( Subset( 0xE0100, 0xE01EF, RID_SUBSETSTR_VARIATION_SELECTORS_SUPPLEMENT ) );
    1166           0 :                     break;
    1167             :                 case UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION:
    1168           0 :                     aAllSubsets.push_back( Subset(0x1D200, 0x1D24F, RID_SUBSETSTR_ANCIENT_GREEK_MUSICAL_NOTATION ) );
    1169           0 :                     break;
    1170             :                 case UBLOCK_ANCIENT_GREEK_NUMBERS:
    1171           0 :                     aAllSubsets.push_back( Subset(0x10140, 0x1018F , RID_SUBSETSTR_ANCIENT_GREEK_NUMBERS ) );
    1172           0 :                     break;
    1173             :                 case UBLOCK_ARABIC_SUPPLEMENT:
    1174           0 :                     aAllSubsets.push_back( Subset(0x0750, 0x077F , RID_SUBSETSTR_ARABIC_SUPPLEMENT ) );
    1175           0 :                     break;
    1176             :                 case UBLOCK_BUGINESE:
    1177           0 :                     aAllSubsets.push_back( Subset(0x1A00, 0x1A1F , RID_SUBSETSTR_BUGINESE ) );
    1178           0 :                     break;
    1179             :                 case UBLOCK_CJK_STROKES:
    1180           0 :                     aAllSubsets.push_back( Subset( 0x31C0, 0x31EF, RID_SUBSETSTR_CJK_STROKES ) );
    1181           0 :                     break;
    1182             :                 case UBLOCK_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT:
    1183           0 :                     aAllSubsets.push_back( Subset( 0x1DC0, 0x1DFF , RID_SUBSETSTR_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT ) );
    1184           0 :                     break;
    1185             :                 case UBLOCK_COPTIC:
    1186           0 :                     aAllSubsets.push_back( Subset( 0x2C80, 0x2CFF , RID_SUBSETSTR_COPTIC ) );
    1187           0 :                     break;
    1188             :                 case UBLOCK_ETHIOPIC_EXTENDED:
    1189           0 :                     aAllSubsets.push_back( Subset( 0x2D80, 0x2DDF , RID_SUBSETSTR_ETHIOPIC_EXTENDED ) );
    1190           0 :                     break;
    1191             :                 case UBLOCK_ETHIOPIC_SUPPLEMENT:
    1192           0 :                     aAllSubsets.push_back( Subset( 0x1380, 0x139F, RID_SUBSETSTR_ETHIOPIC_SUPPLEMENT ) );
    1193           0 :                     break;
    1194             :                 case UBLOCK_GEORGIAN_SUPPLEMENT:
    1195           0 :                     aAllSubsets.push_back( Subset( 0x2D00, 0x2D2F, RID_SUBSETSTR_GEORGIAN_SUPPLEMENT ) );
    1196           0 :                     break;
    1197             :                 case UBLOCK_GLAGOLITIC:
    1198           0 :                     aAllSubsets.push_back( Subset( 0x2C00, 0x2C5F, RID_SUBSETSTR_GLAGOLITIC ) );
    1199           0 :                     break;
    1200             :                 case UBLOCK_KHAROSHTHI:
    1201           0 :                     aAllSubsets.push_back( Subset( 0x10A00, 0x10A5F, RID_SUBSETSTR_KHAROSHTHI ) );
    1202           0 :                     break;
    1203             :                 case UBLOCK_MODIFIER_TONE_LETTERS:
    1204           0 :                     aAllSubsets.push_back( Subset( 0xA700, 0xA71F, RID_SUBSETSTR_MODIFIER_TONE_LETTERS ) );
    1205           0 :                     break;
    1206             :                 case UBLOCK_NEW_TAI_LUE:
    1207           0 :                     aAllSubsets.push_back( Subset( 0x1980, 0x19DF, RID_SUBSETSTR_NEW_TAI_LUE ) );
    1208           0 :                     break;
    1209             :                 case UBLOCK_OLD_PERSIAN:
    1210           0 :                     aAllSubsets.push_back( Subset( 0x103A0, 0x103DF, RID_SUBSETSTR_OLD_PERSIAN ) );
    1211           0 :                     break;
    1212             :                 case UBLOCK_PHONETIC_EXTENSIONS_SUPPLEMENT:
    1213           0 :                     aAllSubsets.push_back( Subset( 0x1D80, 0x1DBF, RID_SUBSETSTR_PHONETIC_EXTENSIONS_SUPPLEMENT ) );
    1214           0 :                     break;
    1215             :                 case UBLOCK_SUPPLEMENTAL_PUNCTUATION:
    1216           0 :                     aAllSubsets.push_back( Subset( 0x2E00, 0x2E7F, RID_SUBSETSTR_SUPPLEMENTAL_PUNCTUATION ) );
    1217           0 :                     break;
    1218             :                 case UBLOCK_SYLOTI_NAGRI:
    1219           0 :                     aAllSubsets.push_back( Subset( 0xA800, 0xA82F, RID_SUBSETSTR_SYLOTI_NAGRI ) );
    1220           0 :                     break;
    1221             :                 case UBLOCK_TIFINAGH:
    1222           0 :                     aAllSubsets.push_back( Subset( 0x2D30, 0x2D7F, RID_SUBSETSTR_TIFINAGH ) );
    1223           0 :                     break;
    1224             :                 case UBLOCK_VERTICAL_FORMS:
    1225           0 :                     aAllSubsets.push_back( Subset( 0xFE10, 0xFE1F, RID_SUBSETSTR_VERTICAL_FORMS ) );
    1226           0 :                     break;
    1227             :                 case UBLOCK_NKO:
    1228           0 :                     aAllSubsets.push_back( Subset( 0x07C0, 0x07FF, RID_SUBSETSTR_NKO ) );
    1229           0 :                     break;
    1230             :                 case UBLOCK_BALINESE:
    1231           0 :                     aAllSubsets.push_back( Subset( 0x1B00, 0x1B7F, RID_SUBSETSTR_BALINESE ) );
    1232           0 :                     break;
    1233             :                 case UBLOCK_LATIN_EXTENDED_C:
    1234           0 :                     aAllSubsets.push_back( Subset( 0x2C60, 0x2C7F, RID_SUBSETSTR_LATIN_EXTENDED_C ) );
    1235           0 :                     break;
    1236             :                 case UBLOCK_LATIN_EXTENDED_D:
    1237           0 :                     aAllSubsets.push_back( Subset( 0xA720, 0xA7FF, RID_SUBSETSTR_LATIN_EXTENDED_D ) );
    1238           0 :                     break;
    1239             :                 case UBLOCK_PHAGS_PA:
    1240           0 :                     aAllSubsets.push_back( Subset( 0xA840, 0xA87F, RID_SUBSETSTR_PHAGS_PA ) );
    1241           0 :                     break;
    1242             :                 case UBLOCK_PHOENICIAN:
    1243           0 :                     aAllSubsets.push_back( Subset( 0x10900, 0x1091F, RID_SUBSETSTR_PHOENICIAN ) );
    1244           0 :                     break;
    1245             :                 case UBLOCK_CUNEIFORM:
    1246           0 :                     aAllSubsets.push_back( Subset( 0x12000, 0x123FF, RID_SUBSETSTR_CUNEIFORM ) );
    1247           0 :                     break;
    1248             :                 case UBLOCK_CUNEIFORM_NUMBERS_AND_PUNCTUATION:
    1249           0 :                     aAllSubsets.push_back( Subset( 0x12400, 0x1247F, RID_SUBSETSTR_CUNEIFORM_NUMBERS_AND_PUNCTUATION ) );
    1250           0 :                     break;
    1251             :                 case UBLOCK_COUNTING_ROD_NUMERALS:
    1252           0 :                     aAllSubsets.push_back( Subset( 0x1D360, 0x1D37F, RID_SUBSETSTR_COUNTING_ROD_NUMERALS ) );
    1253           0 :                     break;
    1254             :                 case UBLOCK_SUNDANESE:
    1255           0 :                     aAllSubsets.push_back( Subset( 0x1B80, 0x1BBF, RID_SUBSETSTR_SUNDANESE ) );
    1256           0 :                     break;
    1257             :                 case UBLOCK_LEPCHA:
    1258           0 :                     aAllSubsets.push_back( Subset( 0x1C00, 0x1C4F, RID_SUBSETSTR_LEPCHA ) );
    1259           0 :                     break;
    1260             :                 case UBLOCK_OL_CHIKI:
    1261           0 :                     aAllSubsets.push_back( Subset( 0x1C50, 0x1C7F, RID_SUBSETSTR_OL_CHIKI ) );
    1262           0 :                     break;
    1263             :                 case UBLOCK_CYRILLIC_EXTENDED_A:
    1264           0 :                     aAllSubsets.push_back( Subset( 0x2DE0, 0x2DFF, RID_SUBSETSTR_CYRILLIC_EXTENDED_A ) );
    1265           0 :                     break;
    1266             :                 case UBLOCK_VAI:
    1267           0 :                     aAllSubsets.push_back( Subset( 0xA500, 0xA63F, RID_SUBSETSTR_VAI ) );
    1268           0 :                     break;
    1269             :                 case UBLOCK_CYRILLIC_EXTENDED_B:
    1270           0 :                     aAllSubsets.push_back( Subset( 0xA640, 0xA69F, RID_SUBSETSTR_CYRILLIC_EXTENDED_B ) );
    1271           0 :                     break;
    1272             :                 case UBLOCK_SAURASHTRA:
    1273           0 :                     aAllSubsets.push_back( Subset( 0xA880, 0xA8DF, RID_SUBSETSTR_SAURASHTRA ) );
    1274           0 :                     break;
    1275             :                 case UBLOCK_KAYAH_LI:
    1276           0 :                     aAllSubsets.push_back( Subset( 0xA900, 0xA92F, RID_SUBSETSTR_KAYAH_LI ) );
    1277           0 :                     break;
    1278             :                 case UBLOCK_REJANG:
    1279           0 :                     aAllSubsets.push_back( Subset( 0xA930, 0xA95F, RID_SUBSETSTR_REJANG ) );
    1280           0 :                     break;
    1281             :                 case UBLOCK_CHAM:
    1282           0 :                     aAllSubsets.push_back( Subset( 0xAA00, 0xAA5F, RID_SUBSETSTR_CHAM ) );
    1283           0 :                     break;
    1284             :                 case UBLOCK_ANCIENT_SYMBOLS:
    1285           0 :                     aAllSubsets.push_back( Subset( 0x10190, 0x101CF, RID_SUBSETSTR_ANCIENT_SYMBOLS ) );
    1286           0 :                     break;
    1287             :                 case UBLOCK_PHAISTOS_DISC:
    1288           0 :                     aAllSubsets.push_back( Subset( 0x101D0, 0x101FF, RID_SUBSETSTR_PHAISTOS_DISC ) );
    1289           0 :                     break;
    1290             :                 case UBLOCK_LYCIAN:
    1291           0 :                     aAllSubsets.push_back( Subset( 0x10280, 0x1029F, RID_SUBSETSTR_LYCIAN ) );
    1292           0 :                     break;
    1293             :                 case UBLOCK_CARIAN:
    1294           0 :                     aAllSubsets.push_back( Subset( 0x102A0, 0x102DF, RID_SUBSETSTR_CARIAN ) );
    1295           0 :                     break;
    1296             :                 case UBLOCK_LYDIAN:
    1297           0 :                     aAllSubsets.push_back( Subset( 0x10920, 0x1093F, RID_SUBSETSTR_LYDIAN ) );
    1298           0 :                     break;
    1299             :                 case UBLOCK_MAHJONG_TILES:
    1300           0 :                     aAllSubsets.push_back( Subset( 0x1F000, 0x1F02F, RID_SUBSETSTR_MAHJONG_TILES ) );
    1301           0 :                     break;
    1302             :                 case UBLOCK_DOMINO_TILES:
    1303           0 :                     aAllSubsets.push_back( Subset( 0x1F030, 0x1F09F, RID_SUBSETSTR_DOMINO_TILES ) );
    1304           0 :                     break;
    1305             : #if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 4)
    1306             :                 case UBLOCK_SAMARITAN:
    1307           0 :                     aAllSubsets.push_back( Subset( 0x0800, 0x083F, RID_SUBSETSTR_SAMARITAN ) );
    1308           0 :                     break;
    1309             :                 case UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED:
    1310           0 :                     aAllSubsets.push_back( Subset( 0x18B0, 0x18FF, RID_SUBSETSTR_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED ) );
    1311           0 :                     break;
    1312             :                 case UBLOCK_TAI_THAM:
    1313           0 :                     aAllSubsets.push_back( Subset( 0x1A20, 0x1AAF, RID_SUBSETSTR_TAI_THAM ) );
    1314           0 :                     break;
    1315             :                 case UBLOCK_VEDIC_EXTENSIONS:
    1316           0 :                     aAllSubsets.push_back( Subset( 0x1CD0, 0x1CFF, RID_SUBSETSTR_VEDIC_EXTENSIONS ) );
    1317           0 :                     break;
    1318             :                 case UBLOCK_LISU:
    1319           0 :                     aAllSubsets.push_back( Subset( 0xA4D0, 0xA4FF, RID_SUBSETSTR_LISU ) );
    1320           0 :                     break;
    1321             :                 case UBLOCK_BAMUM:
    1322           0 :                     aAllSubsets.push_back( Subset( 0xA6A0, 0xA6FF, RID_SUBSETSTR_BAMUM ) );
    1323           0 :                     break;
    1324             :                 case UBLOCK_COMMON_INDIC_NUMBER_FORMS:
    1325           0 :                     aAllSubsets.push_back( Subset( 0xA830, 0xA83F, RID_SUBSETSTR_COMMON_INDIC_NUMBER_FORMS ) );
    1326           0 :                     break;
    1327             :                 case UBLOCK_DEVANAGARI_EXTENDED:
    1328           0 :                     aAllSubsets.push_back( Subset( 0xA8E0, 0xA8FF, RID_SUBSETSTR_DEVANAGARI_EXTENDED ) );
    1329           0 :                     break;
    1330             :                 case UBLOCK_HANGUL_JAMO_EXTENDED_A:
    1331           0 :                     aAllSubsets.push_back( Subset( 0xA960, 0xA97F, RID_SUBSETSTR_HANGUL_JAMO_EXTENDED_A ) );
    1332           0 :                     break;
    1333             :                 case UBLOCK_JAVANESE:
    1334           0 :                     aAllSubsets.push_back( Subset( 0xA980, 0xA9DF, RID_SUBSETSTR_JAVANESE ) );
    1335           0 :                     break;
    1336             :                 case UBLOCK_MYANMAR_EXTENDED_A:
    1337           0 :                     aAllSubsets.push_back( Subset( 0xAA60, 0xAA7F, RID_SUBSETSTR_MYANMAR_EXTENDED_A ) );
    1338           0 :                     break;
    1339             :                 case UBLOCK_TAI_VIET:
    1340           0 :                     aAllSubsets.push_back( Subset( 0xAA80, 0xAADF, RID_SUBSETSTR_TAI_VIET ) );
    1341           0 :                     break;
    1342             :                 case UBLOCK_MEETEI_MAYEK:
    1343           0 :                     aAllSubsets.push_back( Subset( 0xABC0, 0xABFF, RID_SUBSETSTR_MEETEI_MAYEK ) );
    1344           0 :                     break;
    1345             :                 case UBLOCK_HANGUL_JAMO_EXTENDED_B:
    1346           0 :                     aAllSubsets.push_back( Subset( 0xD7B0, 0xD7FF, RID_SUBSETSTR_HANGUL_JAMO_EXTENDED_B ) );
    1347           0 :                     break;
    1348             :                 case UBLOCK_IMPERIAL_ARAMAIC:
    1349           0 :                     aAllSubsets.push_back( Subset( 0x10840, 0x1085F, RID_SUBSETSTR_IMPERIAL_ARAMAIC ) );
    1350           0 :                     break;
    1351             :                 case UBLOCK_OLD_SOUTH_ARABIAN:
    1352           0 :                     aAllSubsets.push_back( Subset( 0x10A60, 0x10A7F, RID_SUBSETSTR_OLD_SOUTH_ARABIAN ) );
    1353           0 :                     break;
    1354             :                 case UBLOCK_AVESTAN:
    1355           0 :                     aAllSubsets.push_back( Subset( 0x10B00, 0x10B3F, RID_SUBSETSTR_AVESTAN ) );
    1356           0 :                     break;
    1357             :                 case UBLOCK_INSCRIPTIONAL_PARTHIAN:
    1358           0 :                     aAllSubsets.push_back( Subset( 0x10B40, 0x10B5F, RID_SUBSETSTR_INSCRIPTIONAL_PARTHIAN ) );
    1359           0 :                     break;
    1360             :                 case UBLOCK_INSCRIPTIONAL_PAHLAVI:
    1361           0 :                     aAllSubsets.push_back( Subset( 0x10B60, 0x10B7F, RID_SUBSETSTR_INSCRIPTIONAL_PAHLAVI ) );
    1362           0 :                     break;
    1363             :                 case UBLOCK_OLD_TURKIC:
    1364           0 :                     aAllSubsets.push_back( Subset( 0x10C00, 0x10C4F, RID_SUBSETSTR_OLD_TURKIC ) );
    1365           0 :                     break;
    1366             :                 case UBLOCK_RUMI_NUMERAL_SYMBOLS:
    1367           0 :                     aAllSubsets.push_back( Subset( 0x10E60, 0x10E7F, RID_SUBSETSTR_RUMI_NUMERAL_SYMBOLS ) );
    1368           0 :                     break;
    1369             :                 case UBLOCK_KAITHI:
    1370           0 :                     aAllSubsets.push_back( Subset( 0x11080, 0x110CF, RID_SUBSETSTR_KAITHI ) );
    1371           0 :                     break;
    1372             :                 case UBLOCK_EGYPTIAN_HIEROGLYPHS:
    1373           0 :                     aAllSubsets.push_back( Subset( 0x13000, 0x1342F, RID_SUBSETSTR_EGYPTIAN_HIEROGLYPHS ) );
    1374           0 :                     break;
    1375             :                 case UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT:
    1376           0 :                     aAllSubsets.push_back( Subset( 0x1F100, 0x1F1FF, RID_SUBSETSTR_ENCLOSED_ALPHANUMERIC_SUPPLEMENT ) );
    1377           0 :                     break;
    1378             :                 case UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT:
    1379           0 :                     aAllSubsets.push_back( Subset( 0x1F200, 0x1F2FF, RID_SUBSETSTR_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT ) );
    1380           0 :                     break;
    1381             :                 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C:
    1382           0 :                     aAllSubsets.push_back( Subset( 0x2A700, 0x2B73F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C ) );
    1383           0 :                     break;
    1384             : #endif
    1385             : #if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 6)
    1386             :                 case UBLOCK_MANDAIC:
    1387           0 :                     aAllSubsets.push_back( Subset( 0x0840, 0x085F, RID_SUBSETSTR_MANDAIC ) );
    1388           0 :                     break;
    1389             :                 case UBLOCK_BATAK:
    1390           0 :                     aAllSubsets.push_back( Subset( 0x1BC0, 0x1BFF, RID_SUBSETSTR_BATAK ) );
    1391           0 :                     break;
    1392             :                 case UBLOCK_ETHIOPIC_EXTENDED_A:
    1393           0 :                     aAllSubsets.push_back( Subset( 0xAB00, 0xAB2F, RID_SUBSETSTR_ETHIOPIC_EXTENDED_A ) );
    1394           0 :                     break;
    1395             :                 case UBLOCK_BRAHMI:
    1396           0 :                     aAllSubsets.push_back( Subset( 0x11000, 0x1107F, RID_SUBSETSTR_BRAHMI ) );
    1397           0 :                     break;
    1398             :                 case UBLOCK_BAMUM_SUPPLEMENT:
    1399           0 :                     aAllSubsets.push_back( Subset( 0x16800, 0x16A3F, RID_SUBSETSTR_BAMUM_SUPPLEMENT ) );
    1400           0 :                     break;
    1401             :                 case UBLOCK_KANA_SUPPLEMENT:
    1402           0 :                     aAllSubsets.push_back( Subset( 0x1B000, 0x1B0FF, RID_SUBSETSTR_KANA_SUPPLEMENT ) );
    1403           0 :                     break;
    1404             :                 case UBLOCK_PLAYING_CARDS:
    1405           0 :                     aAllSubsets.push_back( Subset( 0x1F0A0, 0x1F0FF, RID_SUBSETSTR_PLAYING_CARDS ) );
    1406           0 :                     break;
    1407             :                 case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS:
    1408           0 :                     aAllSubsets.push_back( Subset( 0x1F300, 0x1F5FF, RID_SUBSETSTR_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS ) );
    1409           0 :                     break;
    1410             :                 case UBLOCK_EMOTICONS:
    1411           0 :                     aAllSubsets.push_back( Subset( 0x1F600, 0x1F64F, RID_SUBSETSTR_EMOTICONS ) );
    1412           0 :                     break;
    1413             :                 case UBLOCK_TRANSPORT_AND_MAP_SYMBOLS:
    1414           0 :                     aAllSubsets.push_back( Subset( 0x1F680, 0x1F6FF, RID_SUBSETSTR_TRANSPORT_AND_MAP_SYMBOLS ) );
    1415           0 :                     break;
    1416             :                 case UBLOCK_ALCHEMICAL_SYMBOLS:
    1417           0 :                     aAllSubsets.push_back( Subset( 0x1F700, 0x1F77F, RID_SUBSETSTR_ALCHEMICAL_SYMBOLS ) );
    1418           0 :                     break;
    1419             :                 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D:
    1420           0 :                     aAllSubsets.push_back( Subset( 0x2B740, 0x2B81F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D ) );
    1421           0 :                     break;
    1422             : #endif
    1423             : // Note ICU version 49 (NOT 4.9), so the MAJOR_NUM is two digits.
    1424             : #if U_ICU_VERSION_MAJOR_NUM >= 49
    1425             :                 case UBLOCK_ARABIC_EXTENDED_A:
    1426           0 :                     aAllSubsets.push_back( Subset( 0x08A0, 0x08FF, RID_SUBSETSTR_ARABIC_EXTENDED_A ) );
    1427           0 :                     break;
    1428             :                 case UBLOCK_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS:
    1429           0 :                     aAllSubsets.push_back( Subset( 0x1EE00, 0x1EEFF, RID_SUBSETSTR_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS ) );
    1430           0 :                     break;
    1431             :                 case UBLOCK_CHAKMA:
    1432           0 :                     aAllSubsets.push_back( Subset( 0x11100, 0x1114F, RID_SUBSETSTR_CHAKMA ) );
    1433           0 :                     break;
    1434             :                 case UBLOCK_MEETEI_MAYEK_EXTENSIONS:
    1435           0 :                     aAllSubsets.push_back( Subset( 0xAAE0, 0xAAFF, RID_SUBSETSTR_MEETEI_MAYEK_EXTENSIONS ) );
    1436           0 :                     break;
    1437             :                 case UBLOCK_MEROITIC_CURSIVE:
    1438           0 :                     aAllSubsets.push_back( Subset( 0x109A0, 0x109FF, RID_SUBSETSTR_MEROITIC_CURSIVE ) );
    1439           0 :                     break;
    1440             :                 case UBLOCK_MEROITIC_HIEROGLYPHS:
    1441           0 :                     aAllSubsets.push_back( Subset( 0x10980, 0x1099F, RID_SUBSETSTR_MEROITIC_HIEROGLYPHS ) );
    1442           0 :                     break;
    1443             :                 case UBLOCK_MIAO:
    1444           0 :                     aAllSubsets.push_back( Subset( 0x16F00, 0x16F9F, RID_SUBSETSTR_MIAO ) );
    1445           0 :                     break;
    1446             :                 case UBLOCK_SHARADA:
    1447           0 :                     aAllSubsets.push_back( Subset( 0x11180, 0x111DF, RID_SUBSETSTR_SHARADA ) );
    1448           0 :                     break;
    1449             :                 case UBLOCK_SORA_SOMPENG:
    1450           0 :                     aAllSubsets.push_back( Subset( 0x110D0, 0x110FF, RID_SUBSETSTR_SORA_SOMPENG ) );
    1451           0 :                     break;
    1452             :                 case UBLOCK_SUNDANESE_SUPPLEMENT:
    1453           0 :                     aAllSubsets.push_back( Subset( 0x1CC0, 0x1CCF, RID_SUBSETSTR_SUNDANESE_SUPPLEMENT ) );
    1454           0 :                     break;
    1455             :                 case UBLOCK_TAKRI:
    1456           0 :                     aAllSubsets.push_back( Subset( 0x11680, 0x116CF, RID_SUBSETSTR_TAKRI ) );
    1457           0 :                     break;
    1458             : #endif
    1459             :             }
    1460             : 
    1461             : #if OSL_DEBUG_LEVEL > 0
    1462             :             if (eBlock != UBLOCK_NO_BLOCK &&
    1463             :                 eBlock != UBLOCK_INVALID_CODE &&
    1464             :                 eBlock != UBLOCK_COUNT &&
    1465             :                 eBlock != UBLOCK_HIGH_SURROGATES &&
    1466             :                 eBlock != UBLOCK_HIGH_PRIVATE_USE_SURROGATES &&
    1467             :                 eBlock != UBLOCK_LOW_SURROGATES)
    1468             : 
    1469             :             {
    1470             :                 UBlockCode eBlockStart = ublock_getCode(aAllSubsets.back().GetRangeMin());
    1471             :                 UBlockCode eBlockEnd = ublock_getCode(aAllSubsets.back().GetRangeMax());
    1472             :                 assert(eBlockStart == eBlockEnd && eBlockStart == eBlock);
    1473             :             }
    1474             : #endif
    1475             :         }
    1476             : 
    1477           0 :         aAllSubsets.sort();
    1478             :     }
    1479             : 
    1480           0 :     maSubsets = aAllSubsets;
    1481           0 : }
    1482             : 
    1483           0 : void SubsetMap::ApplyCharMap( const FontCharMap* pFontCharMap )
    1484             : {
    1485           0 :     if( !pFontCharMap )
    1486           0 :         return;
    1487             : 
    1488             :     // remove subsets that are not matched in any range
    1489           0 :     SubsetList::iterator it_next = maSubsets.begin();
    1490           0 :     while( it_next != maSubsets.end() )
    1491             :     {
    1492           0 :         SubsetList::iterator it = it_next++;
    1493           0 :         const Subset& rSubset = *it;
    1494           0 :         sal_uInt32 cMin = rSubset.GetRangeMin();
    1495           0 :         sal_uInt32 cMax = rSubset.GetRangeMax();
    1496             : 
    1497           0 :         int nCount =  pFontCharMap->CountCharsInRange( cMin, cMax );
    1498           0 :         if( nCount <= 0 )
    1499           0 :             maSubsets.erase( it );
    1500             :     }
    1501           0 : }
    1502             : 
    1503             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10