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