LCOV - code coverage report
Current view: top level - svx/source/dialog - charmap.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 505 0.0 %
Date: 2012-08-25 Functions: 0 40 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 685 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <stdio.h>
      30                 :            : 
      31                 :            : #define _SVX_CHARMAP_CXX_
      32                 :            : #include <vcl/svapp.hxx>
      33                 :            : #include <svtools/colorcfg.hxx>
      34                 :            : 
      35                 :            : #include <rtl/textenc.h>
      36                 :            : #include <svx/ucsubset.hxx>
      37                 :            : 
      38                 :            : #include <svx/dialogs.hrc>
      39                 :            : 
      40                 :            : #include <svx/charmap.hxx>
      41                 :            : #include <svx/dialmgr.hxx>
      42                 :            : #include <svx/svxdlg.hxx>
      43                 :            : 
      44                 :            : #include "charmapacc.hxx"
      45                 :            : #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
      46                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      47                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      48                 :            : #include <comphelper/types.hxx>
      49                 :            : #include <svl/itemset.hxx>
      50                 :            : 
      51                 :            : #include "rtl/ustrbuf.hxx"
      52                 :            : 
      53                 :            : using namespace ::com::sun::star::accessibility;
      54                 :            : using namespace ::com::sun::star::uno;
      55                 :            : using namespace ::com::sun::star;
      56                 :            : 
      57                 :            : // -----------------------------------------------------------------------
      58                 :          0 : sal_uInt32& SvxShowCharSet::getSelectedChar()
      59                 :            : {
      60                 :            :     static sal_uInt32 cSelectedChar = ' '; // keeps selected character over app livetime
      61                 :          0 :     return cSelectedChar;
      62                 :            : }
      63                 :            : 
      64                 :            : // class SvxShowCharSet ==================================================
      65                 :            : 
      66                 :            : #define SBWIDTH 16
      67                 :            : 
      68                 :          0 : SvxShowCharSet::SvxShowCharSet( Window* pParent, const ResId& rResId ) :
      69                 :            :     Control( pParent, rResId )
      70                 :            :     ,m_pAccessible(NULL)
      71 [ #  # ][ #  # ]:          0 :     ,aVscrollSB( this, WB_VERT)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      72                 :            : {
      73                 :          0 :     nSelectedIndex = -1;    // TODO: move into init list when it is no longer static
      74                 :            : 
      75                 :          0 :     aOrigSize = GetOutputSizePixel();
      76         [ #  # ]:          0 :     aOrigPos = GetPosPixel();
      77                 :            : 
      78 [ #  # ][ #  # ]:          0 :     SetStyle( GetStyle() | WB_CLIPCHILDREN );
      79         [ #  # ]:          0 :     aVscrollSB.SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) );
      80                 :          0 :     aVscrollSB.EnableDrag( sal_True );
      81                 :            :     // other settings like aVscroll depend on selected font => see SetFont
      82                 :            : 
      83                 :          0 :     bDrag = sal_False;
      84         [ #  # ]:          0 :     InitSettings( sal_True, sal_True );
      85                 :          0 : }
      86                 :            : 
      87                 :            : // -----------------------------------------------------------------------
      88                 :            : 
      89                 :          0 : void SvxShowCharSet::GetFocus()
      90                 :            : {
      91                 :          0 :     Control::GetFocus();
      92                 :          0 :     SelectIndex( nSelectedIndex, sal_True );
      93                 :          0 : }
      94                 :            : 
      95                 :            : // -----------------------------------------------------------------------
      96                 :            : 
      97                 :          0 : void SvxShowCharSet::LoseFocus()
      98                 :            : {
      99                 :          0 :     Control::LoseFocus();
     100                 :          0 :     SelectIndex( nSelectedIndex, sal_False );
     101                 :          0 : }
     102                 :            : 
     103                 :            : // -----------------------------------------------------------------------
     104                 :            : 
     105                 :          0 : void SvxShowCharSet::StateChanged( StateChangedType nType )
     106                 :            : {
     107         [ #  # ]:          0 :     if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
     108                 :          0 :         InitSettings( sal_True, sal_False );
     109         [ #  # ]:          0 :     else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
     110                 :          0 :         InitSettings( sal_False, sal_True );
     111                 :            : 
     112                 :          0 :     Control::StateChanged( nType );
     113                 :          0 : }
     114                 :            : 
     115                 :            : // -----------------------------------------------------------------------
     116                 :            : 
     117                 :          0 : void SvxShowCharSet::DataChanged( const DataChangedEvent& rDCEvt )
     118                 :            : {
     119   [ #  #  #  # ]:          0 :     if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS )
                 [ #  # ]
     120                 :          0 :       && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
     121                 :          0 :         InitSettings( sal_True, sal_True );
     122                 :            :     else
     123                 :          0 :         Control::DataChanged( rDCEvt );
     124                 :          0 : }
     125                 :            : 
     126                 :            : // -----------------------------------------------------------------------
     127                 :            : 
     128                 :          0 : void SvxShowCharSet::MouseButtonDown( const MouseEvent& rMEvt )
     129                 :            : {
     130         [ #  # ]:          0 :     if ( rMEvt.IsLeft() )
     131                 :            :     {
     132         [ #  # ]:          0 :         if ( rMEvt.GetClicks() == 1 )
     133                 :            :         {
     134                 :          0 :             GrabFocus();
     135                 :          0 :             bDrag = sal_True;
     136                 :          0 :             CaptureMouse();
     137                 :            : 
     138                 :          0 :             int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() );
     139                 :          0 :             SelectIndex( nIndex );
     140                 :            :         }
     141                 :            : 
     142         [ #  # ]:          0 :         if ( !(rMEvt.GetClicks() % 2) )
     143                 :          0 :             aDoubleClkHdl.Call( this );
     144                 :            :     }
     145                 :          0 : }
     146                 :            : 
     147                 :            : // -----------------------------------------------------------------------
     148                 :            : 
     149                 :          0 : void SvxShowCharSet::MouseButtonUp( const MouseEvent& rMEvt )
     150                 :            : {
     151 [ #  # ][ #  # ]:          0 :     if ( bDrag && rMEvt.IsLeft() )
                 [ #  # ]
     152                 :            :     {
     153                 :            :         // released mouse over character map
     154 [ #  # ][ #  # ]:          0 :         if ( Rectangle(Point(), GetOutputSize()).IsInside(rMEvt.GetPosPixel()))
                 [ #  # ]
     155                 :          0 :             aSelectHdl.Call( this );
     156                 :          0 :         ReleaseMouse();
     157                 :          0 :         bDrag = sal_False;
     158                 :            :     }
     159                 :          0 : }
     160                 :            : 
     161                 :            : // -----------------------------------------------------------------------
     162                 :            : 
     163                 :          0 : void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt )
     164                 :            : {
     165 [ #  # ][ #  # ]:          0 :     if ( rMEvt.IsLeft() && bDrag )
                 [ #  # ]
     166                 :            :     {
     167                 :          0 :         Point aPos  = rMEvt.GetPosPixel();
     168         [ #  # ]:          0 :         Size  aSize = GetSizePixel();
     169                 :            : 
     170         [ #  # ]:          0 :         if ( aPos.X() < 0 )
     171                 :          0 :             aPos.X() = 0;
     172         [ #  # ]:          0 :         else if ( aPos.X() > aSize.Width()-5 )
     173                 :          0 :             aPos.X() = aSize.Width()-5;
     174         [ #  # ]:          0 :         if ( aPos.Y() < 0 )
     175                 :          0 :             aPos.Y() = 0;
     176         [ #  # ]:          0 :         else if ( aPos.Y() > aSize.Height()-5 )
     177                 :          0 :             aPos.Y() = aSize.Height()-5;
     178                 :            : 
     179         [ #  # ]:          0 :         int nIndex = PixelToMapIndex( aPos );
     180         [ #  # ]:          0 :         SelectIndex( nIndex );
     181                 :            :     }
     182                 :          0 : }
     183                 :            : 
     184                 :            : // -----------------------------------------------------------------------
     185                 :            : 
     186                 :          0 : void SvxShowCharSet::Command( const CommandEvent& rCEvt )
     187                 :            : {
     188         [ #  # ]:          0 :     if( !HandleScrollCommand( rCEvt, 0, &aVscrollSB ) )
     189                 :          0 :         Control::Command( rCEvt );
     190                 :          0 : }
     191                 :            : 
     192                 :            : // -----------------------------------------------------------------------------
     193                 :            : 
     194                 :          0 : sal_uInt16 SvxShowCharSet::GetRowPos(sal_uInt16 _nPos) const
     195                 :            : {
     196                 :          0 :     return _nPos / COLUMN_COUNT ;
     197                 :            : }
     198                 :            : 
     199                 :            : // -----------------------------------------------------------------------------
     200                 :            : 
     201                 :          0 : sal_uInt16 SvxShowCharSet::GetColumnPos(sal_uInt16 _nPos) const
     202                 :            : {
     203                 :          0 :     return _nPos % COLUMN_COUNT ;
     204                 :            : }
     205                 :            : 
     206                 :            : // -----------------------------------------------------------------------
     207                 :            : 
     208                 :          0 : int SvxShowCharSet::FirstInView( void ) const
     209                 :            : {
     210                 :          0 :     int nIndex = 0;
     211         [ #  # ]:          0 :     if( aVscrollSB.IsVisible() )
     212                 :          0 :         nIndex += aVscrollSB.GetThumbPos() * COLUMN_COUNT;
     213                 :          0 :     return nIndex;
     214                 :            : }
     215                 :            : 
     216                 :            : // -----------------------------------------------------------------------
     217                 :            : 
     218                 :          0 : int SvxShowCharSet::LastInView( void ) const
     219                 :            : {
     220                 :          0 :     sal_uIntPtr nIndex = FirstInView();
     221                 :          0 :     nIndex += ROW_COUNT * COLUMN_COUNT - 1;
     222                 :          0 :     sal_uIntPtr nCompare = sal::static_int_cast<sal_uIntPtr>( maFontCharMap.GetCharCount() - 1 );
     223         [ #  # ]:          0 :     if( nIndex > nCompare )
     224                 :          0 :         nIndex = nCompare;
     225                 :          0 :     return nIndex;
     226                 :            : }
     227                 :            : 
     228                 :            : // -----------------------------------------------------------------------
     229                 :            : 
     230                 :          0 : inline Point SvxShowCharSet::MapIndexToPixel( int nIndex ) const
     231                 :            : {
     232                 :          0 :     const int nBase = FirstInView();
     233                 :          0 :     int x = ((nIndex - nBase) % COLUMN_COUNT) * nX;
     234                 :          0 :     int y = ((nIndex - nBase) / COLUMN_COUNT) * nY;
     235                 :          0 :     return Point( x, y );
     236                 :            : }
     237                 :            : // -----------------------------------------------------------------------------
     238                 :            : 
     239                 :          0 : int SvxShowCharSet::PixelToMapIndex( const Point& point) const
     240                 :            : {
     241                 :          0 :     int nBase = FirstInView();
     242                 :          0 :     return (nBase + (point.X()/nX) + (point.Y()/nY) * COLUMN_COUNT);
     243                 :            : }
     244                 :            : 
     245                 :            : // -----------------------------------------------------------------------
     246                 :            : 
     247                 :          0 : void SvxShowCharSet::KeyInput( const KeyEvent& rKEvt )
     248                 :            : {
     249                 :          0 :     KeyCode aCode = rKEvt.GetKeyCode();
     250                 :            : 
     251         [ #  # ]:          0 :     if( aCode.GetModifier() )
     252                 :            :     {
     253         [ #  # ]:          0 :         Control::KeyInput( rKEvt );
     254                 :          0 :         return;
     255                 :            :     }
     256                 :            : 
     257                 :          0 :     int tmpSelected = nSelectedIndex;
     258                 :            : 
     259   [ #  #  #  #  :          0 :     switch ( aCode.GetCode() )
          #  #  #  #  #  
                   #  # ]
     260                 :            :     {
     261                 :            :         case KEY_SPACE:
     262         [ #  # ]:          0 :             aSelectHdl.Call( this );
     263                 :          0 :             break;
     264                 :            :         case KEY_LEFT:
     265                 :          0 :             --tmpSelected;
     266                 :          0 :             break;
     267                 :            :         case KEY_RIGHT:
     268                 :          0 :             ++tmpSelected;
     269                 :          0 :             break;
     270                 :            :         case KEY_UP:
     271                 :          0 :             tmpSelected -= COLUMN_COUNT;
     272                 :          0 :             break;
     273                 :            :         case KEY_DOWN:
     274                 :          0 :             tmpSelected += COLUMN_COUNT;
     275                 :          0 :             break;
     276                 :            :         case KEY_PAGEUP:
     277                 :          0 :             tmpSelected -= ROW_COUNT * COLUMN_COUNT;
     278                 :          0 :             break;
     279                 :            :         case KEY_PAGEDOWN:
     280                 :          0 :             tmpSelected += ROW_COUNT * COLUMN_COUNT;
     281                 :          0 :             break;
     282                 :            :         case KEY_HOME:
     283                 :          0 :             tmpSelected = 0;
     284                 :          0 :             break;
     285                 :            :         case KEY_END:
     286         [ #  # ]:          0 :             tmpSelected = maFontCharMap.GetCharCount() - 1;
     287                 :          0 :             break;
     288                 :            :         case KEY_TAB:   // some fonts have a character at these unicode control codes
     289                 :            :         case KEY_ESCAPE:
     290                 :            :         case KEY_RETURN:
     291         [ #  # ]:          0 :             Control::KeyInput( rKEvt );
     292                 :          0 :             tmpSelected = - 1;  // mark as invalid
     293                 :          0 :             break;
     294                 :            :         default:
     295                 :            :             {
     296                 :          0 :                 sal_UCS4 cChar = rKEvt.GetCharCode();
     297         [ #  # ]:          0 :                 sal_UCS4 cNext = maFontCharMap.GetNextChar( cChar - 1 );
     298         [ #  # ]:          0 :                 tmpSelected = maFontCharMap.GetIndexFromChar( cNext );
     299 [ #  # ][ #  # ]:          0 :                 if( tmpSelected < 0 || (cChar != cNext) )
     300                 :            :                 {
     301         [ #  # ]:          0 :                     Control::KeyInput( rKEvt );
     302                 :          0 :                     tmpSelected = - 1;  // mark as invalid
     303                 :            :                 }
     304                 :            :             }
     305                 :            :     }
     306                 :            : 
     307         [ #  # ]:          0 :     if ( tmpSelected >= 0 )
     308                 :            :     {
     309         [ #  # ]:          0 :         SelectIndex( tmpSelected, sal_True );
     310         [ #  # ]:          0 :         aPreSelectHdl.Call( this );
     311                 :            :     }
     312                 :            : }
     313                 :            : 
     314                 :            : // -----------------------------------------------------------------------
     315                 :            : 
     316                 :          0 : void SvxShowCharSet::Paint( const Rectangle& )
     317                 :            : {
     318                 :          0 :     DrawChars_Impl( FirstInView(), LastInView() );
     319                 :          0 : }
     320                 :            : // -----------------------------------------------------------------------------
     321                 :          0 : void SvxShowCharSet::DeSelect()
     322                 :            : {
     323                 :          0 :     DrawChars_Impl(nSelectedIndex,nSelectedIndex);
     324                 :          0 : }
     325                 :            : // -----------------------------------------------------------------------
     326                 :            : 
     327                 :          0 : void SvxShowCharSet::DrawChars_Impl( int n1, int n2 )
     328                 :            : {
     329 [ #  # ][ #  # ]:          0 :     if( n1 > LastInView() || n2 < FirstInView() )
         [ #  # ][ #  # ]
                 [ #  # ]
     330                 :          0 :         return;
     331                 :            : 
     332                 :          0 :     Size aOutputSize = GetOutputSizePixel();
     333 [ #  # ][ #  # ]:          0 :     if( aVscrollSB.IsVisible() )
     334                 :          0 :         aOutputSize.setWidth( aOutputSize.Width() - SBWIDTH );
     335                 :            : 
     336                 :            :     int i;
     337         [ #  # ]:          0 :     for ( i = 1; i < COLUMN_COUNT; ++i )
     338         [ #  # ]:          0 :         DrawLine( Point( nX * i, 0 ), Point( nX * i, aOutputSize.Height() ) );
     339         [ #  # ]:          0 :     for ( i = 1; i < ROW_COUNT; ++i )
     340         [ #  # ]:          0 :         DrawLine( Point( 0, nY * i ), Point( aOutputSize.Width(), nY * i ) );
     341                 :            : 
     342         [ #  # ]:          0 :     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
     343                 :          0 :     const Color aWindowTextColor( rStyleSettings.GetFieldTextColor() );
     344                 :          0 :     Color aHighlightColor( rStyleSettings.GetHighlightColor() );
     345                 :          0 :     Color aHighlightTextColor( rStyleSettings.GetHighlightTextColor() );
     346                 :          0 :     Color aFaceColor( rStyleSettings.GetFaceColor() );
     347                 :          0 :     Color aLightColor( rStyleSettings.GetLightColor() );
     348                 :          0 :     Color aShadowColor( rStyleSettings.GetShadowColor() );
     349                 :            : 
     350         [ #  # ]:          0 :     int nTextHeight = GetTextHeight();
     351         [ #  # ]:          0 :     Rectangle aBoundRect;
     352         [ #  # ]:          0 :     for( i = n1; i <= n2; ++i )
     353                 :            :     {
     354         [ #  # ]:          0 :         Point pix = MapIndexToPixel( i );
     355                 :          0 :         int x = pix.X();
     356                 :          0 :         int y = pix.Y();
     357                 :            : 
     358                 :          0 :         rtl::OUStringBuffer buf;
     359 [ #  # ][ #  # ]:          0 :         buf.appendUtf32( maFontCharMap.GetCharFromIndex( i ) );
     360 [ #  # ][ #  # ]:          0 :         String aCharStr(buf.makeStringAndClear());
     361         [ #  # ]:          0 :         int nTextWidth = GetTextWidth(aCharStr);
     362                 :          0 :         int tx = x + (nX - nTextWidth + 1) / 2;
     363                 :          0 :         int ty = y + (nY - nTextHeight + 1) / 2;
     364                 :          0 :         Point aPointTxTy( tx, ty );
     365                 :            : 
     366                 :            :         // adjust position before it gets out of bounds
     367 [ #  # ][ #  # ]:          0 :         if( GetTextBoundRect( aBoundRect, aCharStr ) && !aBoundRect.IsEmpty() )
         [ #  # ][ #  # ]
                 [ #  # ]
     368                 :            :         {
     369                 :            :             // zero advance width => use ink width to center glyph
     370         [ #  # ]:          0 :             if( !nTextWidth )
     371                 :            :             {
     372                 :          0 :                 aPointTxTy.X() = x - aBoundRect.Left()
     373         [ #  # ]:          0 :                                + (nX - aBoundRect.GetWidth() + 1) / 2;
     374                 :            :             }
     375                 :            : 
     376         [ #  # ]:          0 :             aBoundRect += aPointTxTy;
     377                 :            : 
     378                 :            :             // shift back vertically if needed
     379                 :          0 :             int nYLDelta = aBoundRect.Top() - y;
     380                 :          0 :             int nYHDelta = (y + nY) - aBoundRect.Bottom();
     381         [ #  # ]:          0 :             if( nYLDelta <= 0 )
     382                 :          0 :                 aPointTxTy.Y() -= nYLDelta - 1;
     383         [ #  # ]:          0 :             else if( nYHDelta <= 0 )
     384                 :          0 :                 aPointTxTy.Y() += nYHDelta - 1;
     385                 :            : 
     386                 :            :             // shift back horizontally if needed
     387                 :          0 :             int nXLDelta = aBoundRect.Left() - x;
     388                 :          0 :             int nXHDelta = (x + nX) - aBoundRect.Right();
     389         [ #  # ]:          0 :             if( nXLDelta <= 0 )
     390                 :          0 :                 aPointTxTy.X() -= nXLDelta - 1;
     391         [ #  # ]:          0 :             else if( nXHDelta <= 0 )
     392                 :          0 :                 aPointTxTy.X() += nXHDelta - 1;
     393                 :            :         }
     394                 :            : 
     395                 :          0 :         Color aTextCol = GetTextColor();
     396         [ #  # ]:          0 :         if ( i != nSelectedIndex )
     397                 :            :         {
     398         [ #  # ]:          0 :             SetTextColor( aWindowTextColor );
     399         [ #  # ]:          0 :             DrawText( aPointTxTy, aCharStr );
     400                 :            :         }
     401                 :            :         else
     402                 :            :         {
     403                 :          0 :             Color aLineCol = GetLineColor();
     404                 :          0 :             Color aFillCol = GetFillColor();
     405         [ #  # ]:          0 :             SetLineColor();
     406                 :          0 :             Point aPointUL( x + 1, y + 1 );
     407 [ #  # ][ #  # ]:          0 :             if( HasFocus() )
     408                 :            :             {
     409         [ #  # ]:          0 :                 SetFillColor( aHighlightColor );
     410 [ #  # ][ #  # ]:          0 :                 DrawRect( Rectangle( aPointUL, Size(nX-1,nY-1) ) );
     411                 :            : 
     412         [ #  # ]:          0 :                 SetTextColor( aHighlightTextColor );
     413         [ #  # ]:          0 :                 DrawText( aPointTxTy, aCharStr );
     414                 :            :             }
     415                 :            :             else
     416                 :            :             {
     417         [ #  # ]:          0 :                 SetFillColor( aFaceColor );
     418 [ #  # ][ #  # ]:          0 :                 DrawRect( Rectangle( aPointUL, Size( nX-1, nY-1) ) );
     419                 :            : 
     420         [ #  # ]:          0 :                 SetLineColor( aLightColor );
     421         [ #  # ]:          0 :                 DrawLine( aPointUL, Point( x+nX-1, y+1) );
     422         [ #  # ]:          0 :                 DrawLine( aPointUL, Point( x+1, y+nY-1) );
     423                 :            : 
     424         [ #  # ]:          0 :                 SetLineColor( aShadowColor );
     425         [ #  # ]:          0 :                 DrawLine( Point( x+1, y+nY-1), Point( x+nX-1, y+nY-1) );
     426         [ #  # ]:          0 :                 DrawLine( Point( x+nX-1, y+nY-1), Point( x+nX-1, y+1) );
     427                 :            : 
     428         [ #  # ]:          0 :                 DrawText( aPointTxTy, aCharStr );
     429                 :            :             }
     430         [ #  # ]:          0 :             SetLineColor( aLineCol );
     431         [ #  # ]:          0 :             SetFillColor( aFillCol );
     432                 :            :         }
     433         [ #  # ]:          0 :         SetTextColor( aTextCol );
     434         [ #  # ]:          0 :     }
     435                 :            : }
     436                 :            : 
     437                 :            : // -----------------------------------------------------------------------
     438                 :            : 
     439                 :          0 : void SvxShowCharSet::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
     440                 :            : {
     441                 :          0 :     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
     442                 :            : 
     443         [ #  # ]:          0 :     if ( bForeground )
     444                 :            :     {
     445                 :          0 :         Color aTextColor( rStyleSettings.GetDialogTextColor() );
     446                 :            : 
     447 [ #  # ][ #  # ]:          0 :         if ( IsControlForeground() )
     448         [ #  # ]:          0 :             aTextColor = GetControlForeground();
     449         [ #  # ]:          0 :         SetTextColor( aTextColor );
     450                 :            :     }
     451                 :            : 
     452         [ #  # ]:          0 :     if ( bBackground )
     453                 :            :     {
     454         [ #  # ]:          0 :         if ( IsControlBackground() )
     455 [ #  # ][ #  # ]:          0 :             SetBackground( GetControlBackground() );
                 [ #  # ]
     456                 :            :         else
     457         [ #  # ]:          0 :             SetBackground( rStyleSettings.GetWindowColor() );
     458                 :            :     }
     459                 :            : 
     460                 :          0 :     Invalidate();
     461                 :          0 : }
     462                 :            : 
     463                 :            : // -----------------------------------------------------------------------
     464                 :            : 
     465                 :          0 : sal_UCS4 SvxShowCharSet::GetSelectCharacter() const
     466                 :            : {
     467         [ #  # ]:          0 :     if( nSelectedIndex >= 0 )
     468                 :          0 :         getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
     469                 :          0 :     return getSelectedChar();
     470                 :            : }
     471                 :            : 
     472                 :            : // -----------------------------------------------------------------------
     473                 :            : 
     474                 :          0 : void SvxShowCharSet::SetFont( const Font& rFont )
     475                 :            : {
     476                 :            :     // save last selected unicode
     477         [ #  # ]:          0 :     if( nSelectedIndex >= 0 )
     478 [ #  # ][ #  # ]:          0 :         getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
     479                 :            : 
     480         [ #  # ]:          0 :     Font aFont = rFont;
     481         [ #  # ]:          0 :     aFont.SetWeight( WEIGHT_LIGHT );
     482         [ #  # ]:          0 :     aFont.SetAlign( ALIGN_TOP );
     483                 :          0 :     int nFontHeight = (aOrigSize.Height() - 5) * 2 / (3 * ROW_COUNT);
     484 [ #  # ][ #  # ]:          0 :     aFont.SetSize( PixelToLogic( Size( 0, nFontHeight ) ) );
     485         [ #  # ]:          0 :     aFont.SetTransparent( sal_True );
     486         [ #  # ]:          0 :     Control::SetFont( aFont );
     487         [ #  # ]:          0 :     GetFontCharMap( maFontCharMap );
     488                 :            : 
     489                 :            :     // hide scrollbar when there is nothing to scroll
     490         [ #  # ]:          0 :     sal_Bool bNeedVscroll = (maFontCharMap.GetCharCount() > ROW_COUNT*COLUMN_COUNT);
     491                 :            : 
     492         [ #  # ]:          0 :     nX = (aOrigSize.Width() - (bNeedVscroll ? SBWIDTH : 0)) / COLUMN_COUNT;
     493                 :          0 :     nY = aOrigSize.Height() / ROW_COUNT;
     494                 :            : 
     495         [ #  # ]:          0 :     if( bNeedVscroll)
     496                 :            :     {
     497         [ #  # ]:          0 :         aVscrollSB.SetPosSizePixel( nX * COLUMN_COUNT, 0, SBWIDTH, nY * ROW_COUNT );
     498         [ #  # ]:          0 :         aVscrollSB.SetRangeMin( 0 );
     499         [ #  # ]:          0 :         int nLastRow = (maFontCharMap.GetCharCount() - 1 + COLUMN_COUNT) / COLUMN_COUNT;
     500         [ #  # ]:          0 :         aVscrollSB.SetRangeMax( nLastRow );
     501                 :          0 :         aVscrollSB.SetPageSize( ROW_COUNT-1 );
     502         [ #  # ]:          0 :         aVscrollSB.SetVisibleSize( ROW_COUNT );
     503                 :            :     }
     504                 :            : 
     505                 :            :     // restore last selected unicode
     506 [ #  # ][ #  # ]:          0 :     int nMapIndex = maFontCharMap.GetIndexFromChar( getSelectedChar() );
     507         [ #  # ]:          0 :     SelectIndex( nMapIndex );
     508                 :            : 
     509                 :            :     // rearrange CharSet element in sync with nX- and nY-multiples
     510         [ #  # ]:          0 :     Size aNewSize( nX * COLUMN_COUNT + (bNeedVscroll ? SBWIDTH : 0), nY * ROW_COUNT );
     511                 :          0 :     Point aNewPos = aOrigPos + Point( (aOrigSize.Width() - aNewSize.Width()) / 2, 0 );
     512         [ #  # ]:          0 :     SetPosPixel( aNewPos );
     513         [ #  # ]:          0 :     SetOutputSizePixel( aNewSize );
     514                 :            : 
     515         [ #  # ]:          0 :     aVscrollSB.Show( bNeedVscroll );
     516 [ #  # ][ #  # ]:          0 :     Invalidate();
     517                 :          0 : }
     518                 :            : 
     519                 :            : // -----------------------------------------------------------------------
     520                 :            : 
     521                 :          0 : void SvxShowCharSet::SelectIndex( int nNewIndex, sal_Bool bFocus )
     522                 :            : {
     523         [ #  # ]:          0 :     if( nNewIndex < 0 )
     524                 :            :     {
     525                 :            :         // need to scroll see closest unicode
     526                 :          0 :         sal_uInt32 cPrev = maFontCharMap.GetPrevChar( getSelectedChar() );
     527                 :          0 :         int nMapIndex = maFontCharMap.GetIndexFromChar( cPrev );
     528                 :          0 :         int nNewPos = nMapIndex / COLUMN_COUNT;
     529                 :          0 :         aVscrollSB.SetThumbPos( nNewPos );
     530         [ #  # ]:          0 :         nSelectedIndex = bFocus ? nMapIndex+1 : -1;
     531                 :          0 :         Invalidate();
     532                 :          0 :         Update();
     533                 :            :     }
     534         [ #  # ]:          0 :     else if( nNewIndex < FirstInView() )
     535                 :            :     {
     536                 :            :         // need to scroll up to see selected item
     537                 :          0 :         int nOldPos = aVscrollSB.GetThumbPos();
     538                 :          0 :         int nDelta = (FirstInView() - nNewIndex + COLUMN_COUNT-1) / COLUMN_COUNT;
     539                 :          0 :         aVscrollSB.SetThumbPos( nOldPos - nDelta );
     540                 :          0 :         nSelectedIndex = nNewIndex;
     541                 :          0 :         Invalidate();
     542         [ #  # ]:          0 :         if( nDelta )
     543                 :          0 :             Update();
     544                 :            :     }
     545         [ #  # ]:          0 :     else if( nNewIndex > LastInView() )
     546                 :            :     {
     547                 :            :         // need to scroll down to see selected item
     548                 :          0 :         int nOldPos = aVscrollSB.GetThumbPos();
     549                 :          0 :         int nDelta = (nNewIndex - LastInView() + COLUMN_COUNT) / COLUMN_COUNT;
     550                 :          0 :         aVscrollSB.SetThumbPos( nOldPos + nDelta );
     551         [ #  # ]:          0 :         if( nNewIndex < maFontCharMap.GetCharCount() )
     552                 :            :         {
     553                 :          0 :             nSelectedIndex = nNewIndex;
     554                 :          0 :             Invalidate();
     555                 :            :         }
     556         [ #  # ]:          0 :         if( nOldPos != aVscrollSB.GetThumbPos() )
     557                 :            :         {
     558                 :          0 :             Invalidate();
     559                 :          0 :             Update();
     560                 :            :         }
     561                 :            :     }
     562                 :            :     else
     563                 :            :     {
     564                 :            :         // remove highlighted view
     565                 :          0 :         Color aLineCol = GetLineColor();
     566                 :          0 :         Color aFillCol = GetFillColor();
     567         [ #  # ]:          0 :         SetLineColor();
     568 [ #  # ][ #  # ]:          0 :         SetFillColor( GetBackground().GetColor() );
     569                 :            : 
     570         [ #  # ]:          0 :         Point aOldPixel = MapIndexToPixel( nSelectedIndex );
     571                 :          0 :         aOldPixel.Move( +1, +1);
     572 [ #  # ][ #  # ]:          0 :         DrawRect( Rectangle( aOldPixel, Size( nX-1, nY-1 ) ) );
     573         [ #  # ]:          0 :         SetLineColor( aLineCol );
     574         [ #  # ]:          0 :         SetFillColor( aFillCol );
     575                 :            : 
     576                 :          0 :         int nOldIndex = nSelectedIndex;
     577                 :          0 :         nSelectedIndex = nNewIndex;
     578         [ #  # ]:          0 :         DrawChars_Impl( nOldIndex, nOldIndex );
     579         [ #  # ]:          0 :         DrawChars_Impl( nNewIndex, nNewIndex );
     580                 :            :     }
     581                 :            : 
     582         [ #  # ]:          0 :     if( nSelectedIndex >= 0 )
     583                 :            :     {
     584                 :          0 :         getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
     585         [ #  # ]:          0 :         if( m_pAccessible )
     586                 :            :         {
     587         [ #  # ]:          0 :             ::svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex);
     588 [ #  # ][ #  # ]:          0 :             m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
                 [ #  # ]
     589                 :            : 
     590                 :            :             OSL_ENSURE(pItem->m_pItem,"No accessible created!");
     591                 :          0 :             Any aOldAny, aNewAny;
     592         [ #  # ]:          0 :             aNewAny <<= AccessibleStateType::FOCUSED;
     593         [ #  # ]:          0 :             pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
     594                 :            : 
     595         [ #  # ]:          0 :             aNewAny <<= AccessibleStateType::SELECTED;
     596         [ #  # ]:          0 :             pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
     597                 :            :         }
     598                 :            :     }
     599                 :            : 
     600                 :            : 
     601                 :          0 :     aHighHdl.Call( this );
     602                 :          0 : }
     603                 :            : 
     604                 :            : // -----------------------------------------------------------------------
     605                 :            : 
     606                 :          0 : void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew, sal_Bool bFocus )
     607                 :            : {
     608                 :            :     // get next available char of current font
     609                 :          0 :     sal_UCS4 cNext = maFontCharMap.GetNextChar( cNew - 1 );
     610                 :            : 
     611                 :          0 :     int nMapIndex = maFontCharMap.GetIndexFromChar( cNext );
     612                 :          0 :     SelectIndex( nMapIndex, bFocus );
     613         [ #  # ]:          0 :     if( !bFocus )
     614                 :            :     {
     615                 :            :         // move selected item to top row if not in focus
     616                 :          0 :         aVscrollSB.SetThumbPos( nMapIndex / COLUMN_COUNT );
     617                 :          0 :         Invalidate();
     618                 :            :     }
     619                 :          0 : }
     620                 :            : 
     621                 :            : // -----------------------------------------------------------------------
     622                 :            : 
     623                 :          0 : IMPL_LINK_NOARG(SvxShowCharSet, VscrollHdl)
     624                 :            : {
     625         [ #  # ]:          0 :     if( nSelectedIndex < FirstInView() )
     626                 :            :     {
     627                 :          0 :         SelectIndex( FirstInView() + (nSelectedIndex % COLUMN_COUNT) );
     628                 :            :     }
     629         [ #  # ]:          0 :     else if( nSelectedIndex > LastInView() )
     630                 :            :     {
     631         [ #  # ]:          0 :         if( m_pAccessible )
     632                 :            :         {
     633                 :          0 :             ::com::sun::star::uno::Any aOldAny, aNewAny;
     634         [ #  # ]:          0 :             int nLast = LastInView();
     635         [ #  # ]:          0 :             for ( ; nLast != nSelectedIndex; ++nLast)
     636                 :            :             {
     637 [ #  # ][ #  # ]:          0 :                 aOldAny <<= ImplGetItem(nLast)->GetAccessible();
                 [ #  # ]
     638         [ #  # ]:          0 :                 m_pAccessible ->fireEvent( AccessibleEventId::CHILD, aOldAny, aNewAny );
     639                 :          0 :             }
     640                 :            :         }
     641                 :          0 :         SelectIndex( (LastInView() - COLUMN_COUNT + 1) + (nSelectedIndex % COLUMN_COUNT) );
     642                 :            :     }
     643                 :            : 
     644                 :          0 :     Invalidate();
     645                 :          0 :     return 0;
     646                 :            : }
     647                 :            : 
     648                 :            : // -----------------------------------------------------------------------
     649                 :            : 
     650 [ #  # ][ #  # ]:          0 : SvxShowCharSet::~SvxShowCharSet()
     651                 :            : {
     652         [ #  # ]:          0 :     if ( m_pAccessible )
     653         [ #  # ]:          0 :         ReleaseAccessible();
     654         [ #  # ]:          0 : }
     655                 :            : // -----------------------------------------------------------------------------
     656                 :          0 : void SvxShowCharSet::ReleaseAccessible()
     657                 :            : {
     658                 :          0 :     m_aItems.clear();
     659                 :          0 :     m_pAccessible = NULL;
     660                 :          0 :     m_xAccessible = NULL;
     661                 :          0 : }
     662                 :            : // -----------------------------------------------------------------------------
     663                 :          0 : ::com::sun::star::uno::Reference< XAccessible > SvxShowCharSet::CreateAccessible()
     664                 :            : {
     665                 :            :     OSL_ENSURE(!m_pAccessible,"Accessible already created!");
     666         [ #  # ]:          0 :     m_pAccessible = new ::svx::SvxShowCharSetVirtualAcc(this);
     667         [ #  # ]:          0 :     m_xAccessible = m_pAccessible;
     668                 :          0 :     return m_xAccessible;
     669                 :            : }
     670                 :            : // -----------------------------------------------------------------------------
     671                 :          0 : ::svx::SvxShowCharSetItem* SvxShowCharSet::ImplGetItem( int _nPos )
     672                 :            : {
     673         [ #  # ]:          0 :     ItemsMap::iterator aFind = m_aItems.find(_nPos);
     674         [ #  # ]:          0 :     if ( aFind == m_aItems.end() )
     675                 :            :     {
     676                 :            :         OSL_ENSURE(m_pAccessible,"Who wants to create a child of my table without a parent?");
     677                 :            :         boost::shared_ptr<svx::SvxShowCharSetItem> xItem(new svx::SvxShowCharSetItem(*this,
     678 [ #  # ][ #  # ]:          0 :             m_pAccessible->getTable(), sal::static_int_cast< sal_uInt16 >(_nPos)));
                 [ #  # ]
     679 [ #  # ][ #  # ]:          0 :         aFind = m_aItems.insert(ItemsMap::value_type(_nPos, xItem)).first;
                 [ #  # ]
     680                 :          0 :         rtl::OUStringBuffer buf;
     681 [ #  # ][ #  # ]:          0 :         buf.appendUtf32( maFontCharMap.GetCharFromIndex( _nPos ) );
     682 [ #  # ][ #  # ]:          0 :         aFind->second->maText = buf.makeStringAndClear();
     683         [ #  # ]:          0 :         Point pix = MapIndexToPixel( _nPos );
     684 [ #  # ][ #  # ]:          0 :         aFind->second->maRect = Rectangle( Point( pix.X() + 1, pix.Y() + 1 ), Size(nX-1,nY-1) );
     685                 :            :     }
     686                 :            : 
     687                 :          0 :     return aFind->second.get();
     688                 :            : }
     689                 :            : 
     690                 :            : // -----------------------------------------------------------------------------
     691                 :          0 : ScrollBar* SvxShowCharSet::getScrollBar()
     692                 :            : {
     693                 :          0 :     return &aVscrollSB;
     694                 :            : }
     695                 :            : // -----------------------------------------------------------------------
     696                 :          0 : sal_Int32 SvxShowCharSet::getMaxCharCount() const
     697                 :            : {
     698                 :          0 :     return maFontCharMap.GetCharCount();
     699                 :            : }
     700                 :            : 
     701                 :            : 
     702                 :            : // class SubsetMap =======================================================
     703                 :            : // TODO: should be moved into Font Attributes stuff
     704                 :            : // we let it mature here though because it is currently the only use
     705                 :            : 
     706                 :          0 : SubsetMap::SubsetMap( const FontCharMap* pFontCharMap )
     707 [ #  # ][ #  # ]:          0 : :   Resource( SVX_RES(RID_SUBSETMAP) )
     708                 :            : {
     709         [ #  # ]:          0 :     InitList();
     710         [ #  # ]:          0 :     ApplyCharMap( pFontCharMap );
     711         [ #  # ]:          0 :     FreeResource();
     712                 :          0 : }
     713                 :            : 
     714                 :          0 : const Subset* SubsetMap::GetNextSubset( bool bFirst ) const
     715                 :            : {
     716         [ #  # ]:          0 :     if( bFirst )
     717                 :          0 :         maSubsetIterator = maSubsets.begin();
     718         [ #  # ]:          0 :     if( maSubsetIterator == maSubsets.end() )
     719                 :          0 :         return NULL;
     720                 :          0 :     const Subset* s = &*(maSubsetIterator++);
     721                 :          0 :     return s;
     722                 :            : }
     723                 :            : 
     724                 :          0 : const Subset* SubsetMap::GetSubsetByUnicode( sal_UCS4 cChar ) const
     725                 :            : {
     726                 :            :     // TODO: is it worth to avoid a linear search?
     727         [ #  # ]:          0 :     for( const Subset* s = GetNextSubset( true ); s; s = GetNextSubset( false ) )
     728 [ #  # ][ #  # ]:          0 :         if( (s->GetRangeMin() <= cChar) && (cChar <= s->GetRangeMax()) )
                 [ #  # ]
     729                 :          0 :             return s;
     730                 :          0 :     return NULL;
     731                 :            : }
     732                 :            : 
     733                 :          0 : inline Subset::Subset( sal_UCS4 nMin, sal_UCS4 nMax, int resId)
     734         [ #  # ]:          0 : :   mnRangeMin(nMin), mnRangeMax(nMax), maRangeName( SVX_RES(resId) )
     735                 :          0 : {}
     736                 :            : 
     737                 :          0 : void SubsetMap::InitList()
     738                 :            : {
     739 [ #  # ][ #  # ]:          0 :     static SubsetList aAllSubsets;
         [ #  # ][ #  # ]
     740                 :            :     static bool bInit = true;
     741         [ #  # ]:          0 :     if( bInit )
     742                 :            :     {
     743                 :          0 :         bInit = false;
     744                 :            : 
     745                 :            :         // TODO: eventually merge or split unicode subranges
     746                 :            :         //       a "native writer" should decide for his subsets
     747         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0020, 0x007F, RID_SUBSETSTR_BASIC_LATIN ) );
     748         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0080, 0x00FF, RID_SUBSETSTR_LATIN_1 ) );
     749         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0100, 0x017F, RID_SUBSETSTR_LATIN_EXTENDED_A ) );
     750         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0180, 0x024F, RID_SUBSETSTR_LATIN_EXTENDED_B ) );
     751         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0250, 0x02AF, RID_SUBSETSTR_IPA_EXTENSIONS ) );
     752         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x02B0, 0x02FF, RID_SUBSETSTR_SPACING_MODIFIERS ) );
     753         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0300, 0x036F, RID_SUBSETSTR_COMB_DIACRITICAL ) );
     754         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0370, 0x03FF, RID_SUBSETSTR_BASIC_GREEK ) );
     755         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0400, 0x04FF, RID_SUBSETSTR_CYRILLIC ) );
     756         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0530, 0x058F, RID_SUBSETSTR_ARMENIAN ) );
     757         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0590, 0x05FF, RID_SUBSETSTR_BASIC_HEBREW ) );
     758         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0600, 0x065F, RID_SUBSETSTR_BASIC_ARABIC ) );
     759         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0660, 0x06FF, RID_SUBSETSTR_ARABIC_EXTENDED ) );
     760         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0700, 0x074F, RID_SUBSETSTR_SYRIAC ) );
     761         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0780, 0x07BF, RID_SUBSETSTR_THAANA ) );
     762         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0900, 0x097F, RID_SUBSETSTR_DEVANAGARI ) );
     763         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0980, 0x09FF, RID_SUBSETSTR_BENGALI ) );
     764         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0A00, 0x0A7F, RID_SUBSETSTR_GURMUKHI ) );
     765         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0A80, 0x0AFF, RID_SUBSETSTR_GUJARATI ) );
     766         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0B00, 0x0B7F, RID_SUBSETSTR_ORIYA ) );
     767         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0B80, 0x0BFF, RID_SUBSETSTR_TAMIL ) );
     768         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0C00, 0x0C7F, RID_SUBSETSTR_TELUGU ) );
     769         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0C80, 0x0CFF, RID_SUBSETSTR_KANNADA ) );
     770         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0D00, 0x0D7F, RID_SUBSETSTR_MALAYALAM ) );
     771         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0D80, 0x0DFF, RID_SUBSETSTR_SINHALA ) );
     772         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0E00, 0x0E7F, RID_SUBSETSTR_THAI ) );
     773         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0E80, 0x0EFF, RID_SUBSETSTR_LAO ) );
     774         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x0F00, 0x0FBF, RID_SUBSETSTR_TIBETAN ) );
     775         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1000, 0x109F, RID_SUBSETSTR_MYANMAR ) );
     776         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x10A0, 0x10FF, RID_SUBSETSTR_BASIC_GEORGIAN ) );
     777                 :            :     //  aAllSubsets.push_back( Subset( 0x10A0, 0x10C5, RID_SUBSETSTR_GEORGIAN_EXTENDED ) );
     778         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1100, 0x11FF, RID_SUBSETSTR_HANGUL_JAMO ) );
     779         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1200, 0x137F, RID_SUBSETSTR_ETHIOPIC ) );
     780         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x13A0, 0x13FF, RID_SUBSETSTR_CHEROKEE ) );
     781         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1400, 0x167F, RID_SUBSETSTR_CANADIAN_ABORIGINAL ) );
     782         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1680, 0x169F, RID_SUBSETSTR_OGHAM ) );
     783         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x16A0, 0x16F0, RID_SUBSETSTR_RUNIC ) );
     784         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1700, 0x171F, RID_SUBSETSTR_TAGALOG ) );
     785         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1720, 0x173F, RID_SUBSETSTR_HANUNOO ) );
     786         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1740, 0x175F, RID_SUBSETSTR_BUHID ) );
     787         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1760, 0x177F, RID_SUBSETSTR_TAGBANWA ) );
     788         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1780, 0x17FF, RID_SUBSETSTR_KHMER ) );
     789         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1800, 0x18AF, RID_SUBSETSTR_MONGOLIAN ) );
     790         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1E00, 0x1EFF, RID_SUBSETSTR_LATIN_EXTENDED_ADDS ) );
     791         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x1F00, 0x1FFF, RID_SUBSETSTR_GREEK_EXTENDED ) );
     792                 :            : 
     793         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2000, 0x206F, RID_SUBSETSTR_GENERAL_PUNCTUATION ) );
     794         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2070, 0x209F, RID_SUBSETSTR_SUB_SUPER_SCRIPTS ) );
     795         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x20A0, 0x20CF, RID_SUBSETSTR_CURRENCY_SYMBOLS ) );
     796         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x20D0, 0x20FF, RID_SUBSETSTR_COMB_DIACRITIC_SYMS ) );
     797         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2100, 0x214F, RID_SUBSETSTR_LETTERLIKE_SYMBOLS ) );
     798         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2150, 0x218F, RID_SUBSETSTR_NUMBER_FORMS ) );
     799         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2190, 0x21FF, RID_SUBSETSTR_ARROWS ) );
     800         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2200, 0x22FF, RID_SUBSETSTR_MATH_OPERATORS ) );
     801         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2300, 0x23FF, RID_SUBSETSTR_MISC_TECHNICAL ) );
     802         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2400, 0x243F, RID_SUBSETSTR_CONTROL_PICTURES ) );
     803         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2440, 0x245F, RID_SUBSETSTR_OPTICAL_CHAR_REC ) );
     804         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2460, 0x24FF, RID_SUBSETSTR_ENCLOSED_ALPHANUM ) );
     805         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2500, 0x257F, RID_SUBSETSTR_BOX_DRAWING ) );
     806         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2580, 0x259F, RID_SUBSETSTR_BLOCK_ELEMENTS ) );
     807         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x25A0, 0x25FF, RID_SUBSETSTR_GEOMETRIC_SHAPES ) );
     808         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2600, 0x26FF, RID_SUBSETSTR_MISC_DINGBATS ) );
     809         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2700, 0x27BF, RID_SUBSETSTR_DINGBATS ) );
     810                 :            : 
     811         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x27C0, 0x27FF, RID_SUBSETSTR_MISC_MATH_SYMS_A ) );
     812         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x27F0, 0x27FF, RID_SUBSETSTR_SUPPL_ARROWS_A ) );
     813         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2800, 0x28FF, RID_SUBSETSTR_BRAILLE_PATTERNS ) );
     814         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2900, 0x297F, RID_SUBSETSTR_SUPPL_ARROWS_B ) );
     815         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2980, 0x29FF, RID_SUBSETSTR_MISC_MATH_SYMS_B ) );
     816         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2E80, 0x2EFF, RID_SUBSETSTR_CJK_RADICAL_SUPPL ) );
     817         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2F00, 0x2FDF, RID_SUBSETSTR_KANGXI_RADICALS ) );
     818         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x2FF0, 0x2FFF, RID_SUBSETSTR_IDEO_DESC_CHARS ) );
     819                 :            : 
     820         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x3000, 0x303F, RID_SUBSETSTR_CJK_SYMS_PUNCTUATION ) );
     821         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x3040, 0x309F, RID_SUBSETSTR_HIRAGANA ) );
     822         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x30A0, 0x30FF, RID_SUBSETSTR_KATAKANA ) );
     823         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x3100, 0x312F, RID_SUBSETSTR_BOPOMOFO ) );
     824         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x3130, 0x318F, RID_SUBSETSTR_HANGUL_COMPAT_JAMO ) );
     825         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x3190, 0x319F, RID_SUBSETSTR_KANBUN ) );
     826         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x31A0, 0x31BF, RID_SUBSETSTR_BOPOMOFO_EXTENDED ) );
     827         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x31C0, 0x31FF, RID_SUBSETSTR_KATAKANA_PHONETIC ) );
     828         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x3200, 0x32FF, RID_SUBSETSTR_ENCLOSED_CJK_LETTERS ) );
     829         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x3300, 0x33FF, RID_SUBSETSTR_CJK_COMPATIBILITY ) );
     830                 :            : 
     831         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x3400, 0x4DFF, RID_SUBSETSTR_CJK_EXT_A_UNIFIED_IDGRAPH ) );
     832         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0x4E00, 0x9FA5, RID_SUBSETSTR_CJK_UNIFIED_IDGRAPH ) );
     833         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xA000, 0xA4CF, RID_SUBSETSTR_YI ) );
     834         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xAC00, 0xB097, RID_SUBSETSTR_HANGUL_GA ) );
     835         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xB098, 0xB2E3, RID_SUBSETSTR_HANGUL_NA ) );
     836         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xB2E4, 0xB77B, RID_SUBSETSTR_HANGUL_DA ) );
     837         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xB77C, 0xB9C7, RID_SUBSETSTR_HANGUL_RA ) );
     838         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xB9C8, 0xBC13, RID_SUBSETSTR_HANGUL_MA ) );
     839         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xBC14, 0xC0AB, RID_SUBSETSTR_HANGUL_BA ) );
     840         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xC0AC, 0xC543, RID_SUBSETSTR_HANGUL_SA ) );
     841         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xC544, 0xC78F, RID_SUBSETSTR_HANGUL_AH ) );
     842         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xC790, 0xCC27, RID_SUBSETSTR_HANGUL_JA ) );
     843         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xCC28, 0xCE73, RID_SUBSETSTR_HANGUL_CHA ) );
     844         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xCE74, 0xD0BF, RID_SUBSETSTR_HANGUL_KA ) );
     845         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xD0C0, 0xD30B, RID_SUBSETSTR_HANGUL_TA ) );
     846         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xD30C, 0xD557, RID_SUBSETSTR_HANGUL_PA ) );
     847         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xD558, 0xD7A3, RID_SUBSETSTR_HANGUL_HA ) );
     848                 :            :     //  aAllSubsets.push_back( Subset( 0xAC00, 0xD7AF, RID_SUBSETSTR_HANGUL ) );
     849                 :            : 
     850                 :            :     //  aAllSubsets.push_back( Subset( 0xD800, 0xDFFF, RID_SUBSETSTR_SURROGATE ) );
     851         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xE000, 0xF8FF, RID_SUBSETSTR_PRIVATE_USE_AREA ) );
     852         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xF900, 0xFAFF, RID_SUBSETSTR_CJK_COMPAT_IDGRAPHS ) );
     853         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xFB00, 0xFB4F, RID_SUBSETSTR_ALPHA_PRESENTATION ) );
     854         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xFB50, 0xFDFF, RID_SUBSETSTR_ARABIC_PRESENT_A ) );
     855         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xFE20, 0xFE2F, RID_SUBSETSTR_COMBINING_HALF_MARKS ) );
     856         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xFE30, 0xFE4F, RID_SUBSETSTR_CJK_COMPAT_FORMS ) );
     857         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xFE50, 0xFE6F, RID_SUBSETSTR_SMALL_FORM_VARIANTS ) );
     858         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xFE70, 0xFEFF, RID_SUBSETSTR_ARABIC_PRESENT_B ) );
     859         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xFF00, 0xFFEF, RID_SUBSETSTR_HALFW_FULLW_FORMS ) );
     860         [ #  # ]:          0 :         aAllSubsets.push_back( Subset( 0xFFF0, 0xFFFF, RID_SUBSETSTR_SPECIALS ) );
     861                 :            :     }
     862                 :            : 
     863                 :          0 :     maSubsets = aAllSubsets;
     864                 :          0 : }
     865                 :            : 
     866                 :          0 : void SubsetMap::ApplyCharMap( const FontCharMap* pFontCharMap )
     867                 :            : {
     868         [ #  # ]:          0 :     if( !pFontCharMap )
     869                 :          0 :         return;
     870                 :            : 
     871                 :            :     // remove subsets that are not matched in any range
     872                 :          0 :     SubsetList::iterator it_next = maSubsets.begin();
     873         [ #  # ]:          0 :     while( it_next != maSubsets.end() )
     874                 :            :     {
     875                 :          0 :         SubsetList::iterator it = it_next++;
     876                 :          0 :         const Subset& rSubset = *it;
     877                 :          0 :         sal_uInt32 cMin = rSubset.GetRangeMin();
     878                 :          0 :         sal_uInt32 cMax = rSubset.GetRangeMax();
     879                 :            : 
     880         [ #  # ]:          0 :         int nCount =  pFontCharMap->CountCharsInRange( cMin, cMax );
     881         [ #  # ]:          0 :         if( nCount <= 0 )
     882         [ #  # ]:          0 :             maSubsets.erase( it );
     883                 :            :     }
     884                 :            : }
     885                 :            : 
     886                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10