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