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

Generated by: LCOV version 1.10