adapt insert character dialog to new layout
Change-Id: I5561c2684d0957b65aef0d139e9210ebdd703153
This commit is contained in:
@@ -55,7 +55,6 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
|
||||
cui/source/customize/macropg.src \
|
||||
cui/source/customize/selector.src \
|
||||
cui/source/dialogs/about.src \
|
||||
cui/source/dialogs/charmap.src \
|
||||
cui/source/dialogs/colorpicker.src \
|
||||
cui/source/dialogs/commonlingui.src \
|
||||
cui/source/dialogs/cuiimapdlg.src \
|
||||
|
@@ -13,6 +13,7 @@ $(eval $(call gb_UI_add_uifiles,cui,\
|
||||
cui/uiconfig/ui/charnamepage \
|
||||
cui/uiconfig/ui/effectspage \
|
||||
cui/uiconfig/ui/positionpage \
|
||||
cui/uiconfig/ui/specialcharacters \
|
||||
cui/uiconfig/ui/twolinespage \
|
||||
cui/uiconfig/ui/zoomdialog \
|
||||
))
|
||||
|
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
#ifndef _SVX_CHARMAP_HRC
|
||||
#define _SVX_CHARMAP_HRC
|
||||
|
||||
// defines ------------------------------------------------------------------
|
||||
|
||||
#define CT_SHOWSET 10
|
||||
#define FT_FONT 11
|
||||
#define LB_FONT 12
|
||||
#define CT_SHOWTEXT 13
|
||||
#define FT_SYMBOLE 14
|
||||
#define CT_SHOWCHAR 15
|
||||
#define FT_CHARCODE 16
|
||||
#define BTN_CHAR_OK 17
|
||||
#define BTN_CHAR_CANCEL 18
|
||||
#define BTN_CHAR_HELP 19
|
||||
#define BTN_DELETE 20
|
||||
#define FT_SUBSET 30
|
||||
#define LB_SUBSET 31
|
||||
#define ED_SHORTCUT 32
|
||||
#define BT_ASSIGN 33
|
||||
#define FT_ASSIGN 34
|
||||
|
||||
#endif
|
||||
|
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <cuires.hrc>
|
||||
#include "charmap.hrc"
|
||||
#include "helpid.hrc"
|
||||
#include <svx/dialogs.hrc> // for RID_SVXDLG_CHARMAP
|
||||
|
||||
// RID_SVXDLG_CHARMAP ----------------------------------------------------
|
||||
ModalDialog RID_SVXDLG_CHARMAP
|
||||
{
|
||||
HelpId = CMD_SID_CHARMAP ;
|
||||
SvLook = TRUE ;
|
||||
Text [ en-US ] = "Special Characters";
|
||||
Size = MAP_APPFONT ( 297 , 153 ) ;
|
||||
OutputSize = TRUE ;
|
||||
Moveable = TRUE ;
|
||||
Control CT_SHOWSET
|
||||
{
|
||||
HelpId = HID_CHARMAP_CTL_SHOWSET ;
|
||||
Border = TRUE ;
|
||||
Pos = MAP_APPFONT ( 6 , 24 ) ;
|
||||
Size = MAP_APPFONT ( 230 , 112 ) ;
|
||||
TabStop = TRUE ;
|
||||
Group = TRUE ;
|
||||
};
|
||||
FixedText FT_FONT
|
||||
{
|
||||
Pos = MAP_APPFONT ( 6 , 8 ) ;
|
||||
Size = MAP_APPFONT ( 33 , 8 ) ;
|
||||
Text [ en-US ] = "~Font" ;
|
||||
Left = TRUE ;
|
||||
Group = TRUE ;
|
||||
};
|
||||
ListBox LB_FONT
|
||||
{
|
||||
HelpID = "cui:ListBox:RID_SVXDLG_CHARMAP:LB_FONT";
|
||||
Pos = MAP_APPFONT ( 42 , 6 ) ;
|
||||
Size = MAP_APPFONT ( 70 , 58 ) ;
|
||||
Sort = TRUE ;
|
||||
TabStop = TRUE ;
|
||||
DropDown = TRUE ;
|
||||
};
|
||||
FixedText FT_SUBSET
|
||||
{
|
||||
Pos = MAP_APPFONT ( 118 , 8 ) ;
|
||||
Size = MAP_APPFONT ( 42 , 8 ) ;
|
||||
Text [ en-US ] = "~Subset";
|
||||
};
|
||||
ListBox LB_SUBSET
|
||||
{
|
||||
HelpID = "cui:ListBox:RID_SVXDLG_CHARMAP:LB_SUBSET";
|
||||
Pos = MAP_APPFONT ( 161 , 6 ) ;
|
||||
Size = MAP_APPFONT ( 63 , 68 ) ;
|
||||
Sort = FALSE ;
|
||||
TabStop = TRUE ;
|
||||
DropDown = TRUE ;
|
||||
};
|
||||
FixedText FT_SYMBOLE
|
||||
{
|
||||
Pos = MAP_APPFONT ( 6 , 140 ) ;
|
||||
Size = MAP_APPFONT ( 38 , 8 ) ;
|
||||
Left = TRUE ;
|
||||
Text [ en-US ] = "Characters:";
|
||||
};
|
||||
Control CT_SHOWTEXT
|
||||
{
|
||||
HelpId = HID_CHARMAP_CTL_SHOWTEXT ;
|
||||
Pos = MAP_APPFONT ( 46 , 137 ) ;
|
||||
Size = MAP_APPFONT ( 244 , 16 ) ;
|
||||
Group = TRUE ;
|
||||
};
|
||||
Control CT_SHOWCHAR
|
||||
{
|
||||
HelpId = HID_CHARMAP_CTL_SHOWCHAR ;
|
||||
Pos = MAP_APPFONT ( 241 , 79 ) ;
|
||||
Size = MAP_APPFONT ( 50 , 44 ) ;
|
||||
Group = TRUE ;
|
||||
};
|
||||
FixedText FT_CHARCODE
|
||||
{
|
||||
Pos = MAP_APPFONT ( 241 , 126 ) ;
|
||||
Size = MAP_APPFONT ( 50 , 8 ) ;
|
||||
Center = TRUE ;
|
||||
};
|
||||
OKButton BTN_CHAR_OK
|
||||
{
|
||||
Pos = MAP_APPFONT ( 242 , 6 ) ;
|
||||
Size = MAP_APPFONT ( 50 , 14 ) ;
|
||||
TabStop = TRUE ;
|
||||
DefButton = TRUE ;
|
||||
};
|
||||
CancelButton BTN_CHAR_CANCEL
|
||||
{
|
||||
Pos = MAP_APPFONT ( 242 , 23 ) ;
|
||||
Size = MAP_APPFONT ( 50 , 14 ) ;
|
||||
TabStop = TRUE ;
|
||||
};
|
||||
HelpButton BTN_CHAR_HELP
|
||||
{
|
||||
Pos = MAP_APPFONT ( 242 , 43 ) ;
|
||||
Size = MAP_APPFONT ( 50 , 14 ) ;
|
||||
TabStop = TRUE ;
|
||||
};
|
||||
PushButton BTN_DELETE
|
||||
{
|
||||
HelpID = "cui:PushButton:RID_SVXDLG_CHARMAP:BTN_DELETE";
|
||||
Pos = MAP_APPFONT ( 242 , 63 ) ;
|
||||
Size = MAP_APPFONT ( 50 , 14 ) ;
|
||||
Text [ en-US ] = "~Delete";
|
||||
};
|
||||
};
|
||||
|
||||
// ********************************************************************** EOF
|
@@ -48,29 +48,28 @@
|
||||
#include <sfx2/sfxsids.hrc>
|
||||
#include <sfx2/app.hxx>
|
||||
#include <editeng/fontitem.hxx>
|
||||
#include "charmap.hrc"
|
||||
#include "macroass.hxx"
|
||||
|
||||
// class SvxCharacterMap =================================================
|
||||
|
||||
SvxCharacterMap::SvxCharacterMap( Window* pParent, sal_Bool bOne_, const SfxItemSet* pSet )
|
||||
: SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_CHARMAP ) ),
|
||||
aShowSet ( this, CUI_RES( CT_SHOWSET ) ),
|
||||
aShowText ( this, CUI_RES( CT_SHOWTEXT ) ),
|
||||
aOKBtn ( this, CUI_RES( BTN_CHAR_OK ) ),
|
||||
aCancelBtn ( this, CUI_RES( BTN_CHAR_CANCEL ) ),
|
||||
aHelpBtn ( this, CUI_RES( BTN_CHAR_HELP ) ),
|
||||
aDeleteBtn ( this, CUI_RES( BTN_DELETE ) ),
|
||||
aFontText ( this, CUI_RES( FT_FONT ) ),
|
||||
aFontLB ( this, CUI_RES( LB_FONT ) ),
|
||||
aSubsetText ( this, CUI_RES( FT_SUBSET ) ),
|
||||
aSubsetLB ( this, CUI_RES( LB_SUBSET ) ),
|
||||
aSymbolText ( this, CUI_RES( FT_SYMBOLE ) ),
|
||||
aShowChar ( this, CUI_RES( CT_SHOWCHAR ), sal_True ),
|
||||
aCharCodeText ( this, CUI_RES( FT_CHARCODE ) ),
|
||||
bOne( bOne_ ),
|
||||
pSubsetMap( NULL )
|
||||
: SfxModalDialog(pParent, "SpecialCharactersDialog", "cui/ui/specialcharacters.ui")
|
||||
, bOne( bOne_ )
|
||||
, pSubsetMap( NULL )
|
||||
{
|
||||
get(m_pShowSet, "showcharset");
|
||||
get(m_pShowChar, "showchar");
|
||||
m_pShowChar->SetCentered(true);
|
||||
get(m_pShowText, "showtext");
|
||||
get(m_pOKBtn, "ok");
|
||||
get(m_pDeleteBtn, "delete");
|
||||
get(m_pFontText, "fontft");
|
||||
get(m_pFontLB, "fontlb");
|
||||
get(m_pSubsetText, "subsetft");
|
||||
get(m_pSubsetLB, "subsetlb");
|
||||
get(m_pCharCodeText, "charcodeft");
|
||||
get(m_pSymbolText, "symboltext");
|
||||
|
||||
SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, FN_PARAM_1, sal_False );
|
||||
if ( pItem )
|
||||
bOne = pItem->GetValue();
|
||||
@@ -101,7 +100,6 @@ SvxCharacterMap::SvxCharacterMap( Window* pParent, sal_Bool bOne_, const SfxItem
|
||||
SetCharFont( aTmpFont );
|
||||
}
|
||||
|
||||
FreeResource();
|
||||
CreateOutputItemSet( pSet ? *pSet->GetPool() : SFX_APP()->GetPool() );
|
||||
}
|
||||
|
||||
@@ -122,21 +120,21 @@ const Font& SvxCharacterMap::GetCharFont() const
|
||||
|
||||
void SvxCharacterMap::SetChar( sal_UCS4 c )
|
||||
{
|
||||
aShowSet.SelectCharacter( c );
|
||||
m_pShowSet->SelectCharacter( c );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
sal_UCS4 SvxCharacterMap::GetChar() const
|
||||
{
|
||||
return aShowSet.GetSelectCharacter();
|
||||
return m_pShowSet->GetSelectCharacter();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
String SvxCharacterMap::GetCharacters() const
|
||||
{
|
||||
return aShowText.GetText();
|
||||
return m_pShowText->GetText();
|
||||
}
|
||||
|
||||
|
||||
@@ -144,8 +142,8 @@ String SvxCharacterMap::GetCharacters() const
|
||||
|
||||
void SvxCharacterMap::DisableFontSelection()
|
||||
{
|
||||
aFontText.Disable();
|
||||
aFontLB.Disable();
|
||||
m_pFontText->Disable();
|
||||
m_pFontLB->Disable();
|
||||
}
|
||||
|
||||
short SvxCharacterMap::Execute()
|
||||
@@ -177,6 +175,16 @@ SvxShowText::SvxShowText( Window* pParent, const ResId& rResId, sal_Bool bCenter
|
||||
mbCenter( bCenter)
|
||||
{}
|
||||
|
||||
SvxShowText::SvxShowText( Window* pParent, sal_Bool bCenter )
|
||||
: Control( pParent ),
|
||||
mbCenter( bCenter)
|
||||
{}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxShowText(Window *pParent, VclBuilder::stringmap &)
|
||||
{
|
||||
return new SvxShowText(pParent);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvxShowText::Paint( const Rectangle& )
|
||||
@@ -246,6 +254,12 @@ void SvxShowText::SetFont( const Font& rFont )
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void SvxShowText::Resize()
|
||||
{
|
||||
Control::Resize();
|
||||
SetFont(GetFont()); //force recalculation of size
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvxShowText::SetText( const String& rText )
|
||||
@@ -269,14 +283,11 @@ void SvxCharacterMap::init()
|
||||
aFont.SetPitch( PITCH_DONTKNOW );
|
||||
aFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
|
||||
|
||||
if ( bOne )
|
||||
if (bOne)
|
||||
{
|
||||
Size aDlgSize = GetSizePixel();
|
||||
SetSizePixel( Size( aDlgSize.Width(),
|
||||
aDlgSize.Height()-aShowText.GetSizePixel().Height() ) );
|
||||
aSymbolText.Hide();
|
||||
aShowText.Hide();
|
||||
aDeleteBtn.Hide();
|
||||
m_pSymbolText->Hide();
|
||||
m_pShowText->Hide();
|
||||
m_pDeleteBtn->Hide();
|
||||
}
|
||||
|
||||
rtl::OUString aDefStr( aFont.GetName() );
|
||||
@@ -288,21 +299,21 @@ void SvxCharacterMap::init()
|
||||
if ( aFontName != aLastName )
|
||||
{
|
||||
aLastName = aFontName;
|
||||
sal_uInt16 nPos = aFontLB.InsertEntry( aFontName );
|
||||
aFontLB.SetEntryData( nPos, (void*)(sal_uLong)i );
|
||||
sal_uInt16 nPos = m_pFontLB->InsertEntry( aFontName );
|
||||
m_pFontLB->SetEntryData( nPos, (void*)(sal_uLong)i );
|
||||
}
|
||||
}
|
||||
// the font may not be in the list =>
|
||||
// try to find a font name token in list and select found font,
|
||||
// else select topmost entry
|
||||
bool bFound = (aFontLB.GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND );
|
||||
bool bFound = (m_pFontLB->GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND );
|
||||
if( !bFound )
|
||||
{
|
||||
sal_Int32 nIndex = 0;
|
||||
do
|
||||
{
|
||||
rtl::OUString aToken = aDefStr.getToken(0, ';', nIndex);
|
||||
if ( aFontLB.GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND )
|
||||
if ( m_pFontLB->GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND )
|
||||
{
|
||||
aDefStr = aToken;
|
||||
bFound = sal_True;
|
||||
@@ -313,29 +324,24 @@ void SvxCharacterMap::init()
|
||||
}
|
||||
|
||||
if ( bFound )
|
||||
aFontLB.SelectEntry( aDefStr );
|
||||
else if ( aFontLB.GetEntryCount() )
|
||||
aFontLB.SelectEntryPos(0);
|
||||
FontSelectHdl( &aFontLB );
|
||||
m_pFontLB->SelectEntry( aDefStr );
|
||||
else if ( m_pFontLB->GetEntryCount() )
|
||||
m_pFontLB->SelectEntryPos(0);
|
||||
FontSelectHdl(m_pFontLB);
|
||||
|
||||
aOKBtn.SetClickHdl( LINK( this, SvxCharacterMap, OKHdl ) );
|
||||
aFontLB.SetSelectHdl( LINK( this, SvxCharacterMap, FontSelectHdl ) );
|
||||
aSubsetLB.SetSelectHdl( LINK( this, SvxCharacterMap, SubsetSelectHdl ) );
|
||||
aShowSet.SetDoubleClickHdl( LINK( this, SvxCharacterMap, CharDoubleClickHdl ) );
|
||||
aShowSet.SetSelectHdl( LINK( this, SvxCharacterMap, CharSelectHdl ) );
|
||||
aShowSet.SetHighlightHdl( LINK( this, SvxCharacterMap, CharHighlightHdl ) );
|
||||
aShowSet.SetPreSelectHdl( LINK( this, SvxCharacterMap, CharPreSelectHdl ) );
|
||||
aDeleteBtn.SetClickHdl( LINK( this, SvxCharacterMap, DeleteHdl ) );
|
||||
m_pOKBtn->SetClickHdl( LINK( this, SvxCharacterMap, OKHdl ) );
|
||||
m_pFontLB->SetSelectHdl( LINK( this, SvxCharacterMap, FontSelectHdl ) );
|
||||
m_pSubsetLB->SetSelectHdl( LINK( this, SvxCharacterMap, SubsetSelectHdl ) );
|
||||
m_pShowSet->SetDoubleClickHdl( LINK( this, SvxCharacterMap, CharDoubleClickHdl ) );
|
||||
m_pShowSet->SetSelectHdl( LINK( this, SvxCharacterMap, CharSelectHdl ) );
|
||||
m_pShowSet->SetHighlightHdl( LINK( this, SvxCharacterMap, CharHighlightHdl ) );
|
||||
m_pShowSet->SetPreSelectHdl( LINK( this, SvxCharacterMap, CharPreSelectHdl ) );
|
||||
m_pDeleteBtn->SetClickHdl( LINK( this, SvxCharacterMap, DeleteHdl ) );
|
||||
|
||||
if( SvxShowCharSet::getSelectedChar() == ' ')
|
||||
aOKBtn.Disable();
|
||||
m_pOKBtn->Disable();
|
||||
else
|
||||
aOKBtn.Enable();
|
||||
|
||||
// left align aShowText field
|
||||
int nLeftEdge = aSymbolText.GetPosPixel().X();
|
||||
nLeftEdge += aSymbolText.GetTextWidth( aSymbolText.GetText() );
|
||||
aShowText.SetPosPixel( Point( nLeftEdge+4, aShowText.GetPosPixel().Y() ) );
|
||||
m_pOKBtn->Enable();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -346,12 +352,12 @@ void SvxCharacterMap::SetCharFont( const Font& rFont )
|
||||
// like "Times New Roman;Times" resolved
|
||||
Font aTmp( GetFontMetric( rFont ) );
|
||||
|
||||
if ( aFontLB.GetEntryPos( aTmp.GetName() ) == LISTBOX_ENTRY_NOTFOUND )
|
||||
if ( m_pFontLB->GetEntryPos( aTmp.GetName() ) == LISTBOX_ENTRY_NOTFOUND )
|
||||
return;
|
||||
|
||||
aFontLB.SelectEntry( aTmp.GetName() );
|
||||
m_pFontLB->SelectEntry( aTmp.GetName() );
|
||||
aFont = aTmp;
|
||||
FontSelectHdl( &aFontLB );
|
||||
FontSelectHdl(m_pFontLB);
|
||||
|
||||
// for compatibility reasons
|
||||
ModalDialog::SetFont( aFont );
|
||||
@@ -361,14 +367,14 @@ void SvxCharacterMap::SetCharFont( const Font& rFont )
|
||||
|
||||
IMPL_LINK_NOARG(SvxCharacterMap, OKHdl)
|
||||
{
|
||||
String aStr = aShowText.GetText();
|
||||
String aStr = m_pShowText->GetText();
|
||||
|
||||
if ( !aStr.Len() )
|
||||
{
|
||||
sal_UCS4 cChar = aShowSet.GetSelectCharacter();
|
||||
sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
|
||||
// using the new UCS4 constructor
|
||||
rtl::OUString aOUStr( &cChar, 1 );
|
||||
aShowText.SetText( aOUStr );
|
||||
m_pShowText->SetText( aOUStr );
|
||||
}
|
||||
EndDialog( sal_True );
|
||||
return 0;
|
||||
@@ -378,8 +384,8 @@ IMPL_LINK_NOARG(SvxCharacterMap, OKHdl)
|
||||
|
||||
IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl)
|
||||
{
|
||||
sal_uInt16 nPos = aFontLB.GetSelectEntryPos(),
|
||||
nFont = (sal_uInt16)(sal_uLong)aFontLB.GetEntryData( nPos );
|
||||
sal_uInt16 nPos = m_pFontLB->GetSelectEntryPos(),
|
||||
nFont = (sal_uInt16)(sal_uLong)m_pFontLB->GetEntryData( nPos );
|
||||
aFont = GetDevFont( nFont );
|
||||
aFont.SetWeight( WEIGHT_DONTKNOW );
|
||||
aFont.SetItalic( ITALIC_NONE );
|
||||
@@ -388,50 +394,43 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl)
|
||||
aFont.SetFamily( FAMILY_DONTKNOW );
|
||||
|
||||
// notify children using this font
|
||||
aShowSet.SetFont( aFont );
|
||||
aShowChar.SetFont( aFont );
|
||||
aShowText.SetFont( aFont );
|
||||
|
||||
// right align some fields to aShowSet
|
||||
int nRightEdge = aShowSet.GetPosPixel().X() + aShowSet.GetOutputSizePixel().Width();
|
||||
Size aNewSize = aSubsetLB.GetOutputSizePixel();
|
||||
aNewSize.setWidth( nRightEdge - aSubsetLB.GetPosPixel().X() );
|
||||
aSubsetLB.SetOutputSizePixel( aNewSize );
|
||||
m_pShowSet->SetFont( aFont );
|
||||
m_pShowChar->SetFont( aFont );
|
||||
m_pShowText->SetFont( aFont );
|
||||
|
||||
// setup unicode subset listbar with font specific subsets,
|
||||
// hide unicode subset listbar for symbol fonts
|
||||
// TODO: get info from the Font once it provides it
|
||||
if( pSubsetMap)
|
||||
delete pSubsetMap;
|
||||
delete pSubsetMap;
|
||||
pSubsetMap = NULL;
|
||||
|
||||
sal_Bool bNeedSubset = (aFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL);
|
||||
if( bNeedSubset )
|
||||
{
|
||||
FontCharMap aFontCharMap;
|
||||
aShowSet.GetFontCharMap( aFontCharMap );
|
||||
m_pShowSet->GetFontCharMap( aFontCharMap );
|
||||
pSubsetMap = new SubsetMap( &aFontCharMap );
|
||||
|
||||
// update subset listbox for new font's unicode subsets
|
||||
aSubsetLB.Clear();
|
||||
m_pSubsetLB->Clear();
|
||||
// TODO: is it worth to improve the stupid linear search?
|
||||
bool bFirst = true;
|
||||
const Subset* s;
|
||||
while( NULL != (s = pSubsetMap->GetNextSubset( bFirst )) )
|
||||
{
|
||||
sal_uInt16 nPos_ = aSubsetLB.InsertEntry( s->GetName() );
|
||||
aSubsetLB.SetEntryData( nPos_, (void*)s );
|
||||
sal_uInt16 nPos_ = m_pSubsetLB->InsertEntry( s->GetName() );
|
||||
m_pSubsetLB->SetEntryData( nPos_, (void*)s );
|
||||
// NOTE: subset must live at least as long as the selected font
|
||||
if( bFirst )
|
||||
aSubsetLB.SelectEntryPos( nPos_ );
|
||||
m_pSubsetLB->SelectEntryPos( nPos_ );
|
||||
bFirst = false;
|
||||
}
|
||||
if( aSubsetLB.GetEntryCount() <= 1 )
|
||||
if( m_pSubsetLB->GetEntryCount() <= 1 )
|
||||
bNeedSubset = sal_False;
|
||||
}
|
||||
|
||||
aSubsetText.Show( bNeedSubset);
|
||||
aSubsetLB.Show( bNeedSubset);
|
||||
m_pSubsetText->Show( bNeedSubset);
|
||||
m_pSubsetLB->Show( bNeedSubset);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -440,14 +439,14 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl)
|
||||
|
||||
IMPL_LINK_NOARG(SvxCharacterMap, SubsetSelectHdl)
|
||||
{
|
||||
sal_uInt16 nPos = aSubsetLB.GetSelectEntryPos();
|
||||
const Subset* pSubset = reinterpret_cast<const Subset*> (aSubsetLB.GetEntryData(nPos));
|
||||
sal_uInt16 nPos = m_pSubsetLB->GetSelectEntryPos();
|
||||
const Subset* pSubset = reinterpret_cast<const Subset*> (m_pSubsetLB->GetEntryData(nPos));
|
||||
if( pSubset )
|
||||
{
|
||||
sal_UCS4 cFirst = pSubset->GetRangeMin();
|
||||
aShowSet.SelectCharacter( cFirst );
|
||||
m_pShowSet->SelectCharacter( cFirst );
|
||||
}
|
||||
aSubsetLB.SelectEntryPos( nPos );
|
||||
m_pSubsetLB->SelectEntryPos( nPos );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -465,18 +464,18 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl)
|
||||
{
|
||||
if ( !bOne )
|
||||
{
|
||||
String aText = aShowText.GetText();
|
||||
String aText = m_pShowText->GetText();
|
||||
|
||||
if ( aText.Len() != CHARMAP_MAXLEN )
|
||||
{
|
||||
sal_UCS4 cChar = aShowSet.GetSelectCharacter();
|
||||
sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
|
||||
// using the new UCS4 constructor
|
||||
rtl::OUString aOUStr( &cChar, 1 );
|
||||
aShowText.SetText( aText + aOUStr );
|
||||
m_pShowText->SetText( aText + aOUStr );
|
||||
}
|
||||
|
||||
}
|
||||
aOKBtn.Enable();
|
||||
m_pOKBtn->Enable();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -485,7 +484,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl)
|
||||
IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl)
|
||||
{
|
||||
String aText;
|
||||
sal_UCS4 cChar = aShowSet.GetSelectCharacter();
|
||||
sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
|
||||
sal_Bool bSelect = (cChar > 0);
|
||||
|
||||
// show char sample
|
||||
@@ -498,12 +497,12 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl)
|
||||
if( pSubsetMap )
|
||||
pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
|
||||
if( pSubset )
|
||||
aSubsetLB.SelectEntry( pSubset->GetName() );
|
||||
m_pSubsetLB->SelectEntry( pSubset->GetName() );
|
||||
else
|
||||
aSubsetLB.SetNoSelection();
|
||||
m_pSubsetLB->SetNoSelection();
|
||||
}
|
||||
aShowChar.SetText( aText );
|
||||
aShowChar.Update();
|
||||
m_pShowChar->SetText( aText );
|
||||
m_pShowChar->Update();
|
||||
|
||||
// show char code
|
||||
if ( bSelect )
|
||||
@@ -514,7 +513,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl)
|
||||
snprintf( aBuf+6, sizeof(aBuf)-6, " (%u)", static_cast<unsigned>(cChar) );
|
||||
aText = rtl::OUString::createFromAscii(aBuf);
|
||||
}
|
||||
aCharCodeText.SetText( aText );
|
||||
m_pCharCodeText->SetText( aText );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -526,13 +525,13 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharPreSelectHdl)
|
||||
// adjust subset selection
|
||||
if( pSubsetMap )
|
||||
{
|
||||
sal_UCS4 cChar = aShowSet.GetSelectCharacter();
|
||||
sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
|
||||
const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
|
||||
if( pSubset )
|
||||
aSubsetLB.SelectEntry( pSubset->GetName() );
|
||||
m_pSubsetLB->SelectEntry( pSubset->GetName() );
|
||||
}
|
||||
|
||||
aOKBtn.Enable();
|
||||
m_pOKBtn->Enable();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -540,8 +539,8 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharPreSelectHdl)
|
||||
|
||||
IMPL_LINK_NOARG(SvxCharacterMap, DeleteHdl)
|
||||
{
|
||||
aShowText.SetText( String() );
|
||||
aOKBtn.Disable();
|
||||
m_pShowText->SetText( String() );
|
||||
m_pOKBtn->Disable();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -1302,24 +1302,13 @@ AbstractSvxHlinkDlgMarkWnd* AbstractDialogFactory_Impl::CreateSvxHlinkDlgMarkWnd
|
||||
return 0;
|
||||
}
|
||||
|
||||
SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( sal_uInt32 nResId,
|
||||
SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( sal_uInt32,
|
||||
Window* pParent,
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& ,
|
||||
const SfxItemSet* pAttrSet )
|
||||
{
|
||||
SfxModalDialog* pDlg=NULL;
|
||||
switch ( nResId )
|
||||
{
|
||||
case RID_SVXDLG_CHARMAP :
|
||||
pDlg = new SvxCharacterMap( pParent, sal_True, pAttrSet );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( pDlg )
|
||||
return new AbstractSfxDialog_Impl( pDlg );
|
||||
return 0;
|
||||
SfxModalDialog* pDlg = new SvxCharacterMap( pParent, sal_True, pAttrSet );
|
||||
return new AbstractSfxDialog_Impl( pDlg );
|
||||
}
|
||||
|
||||
SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabItemDialog( Window* pParent,
|
||||
|
@@ -51,10 +51,15 @@ public:
|
||||
SvxShowText( Window* pParent,
|
||||
const ResId& rResId,
|
||||
sal_Bool bCenter = sal_False );
|
||||
SvxShowText( Window* pParent,
|
||||
sal_Bool bCenter = sal_False );
|
||||
~SvxShowText();
|
||||
|
||||
void SetFont( const Font& rFont );
|
||||
void SetText( const String& rText );
|
||||
void SetCentered(bool bCenter) { mbCenter = bCenter; }
|
||||
|
||||
virtual void Resize();
|
||||
|
||||
protected:
|
||||
virtual void Paint( const Rectangle& );
|
||||
@@ -73,19 +78,17 @@ private:
|
||||
|
||||
void init();
|
||||
|
||||
SvxShowCharSet aShowSet;
|
||||
SvxShowText aShowText;
|
||||
OKButton aOKBtn;
|
||||
CancelButton aCancelBtn;
|
||||
HelpButton aHelpBtn;
|
||||
PushButton aDeleteBtn;
|
||||
FixedText aFontText;
|
||||
ListBox aFontLB;
|
||||
FixedText aSubsetText;
|
||||
ListBox aSubsetLB;
|
||||
FixedText aSymbolText;
|
||||
SvxShowText aShowChar;
|
||||
FixedText aCharCodeText;
|
||||
SvxShowCharSet* m_pShowSet;
|
||||
SvxShowText* m_pShowText;
|
||||
OKButton* m_pOKBtn;
|
||||
PushButton* m_pDeleteBtn;
|
||||
FixedText* m_pFontText;
|
||||
ListBox* m_pFontLB;
|
||||
FixedText* m_pSubsetText;
|
||||
ListBox* m_pSubsetLB;
|
||||
FixedText* m_pSymbolText;
|
||||
SvxShowText* m_pShowChar;
|
||||
FixedText* m_pCharCodeText;
|
||||
Font aFont;
|
||||
sal_Bool bOne;
|
||||
const SubsetMap* pSubsetMap;
|
||||
|
@@ -3338,26 +3338,20 @@ void SvxCharTwoLinesPage::Initialize()
|
||||
|
||||
void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
|
||||
{
|
||||
|
||||
bool bStart = pBox == m_pStartBracketLB;
|
||||
//SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
||||
//if(pFact)
|
||||
{
|
||||
//AbstractSvxCharacterMap* aDlg = pFact->CreateSvxCharacterMap( this, RID_SVXDLG_CHARMAP );
|
||||
SvxCharacterMap* aDlg = new SvxCharacterMap( this );
|
||||
aDlg->DisableFontSelection();
|
||||
SvxCharacterMap* aDlg = new SvxCharacterMap( this );
|
||||
aDlg->DisableFontSelection();
|
||||
|
||||
if ( aDlg->Execute() == RET_OK )
|
||||
{
|
||||
sal_Unicode cChar = (sal_Unicode) aDlg->GetChar();
|
||||
SetBracket( cChar, bStart );
|
||||
}
|
||||
else
|
||||
{
|
||||
pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition );
|
||||
}
|
||||
delete aDlg;
|
||||
if ( aDlg->Execute() == RET_OK )
|
||||
{
|
||||
sal_Unicode cChar = (sal_Unicode) aDlg->GetChar();
|
||||
SetBracket( cChar, bStart );
|
||||
}
|
||||
else
|
||||
{
|
||||
pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition );
|
||||
}
|
||||
delete aDlg;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
@@ -53,6 +53,7 @@ class SVX_DLLPUBLIC SvxShowCharSet : public Control
|
||||
{
|
||||
public:
|
||||
SvxShowCharSet( Window* pParent, const ResId& rResId );
|
||||
SvxShowCharSet( Window* pParent );
|
||||
~SvxShowCharSet();
|
||||
|
||||
void SetFont( const Font& rFont );
|
||||
@@ -87,6 +88,8 @@ public:
|
||||
sal_Int32 getMaxCharCount() const;
|
||||
#endif // _SVX_CHARMAP_CXX_
|
||||
|
||||
virtual void Resize();
|
||||
|
||||
protected:
|
||||
virtual void Paint( const Rectangle& );
|
||||
virtual void MouseButtonDown( const MouseEvent& rMEvt );
|
||||
@@ -130,6 +133,8 @@ private:
|
||||
// abstraction layers are: Unicode<->MapIndex<->Pixel
|
||||
Point MapIndexToPixel( int) const;
|
||||
DECL_LINK(VscrollHdl, void *);
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -65,10 +65,25 @@ sal_uInt32& SvxShowCharSet::getSelectedChar()
|
||||
|
||||
#define SBWIDTH 16
|
||||
|
||||
SvxShowCharSet::SvxShowCharSet( Window* pParent, const ResId& rResId ) :
|
||||
Control( pParent, rResId )
|
||||
,m_pAccessible(NULL)
|
||||
,aVscrollSB( this, WB_VERT)
|
||||
SvxShowCharSet::SvxShowCharSet(Window* pParent, const ResId& rResId)
|
||||
: Control(pParent, rResId)
|
||||
, m_pAccessible(NULL)
|
||||
, aVscrollSB(this, WB_VERT)
|
||||
{
|
||||
init();
|
||||
InitSettings( sal_True, sal_True );
|
||||
}
|
||||
|
||||
SvxShowCharSet::SvxShowCharSet(Window* pParent)
|
||||
: Control(pParent)
|
||||
, m_pAccessible(NULL)
|
||||
, aVscrollSB( this, WB_VERT)
|
||||
{
|
||||
init();
|
||||
InitSettings( sal_True, sal_True );
|
||||
}
|
||||
|
||||
void SvxShowCharSet::init()
|
||||
{
|
||||
nSelectedIndex = -1; // TODO: move into init list when it is no longer static
|
||||
|
||||
@@ -81,7 +96,21 @@ SvxShowCharSet::SvxShowCharSet( Window* pParent, const ResId& rResId ) :
|
||||
// other settings like aVscroll depend on selected font => see SetFont
|
||||
|
||||
bDrag = sal_False;
|
||||
InitSettings( sal_True, sal_True );
|
||||
}
|
||||
|
||||
void SvxShowCharSet::Resize()
|
||||
{
|
||||
aOrigSize = GetOutputSizePixel();
|
||||
aOrigPos = GetPosPixel();
|
||||
|
||||
Control::Resize();
|
||||
|
||||
SetFont(GetFont()); //force recalculation of correct fontsize
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxShowCharSet(Window *pParent, VclBuilder::stringmap &)
|
||||
{
|
||||
return new SvxShowCharSet(pParent);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user