1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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
56 // class SvxShowCharSet ==================================================
58 SvxShowCharSet::SvxShowCharSet(Window
* pParent
)
59 : Control(pParent
, WB_TABSTOP
| WB_BORDER
)
61 , aVscrollSB( this, WB_VERT
)
64 InitSettings( true, true );
67 void SvxShowCharSet::init()
69 nSelectedIndex
= -1; // TODO: move into init list when it is no longer static
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
81 void SvxShowCharSet::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()
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 );
128 Control::DataChanged( rDCEvt
);
133 void SvxShowCharSet::MouseButtonDown( const MouseEvent
& rMEvt
)
135 if ( rMEvt
.IsLeft() )
137 if ( rMEvt
.GetClicks() == 1 )
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 );
169 void SvxShowCharSet::MouseMove( const MouseEvent
& rMEvt
)
171 if ( rMEvt
.IsLeft() && bDrag
)
173 Point aPos
= rMEvt
.GetPosPixel();
174 Size aSize
= GetSizePixel();
178 else if ( aPos
.X() > aSize
.Width()-5 )
179 aPos
.X() = aSize
.Width()-5;
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
218 if( aVscrollSB
.IsVisible() )
219 nIndex
+= aVscrollSB
.GetThumbPos() * COLUMN_COUNT
;
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
)
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
);
264 int tmpSelected
= nSelectedIndex
;
266 switch ( aCode
.GetCode() )
269 aSelectHdl
.Call( this );
278 tmpSelected
-= COLUMN_COUNT
;
281 tmpSelected
+= COLUMN_COUNT
;
284 tmpSelected
-= ROW_COUNT
* COLUMN_COUNT
;
287 tmpSelected
+= ROW_COUNT
* COLUMN_COUNT
;
293 tmpSelected
= maFontCharMap
.GetCharCount() - 1;
295 case KEY_TAB
: // some fonts have a character at these unicode control codes
298 Control::KeyInput( rKEvt
);
299 tmpSelected
= - 1; // mark as invalid
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)
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)
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() )
369 Size aOutputSize
= GetOutputSizePixel();
370 if (aVscrollSB
.IsVisible())
371 aOutputSize
.Width() -= aVscrollSB
.GetOptimalSize().Width();
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
);
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
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();
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();
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
);
440 Color aLineCol
= GetLineColor();
441 Color aFillCol
= GetFillColor();
443 Point
aPointUL( x
+ 1, y
+ 1 );
446 SetFillColor( aHighlightColor
);
447 DrawRect( getGridRectangle(aPointUL
, aOutputSize
) );
449 SetTextColor( aHighlightTextColor
);
450 DrawText( aPointTxTy
, aCharStr
);
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();
482 Color
aTextColor( rStyleSettings
.GetDialogTextColor() );
484 if ( IsControlForeground() )
485 aTextColor
= GetControlForeground();
486 SetTextColor( aTextColor
);
491 if ( IsControlBackground() )
492 SetBackground( GetControlBackground() );
494 SetBackground( rStyleSettings
.GetWindowColor() );
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
;
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
);
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;
556 void SvxShowCharSet::SelectIndex( int nNewIndex
, bool bFocus
)
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;
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
;
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
;
591 if( nOldPos
!= aVscrollSB
.GetThumbPos() )
599 // remove highlighted view
600 Color aLineCol
= GetLineColor();
601 Color aFillCol
= GetFillColor();
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
);
625 ::svx::SvxShowCharSetItem
* pItem
= ImplGetItem(nSelectedIndex
);
626 // Don't fire the focus event.
628 m_pAccessible
->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED
, Any(), makeAny(pItem
->GetAccessible()) ); // this call asures that m_pItem is set
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.
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
);
659 // move selected item to top row if not in focus
660 aVscrollSB
.SetThumbPos( nMapIndex
/ COLUMN_COUNT
);
667 IMPL_LINK_NOARG(SvxShowCharSet
, VscrollHdl
)
669 if( nSelectedIndex
< FirstInView() )
671 SelectIndex( FirstInView() + (nSelectedIndex
% COLUMN_COUNT
) );
673 else if( nSelectedIndex
> LastInView() )
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
) );
694 SvxShowCharSet::~SvxShowCharSet()
700 void SvxShowCharSet::ReleaseAccessible()
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
;
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()
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
) )
754 ApplyCharMap( pFontCharMap
);
758 const Subset
* SubsetMap::GetNextSubset( bool bFirst
) const
761 maSubsetIterator
= maSubsets
.begin();
762 if( maSubsetIterator
== maSubsets
.end() )
764 const Subset
* s
= &*(maSubsetIterator
++);
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()) )
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;
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
);
794 case UBLOCK_NO_BLOCK
:
795 case UBLOCK_INVALID_CODE
:
797 case UBLOCK_HIGH_SURROGATES
:
798 case UBLOCK_HIGH_PRIVATE_USE_SURROGATES
:
799 case UBLOCK_LOW_SURROGATES
:
801 case UBLOCK_BASIC_LATIN
:
802 aAllSubsets
.push_back( Subset( 0x0000, 0x007F, RID_SUBSETSTR_BASIC_LATIN
) );
804 case UBLOCK_LATIN_1_SUPPLEMENT
:
805 aAllSubsets
.push_back( Subset( 0x0080, 0x00FF, RID_SUBSETSTR_LATIN_1
) );
807 case UBLOCK_LATIN_EXTENDED_A
:
808 aAllSubsets
.push_back( Subset( 0x0100, 0x017F, RID_SUBSETSTR_LATIN_EXTENDED_A
) );
810 case UBLOCK_LATIN_EXTENDED_B
:
811 aAllSubsets
.push_back( Subset( 0x0180, 0x024F, RID_SUBSETSTR_LATIN_EXTENDED_B
) );
813 case UBLOCK_IPA_EXTENSIONS
:
814 aAllSubsets
.push_back( Subset( 0x0250, 0x02AF, RID_SUBSETSTR_IPA_EXTENSIONS
) );
816 case UBLOCK_SPACING_MODIFIER_LETTERS
:
817 aAllSubsets
.push_back( Subset( 0x02B0, 0x02FF, RID_SUBSETSTR_SPACING_MODIFIERS
) );
819 case UBLOCK_COMBINING_DIACRITICAL_MARKS
:
820 aAllSubsets
.push_back( Subset( 0x0300, 0x036F, RID_SUBSETSTR_COMB_DIACRITICAL
) );
823 aAllSubsets
.push_back( Subset( 0x0370, 0x03FF, RID_SUBSETSTR_BASIC_GREEK
) );
825 case UBLOCK_CYRILLIC
:
826 aAllSubsets
.push_back( Subset( 0x0400, 0x04FF, RID_SUBSETSTR_CYRILLIC
) );
828 case UBLOCK_ARMENIAN
:
829 aAllSubsets
.push_back( Subset( 0x0530, 0x058F, RID_SUBSETSTR_ARMENIAN
) );
832 aAllSubsets
.push_back( Subset( 0x0590, 0x05FF, RID_SUBSETSTR_BASIC_HEBREW
) );
835 aAllSubsets
.push_back( Subset( 0x0600, 0x065F, RID_SUBSETSTR_BASIC_ARABIC
) );
838 aAllSubsets
.push_back( Subset( 0x0700, 0x074F, RID_SUBSETSTR_SYRIAC
) );
841 aAllSubsets
.push_back( Subset( 0x0780, 0x07BF, RID_SUBSETSTR_THAANA
) );
843 case UBLOCK_DEVANAGARI
:
844 aAllSubsets
.push_back( Subset( 0x0900, 0x097F, RID_SUBSETSTR_DEVANAGARI
) );
847 aAllSubsets
.push_back( Subset( 0x0980, 0x09FF, RID_SUBSETSTR_BENGALI
) );
849 case UBLOCK_GURMUKHI
:
850 aAllSubsets
.push_back( Subset( 0x0A00, 0x0A7F, RID_SUBSETSTR_GURMUKHI
) );
852 case UBLOCK_GUJARATI
:
853 aAllSubsets
.push_back( Subset( 0x0A80, 0x0AFF, RID_SUBSETSTR_GUJARATI
) );
856 aAllSubsets
.push_back( Subset( 0x0B00, 0x0B7F, RID_SUBSETSTR_ODIA
) );
859 aAllSubsets
.push_back( Subset( 0x0B80, 0x0BFF, RID_SUBSETSTR_TAMIL
) );
862 aAllSubsets
.push_back( Subset( 0x0C00, 0x0C7F, RID_SUBSETSTR_TELUGU
) );
865 aAllSubsets
.push_back( Subset( 0x0C80, 0x0CFF, RID_SUBSETSTR_KANNADA
) );
867 case UBLOCK_MALAYALAM
:
868 aAllSubsets
.push_back( Subset( 0x0D00, 0x0D7F, RID_SUBSETSTR_MALAYALAM
) );
871 aAllSubsets
.push_back( Subset( 0x0D80, 0x0DFF, RID_SUBSETSTR_SINHALA
) );
874 aAllSubsets
.push_back( Subset( 0x0E00, 0x0E7F, RID_SUBSETSTR_THAI
) );
877 aAllSubsets
.push_back( Subset( 0x0E80, 0x0EFF, RID_SUBSETSTR_LAO
) );
880 aAllSubsets
.push_back( Subset( 0x0F00, 0x0FBF, RID_SUBSETSTR_TIBETAN
) );
883 aAllSubsets
.push_back( Subset( 0x1000, 0x109F, RID_SUBSETSTR_MYANMAR
) );
885 case UBLOCK_GEORGIAN
:
886 aAllSubsets
.push_back( Subset( 0x10A0, 0x10FF, RID_SUBSETSTR_BASIC_GEORGIAN
) );
888 case UBLOCK_HANGUL_JAMO
:
889 aAllSubsets
.push_back( Subset( 0x1100, 0x11FF, RID_SUBSETSTR_HANGUL_JAMO
) );
891 case UBLOCK_ETHIOPIC
:
892 aAllSubsets
.push_back( Subset( 0x1200, 0x137F, RID_SUBSETSTR_ETHIOPIC
) );
894 case UBLOCK_CHEROKEE
:
895 aAllSubsets
.push_back( Subset( 0x13A0, 0x13FF, RID_SUBSETSTR_CHEROKEE
) );
897 case UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS
:
898 aAllSubsets
.push_back( Subset( 0x1400, 0x167F, RID_SUBSETSTR_CANADIAN_ABORIGINAL
) );
901 aAllSubsets
.push_back( Subset( 0x1680, 0x169F, RID_SUBSETSTR_OGHAM
) );
904 aAllSubsets
.push_back( Subset( 0x16A0, 0x16F0, RID_SUBSETSTR_RUNIC
) );
907 aAllSubsets
.push_back( Subset( 0x1780, 0x17FF, RID_SUBSETSTR_KHMER
) );
909 case UBLOCK_MONGOLIAN
:
910 aAllSubsets
.push_back( Subset( 0x1800, 0x18AF, RID_SUBSETSTR_MONGOLIAN
) );
912 case UBLOCK_LATIN_EXTENDED_ADDITIONAL
:
913 aAllSubsets
.push_back( Subset( 0x1E00, 0x1EFF, RID_SUBSETSTR_LATIN_EXTENDED_ADDS
) );
915 case UBLOCK_GREEK_EXTENDED
:
916 aAllSubsets
.push_back( Subset( 0x1F00, 0x1FFF, RID_SUBSETSTR_GREEK_EXTENDED
) );
918 case UBLOCK_GENERAL_PUNCTUATION
:
919 aAllSubsets
.push_back( Subset( 0x2000, 0x206F, RID_SUBSETSTR_GENERAL_PUNCTUATION
) );
921 case UBLOCK_SUPERSCRIPTS_AND_SUBSCRIPTS
:
922 aAllSubsets
.push_back( Subset( 0x2070, 0x209F, RID_SUBSETSTR_SUB_SUPER_SCRIPTS
) );
924 case UBLOCK_CURRENCY_SYMBOLS
:
925 aAllSubsets
.push_back( Subset( 0x20A0, 0x20CF, RID_SUBSETSTR_CURRENCY_SYMBOLS
) );
927 case UBLOCK_COMBINING_MARKS_FOR_SYMBOLS
:
928 aAllSubsets
.push_back( Subset( 0x20D0, 0x20FF, RID_SUBSETSTR_COMB_DIACRITIC_SYMS
) );
930 case UBLOCK_LETTERLIKE_SYMBOLS
:
931 aAllSubsets
.push_back( Subset( 0x2100, 0x214F, RID_SUBSETSTR_LETTERLIKE_SYMBOLS
) );
933 case UBLOCK_NUMBER_FORMS
:
934 aAllSubsets
.push_back( Subset( 0x2150, 0x218F, RID_SUBSETSTR_NUMBER_FORMS
) );
937 aAllSubsets
.push_back( Subset( 0x2190, 0x21FF, RID_SUBSETSTR_ARROWS
) );
939 case UBLOCK_MATHEMATICAL_OPERATORS
:
940 aAllSubsets
.push_back( Subset( 0x2200, 0x22FF, RID_SUBSETSTR_MATH_OPERATORS
) );
942 case UBLOCK_MISCELLANEOUS_TECHNICAL
:
943 aAllSubsets
.push_back( Subset( 0x2300, 0x23FF, RID_SUBSETSTR_MISC_TECHNICAL
) );
945 case UBLOCK_CONTROL_PICTURES
:
946 aAllSubsets
.push_back( Subset( 0x2400, 0x243F, RID_SUBSETSTR_CONTROL_PICTURES
) );
948 case UBLOCK_OPTICAL_CHARACTER_RECOGNITION
:
949 aAllSubsets
.push_back( Subset( 0x2440, 0x245F, RID_SUBSETSTR_OPTICAL_CHAR_REC
) );
951 case UBLOCK_ENCLOSED_ALPHANUMERICS
:
952 aAllSubsets
.push_back( Subset( 0x2460, 0x24FF, RID_SUBSETSTR_ENCLOSED_ALPHANUM
) );
954 case UBLOCK_BOX_DRAWING
:
955 aAllSubsets
.push_back( Subset( 0x2500, 0x257F, RID_SUBSETSTR_BOX_DRAWING
) );
957 case UBLOCK_BLOCK_ELEMENTS
:
958 aAllSubsets
.push_back( Subset( 0x2580, 0x259F, RID_SUBSETSTR_BLOCK_ELEMENTS
) );
960 case UBLOCK_GEOMETRIC_SHAPES
:
961 aAllSubsets
.push_back( Subset( 0x25A0, 0x25FF, RID_SUBSETSTR_GEOMETRIC_SHAPES
) );
963 case UBLOCK_MISCELLANEOUS_SYMBOLS
:
964 aAllSubsets
.push_back( Subset( 0x2600, 0x26FF, RID_SUBSETSTR_MISC_DINGBATS
) );
966 case UBLOCK_DINGBATS
:
967 aAllSubsets
.push_back( Subset( 0x2700, 0x27BF, RID_SUBSETSTR_DINGBATS
) );
969 case UBLOCK_BRAILLE_PATTERNS
:
970 aAllSubsets
.push_back( Subset( 0x2800, 0x28FF, RID_SUBSETSTR_BRAILLE_PATTERNS
) );
972 case UBLOCK_CJK_RADICALS_SUPPLEMENT
:
973 aAllSubsets
.push_back( Subset( 0x2E80, 0x2EFF, RID_SUBSETSTR_CJK_RADICAL_SUPPL
) );
975 case UBLOCK_KANGXI_RADICALS
:
976 aAllSubsets
.push_back( Subset( 0x2F00, 0x2FDF, RID_SUBSETSTR_KANGXI_RADICALS
) );
978 case UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS
:
979 aAllSubsets
.push_back( Subset( 0x2FF0, 0x2FFF, RID_SUBSETSTR_IDEO_DESC_CHARS
) );
981 case UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION
:
982 aAllSubsets
.push_back( Subset( 0x3000, 0x303F, RID_SUBSETSTR_CJK_SYMS_PUNCTUATION
) );
984 case UBLOCK_HIRAGANA
:
985 aAllSubsets
.push_back( Subset( 0x3040, 0x309F, RID_SUBSETSTR_HIRAGANA
) );
987 case UBLOCK_KATAKANA
:
988 aAllSubsets
.push_back( Subset( 0x30A0, 0x30FF, RID_SUBSETSTR_KATAKANA
) );
990 case UBLOCK_BOPOMOFO
:
991 aAllSubsets
.push_back( Subset( 0x3100, 0x312F, RID_SUBSETSTR_BOPOMOFO
) );
993 case UBLOCK_HANGUL_COMPATIBILITY_JAMO
:
994 aAllSubsets
.push_back( Subset( 0x3130, 0x318F, RID_SUBSETSTR_HANGUL_COMPAT_JAMO
) );
997 aAllSubsets
.push_back( Subset( 0x3190, 0x319F, RID_SUBSETSTR_KANBUN
) );
999 case UBLOCK_BOPOMOFO_EXTENDED
:
1000 aAllSubsets
.push_back( Subset( 0x31A0, 0x31BF, RID_SUBSETSTR_BOPOMOFO_EXTENDED
) );
1002 case UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS
:
1003 aAllSubsets
.push_back( Subset( 0x3200, 0x32FF, RID_SUBSETSTR_ENCLOSED_CJK_LETTERS
) );
1005 case UBLOCK_CJK_COMPATIBILITY
:
1006 aAllSubsets
.push_back( Subset( 0x3300, 0x33FF, RID_SUBSETSTR_CJK_COMPATIBILITY
) );
1008 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
:
1009 aAllSubsets
.push_back( Subset( 0x3400, 0x4DBF, RID_SUBSETSTR_CJK_EXT_A_UNIFIED_IDGRAPH
) );
1011 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS
:
1012 aAllSubsets
.push_back( Subset( 0x4E00, 0x9FA5, RID_SUBSETSTR_CJK_UNIFIED_IDGRAPH
) );
1014 case UBLOCK_YI_SYLLABLES
:
1015 aAllSubsets
.push_back( Subset( 0xA000, 0xA48F, RID_SUBSETSTR_YI_SYLLABLES
) );
1017 case UBLOCK_YI_RADICALS
:
1018 aAllSubsets
.push_back( Subset( 0xA490, 0xA4CF, RID_SUBSETSTR_YI_RADICALS
) );
1020 case UBLOCK_HANGUL_SYLLABLES
:
1021 aAllSubsets
.push_back( Subset( 0xAC00, 0xD7AF, RID_SUBSETSTR_HANGUL
) );
1023 case UBLOCK_PRIVATE_USE_AREA
:
1024 aAllSubsets
.push_back( Subset( 0xE000, 0xF8FF, RID_SUBSETSTR_PRIVATE_USE_AREA
) );
1026 case UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS
:
1027 aAllSubsets
.push_back( Subset( 0xF900, 0xFAFF, RID_SUBSETSTR_CJK_COMPAT_IDGRAPHS
) );
1029 case UBLOCK_ALPHABETIC_PRESENTATION_FORMS
:
1030 aAllSubsets
.push_back( Subset( 0xFB00, 0xFB4F, RID_SUBSETSTR_ALPHA_PRESENTATION
) );
1032 case UBLOCK_ARABIC_PRESENTATION_FORMS_A
:
1033 aAllSubsets
.push_back( Subset( 0xFB50, 0xFDFF, RID_SUBSETSTR_ARABIC_PRESENT_A
) );
1035 case UBLOCK_COMBINING_HALF_MARKS
:
1036 aAllSubsets
.push_back( Subset( 0xFE20, 0xFE2F, RID_SUBSETSTR_COMBINING_HALF_MARKS
) );
1038 case UBLOCK_CJK_COMPATIBILITY_FORMS
:
1039 aAllSubsets
.push_back( Subset( 0xFE30, 0xFE4F, RID_SUBSETSTR_CJK_COMPAT_FORMS
) );
1041 case UBLOCK_SMALL_FORM_VARIANTS
:
1042 aAllSubsets
.push_back( Subset( 0xFE50, 0xFE6F, RID_SUBSETSTR_SMALL_FORM_VARIANTS
) );
1044 case UBLOCK_ARABIC_PRESENTATION_FORMS_B
:
1045 aAllSubsets
.push_back( Subset( 0xFE70, 0xFEFF, RID_SUBSETSTR_ARABIC_PRESENT_B
) );
1047 case UBLOCK_SPECIALS
:
1048 aAllSubsets
.push_back( Subset( 0xFFF0, 0xFFFF, RID_SUBSETSTR_SPECIALS
) );
1050 case UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS
:
1051 aAllSubsets
.push_back( Subset( 0xFF00, 0xFFEF, RID_SUBSETSTR_HALFW_FULLW_FORMS
) );
1053 case UBLOCK_OLD_ITALIC
:
1054 aAllSubsets
.push_back( Subset( 0x10300, 0x1032F, RID_SUBSETSTR_OLD_ITALIC
) );
1057 aAllSubsets
.push_back( Subset( 0x10330, 0x1034F, RID_SUBSETSTR_GOTHIC
) );
1059 case UBLOCK_DESERET
:
1060 aAllSubsets
.push_back( Subset( 0x10400, 0x1044F, RID_SUBSETSTR_DESERET
) );
1062 case UBLOCK_BYZANTINE_MUSICAL_SYMBOLS
:
1063 aAllSubsets
.push_back( Subset( 0x1D000, 0x1D0FF, RID_SUBSETSTR_BYZANTINE_MUSICAL_SYMBOLS
) );
1065 case UBLOCK_MUSICAL_SYMBOLS
:
1066 aAllSubsets
.push_back( Subset( 0x1D100, 0x1D1FF, RID_SUBSETSTR_MUSICAL_SYMBOLS
) );
1068 case UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS
:
1069 aAllSubsets
.push_back( Subset( 0x1D400, 0x1D7FF, RID_SUBSETSTR_MATHEMATICAL_ALPHANUMERIC_SYMBOLS
) );
1071 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
:
1072 aAllSubsets
.push_back( Subset( 0x20000, 0x2A6DF, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
) );
1074 case UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT
:
1075 aAllSubsets
.push_back( Subset( 0x2F800, 0x2FA1F, RID_SUBSETSTR_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT
) );
1078 aAllSubsets
.push_back( Subset( 0xE0000, 0xE007F, RID_SUBSETSTR_TAGS
) );
1080 case UBLOCK_CYRILLIC_SUPPLEMENTARY
:
1081 aAllSubsets
.push_back( Subset( 0x0500, 0x052F, RID_SUBSETSTR_CYRILLIC_SUPPLEMENTARY
) );
1083 case UBLOCK_TAGALOG
:
1084 aAllSubsets
.push_back( Subset( 0x1700, 0x171F, RID_SUBSETSTR_TAGALOG
) );
1086 case UBLOCK_HANUNOO
:
1087 aAllSubsets
.push_back( Subset( 0x1720, 0x173F, RID_SUBSETSTR_HANUNOO
) );
1090 aAllSubsets
.push_back( Subset( 0x1740, 0x175F, RID_SUBSETSTR_BUHID
) );
1092 case UBLOCK_TAGBANWA
:
1093 aAllSubsets
.push_back( Subset( 0x1760, 0x177F, RID_SUBSETSTR_TAGBANWA
) );
1095 case UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A
:
1096 aAllSubsets
.push_back( Subset( 0x27C0, 0x27EF, RID_SUBSETSTR_MISC_MATH_SYMS_A
) );
1098 case UBLOCK_SUPPLEMENTAL_ARROWS_A
:
1099 aAllSubsets
.push_back( Subset( 0x27F0, 0x27FF, RID_SUBSETSTR_SUPPL_ARROWS_A
) );
1101 case UBLOCK_SUPPLEMENTAL_ARROWS_B
:
1102 aAllSubsets
.push_back( Subset( 0x2900, 0x297F, RID_SUBSETSTR_SUPPL_ARROWS_B
) );
1104 case UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B
:
1105 aAllSubsets
.push_back( Subset( 0x2980, 0x29FF, RID_SUBSETSTR_MISC_MATH_SYMS_B
) );
1107 case UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS
:
1108 aAllSubsets
.push_back( Subset( 0x2A00, 0x2AFF, RID_SUBSETSTR_MISC_MATH_SYMS_B
) );
1110 case UBLOCK_KATAKANA_PHONETIC_EXTENSIONS
:
1111 aAllSubsets
.push_back( Subset( 0x31F0, 0x31FF, RID_SUBSETSTR_KATAKANA_PHONETIC
) );
1113 case UBLOCK_VARIATION_SELECTORS
:
1114 aAllSubsets
.push_back( Subset( 0xFE00, 0xFE0F, RID_SUBSETSTR_VARIATION_SELECTORS
) );
1116 case UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_A
:
1117 aAllSubsets
.push_back( Subset( 0xF0000, 0xFFFFF, RID_SUBSETSTR_SUPPLEMENTARY_PRIVATE_USE_AREA_A
) );
1119 case UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B
:
1120 aAllSubsets
.push_back( Subset( 0x100000, 0x10FFFF, RID_SUBSETSTR_SUPPLEMENTARY_PRIVATE_USE_AREA_B
) );
1123 aAllSubsets
.push_back( Subset( 0x1900, 0x194F, RID_SUBSETSTR_LIMBU
) );
1126 aAllSubsets
.push_back( Subset( 0x1950, 0x197F, RID_SUBSETSTR_TAI_LE
) );
1128 case UBLOCK_KHMER_SYMBOLS
:
1129 aAllSubsets
.push_back( Subset( 0x19E0, 0x19FF, RID_SUBSETSTR_KHMER_SYMBOLS
) );
1131 case UBLOCK_PHONETIC_EXTENSIONS
:
1132 aAllSubsets
.push_back( Subset( 0x1D00, 0x1D7F, RID_SUBSETSTR_PHONETIC_EXTENSIONS
) );
1134 case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS
:
1135 aAllSubsets
.push_back( Subset( 0x2B00, 0x2BFF, RID_SUBSETSTR_MISCELLANEOUS_SYMBOLS_AND_ARROWS
) );
1137 case UBLOCK_YIJING_HEXAGRAM_SYMBOLS
:
1138 aAllSubsets
.push_back( Subset( 0x4DC0, 0x4DFF, RID_SUBSETSTR_YIJING_HEXAGRAM_SYMBOLS
) );
1140 case UBLOCK_LINEAR_B_SYLLABARY
:
1141 aAllSubsets
.push_back( Subset( 0x10000, 0x1007F, RID_SUBSETSTR_LINEAR_B_SYLLABARY
) );
1143 case UBLOCK_LINEAR_B_IDEOGRAMS
:
1144 aAllSubsets
.push_back( Subset( 0x10080, 0x100FF, RID_SUBSETSTR_LINEAR_B_IDEOGRAMS
) );
1146 case UBLOCK_AEGEAN_NUMBERS
:
1147 aAllSubsets
.push_back( Subset( 0x10100, 0x1013F, RID_SUBSETSTR_AEGEAN_NUMBERS
) );
1149 case UBLOCK_UGARITIC
:
1150 aAllSubsets
.push_back( Subset( 0x10380, 0x1039F, RID_SUBSETSTR_UGARITIC
) );
1152 case UBLOCK_SHAVIAN
:
1153 aAllSubsets
.push_back( Subset( 0x10450, 0x1047F, RID_SUBSETSTR_SHAVIAN
) );
1155 case UBLOCK_OSMANYA
:
1156 aAllSubsets
.push_back( Subset( 0x10480, 0x104AF, RID_SUBSETSTR_OSMANYA
) );
1158 case UBLOCK_CYPRIOT_SYLLABARY
:
1159 aAllSubsets
.push_back( Subset( 0x10800, 0x1083F, RID_SUBSETSTR_CYPRIOT_SYLLABARY
) );
1161 case UBLOCK_TAI_XUAN_JING_SYMBOLS
:
1162 aAllSubsets
.push_back( Subset( 0x1D300, 0x1D35F, RID_SUBSETSTR_TAI_XUAN_JING_SYMBOLS
) );
1164 case UBLOCK_VARIATION_SELECTORS_SUPPLEMENT
:
1165 aAllSubsets
.push_back( Subset( 0xE0100, 0xE01EF, RID_SUBSETSTR_VARIATION_SELECTORS_SUPPLEMENT
) );
1167 case UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION
:
1168 aAllSubsets
.push_back( Subset(0x1D200, 0x1D24F, RID_SUBSETSTR_ANCIENT_GREEK_MUSICAL_NOTATION
) );
1170 case UBLOCK_ANCIENT_GREEK_NUMBERS
:
1171 aAllSubsets
.push_back( Subset(0x10140, 0x1018F , RID_SUBSETSTR_ANCIENT_GREEK_NUMBERS
) );
1173 case UBLOCK_ARABIC_SUPPLEMENT
:
1174 aAllSubsets
.push_back( Subset(0x0750, 0x077F , RID_SUBSETSTR_ARABIC_SUPPLEMENT
) );
1176 case UBLOCK_BUGINESE
:
1177 aAllSubsets
.push_back( Subset(0x1A00, 0x1A1F , RID_SUBSETSTR_BUGINESE
) );
1179 case UBLOCK_CJK_STROKES
:
1180 aAllSubsets
.push_back( Subset( 0x31C0, 0x31EF, RID_SUBSETSTR_CJK_STROKES
) );
1182 case UBLOCK_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT
:
1183 aAllSubsets
.push_back( Subset( 0x1DC0, 0x1DFF , RID_SUBSETSTR_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT
) );
1186 aAllSubsets
.push_back( Subset( 0x2C80, 0x2CFF , RID_SUBSETSTR_COPTIC
) );
1188 case UBLOCK_ETHIOPIC_EXTENDED
:
1189 aAllSubsets
.push_back( Subset( 0x2D80, 0x2DDF , RID_SUBSETSTR_ETHIOPIC_EXTENDED
) );
1191 case UBLOCK_ETHIOPIC_SUPPLEMENT
:
1192 aAllSubsets
.push_back( Subset( 0x1380, 0x139F, RID_SUBSETSTR_ETHIOPIC_SUPPLEMENT
) );
1194 case UBLOCK_GEORGIAN_SUPPLEMENT
:
1195 aAllSubsets
.push_back( Subset( 0x2D00, 0x2D2F, RID_SUBSETSTR_GEORGIAN_SUPPLEMENT
) );
1197 case UBLOCK_GLAGOLITIC
:
1198 aAllSubsets
.push_back( Subset( 0x2C00, 0x2C5F, RID_SUBSETSTR_GLAGOLITIC
) );
1200 case UBLOCK_KHAROSHTHI
:
1201 aAllSubsets
.push_back( Subset( 0x10A00, 0x10A5F, RID_SUBSETSTR_KHAROSHTHI
) );
1203 case UBLOCK_MODIFIER_TONE_LETTERS
:
1204 aAllSubsets
.push_back( Subset( 0xA700, 0xA71F, RID_SUBSETSTR_MODIFIER_TONE_LETTERS
) );
1206 case UBLOCK_NEW_TAI_LUE
:
1207 aAllSubsets
.push_back( Subset( 0x1980, 0x19DF, RID_SUBSETSTR_NEW_TAI_LUE
) );
1209 case UBLOCK_OLD_PERSIAN
:
1210 aAllSubsets
.push_back( Subset( 0x103A0, 0x103DF, RID_SUBSETSTR_OLD_PERSIAN
) );
1212 case UBLOCK_PHONETIC_EXTENSIONS_SUPPLEMENT
:
1213 aAllSubsets
.push_back( Subset( 0x1D80, 0x1DBF, RID_SUBSETSTR_PHONETIC_EXTENSIONS_SUPPLEMENT
) );
1215 case UBLOCK_SUPPLEMENTAL_PUNCTUATION
:
1216 aAllSubsets
.push_back( Subset( 0x2E00, 0x2E7F, RID_SUBSETSTR_SUPPLEMENTAL_PUNCTUATION
) );
1218 case UBLOCK_SYLOTI_NAGRI
:
1219 aAllSubsets
.push_back( Subset( 0xA800, 0xA82F, RID_SUBSETSTR_SYLOTI_NAGRI
) );
1221 case UBLOCK_TIFINAGH
:
1222 aAllSubsets
.push_back( Subset( 0x2D30, 0x2D7F, RID_SUBSETSTR_TIFINAGH
) );
1224 case UBLOCK_VERTICAL_FORMS
:
1225 aAllSubsets
.push_back( Subset( 0xFE10, 0xFE1F, RID_SUBSETSTR_VERTICAL_FORMS
) );
1228 aAllSubsets
.push_back( Subset( 0x07C0, 0x07FF, RID_SUBSETSTR_NKO
) );
1230 case UBLOCK_BALINESE
:
1231 aAllSubsets
.push_back( Subset( 0x1B00, 0x1B7F, RID_SUBSETSTR_BALINESE
) );
1233 case UBLOCK_LATIN_EXTENDED_C
:
1234 aAllSubsets
.push_back( Subset( 0x2C60, 0x2C7F, RID_SUBSETSTR_LATIN_EXTENDED_C
) );
1236 case UBLOCK_LATIN_EXTENDED_D
:
1237 aAllSubsets
.push_back( Subset( 0xA720, 0xA7FF, RID_SUBSETSTR_LATIN_EXTENDED_D
) );
1239 case UBLOCK_PHAGS_PA
:
1240 aAllSubsets
.push_back( Subset( 0xA840, 0xA87F, RID_SUBSETSTR_PHAGS_PA
) );
1242 case UBLOCK_PHOENICIAN
:
1243 aAllSubsets
.push_back( Subset( 0x10900, 0x1091F, RID_SUBSETSTR_PHOENICIAN
) );
1245 case UBLOCK_CUNEIFORM
:
1246 aAllSubsets
.push_back( Subset( 0x12000, 0x123FF, RID_SUBSETSTR_CUNEIFORM
) );
1248 case UBLOCK_CUNEIFORM_NUMBERS_AND_PUNCTUATION
:
1249 aAllSubsets
.push_back( Subset( 0x12400, 0x1247F, RID_SUBSETSTR_CUNEIFORM_NUMBERS_AND_PUNCTUATION
) );
1251 case UBLOCK_COUNTING_ROD_NUMERALS
:
1252 aAllSubsets
.push_back( Subset( 0x1D360, 0x1D37F, RID_SUBSETSTR_COUNTING_ROD_NUMERALS
) );
1254 case UBLOCK_SUNDANESE
:
1255 aAllSubsets
.push_back( Subset( 0x1B80, 0x1BBF, RID_SUBSETSTR_SUNDANESE
) );
1258 aAllSubsets
.push_back( Subset( 0x1C00, 0x1C4F, RID_SUBSETSTR_LEPCHA
) );
1260 case UBLOCK_OL_CHIKI
:
1261 aAllSubsets
.push_back( Subset( 0x1C50, 0x1C7F, RID_SUBSETSTR_OL_CHIKI
) );
1263 case UBLOCK_CYRILLIC_EXTENDED_A
:
1264 aAllSubsets
.push_back( Subset( 0x2DE0, 0x2DFF, RID_SUBSETSTR_CYRILLIC_EXTENDED_A
) );
1267 aAllSubsets
.push_back( Subset( 0xA500, 0xA63F, RID_SUBSETSTR_VAI
) );
1269 case UBLOCK_CYRILLIC_EXTENDED_B
:
1270 aAllSubsets
.push_back( Subset( 0xA640, 0xA69F, RID_SUBSETSTR_CYRILLIC_EXTENDED_B
) );
1272 case UBLOCK_SAURASHTRA
:
1273 aAllSubsets
.push_back( Subset( 0xA880, 0xA8DF, RID_SUBSETSTR_SAURASHTRA
) );
1275 case UBLOCK_KAYAH_LI
:
1276 aAllSubsets
.push_back( Subset( 0xA900, 0xA92F, RID_SUBSETSTR_KAYAH_LI
) );
1279 aAllSubsets
.push_back( Subset( 0xA930, 0xA95F, RID_SUBSETSTR_REJANG
) );
1282 aAllSubsets
.push_back( Subset( 0xAA00, 0xAA5F, RID_SUBSETSTR_CHAM
) );
1284 case UBLOCK_ANCIENT_SYMBOLS
:
1285 aAllSubsets
.push_back( Subset( 0x10190, 0x101CF, RID_SUBSETSTR_ANCIENT_SYMBOLS
) );
1287 case UBLOCK_PHAISTOS_DISC
:
1288 aAllSubsets
.push_back( Subset( 0x101D0, 0x101FF, RID_SUBSETSTR_PHAISTOS_DISC
) );
1291 aAllSubsets
.push_back( Subset( 0x10280, 0x1029F, RID_SUBSETSTR_LYCIAN
) );
1294 aAllSubsets
.push_back( Subset( 0x102A0, 0x102DF, RID_SUBSETSTR_CARIAN
) );
1297 aAllSubsets
.push_back( Subset( 0x10920, 0x1093F, RID_SUBSETSTR_LYDIAN
) );
1299 case UBLOCK_MAHJONG_TILES
:
1300 aAllSubsets
.push_back( Subset( 0x1F000, 0x1F02F, RID_SUBSETSTR_MAHJONG_TILES
) );
1302 case UBLOCK_DOMINO_TILES
:
1303 aAllSubsets
.push_back( Subset( 0x1F030, 0x1F09F, RID_SUBSETSTR_DOMINO_TILES
) );
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
) );
1309 case UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED
:
1310 aAllSubsets
.push_back( Subset( 0x18B0, 0x18FF, RID_SUBSETSTR_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED
) );
1312 case UBLOCK_TAI_THAM
:
1313 aAllSubsets
.push_back( Subset( 0x1A20, 0x1AAF, RID_SUBSETSTR_TAI_THAM
) );
1315 case UBLOCK_VEDIC_EXTENSIONS
:
1316 aAllSubsets
.push_back( Subset( 0x1CD0, 0x1CFF, RID_SUBSETSTR_VEDIC_EXTENSIONS
) );
1319 aAllSubsets
.push_back( Subset( 0xA4D0, 0xA4FF, RID_SUBSETSTR_LISU
) );
1322 aAllSubsets
.push_back( Subset( 0xA6A0, 0xA6FF, RID_SUBSETSTR_BAMUM
) );
1324 case UBLOCK_COMMON_INDIC_NUMBER_FORMS
:
1325 aAllSubsets
.push_back( Subset( 0xA830, 0xA83F, RID_SUBSETSTR_COMMON_INDIC_NUMBER_FORMS
) );
1327 case UBLOCK_DEVANAGARI_EXTENDED
:
1328 aAllSubsets
.push_back( Subset( 0xA8E0, 0xA8FF, RID_SUBSETSTR_DEVANAGARI_EXTENDED
) );
1330 case UBLOCK_HANGUL_JAMO_EXTENDED_A
:
1331 aAllSubsets
.push_back( Subset( 0xA960, 0xA97F, RID_SUBSETSTR_HANGUL_JAMO_EXTENDED_A
) );
1333 case UBLOCK_JAVANESE
:
1334 aAllSubsets
.push_back( Subset( 0xA980, 0xA9DF, RID_SUBSETSTR_JAVANESE
) );
1336 case UBLOCK_MYANMAR_EXTENDED_A
:
1337 aAllSubsets
.push_back( Subset( 0xAA60, 0xAA7F, RID_SUBSETSTR_MYANMAR_EXTENDED_A
) );
1339 case UBLOCK_TAI_VIET
:
1340 aAllSubsets
.push_back( Subset( 0xAA80, 0xAADF, RID_SUBSETSTR_TAI_VIET
) );
1342 case UBLOCK_MEETEI_MAYEK
:
1343 aAllSubsets
.push_back( Subset( 0xABC0, 0xABFF, RID_SUBSETSTR_MEETEI_MAYEK
) );
1345 case UBLOCK_HANGUL_JAMO_EXTENDED_B
:
1346 aAllSubsets
.push_back( Subset( 0xD7B0, 0xD7FF, RID_SUBSETSTR_HANGUL_JAMO_EXTENDED_B
) );
1348 case UBLOCK_IMPERIAL_ARAMAIC
:
1349 aAllSubsets
.push_back( Subset( 0x10840, 0x1085F, RID_SUBSETSTR_IMPERIAL_ARAMAIC
) );
1351 case UBLOCK_OLD_SOUTH_ARABIAN
:
1352 aAllSubsets
.push_back( Subset( 0x10A60, 0x10A7F, RID_SUBSETSTR_OLD_SOUTH_ARABIAN
) );
1354 case UBLOCK_AVESTAN
:
1355 aAllSubsets
.push_back( Subset( 0x10B00, 0x10B3F, RID_SUBSETSTR_AVESTAN
) );
1357 case UBLOCK_INSCRIPTIONAL_PARTHIAN
:
1358 aAllSubsets
.push_back( Subset( 0x10B40, 0x10B5F, RID_SUBSETSTR_INSCRIPTIONAL_PARTHIAN
) );
1360 case UBLOCK_INSCRIPTIONAL_PAHLAVI
:
1361 aAllSubsets
.push_back( Subset( 0x10B60, 0x10B7F, RID_SUBSETSTR_INSCRIPTIONAL_PAHLAVI
) );
1363 case UBLOCK_OLD_TURKIC
:
1364 aAllSubsets
.push_back( Subset( 0x10C00, 0x10C4F, RID_SUBSETSTR_OLD_TURKIC
) );
1366 case UBLOCK_RUMI_NUMERAL_SYMBOLS
:
1367 aAllSubsets
.push_back( Subset( 0x10E60, 0x10E7F, RID_SUBSETSTR_RUMI_NUMERAL_SYMBOLS
) );
1370 aAllSubsets
.push_back( Subset( 0x11080, 0x110CF, RID_SUBSETSTR_KAITHI
) );
1372 case UBLOCK_EGYPTIAN_HIEROGLYPHS
:
1373 aAllSubsets
.push_back( Subset( 0x13000, 0x1342F, RID_SUBSETSTR_EGYPTIAN_HIEROGLYPHS
) );
1375 case UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT
:
1376 aAllSubsets
.push_back( Subset( 0x1F100, 0x1F1FF, RID_SUBSETSTR_ENCLOSED_ALPHANUMERIC_SUPPLEMENT
) );
1378 case UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT
:
1379 aAllSubsets
.push_back( Subset( 0x1F200, 0x1F2FF, RID_SUBSETSTR_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT
) );
1381 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C
:
1382 aAllSubsets
.push_back( Subset( 0x2A700, 0x2B73F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C
) );
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
) );
1390 aAllSubsets
.push_back( Subset( 0x1BC0, 0x1BFF, RID_SUBSETSTR_BATAK
) );
1392 case UBLOCK_ETHIOPIC_EXTENDED_A
:
1393 aAllSubsets
.push_back( Subset( 0xAB00, 0xAB2F, RID_SUBSETSTR_ETHIOPIC_EXTENDED_A
) );
1396 aAllSubsets
.push_back( Subset( 0x11000, 0x1107F, RID_SUBSETSTR_BRAHMI
) );
1398 case UBLOCK_BAMUM_SUPPLEMENT
:
1399 aAllSubsets
.push_back( Subset( 0x16800, 0x16A3F, RID_SUBSETSTR_BAMUM_SUPPLEMENT
) );
1401 case UBLOCK_KANA_SUPPLEMENT
:
1402 aAllSubsets
.push_back( Subset( 0x1B000, 0x1B0FF, RID_SUBSETSTR_KANA_SUPPLEMENT
) );
1404 case UBLOCK_PLAYING_CARDS
:
1405 aAllSubsets
.push_back( Subset( 0x1F0A0, 0x1F0FF, RID_SUBSETSTR_PLAYING_CARDS
) );
1407 case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS
:
1408 aAllSubsets
.push_back( Subset( 0x1F300, 0x1F5FF, RID_SUBSETSTR_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS
) );
1410 case UBLOCK_EMOTICONS
:
1411 aAllSubsets
.push_back( Subset( 0x1F600, 0x1F64F, RID_SUBSETSTR_EMOTICONS
) );
1413 case UBLOCK_TRANSPORT_AND_MAP_SYMBOLS
:
1414 aAllSubsets
.push_back( Subset( 0x1F680, 0x1F6FF, RID_SUBSETSTR_TRANSPORT_AND_MAP_SYMBOLS
) );
1416 case UBLOCK_ALCHEMICAL_SYMBOLS
:
1417 aAllSubsets
.push_back( Subset( 0x1F700, 0x1F77F, RID_SUBSETSTR_ALCHEMICAL_SYMBOLS
) );
1419 case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D
:
1420 aAllSubsets
.push_back( Subset( 0x2B740, 0x2B81F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D
) );
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
) );
1428 case UBLOCK_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS
:
1429 aAllSubsets
.push_back( Subset( 0x1EE00, 0x1EEFF, RID_SUBSETSTR_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS
) );
1432 aAllSubsets
.push_back( Subset( 0x11100, 0x1114F, RID_SUBSETSTR_CHAKMA
) );
1434 case UBLOCK_MEETEI_MAYEK_EXTENSIONS
:
1435 aAllSubsets
.push_back( Subset( 0xAAE0, 0xAAFF, RID_SUBSETSTR_MEETEI_MAYEK_EXTENSIONS
) );
1437 case UBLOCK_MEROITIC_CURSIVE
:
1438 aAllSubsets
.push_back( Subset( 0x109A0, 0x109FF, RID_SUBSETSTR_MEROITIC_CURSIVE
) );
1440 case UBLOCK_MEROITIC_HIEROGLYPHS
:
1441 aAllSubsets
.push_back( Subset( 0x10980, 0x1099F, RID_SUBSETSTR_MEROITIC_HIEROGLYPHS
) );
1444 aAllSubsets
.push_back( Subset( 0x16F00, 0x16F9F, RID_SUBSETSTR_MIAO
) );
1446 case UBLOCK_SHARADA
:
1447 aAllSubsets
.push_back( Subset( 0x11180, 0x111DF, RID_SUBSETSTR_SHARADA
) );
1449 case UBLOCK_SORA_SOMPENG
:
1450 aAllSubsets
.push_back( Subset( 0x110D0, 0x110FF, RID_SUBSETSTR_SORA_SOMPENG
) );
1452 case UBLOCK_SUNDANESE_SUPPLEMENT
:
1453 aAllSubsets
.push_back( Subset( 0x1CC0, 0x1CCF, RID_SUBSETSTR_SUNDANESE_SUPPLEMENT
) );
1456 aAllSubsets
.push_back( Subset( 0x11680, 0x116CF, RID_SUBSETSTR_TAKRI
) );
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
);
1480 maSubsets
= aAllSubsets
;
1483 void SubsetMap::ApplyCharMap( const FontCharMap
* pFontCharMap
)
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
);
1499 maSubsets
.erase( it
);
1503 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */