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 <tools/shl.hxx>
23 : #include <vcl/svapp.hxx>
24 : #include <svtools/colorcfg.hxx>
25 : #include <svl/eitem.hxx>
26 : #include <svl/intitem.hxx>
27 : #include <svl/itempool.hxx>
28 :
29 : #include <rtl/textenc.h>
30 : #include <svx/ucsubset.hxx>
31 : #include <sfx2/objsh.hxx>
32 : #include <vcl/msgbox.hxx>
33 : #include <svl/stritem.hxx>
34 :
35 : #include <cuires.hrc>
36 : #include <dialmgr.hxx>
37 : #include "cuicharmap.hxx"
38 : #include <sfx2/request.hxx>
39 : #include <sfx2/sfxsids.hrc>
40 : #include <sfx2/app.hxx>
41 : #include <editeng/fontitem.hxx>
42 : #include "macroass.hxx"
43 :
44 : // class SvxCharacterMap =================================================
45 :
46 0 : SvxCharacterMap::SvxCharacterMap( Window* pParent, sal_Bool bOne_, const SfxItemSet* pSet )
47 : : SfxModalDialog(pParent, "SpecialCharactersDialog", "cui/ui/specialcharacters.ui")
48 : , bOne( bOne_ )
49 0 : , pSubsetMap( NULL )
50 : {
51 0 : get(m_pShowSet, "showcharset");
52 0 : get(m_pShowChar, "showchar");
53 0 : m_pShowChar->SetCentered(true);
54 0 : get(m_pShowText, "showtext");
55 0 : get(m_pOKBtn, "ok");
56 0 : get(m_pDeleteBtn, "delete");
57 0 : get(m_pDeleteLastBtn, "deletelast");
58 0 : get(m_pFontText, "fontft");
59 0 : get(m_pFontLB, "fontlb");
60 0 : m_pFontLB->SetStyle(m_pFontLB->GetStyle() | WB_SORT);
61 0 : get(m_pSubsetText, "subsetft");
62 0 : get(m_pSubsetLB, "subsetlb");
63 : //lock the size request of this widget to the width of all possible entries
64 0 : fillAllSubsets(*m_pSubsetLB);
65 0 : m_pSubsetLB->set_width_request(m_pSubsetLB->get_preferred_size().Width());
66 0 : get(m_pCharCodeText, "charcodeft");
67 : //lock the size request of this widget to the width of the original .ui string
68 0 : m_pCharCodeText->set_width_request(m_pCharCodeText->get_preferred_size().Width());
69 0 : get(m_pSymbolText, "symboltext");
70 : //lock the size request of this widget to double the height of the label
71 0 : m_pShowText->set_height_request(m_pSymbolText->get_preferred_size().Height() * 3);
72 :
73 0 : SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, FN_PARAM_1, sal_False );
74 0 : if ( pItem )
75 0 : bOne = pItem->GetValue();
76 :
77 0 : init();
78 :
79 0 : SFX_ITEMSET_ARG( pSet, pCharItem, SfxInt32Item, SID_ATTR_CHAR, sal_False );
80 0 : if ( pCharItem )
81 0 : SetChar( pCharItem->GetValue() );
82 :
83 0 : SFX_ITEMSET_ARG( pSet, pDisableItem, SfxBoolItem, FN_PARAM_2, sal_False );
84 0 : if ( pDisableItem && pDisableItem->GetValue() )
85 0 : DisableFontSelection();
86 :
87 0 : SFX_ITEMSET_ARG( pSet, pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False );
88 0 : SFX_ITEMSET_ARG( pSet, pFontNameItem, SfxStringItem, SID_FONT_NAME, sal_False );
89 0 : if ( pFontItem )
90 : {
91 0 : Font aTmpFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), GetCharFont().GetSize() );
92 0 : aTmpFont.SetCharSet( pFontItem->GetCharSet() );
93 0 : aTmpFont.SetPitch( pFontItem->GetPitch() );
94 0 : SetCharFont( aTmpFont );
95 : }
96 0 : else if ( pFontNameItem )
97 : {
98 0 : Font aTmpFont( GetCharFont() );
99 0 : aTmpFont.SetName( pFontNameItem->GetValue() );
100 0 : SetCharFont( aTmpFont );
101 : }
102 :
103 0 : CreateOutputItemSet( pSet ? *pSet->GetPool() : SFX_APP()->GetPool() );
104 0 : }
105 :
106 : // -----------------------------------------------------------------------
107 :
108 0 : SvxCharacterMap::~SvxCharacterMap()
109 : {
110 0 : }
111 :
112 : // -----------------------------------------------------------------------
113 :
114 0 : const Font& SvxCharacterMap::GetCharFont() const
115 : {
116 0 : return aFont;
117 : }
118 :
119 : // -----------------------------------------------------------------------
120 :
121 0 : void SvxCharacterMap::SetChar( sal_UCS4 c )
122 : {
123 0 : m_pShowSet->SelectCharacter( c );
124 0 : }
125 :
126 : // -----------------------------------------------------------------------
127 :
128 0 : sal_UCS4 SvxCharacterMap::GetChar() const
129 : {
130 0 : return m_pShowSet->GetSelectCharacter();
131 : }
132 :
133 : // -----------------------------------------------------------------------
134 :
135 0 : String SvxCharacterMap::GetCharacters() const
136 : {
137 0 : return m_pShowText->GetText();
138 : }
139 :
140 :
141 : // -----------------------------------------------------------------------
142 :
143 0 : void SvxCharacterMap::DisableFontSelection()
144 : {
145 0 : m_pFontText->Disable();
146 0 : m_pFontLB->Disable();
147 0 : }
148 :
149 0 : short SvxCharacterMap::Execute()
150 : {
151 0 : short nResult = SfxModalDialog::Execute();
152 0 : if ( nResult == RET_OK )
153 : {
154 0 : SfxItemSet* pSet = GetItemSet();
155 0 : if ( pSet )
156 : {
157 0 : const SfxItemPool* pPool = pSet->GetPool();
158 0 : const Font& rFont( GetCharFont() );
159 0 : pSet->Put( SfxStringItem( pPool->GetWhich(SID_CHARMAP), GetCharacters() ) );
160 0 : pSet->Put( SvxFontItem( rFont.GetFamily(), rFont.GetName(),
161 0 : rFont.GetStyleName(), rFont.GetPitch(), rFont.GetCharSet(), pPool->GetWhich(SID_ATTR_CHAR_FONT) ) );
162 0 : pSet->Put( SfxStringItem( pPool->GetWhich(SID_FONT_NAME), rFont.GetName() ) );
163 0 : pSet->Put( SfxInt32Item( pPool->GetWhich(SID_ATTR_CHAR), GetChar() ) );
164 : }
165 : }
166 :
167 0 : return nResult;
168 : }
169 :
170 :
171 : // class SvxShowText =====================================================
172 :
173 0 : SvxShowText::SvxShowText(Window* pParent, sal_Bool bCenter)
174 : : Control( pParent ),
175 0 : mbCenter( bCenter)
176 0 : {}
177 :
178 0 : extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxShowText(Window *pParent, VclBuilder::stringmap &)
179 : {
180 0 : return new SvxShowText(pParent);
181 : }
182 :
183 : // -----------------------------------------------------------------------
184 :
185 0 : void SvxShowText::Paint( const Rectangle& )
186 : {
187 0 : Color aTextCol = GetTextColor();
188 :
189 0 : const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
190 0 : const Color aWindowTextColor( rStyleSettings.GetDialogTextColor() );
191 0 : SetTextColor( aWindowTextColor );
192 :
193 0 : const String aText = GetText();
194 0 : const Size aSize = GetOutputSizePixel();
195 :
196 0 : long nAvailWidth = aSize.Width();
197 0 : long nWinHeight = GetOutputSizePixel().Height();
198 :
199 0 : bool bGotBoundary = true;
200 0 : bool bShrankFont = false;
201 0 : Font aOrigFont(GetFont());
202 0 : Size aFontSize(aOrigFont.GetSize());
203 0 : Rectangle aBoundRect;
204 :
205 0 : for (long nFontHeight = aFontSize.Height(); nFontHeight > 0; nFontHeight -= 5)
206 : {
207 0 : if( !GetTextBoundRect( aBoundRect, aText ) || aBoundRect.IsEmpty() )
208 : {
209 0 : bGotBoundary = false;
210 0 : break;
211 : }
212 0 : if (!mbCenter)
213 0 : break;
214 : //only shrink in the single glyph large view mode
215 0 : long nTextWidth = aBoundRect.GetWidth();
216 0 : if (nAvailWidth > nTextWidth)
217 0 : break;
218 0 : Font aFont(aOrigFont);
219 0 : aFontSize.Height() = nFontHeight;
220 0 : aFont.SetSize(aFontSize);
221 0 : Control::SetFont(aFont);
222 0 : mnY = ( nWinHeight - GetTextHeight() ) / 2;
223 0 : bShrankFont = true;
224 0 : }
225 :
226 0 : Point aPoint( 2, mnY );
227 : // adjust position using ink boundary if possible
228 0 : if( !bGotBoundary )
229 0 : aPoint.X() = (aSize.Width() - GetTextWidth( aText )) / 2;
230 : else
231 : {
232 : // adjust position before it gets out of bounds
233 0 : aBoundRect += aPoint;
234 :
235 : // shift back vertically if needed
236 0 : int nYLDelta = aBoundRect.Top();
237 0 : int nYHDelta = aSize.Height() - aBoundRect.Bottom();
238 0 : if( nYLDelta <= 0 )
239 0 : aPoint.Y() -= nYLDelta - 1;
240 0 : else if( nYHDelta <= 0 )
241 0 : aPoint.Y() += nYHDelta - 1;
242 :
243 0 : if( mbCenter )
244 : {
245 : // move glyph to middle of cell
246 0 : aPoint.X() = -aBoundRect.Left()
247 0 : + (aSize.Width() - aBoundRect.GetWidth()) / 2;
248 : }
249 : else
250 : {
251 : // shift back horizontally if needed
252 0 : int nXLDelta = aBoundRect.Left();
253 0 : int nXHDelta = aSize.Width() - aBoundRect.Right();
254 0 : if( nXLDelta <= 0 )
255 0 : aPoint.X() -= nXLDelta - 1;
256 0 : else if( nXHDelta <= 0 )
257 0 : aPoint.X() += nXHDelta - 1;
258 : }
259 : }
260 :
261 0 : DrawText( aPoint, aText );
262 0 : SetTextColor( aTextCol );
263 0 : if (bShrankFont)
264 0 : Control::SetFont(aOrigFont);
265 0 : }
266 :
267 : // -----------------------------------------------------------------------
268 :
269 0 : void SvxShowText::SetFont( const Font& rFont )
270 : {
271 0 : long nWinHeight = GetOutputSizePixel().Height();
272 0 : Font aFont = rFont;
273 0 : aFont.SetWeight( WEIGHT_NORMAL );
274 0 : aFont.SetAlign( ALIGN_TOP );
275 0 : aFont.SetSize( PixelToLogic( Size( 0, nWinHeight/2 ) ) );
276 0 : aFont.SetTransparent( sal_True );
277 0 : Control::SetFont( aFont );
278 0 : mnY = ( nWinHeight - GetTextHeight() ) / 2;
279 :
280 0 : Invalidate();
281 0 : }
282 :
283 0 : Size SvxShowText::GetOptimalSize() const
284 : {
285 0 : const Font &rFont = GetFont();
286 0 : const Size rFontSize = rFont.GetSize();
287 0 : long nWinHeight = LogicToPixel(rFontSize).Height() * 2;
288 0 : return Size( GetTextWidth( GetText() ) + 2 * 12, nWinHeight );
289 : }
290 :
291 0 : void SvxShowText::Resize()
292 : {
293 0 : Control::Resize();
294 0 : SetFont(GetFont()); //force recalculation of size
295 0 : }
296 :
297 : // -----------------------------------------------------------------------
298 :
299 0 : void SvxShowText::SetText( const OUString& rText )
300 : {
301 0 : Control::SetText( rText );
302 0 : Invalidate();
303 0 : }
304 :
305 : // -----------------------------------------------------------------------
306 :
307 0 : SvxShowText::~SvxShowText()
308 0 : {}
309 :
310 : // class SvxCharacterMap =================================================
311 :
312 0 : void SvxCharacterMap::init()
313 : {
314 0 : aFont = GetFont();
315 0 : aFont.SetTransparent( sal_True );
316 0 : aFont.SetFamily( FAMILY_DONTKNOW );
317 0 : aFont.SetPitch( PITCH_DONTKNOW );
318 0 : aFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
319 :
320 0 : if (bOne)
321 : {
322 0 : m_pSymbolText->Hide();
323 0 : m_pShowText->Hide();
324 0 : m_pDeleteBtn->Hide();
325 0 : m_pDeleteLastBtn->Hide();
326 : }
327 :
328 0 : OUString aDefStr( aFont.GetName() );
329 0 : String aLastName;
330 0 : int nCount = GetDevFontCount();
331 0 : for ( int i = 0; i < nCount; i++ )
332 : {
333 0 : String aFontName( GetDevFont( i ).GetName() );
334 0 : if ( aFontName != aLastName )
335 : {
336 0 : aLastName = aFontName;
337 0 : sal_uInt16 nPos = m_pFontLB->InsertEntry( aFontName );
338 0 : m_pFontLB->SetEntryData( nPos, (void*)(sal_uLong)i );
339 : }
340 0 : }
341 : // the font may not be in the list =>
342 : // try to find a font name token in list and select found font,
343 : // else select topmost entry
344 0 : bool bFound = (m_pFontLB->GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND );
345 0 : if( !bFound )
346 : {
347 0 : sal_Int32 nIndex = 0;
348 0 : do
349 : {
350 0 : OUString aToken = aDefStr.getToken(0, ';', nIndex);
351 0 : if ( m_pFontLB->GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND )
352 : {
353 0 : aDefStr = aToken;
354 0 : bFound = sal_True;
355 0 : break;
356 0 : }
357 : }
358 0 : while ( nIndex >= 0 );
359 : }
360 :
361 0 : if ( bFound )
362 0 : m_pFontLB->SelectEntry( aDefStr );
363 0 : else if ( m_pFontLB->GetEntryCount() )
364 0 : m_pFontLB->SelectEntryPos(0);
365 0 : FontSelectHdl(m_pFontLB);
366 :
367 0 : m_pOKBtn->SetClickHdl( LINK( this, SvxCharacterMap, OKHdl ) );
368 0 : m_pFontLB->SetSelectHdl( LINK( this, SvxCharacterMap, FontSelectHdl ) );
369 0 : m_pSubsetLB->SetSelectHdl( LINK( this, SvxCharacterMap, SubsetSelectHdl ) );
370 0 : m_pShowSet->SetDoubleClickHdl( LINK( this, SvxCharacterMap, CharDoubleClickHdl ) );
371 0 : m_pShowSet->SetSelectHdl( LINK( this, SvxCharacterMap, CharSelectHdl ) );
372 0 : m_pShowSet->SetHighlightHdl( LINK( this, SvxCharacterMap, CharHighlightHdl ) );
373 0 : m_pShowSet->SetPreSelectHdl( LINK( this, SvxCharacterMap, CharPreSelectHdl ) );
374 0 : m_pDeleteLastBtn->SetClickHdl( LINK( this, SvxCharacterMap, DeleteLastHdl ) );
375 0 : m_pDeleteBtn->SetClickHdl( LINK( this, SvxCharacterMap, DeleteHdl ) );
376 :
377 0 : if( SvxShowCharSet::getSelectedChar() == ' ')
378 0 : m_pOKBtn->Disable();
379 : else
380 0 : m_pOKBtn->Enable();
381 0 : }
382 :
383 : // -----------------------------------------------------------------------
384 :
385 0 : void SvxCharacterMap::SetCharFont( const Font& rFont )
386 : {
387 : // first get the underlying info in order to get font names
388 : // like "Times New Roman;Times" resolved
389 0 : Font aTmp( GetFontMetric( rFont ) );
390 :
391 0 : if ( m_pFontLB->GetEntryPos( aTmp.GetName() ) == LISTBOX_ENTRY_NOTFOUND )
392 0 : return;
393 :
394 0 : m_pFontLB->SelectEntry( aTmp.GetName() );
395 0 : aFont = aTmp;
396 0 : FontSelectHdl(m_pFontLB);
397 :
398 : // for compatibility reasons
399 0 : ModalDialog::SetFont( aFont );
400 : }
401 :
402 : // -----------------------------------------------------------------------
403 :
404 0 : IMPL_LINK_NOARG(SvxCharacterMap, OKHdl)
405 : {
406 0 : String aStr = m_pShowText->GetText();
407 :
408 0 : if ( !aStr.Len() )
409 : {
410 0 : sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
411 : // using the new UCS4 constructor
412 0 : OUString aOUStr( &cChar, 1 );
413 0 : m_pShowText->SetText( aOUStr );
414 : }
415 0 : EndDialog( sal_True );
416 0 : return 0;
417 : }
418 :
419 0 : void SvxCharacterMap::fillAllSubsets(ListBox &rListBox)
420 : {
421 0 : SubsetMap aAll(NULL);
422 0 : rListBox.Clear();
423 0 : bool bFirst = true;
424 0 : while (const Subset *s = aAll.GetNextSubset(bFirst))
425 : {
426 0 : rListBox.InsertEntry( s->GetName() );
427 0 : bFirst = false;
428 0 : }
429 0 : }
430 :
431 : // -----------------------------------------------------------------------
432 :
433 0 : IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl)
434 : {
435 0 : sal_uInt16 nPos = m_pFontLB->GetSelectEntryPos(),
436 0 : nFont = (sal_uInt16)(sal_uLong)m_pFontLB->GetEntryData( nPos );
437 0 : aFont = GetDevFont( nFont );
438 0 : aFont.SetWeight( WEIGHT_DONTKNOW );
439 0 : aFont.SetItalic( ITALIC_NONE );
440 0 : aFont.SetWidthType( WIDTH_DONTKNOW );
441 0 : aFont.SetPitch( PITCH_DONTKNOW );
442 0 : aFont.SetFamily( FAMILY_DONTKNOW );
443 :
444 : // notify children using this font
445 0 : m_pShowSet->SetFont( aFont );
446 0 : m_pShowChar->SetFont( aFont );
447 0 : m_pShowText->SetFont( aFont );
448 :
449 : // setup unicode subset listbar with font specific subsets,
450 : // hide unicode subset listbar for symbol fonts
451 : // TODO: get info from the Font once it provides it
452 0 : delete pSubsetMap;
453 0 : pSubsetMap = NULL;
454 0 : m_pSubsetLB->Clear();
455 :
456 0 : sal_Bool bNeedSubset = (aFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL);
457 0 : if( bNeedSubset )
458 : {
459 0 : FontCharMap aFontCharMap;
460 0 : m_pShowSet->GetFontCharMap( aFontCharMap );
461 0 : pSubsetMap = new SubsetMap( &aFontCharMap );
462 :
463 : // update subset listbox for new font's unicode subsets
464 : // TODO: is it worth to improve the stupid linear search?
465 0 : bool bFirst = true;
466 : const Subset* s;
467 0 : while( NULL != (s = pSubsetMap->GetNextSubset( bFirst )) )
468 : {
469 0 : sal_uInt16 nPos_ = m_pSubsetLB->InsertEntry( s->GetName() );
470 0 : m_pSubsetLB->SetEntryData( nPos_, (void*)s );
471 : // NOTE: subset must live at least as long as the selected font
472 0 : if( bFirst )
473 0 : m_pSubsetLB->SelectEntryPos( nPos_ );
474 0 : bFirst = false;
475 : }
476 0 : if( m_pSubsetLB->GetEntryCount() <= 1 )
477 0 : bNeedSubset = sal_False;
478 : }
479 :
480 0 : m_pSubsetText->Enable(bNeedSubset);
481 0 : m_pSubsetLB->Enable(bNeedSubset);
482 :
483 0 : return 0;
484 : }
485 :
486 : // -----------------------------------------------------------------------
487 :
488 0 : IMPL_LINK_NOARG(SvxCharacterMap, SubsetSelectHdl)
489 : {
490 0 : sal_uInt16 nPos = m_pSubsetLB->GetSelectEntryPos();
491 0 : const Subset* pSubset = reinterpret_cast<const Subset*> (m_pSubsetLB->GetEntryData(nPos));
492 0 : if( pSubset )
493 : {
494 0 : sal_UCS4 cFirst = pSubset->GetRangeMin();
495 0 : m_pShowSet->SelectCharacter( cFirst );
496 : }
497 0 : m_pSubsetLB->SelectEntryPos( nPos );
498 0 : return 0;
499 : }
500 :
501 : // -----------------------------------------------------------------------
502 :
503 0 : IMPL_LINK_NOARG(SvxCharacterMap, CharDoubleClickHdl)
504 : {
505 0 : EndDialog( sal_True );
506 0 : return 0;
507 : }
508 :
509 : // -----------------------------------------------------------------------
510 :
511 0 : IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl)
512 : {
513 0 : if ( !bOne )
514 : {
515 0 : String aText = m_pShowText->GetText();
516 :
517 0 : if ( aText.Len() != CHARMAP_MAXLEN )
518 : {
519 0 : sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
520 : // using the new UCS4 constructor
521 0 : OUString aOUStr( &cChar, 1 );
522 0 : m_pShowText->SetText( aText + aOUStr );
523 0 : }
524 :
525 : }
526 0 : m_pOKBtn->Enable();
527 0 : m_pDeleteLastBtn->Enable();
528 0 : return 0;
529 : }
530 :
531 : // -----------------------------------------------------------------------
532 :
533 0 : IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl)
534 : {
535 0 : String aText;
536 0 : sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
537 0 : sal_Bool bSelect = (cChar > 0);
538 :
539 : // show char sample
540 0 : if ( bSelect )
541 : {
542 : // using the new UCS4 constructor
543 0 : aText = OUString( &cChar, 1 );
544 :
545 0 : const Subset* pSubset = NULL;
546 0 : if( pSubsetMap )
547 0 : pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
548 0 : if( pSubset )
549 0 : m_pSubsetLB->SelectEntry( pSubset->GetName() );
550 : else
551 0 : m_pSubsetLB->SetNoSelection();
552 : }
553 0 : m_pShowChar->SetText( aText );
554 0 : m_pShowChar->Update();
555 :
556 : // show char code
557 0 : if ( bSelect )
558 : {
559 : char aBuf[32];
560 0 : snprintf( aBuf, sizeof(aBuf), "U+%04X", static_cast<unsigned>(cChar) );
561 0 : if( cChar < 0x0100 )
562 0 : snprintf( aBuf+6, sizeof(aBuf)-6, " (%u)", static_cast<unsigned>(cChar) );
563 0 : aText = OUString::createFromAscii(aBuf);
564 : }
565 0 : m_pCharCodeText->SetText( aText );
566 :
567 0 : return 0;
568 : }
569 :
570 : // -----------------------------------------------------------------------
571 :
572 0 : IMPL_LINK_NOARG(SvxCharacterMap, CharPreSelectHdl)
573 : {
574 : // adjust subset selection
575 0 : if( pSubsetMap )
576 : {
577 0 : sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
578 0 : const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
579 0 : if( pSubset )
580 0 : m_pSubsetLB->SelectEntry( pSubset->GetName() );
581 : }
582 :
583 0 : m_pOKBtn->Enable();
584 0 : return 0;
585 : }
586 :
587 : // -----------------------------------------------------------------------
588 :
589 0 : IMPL_LINK_NOARG(SvxCharacterMap, DeleteLastHdl)
590 : {
591 0 : OUString aCurrentText = m_pShowText->GetText();
592 0 : m_pShowText->SetText( aCurrentText.copy( 0, aCurrentText.getLength() - 1 ) );
593 0 : if ( m_pShowText->GetText() == "" )
594 : {
595 0 : m_pOKBtn->Disable();
596 0 : m_pDeleteLastBtn->Disable();
597 : }
598 0 : return 0;
599 : }
600 :
601 0 : IMPL_LINK_NOARG(SvxCharacterMap, DeleteHdl)
602 : {
603 0 : m_pShowText->SetText( String() );
604 0 : m_pOKBtn->Disable();
605 0 : m_pDeleteLastBtn->Disable();
606 0 : return 0;
607 0 : }
608 :
609 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|