Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / dialog / charmap.cxx
blob656c50c28fe278657d50324dc796dfafbdfe81a6
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 <vcl/settings.hxx>
24 #include <svtools/colorcfg.hxx>
26 #include <rtl/textenc.h>
27 #include <svx/ucsubset.hxx>
29 #include <svx/dialogs.hrc>
31 #include <svx/charmap.hxx>
32 #include <svx/dialmgr.hxx>
33 #include <svx/svxdlg.hxx>
35 #include "charmapacc.hxx"
36 #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
37 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
38 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
39 #include <comphelper/types.hxx>
40 #include <svl/itemset.hxx>
41 #include <unicode/uchar.h>
43 #include "rtl/ustrbuf.hxx"
45 using namespace ::com::sun::star::accessibility;
46 using namespace ::com::sun::star::uno;
47 using namespace ::com::sun::star;
50 sal_uInt32& SvxShowCharSet::getSelectedChar()
52 static sal_uInt32 cSelectedChar = ' '; // keeps selected character over app livetime
53 return cSelectedChar;
56 // class SvxShowCharSet ==================================================
58 SvxShowCharSet::SvxShowCharSet(Window* pParent)
59 : Control(pParent, WB_TABSTOP | WB_BORDER)
60 , m_pAccessible(NULL)
61 , aVscrollSB( this, WB_VERT)
63 init();
64 InitSettings( true, true );
67 void SvxShowCharSet::init()
69 nSelectedIndex = -1; // TODO: move into init list when it is no longer static
70 m_nXGap = 0;
71 m_nYGap = 0;
73 SetStyle( GetStyle() | WB_CLIPCHILDREN );
74 aVscrollSB.SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) );
75 aVscrollSB.EnableDrag( true );
76 // other settings like aVscroll depend on selected font => see SetFont
78 bDrag = false;
81 void SvxShowCharSet::Resize()
83 Control::Resize();
84 SetFont(GetFont()); //force recalculation of correct fontsize
87 extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxShowCharSet(Window *pParent, VclBuilder::stringmap &)
89 return new SvxShowCharSet(pParent);
94 void SvxShowCharSet::GetFocus()
96 Control::GetFocus();
97 SelectIndex( nSelectedIndex, true );
102 void SvxShowCharSet::LoseFocus()
104 Control::LoseFocus();
105 SelectIndex( nSelectedIndex, false );
110 void SvxShowCharSet::StateChanged( StateChangedType nType )
112 if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
113 InitSettings( true, false );
114 else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
115 InitSettings( false, true );
117 Control::StateChanged( nType );
122 void SvxShowCharSet::DataChanged( const DataChangedEvent& rDCEvt )
124 if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS )
125 && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
126 InitSettings( true, true );
127 else
128 Control::DataChanged( rDCEvt );
133 void SvxShowCharSet::MouseButtonDown( const MouseEvent& rMEvt )
135 if ( rMEvt.IsLeft() )
137 if ( rMEvt.GetClicks() == 1 )
139 GrabFocus();
140 bDrag = true;
141 CaptureMouse();
143 int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() );
144 // Fire the focus event
145 SelectIndex( nIndex, true);
148 if ( !(rMEvt.GetClicks() % 2) )
149 aDoubleClkHdl.Call( this );
155 void SvxShowCharSet::MouseButtonUp( const MouseEvent& rMEvt )
157 if ( bDrag && rMEvt.IsLeft() )
159 // released mouse over character map
160 if ( Rectangle(Point(), GetOutputSize()).IsInside(rMEvt.GetPosPixel()))
161 aSelectHdl.Call( this );
162 ReleaseMouse();
163 bDrag = false;
169 void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt )
171 if ( rMEvt.IsLeft() && bDrag )
173 Point aPos = rMEvt.GetPosPixel();
174 Size aSize = GetSizePixel();
176 if ( aPos.X() < 0 )
177 aPos.X() = 0;
178 else if ( aPos.X() > aSize.Width()-5 )
179 aPos.X() = aSize.Width()-5;
180 if ( aPos.Y() < 0 )
181 aPos.Y() = 0;
182 else if ( aPos.Y() > aSize.Height()-5 )
183 aPos.Y() = aSize.Height()-5;
185 int nIndex = PixelToMapIndex( aPos );
186 // Fire the focus event.
187 SelectIndex( nIndex, true );
193 void SvxShowCharSet::Command( const CommandEvent& rCEvt )
195 if( !HandleScrollCommand( rCEvt, 0, &aVscrollSB ) )
196 Control::Command( rCEvt );
201 sal_uInt16 SvxShowCharSet::GetRowPos(sal_uInt16 _nPos) const
203 return _nPos / COLUMN_COUNT ;
208 sal_uInt16 SvxShowCharSet::GetColumnPos(sal_uInt16 _nPos) const
210 return _nPos % COLUMN_COUNT ;
215 int SvxShowCharSet::FirstInView( void ) const
217 int nIndex = 0;
218 if( aVscrollSB.IsVisible() )
219 nIndex += aVscrollSB.GetThumbPos() * COLUMN_COUNT;
220 return nIndex;
225 int SvxShowCharSet::LastInView( void ) const
227 sal_uIntPtr nIndex = FirstInView();
228 nIndex += ROW_COUNT * COLUMN_COUNT - 1;
229 sal_uIntPtr nCompare = sal::static_int_cast<sal_uIntPtr>( maFontCharMap.GetCharCount() - 1 );
230 if( nIndex > nCompare )
231 nIndex = nCompare;
232 return nIndex;
237 inline Point SvxShowCharSet::MapIndexToPixel( int nIndex ) const
239 const int nBase = FirstInView();
240 int x = ((nIndex - nBase) % COLUMN_COUNT) * nX;
241 int y = ((nIndex - nBase) / COLUMN_COUNT) * nY;
242 return Point( x + m_nXGap, y + m_nYGap );
246 int SvxShowCharSet::PixelToMapIndex( const Point& point) const
248 int nBase = FirstInView();
249 return (nBase + ((point.X() - m_nXGap)/nX) + ((point.Y() - m_nYGap)/nY) * COLUMN_COUNT);
254 void SvxShowCharSet::KeyInput( const KeyEvent& rKEvt )
256 KeyCode aCode = rKEvt.GetKeyCode();
258 if( aCode.GetModifier() )
260 Control::KeyInput( rKEvt );
261 return;
264 int tmpSelected = nSelectedIndex;
266 switch ( aCode.GetCode() )
268 case KEY_SPACE:
269 aSelectHdl.Call( this );
270 break;
271 case KEY_LEFT:
272 --tmpSelected;
273 break;
274 case KEY_RIGHT:
275 ++tmpSelected;
276 break;
277 case KEY_UP:
278 tmpSelected -= COLUMN_COUNT;
279 break;
280 case KEY_DOWN:
281 tmpSelected += COLUMN_COUNT;
282 break;
283 case KEY_PAGEUP:
284 tmpSelected -= ROW_COUNT * COLUMN_COUNT;
285 break;
286 case KEY_PAGEDOWN:
287 tmpSelected += ROW_COUNT * COLUMN_COUNT;
288 break;
289 case KEY_HOME:
290 tmpSelected = 0;
291 break;
292 case KEY_END:
293 tmpSelected = maFontCharMap.GetCharCount() - 1;
294 break;
295 case KEY_TAB: // some fonts have a character at these unicode control codes
296 case KEY_ESCAPE:
297 case KEY_RETURN:
298 Control::KeyInput( rKEvt );
299 tmpSelected = - 1; // mark as invalid
300 break;
301 default:
303 sal_UCS4 cChar = rKEvt.GetCharCode();
304 sal_UCS4 cNext = maFontCharMap.GetNextChar( cChar - 1 );
305 tmpSelected = maFontCharMap.GetIndexFromChar( cNext );
306 if( tmpSelected < 0 || (cChar != cNext) )
308 Control::KeyInput( rKEvt );
309 tmpSelected = - 1; // mark as invalid
314 if ( tmpSelected >= 0 )
316 SelectIndex( tmpSelected, true );
317 aPreSelectHdl.Call( this );
323 void SvxShowCharSet::Paint( const Rectangle& )
325 DrawChars_Impl( FirstInView(), LastInView() );
328 void SvxShowCharSet::DeSelect()
330 DrawChars_Impl(nSelectedIndex,nSelectedIndex);
333 // stretch a grid rectangle if its at the edge to fill unused space
334 Rectangle SvxShowCharSet::getGridRectangle(const Point &rPointUL, const Size &rOutputSize)
336 long x = rPointUL.X() - 1;
337 long y = rPointUL.Y() - 1;
338 Point aPointUL(x+1, y+1);
339 Size aGridSize(nX-1, nY-1);
341 long nXDistFromLeft = x - m_nXGap;
342 if (nXDistFromLeft <= 1)
344 aPointUL.X() = 1;
345 aGridSize.Width() += m_nXGap + nXDistFromLeft;
347 long nXDistFromRight = rOutputSize.Width() - m_nXGap - nX - x;
348 if (nXDistFromRight <= 1)
349 aGridSize.Width() += m_nXGap + nXDistFromRight;
351 long nXDistFromTop = y - m_nYGap;
352 if (nXDistFromTop <= 1)
354 aPointUL.Y() = 1;
355 aGridSize.Height() += m_nYGap + nXDistFromTop;
357 long nXDistFromBottom = rOutputSize.Height() - m_nYGap - nY - y;
358 if (nXDistFromBottom <= 1)
359 aGridSize.Height() += m_nYGap + nXDistFromBottom;
361 return Rectangle(aPointUL, aGridSize);
364 void SvxShowCharSet::DrawChars_Impl( int n1, int n2 )
366 if( n1 > LastInView() || n2 < FirstInView() )
367 return;
369 Size aOutputSize = GetOutputSizePixel();
370 if (aVscrollSB.IsVisible())
371 aOutputSize.Width() -= aVscrollSB.GetOptimalSize().Width();
373 int i;
374 for ( i = 1; i < COLUMN_COUNT; ++i )
375 DrawLine( Point( nX * i + m_nXGap, 0 ), Point( nX * i + m_nXGap, aOutputSize.Height() ) );
376 for ( i = 1; i < ROW_COUNT; ++i )
377 DrawLine( Point( 0, nY * i + m_nYGap ), Point( aOutputSize.Width(), nY * i + m_nYGap) );
379 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
380 const Color aWindowTextColor( rStyleSettings.GetFieldTextColor() );
381 Color aHighlightColor( rStyleSettings.GetHighlightColor() );
382 Color aHighlightTextColor( rStyleSettings.GetHighlightTextColor() );
383 Color aFaceColor( rStyleSettings.GetFaceColor() );
384 Color aLightColor( rStyleSettings.GetLightColor() );
385 Color aShadowColor( rStyleSettings.GetShadowColor() );
387 int nTextHeight = GetTextHeight();
388 Rectangle aBoundRect;
389 for( i = n1; i <= n2; ++i )
391 Point pix = MapIndexToPixel( i );
392 int x = pix.X();
393 int y = pix.Y();
395 OUStringBuffer buf;
396 buf.appendUtf32( maFontCharMap.GetCharFromIndex( i ) );
397 OUString aCharStr(buf.makeStringAndClear());
398 int nTextWidth = GetTextWidth(aCharStr);
399 int tx = x + (nX - nTextWidth + 1) / 2;
400 int ty = y + (nY - nTextHeight + 1) / 2;
401 Point aPointTxTy( tx, ty );
403 // adjust position before it gets out of bounds
404 if( GetTextBoundRect( aBoundRect, aCharStr ) && !aBoundRect.IsEmpty() )
406 // zero advance width => use ink width to center glyph
407 if( !nTextWidth )
409 aPointTxTy.X() = x - aBoundRect.Left()
410 + (nX - aBoundRect.GetWidth() + 1) / 2;
413 aBoundRect += aPointTxTy;
415 // shift back vertically if needed
416 int nYLDelta = aBoundRect.Top() - y;
417 int nYHDelta = (y + nY) - aBoundRect.Bottom();
418 if( nYLDelta <= 0 )
419 aPointTxTy.Y() -= nYLDelta - 1;
420 else if( nYHDelta <= 0 )
421 aPointTxTy.Y() += nYHDelta - 1;
423 // shift back horizontally if needed
424 int nXLDelta = aBoundRect.Left() - x;
425 int nXHDelta = (x + nX) - aBoundRect.Right();
426 if( nXLDelta <= 0 )
427 aPointTxTy.X() -= nXLDelta - 1;
428 else if( nXHDelta <= 0 )
429 aPointTxTy.X() += nXHDelta - 1;
432 Color aTextCol = GetTextColor();
433 if ( i != nSelectedIndex )
435 SetTextColor( aWindowTextColor );
436 DrawText( aPointTxTy, aCharStr );
438 else
440 Color aLineCol = GetLineColor();
441 Color aFillCol = GetFillColor();
442 SetLineColor();
443 Point aPointUL( x + 1, y + 1 );
444 if( HasFocus() )
446 SetFillColor( aHighlightColor );
447 DrawRect( getGridRectangle(aPointUL, aOutputSize) );
449 SetTextColor( aHighlightTextColor );
450 DrawText( aPointTxTy, aCharStr );
452 else
454 SetFillColor( aFaceColor );
455 DrawRect( getGridRectangle(aPointUL, aOutputSize) );
457 SetLineColor( aLightColor );
458 DrawLine( aPointUL, Point( x+nX-1, y+1) );
459 DrawLine( aPointUL, Point( x+1, y+nY-1) );
461 SetLineColor( aShadowColor );
462 DrawLine( Point( x+1, y+nY-1), Point( x+nX-1, y+nY-1) );
463 DrawLine( Point( x+nX-1, y+nY-1), Point( x+nX-1, y+1) );
465 DrawText( aPointTxTy, aCharStr );
467 SetLineColor( aLineCol );
468 SetFillColor( aFillCol );
470 SetTextColor( aTextCol );
476 void SvxShowCharSet::InitSettings( bool bForeground, bool bBackground )
478 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
480 if ( bForeground )
482 Color aTextColor( rStyleSettings.GetDialogTextColor() );
484 if ( IsControlForeground() )
485 aTextColor = GetControlForeground();
486 SetTextColor( aTextColor );
489 if ( bBackground )
491 if ( IsControlBackground() )
492 SetBackground( GetControlBackground() );
493 else
494 SetBackground( rStyleSettings.GetWindowColor() );
497 Invalidate();
502 sal_UCS4 SvxShowCharSet::GetSelectCharacter() const
504 if( nSelectedIndex >= 0 )
505 getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
506 return getSelectedChar();
511 void SvxShowCharSet::SetFont( const Font& rFont )
513 // save last selected unicode
514 if( nSelectedIndex >= 0 )
515 getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
517 Size aSize = GetOutputSizePixel();
518 long nSBWidth = aVscrollSB.GetOptimalSize().Width();
519 aSize.Width() -= nSBWidth;
521 Font aFont = rFont;
522 aFont.SetWeight( WEIGHT_LIGHT );
523 aFont.SetAlign( ALIGN_TOP );
524 int nFontHeight = (aSize.Height() - 5) * 2 / (3 * ROW_COUNT);
525 aFont.SetSize( PixelToLogic( Size( 0, nFontHeight ) ) );
526 aFont.SetTransparent( true );
527 Control::SetFont( aFont );
528 GetFontCharMap( maFontCharMap );
530 nX = aSize.Width() / COLUMN_COUNT;
531 nY = aSize.Height() / ROW_COUNT;
533 aVscrollSB.setPosSizePixel( aSize.Width(), 0, nSBWidth, aSize.Height() );
534 aVscrollSB.SetRangeMin( 0 );
535 int nLastRow = (maFontCharMap.GetCharCount() - 1 + COLUMN_COUNT) / COLUMN_COUNT;
536 aVscrollSB.SetRangeMax( nLastRow );
537 aVscrollSB.SetPageSize( ROW_COUNT-1 );
538 aVscrollSB.SetVisibleSize( ROW_COUNT );
540 // restore last selected unicode
541 int nMapIndex = maFontCharMap.GetIndexFromChar( getSelectedChar() );
542 SelectIndex( nMapIndex );
544 aVscrollSB.Show();
546 // rearrange CharSet element in sync with nX- and nY-multiples
547 Size aDrawSize(nX * COLUMN_COUNT, nY * ROW_COUNT);
548 m_nXGap = (aSize.Width() - aDrawSize.Width()) / 2;
549 m_nYGap = (aSize.Height() - aDrawSize.Height()) / 2;
551 Invalidate();
556 void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
558 if( nNewIndex < 0 )
560 // need to scroll see closest unicode
561 sal_uInt32 cPrev = maFontCharMap.GetPrevChar( getSelectedChar() );
562 int nMapIndex = maFontCharMap.GetIndexFromChar( cPrev );
563 int nNewPos = nMapIndex / COLUMN_COUNT;
564 aVscrollSB.SetThumbPos( nNewPos );
565 nSelectedIndex = bFocus ? nMapIndex+1 : -1;
566 Invalidate();
567 Update();
569 else if( nNewIndex < FirstInView() )
571 // need to scroll up to see selected item
572 int nOldPos = aVscrollSB.GetThumbPos();
573 int nDelta = (FirstInView() - nNewIndex + COLUMN_COUNT-1) / COLUMN_COUNT;
574 aVscrollSB.SetThumbPos( nOldPos - nDelta );
575 nSelectedIndex = nNewIndex;
576 Invalidate();
577 if( nDelta )
578 Update();
580 else if( nNewIndex > LastInView() )
582 // need to scroll down to see selected item
583 int nOldPos = aVscrollSB.GetThumbPos();
584 int nDelta = (nNewIndex - LastInView() + COLUMN_COUNT) / COLUMN_COUNT;
585 aVscrollSB.SetThumbPos( nOldPos + nDelta );
586 if( nNewIndex < maFontCharMap.GetCharCount() )
588 nSelectedIndex = nNewIndex;
589 Invalidate();
591 if( nOldPos != aVscrollSB.GetThumbPos() )
593 Invalidate();
594 Update();
597 else
599 // remove highlighted view
600 Color aLineCol = GetLineColor();
601 Color aFillCol = GetFillColor();
602 SetLineColor();
603 SetFillColor( GetBackground().GetColor() );
605 Point aOldPixel = MapIndexToPixel( nSelectedIndex );
606 aOldPixel.Move( +1, +1);
607 Size aOutputSize = GetOutputSizePixel();
608 if (aVscrollSB.IsVisible())
609 aOutputSize.Width() -= aVscrollSB.GetOptimalSize().Width();
610 DrawRect( getGridRectangle(aOldPixel, aOutputSize) );
611 SetLineColor( aLineCol );
612 SetFillColor( aFillCol );
614 int nOldIndex = nSelectedIndex;
615 nSelectedIndex = nNewIndex;
616 DrawChars_Impl( nOldIndex, nOldIndex );
617 DrawChars_Impl( nNewIndex, nNewIndex );
620 if( nSelectedIndex >= 0 )
622 getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
623 if( m_pAccessible )
625 ::svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex);
626 // Don't fire the focus event.
627 if ( bFocus )
628 m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
629 else
630 m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
632 OSL_ENSURE(pItem->m_pItem,"No accessible created!");
633 Any aOldAny, aNewAny;
634 aNewAny <<= AccessibleStateType::FOCUSED;
635 // Don't fire the focus event.
636 if ( bFocus )
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 );
650 void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew, 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();
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;
694 SvxShowCharSet::~SvxShowCharSet()
696 if ( m_pAccessible )
697 ReleaseAccessible();
700 void SvxShowCharSet::ReleaseAccessible()
702 m_aItems.clear();
703 m_pAccessible = NULL;
704 m_xAccessible = NULL;
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;
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();
735 ScrollBar* SvxShowCharSet::getScrollBar()
737 return &aVscrollSB;
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_RESSTR(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_ODIA ) );
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 #if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 4)
1306 case UBLOCK_SAMARITAN:
1307 aAllSubsets.push_back( Subset( 0x0800, 0x083F, RID_SUBSETSTR_SAMARITAN ) );
1308 break;
1309 case UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED:
1310 aAllSubsets.push_back( Subset( 0x18B0, 0x18FF, RID_SUBSETSTR_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED ) );
1311 break;
1312 case UBLOCK_TAI_THAM:
1313 aAllSubsets.push_back( Subset( 0x1A20, 0x1AAF, RID_SUBSETSTR_TAI_THAM ) );
1314 break;
1315 case UBLOCK_VEDIC_EXTENSIONS:
1316 aAllSubsets.push_back( Subset( 0x1CD0, 0x1CFF, RID_SUBSETSTR_VEDIC_EXTENSIONS ) );
1317 break;
1318 case UBLOCK_LISU:
1319 aAllSubsets.push_back( Subset( 0xA4D0, 0xA4FF, RID_SUBSETSTR_LISU ) );
1320 break;
1321 case UBLOCK_BAMUM:
1322 aAllSubsets.push_back( Subset( 0xA6A0, 0xA6FF, RID_SUBSETSTR_BAMUM ) );
1323 break;
1324 case UBLOCK_COMMON_INDIC_NUMBER_FORMS:
1325 aAllSubsets.push_back( Subset( 0xA830, 0xA83F, RID_SUBSETSTR_COMMON_INDIC_NUMBER_FORMS ) );
1326 break;
1327 case UBLOCK_DEVANAGARI_EXTENDED:
1328 aAllSubsets.push_back( Subset( 0xA8E0, 0xA8FF, RID_SUBSETSTR_DEVANAGARI_EXTENDED ) );
1329 break;
1330 case UBLOCK_HANGUL_JAMO_EXTENDED_A:
1331 aAllSubsets.push_back( Subset( 0xA960, 0xA97F, RID_SUBSETSTR_HANGUL_JAMO_EXTENDED_A ) );
1332 break;
1333 case UBLOCK_JAVANESE:
1334 aAllSubsets.push_back( Subset( 0xA980, 0xA9DF, RID_SUBSETSTR_JAVANESE ) );
1335 break;
1336 case UBLOCK_MYANMAR_EXTENDED_A:
1337 aAllSubsets.push_back( Subset( 0xAA60, 0xAA7F, RID_SUBSETSTR_MYANMAR_EXTENDED_A ) );
1338 break;
1339 case UBLOCK_TAI_VIET:
1340 aAllSubsets.push_back( Subset( 0xAA80, 0xAADF, RID_SUBSETSTR_TAI_VIET ) );
1341 break;
1342 case UBLOCK_MEETEI_MAYEK:
1343 aAllSubsets.push_back( Subset( 0xABC0, 0xABFF, RID_SUBSETSTR_MEETEI_MAYEK ) );
1344 break;
1345 case UBLOCK_HANGUL_JAMO_EXTENDED_B:
1346 aAllSubsets.push_back( Subset( 0xD7B0, 0xD7FF, RID_SUBSETSTR_HANGUL_JAMO_EXTENDED_B ) );
1347 break;
1348 case UBLOCK_IMPERIAL_ARAMAIC:
1349 aAllSubsets.push_back( Subset( 0x10840, 0x1085F, RID_SUBSETSTR_IMPERIAL_ARAMAIC ) );
1350 break;
1351 case UBLOCK_OLD_SOUTH_ARABIAN:
1352 aAllSubsets.push_back( Subset( 0x10A60, 0x10A7F, RID_SUBSETSTR_OLD_SOUTH_ARABIAN ) );
1353 break;
1354 case UBLOCK_AVESTAN:
1355 aAllSubsets.push_back( Subset( 0x10B00, 0x10B3F, RID_SUBSETSTR_AVESTAN ) );
1356 break;
1357 case UBLOCK_INSCRIPTIONAL_PARTHIAN:
1358 aAllSubsets.push_back( Subset( 0x10B40, 0x10B5F, RID_SUBSETSTR_INSCRIPTIONAL_PARTHIAN ) );
1359 break;
1360 case UBLOCK_INSCRIPTIONAL_PAHLAVI:
1361 aAllSubsets.push_back( Subset( 0x10B60, 0x10B7F, RID_SUBSETSTR_INSCRIPTIONAL_PAHLAVI ) );
1362 break;
1363 case UBLOCK_OLD_TURKIC:
1364 aAllSubsets.push_back( Subset( 0x10C00, 0x10C4F, RID_SUBSETSTR_OLD_TURKIC ) );
1365 break;
1366 case UBLOCK_RUMI_NUMERAL_SYMBOLS:
1367 aAllSubsets.push_back( Subset( 0x10E60, 0x10E7F, RID_SUBSETSTR_RUMI_NUMERAL_SYMBOLS ) );
1368 break;
1369 case UBLOCK_KAITHI:
1370 aAllSubsets.push_back( Subset( 0x11080, 0x110CF, RID_SUBSETSTR_KAITHI ) );
1371 break;
1372 case UBLOCK_EGYPTIAN_HIEROGLYPHS:
1373 aAllSubsets.push_back( Subset( 0x13000, 0x1342F, RID_SUBSETSTR_EGYPTIAN_HIEROGLYPHS ) );
1374 break;
1375 case UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT:
1376 aAllSubsets.push_back( Subset( 0x1F100, 0x1F1FF, RID_SUBSETSTR_ENCLOSED_ALPHANUMERIC_SUPPLEMENT ) );
1377 break;
1378 case UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT:
1379 aAllSubsets.push_back( Subset( 0x1F200, 0x1F2FF, RID_SUBSETSTR_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT ) );
1380 break;
1381 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C:
1382 aAllSubsets.push_back( Subset( 0x2A700, 0x2B73F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C ) );
1383 break;
1384 #endif
1385 #if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 6)
1386 case UBLOCK_MANDAIC:
1387 aAllSubsets.push_back( Subset( 0x0840, 0x085F, RID_SUBSETSTR_MANDAIC ) );
1388 break;
1389 case UBLOCK_BATAK:
1390 aAllSubsets.push_back( Subset( 0x1BC0, 0x1BFF, RID_SUBSETSTR_BATAK ) );
1391 break;
1392 case UBLOCK_ETHIOPIC_EXTENDED_A:
1393 aAllSubsets.push_back( Subset( 0xAB00, 0xAB2F, RID_SUBSETSTR_ETHIOPIC_EXTENDED_A ) );
1394 break;
1395 case UBLOCK_BRAHMI:
1396 aAllSubsets.push_back( Subset( 0x11000, 0x1107F, RID_SUBSETSTR_BRAHMI ) );
1397 break;
1398 case UBLOCK_BAMUM_SUPPLEMENT:
1399 aAllSubsets.push_back( Subset( 0x16800, 0x16A3F, RID_SUBSETSTR_BAMUM_SUPPLEMENT ) );
1400 break;
1401 case UBLOCK_KANA_SUPPLEMENT:
1402 aAllSubsets.push_back( Subset( 0x1B000, 0x1B0FF, RID_SUBSETSTR_KANA_SUPPLEMENT ) );
1403 break;
1404 case UBLOCK_PLAYING_CARDS:
1405 aAllSubsets.push_back( Subset( 0x1F0A0, 0x1F0FF, RID_SUBSETSTR_PLAYING_CARDS ) );
1406 break;
1407 case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS:
1408 aAllSubsets.push_back( Subset( 0x1F300, 0x1F5FF, RID_SUBSETSTR_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS ) );
1409 break;
1410 case UBLOCK_EMOTICONS:
1411 aAllSubsets.push_back( Subset( 0x1F600, 0x1F64F, RID_SUBSETSTR_EMOTICONS ) );
1412 break;
1413 case UBLOCK_TRANSPORT_AND_MAP_SYMBOLS:
1414 aAllSubsets.push_back( Subset( 0x1F680, 0x1F6FF, RID_SUBSETSTR_TRANSPORT_AND_MAP_SYMBOLS ) );
1415 break;
1416 case UBLOCK_ALCHEMICAL_SYMBOLS:
1417 aAllSubsets.push_back( Subset( 0x1F700, 0x1F77F, RID_SUBSETSTR_ALCHEMICAL_SYMBOLS ) );
1418 break;
1419 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D:
1420 aAllSubsets.push_back( Subset( 0x2B740, 0x2B81F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D ) );
1421 break;
1422 #endif
1423 // Note ICU version 49 (NOT 4.9), so the MAJOR_NUM is two digits.
1424 #if U_ICU_VERSION_MAJOR_NUM >= 49
1425 case UBLOCK_ARABIC_EXTENDED_A:
1426 aAllSubsets.push_back( Subset( 0x08A0, 0x08FF, RID_SUBSETSTR_ARABIC_EXTENDED_A ) );
1427 break;
1428 case UBLOCK_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS:
1429 aAllSubsets.push_back( Subset( 0x1EE00, 0x1EEFF, RID_SUBSETSTR_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS ) );
1430 break;
1431 case UBLOCK_CHAKMA:
1432 aAllSubsets.push_back( Subset( 0x11100, 0x1114F, RID_SUBSETSTR_CHAKMA ) );
1433 break;
1434 case UBLOCK_MEETEI_MAYEK_EXTENSIONS:
1435 aAllSubsets.push_back( Subset( 0xAAE0, 0xAAFF, RID_SUBSETSTR_MEETEI_MAYEK_EXTENSIONS ) );
1436 break;
1437 case UBLOCK_MEROITIC_CURSIVE:
1438 aAllSubsets.push_back( Subset( 0x109A0, 0x109FF, RID_SUBSETSTR_MEROITIC_CURSIVE ) );
1439 break;
1440 case UBLOCK_MEROITIC_HIEROGLYPHS:
1441 aAllSubsets.push_back( Subset( 0x10980, 0x1099F, RID_SUBSETSTR_MEROITIC_HIEROGLYPHS ) );
1442 break;
1443 case UBLOCK_MIAO:
1444 aAllSubsets.push_back( Subset( 0x16F00, 0x16F9F, RID_SUBSETSTR_MIAO ) );
1445 break;
1446 case UBLOCK_SHARADA:
1447 aAllSubsets.push_back( Subset( 0x11180, 0x111DF, RID_SUBSETSTR_SHARADA ) );
1448 break;
1449 case UBLOCK_SORA_SOMPENG:
1450 aAllSubsets.push_back( Subset( 0x110D0, 0x110FF, RID_SUBSETSTR_SORA_SOMPENG ) );
1451 break;
1452 case UBLOCK_SUNDANESE_SUPPLEMENT:
1453 aAllSubsets.push_back( Subset( 0x1CC0, 0x1CCF, RID_SUBSETSTR_SUNDANESE_SUPPLEMENT ) );
1454 break;
1455 case UBLOCK_TAKRI:
1456 aAllSubsets.push_back( Subset( 0x11680, 0x116CF, RID_SUBSETSTR_TAKRI ) );
1457 break;
1458 #endif
1461 #if OSL_DEBUG_LEVEL > 0
1462 if (eBlock != UBLOCK_NO_BLOCK &&
1463 eBlock != UBLOCK_INVALID_CODE &&
1464 eBlock != UBLOCK_COUNT &&
1465 eBlock != UBLOCK_HIGH_SURROGATES &&
1466 eBlock != UBLOCK_HIGH_PRIVATE_USE_SURROGATES &&
1467 eBlock != UBLOCK_LOW_SURROGATES)
1470 UBlockCode eBlockStart = ublock_getCode(aAllSubsets.back().GetRangeMin());
1471 UBlockCode eBlockEnd = ublock_getCode(aAllSubsets.back().GetRangeMax());
1472 assert(eBlockStart == eBlockEnd && eBlockStart == eBlock);
1474 #endif
1477 aAllSubsets.sort();
1480 maSubsets = aAllSubsets;
1483 void SubsetMap::ApplyCharMap( const FontCharMap* pFontCharMap )
1485 if( !pFontCharMap )
1486 return;
1488 // remove subsets that are not matched in any range
1489 SubsetList::iterator it_next = maSubsets.begin();
1490 while( it_next != maSubsets.end() )
1492 SubsetList::iterator it = it_next++;
1493 const Subset& rSubset = *it;
1494 sal_uInt32 cMin = rSubset.GetRangeMin();
1495 sal_uInt32 cMax = rSubset.GetRangeMax();
1497 int nCount = pFontCharMap->CountCharsInRange( cMin, cMax );
1498 if( nCount <= 0 )
1499 maSubsets.erase( it );
1503 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */