weld SvxCharacterMap dialog
and SmSymDefineDialog
There's a whole bunch of interrelated stuff which needs to work at the same
time.
add menu support, keyboard support, better mouse support,
a gtk scrollable adaptor to support pseudo scrolling drawing bodge,
plugable uitest support for custom widgets, plugable a11y support
for custom widgets via the existing atk_object_wrapper_new wrapper
for XAccessible
In this specific case, change SvxCharacterMap from something that has an
internal scrollbar to a scrolledwindow where the scrollbar is external, which
drops the need for the a11y impl of SvxCharacterMap to emulate being a scrolled
window and internal table and just needs the table a11y impl
Change-Id: Ia2743d6958021c525a1900154dcbb69ae33fc400
Reviewed-on: https://gerrit.libreoffice.org/52084
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
index f3c59f6..89cc3ca 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -166,7 +166,8 @@ void ChartController::executeDispatch_InsertSpecialCharacter()
vcl::Font aCurFont = m_pDrawViewWrapper->getOutliner()->GetRefDevice()->GetFont();
aSet.Put( SvxFontItem( aCurFont.GetFamilyType(), aCurFont.GetFamilyName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), SID_ATTR_CHAR_FONT ) );
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog( GetChartWindow(), aSet, false ));
vcl::Window* pWin = GetChartWindow();
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(pWin ? pWin->GetFrameWeld() : nullptr, aSet, false));
OSL_ENSURE( pDlg, "Couldn't create SvxCharacterMap dialog" );
if( pDlg->Execute() == RET_OK )
{
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index 87605ab..2b9459b 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -227,9 +227,9 @@ public:
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
DECL_LINK(DoResize, const Size& rSize, void);
DECL_LINK(DoButtonDown, const Point& rMEvt, void);
DECL_LINK(DoMouseMove, const Point& rMEvt, void);
DECL_LINK(DoButtonUp, const Point& rMEvt, void);
DECL_LINK(DoButtonDown, const MouseEvent& rMEvt, void);
DECL_LINK(DoMouseMove, const MouseEvent& rMEvt, void);
DECL_LINK(DoButtonUp, const MouseEvent& rMEvt, void);
void UpdateBitmap();
void ShowPosition( const Point& rPos, bool bUpdate );
@@ -438,22 +438,24 @@ void ColorFieldControl::ShowPosition( const Point& rPos, bool bUpdate )
}
}
IMPL_LINK(ColorFieldControl, DoButtonDown, const Point&, rMEvt, void)
IMPL_LINK(ColorFieldControl, DoButtonDown, const MouseEvent&, rMEvt, void)
{
m_xDrawingArea->connect_mouse_move(LINK(this, ColorFieldControl, DoMouseMove));
ShowPosition(rMEvt, true);
m_xDrawingArea->grab_add();
ShowPosition(rMEvt.GetPosPixel(), true);
Modify();
}
IMPL_LINK(ColorFieldControl, DoMouseMove, const Point&, rMEvt, void)
IMPL_LINK(ColorFieldControl, DoMouseMove, const MouseEvent&, rMEvt, void)
{
ShowPosition(rMEvt, true);
ShowPosition(rMEvt.GetPosPixel(), true);
Modify();
}
IMPL_LINK_NOARG(ColorFieldControl, DoButtonUp, const Point&, void)
IMPL_LINK_NOARG(ColorFieldControl, DoButtonUp, const MouseEvent&, void)
{
m_xDrawingArea->connect_mouse_move(Link<const Point&, void>());
m_xDrawingArea->grab_remove();
m_xDrawingArea->connect_mouse_move(Link<const MouseEvent&, void>());
}
IMPL_LINK(ColorFieldControl, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
@@ -522,9 +524,9 @@ public:
ColorSliderControl(weld::DrawingArea* pDrawingArea);
~ColorSliderControl();
DECL_LINK(DoButtonDown, const Point& rMEvt, void);
DECL_LINK(DoMouseMove, const Point& rMEvt, void);
DECL_LINK(DoButtonUp, const Point& rMEvt, void);
DECL_LINK(DoButtonDown, const MouseEvent& rMEvt, void);
DECL_LINK(DoMouseMove, const MouseEvent& rMEvt, void);
DECL_LINK(DoButtonUp, const MouseEvent& rMEvt, void);
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
DECL_LINK(DoResize, const Size& rSize, void);
@@ -661,25 +663,24 @@ void ColorSliderControl::ChangePosition(long nY)
mdValue = double(nHeight - nY) / double(nHeight);
}
IMPL_LINK(ColorSliderControl, DoButtonDown, const Point&, rMEvt, void)
IMPL_LINK(ColorSliderControl, DoButtonDown, const MouseEvent&, rMEvt, void)
{
m_xDrawingArea->connect_mouse_move(LINK(this, ColorSliderControl, DoMouseMove));
ChangePosition(rMEvt.Y());
ChangePosition(rMEvt.GetPosPixel().Y());
Modify();
}
IMPL_LINK(ColorSliderControl, DoMouseMove, const Point&, rMEvt, void)
IMPL_LINK(ColorSliderControl, DoMouseMove, const MouseEvent&, rMEvt, void)
{
ChangePosition(rMEvt.Y());
ChangePosition(rMEvt.GetPosPixel().Y());
Modify();
}
IMPL_LINK_NOARG(ColorSliderControl, DoButtonUp, const Point&, void)
IMPL_LINK_NOARG(ColorSliderControl, DoButtonUp, const MouseEvent&, void)
{
m_xDrawingArea->connect_mouse_move(Link<const Point&, void>());
m_xDrawingArea->connect_mouse_move(Link<const MouseEvent&, void>());
}
IMPL_LINK(ColorSliderControl, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
{
vcl::RenderContext& rRenderContext = aPayload.first;
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 2aa6c6c..ea36b0c 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -32,6 +32,7 @@
#include <vcl/builderfactory.hxx>
#include <vcl/fontcharmap.hxx>
#include <svl/stritem.hxx>
#include <o3tl/make_unique.hxx>
#include <officecfg/Office/Common.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
@@ -52,71 +53,72 @@
using namespace css;
// class SvxCharacterMap =================================================
SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, const SfxItemSet* pSet, bool bInsert )
: SfxModalDialog(pParent, "SpecialCharactersDialog", "cui/ui/specialcharacters.ui")
SvxCharacterMap::SvxCharacterMap(weld::Window* pParent, const SfxItemSet* pSet, bool bInsert)
: GenericDialogController(pParent, "cui/ui/specialcharacters.ui", "SpecialCharactersDialog")
, m_xVirDev(VclPtr<VirtualDevice>::Create())
, pSubsetMap( nullptr )
, isSearchMode(true)
, m_bHasInsert(bInsert)
, mxContext(comphelper::getProcessComponentContext())
, m_xOKBtn(bInsert ? m_xBuilder->weld_button("insert") : m_xBuilder->weld_button("ok"))
, m_xFontText(m_xBuilder->weld_label("fontft"))
, m_xFontLB(m_xBuilder->weld_combo_box_text("fontlb"))
, m_xSubsetText(m_xBuilder->weld_label("subsetft"))
, m_xSubsetLB(m_xBuilder->weld_combo_box_text("subsetlb"))
, m_xSearchText(m_xBuilder->weld_entry("search"))
, m_xHexCodeText(m_xBuilder->weld_entry("hexvalue"))
, m_xDecimalCodeText(m_xBuilder->weld_entry("decimalvalue"))
, m_xFavouritesBtn(m_xBuilder->weld_button("favbtn"))
, m_xCharName(m_xBuilder->weld_label("charname"))
, m_xRecentGrid(m_xBuilder->weld_widget("viewgrid"))
, m_xFavGrid(m_xBuilder->weld_widget("favgrid"))
, m_xShowChar(new SvxShowText(*m_xBuilder, "showchar", m_xVirDev))
, m_xRecentCharView{o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar1", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar2", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar3", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar4", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar5", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar6", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar7", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar8", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar9", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar10", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar11", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar12", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar13", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar14", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar15", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "viewchar16", m_xVirDev)}
, m_xFavCharView{o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar1", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar2", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar3", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar4", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar5", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar6", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar7", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar8", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar9", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar10", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar11", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar12", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar13", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar14", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar15", m_xVirDev),
o3tl::make_unique<SvxCharView>(*m_xBuilder, "favchar16", m_xVirDev)}
, m_xShowSet(new SvxShowCharSet(*m_xBuilder, "showcharset", "showscroll", m_xVirDev))
, m_xSearchSet(new SvxSearchCharSet(*m_xBuilder, "searchcharset", "searchscroll", m_xVirDev))
{
get(m_pShowSet, "showcharset");
get(m_pSearchSet, "searchcharset");
get(m_pShowChar, "showchar");
m_pShowChar->SetCentered(true);
if (m_bHasInsert) get(m_pOKBtn, "insert");
else get(m_pOKBtn, "ok");
get(m_pFontText, "fontft");
get(m_pFontLB, "fontlb");
m_pFontLB->SetStyle(m_pFontLB->GetStyle() | WB_SORT);
get(m_pSubsetText, "subsetft");
get(m_pSubsetLB, "subsetlb");
m_xShowChar->SetCentered(true);
m_xFontLB->make_sorted();
//lock the size request of this widget to the width of all possible entries
fillAllSubsets(*m_pSubsetLB);
m_pSubsetLB->set_width_request(m_pSubsetLB->get_preferred_size().Width());
get(m_pHexCodeText, "hexvalue"); get(m_pDecimalCodeText, "decimalvalue");
get(m_pFavouritesBtn, "favbtn");
get(m_pCharName, "charname");
m_pCharName->set_height_request(m_pCharName->GetTextHeight()*3);
m_pCharName->SetPaintTransparent(true);
get(m_pSearchText, "search");
fillAllSubsets(*m_xSubsetLB);
m_xSubsetLB->set_size_request(m_xSubsetLB->get_preferred_size().Width(), -1);
m_xCharName->set_size_request(m_xShowChar->get_preferred_size().Width(), m_xCharName->get_text_height() * 4);
//lock the size request of this widget to the width of the original .ui string
m_pHexCodeText->set_width_request(m_pHexCodeText->get_preferred_size().Width());
get( m_pRecentCharView[0], "viewchar1" );
get( m_pRecentCharView[1], "viewchar2" );
get( m_pRecentCharView[2], "viewchar3" );
get( m_pRecentCharView[3], "viewchar4" );
get( m_pRecentCharView[4], "viewchar5" );
get( m_pRecentCharView[5], "viewchar6" );
get( m_pRecentCharView[6], "viewchar7" );
get( m_pRecentCharView[7], "viewchar8" );
get( m_pRecentCharView[8], "viewchar9" );
get( m_pRecentCharView[9], "viewchar10" );
get( m_pRecentCharView[10], "viewchar11" );
get( m_pRecentCharView[11], "viewchar12" );
get( m_pRecentCharView[12], "viewchar13" );
get( m_pRecentCharView[13], "viewchar14" );
get( m_pRecentCharView[14], "viewchar15" );
get( m_pRecentCharView[15], "viewchar16" );
get( m_pFavCharView[0], "favchar1" );
get( m_pFavCharView[1], "favchar2" );
get( m_pFavCharView[2], "favchar3" );
get( m_pFavCharView[3], "favchar4" );
get( m_pFavCharView[4], "favchar5" );
get( m_pFavCharView[5], "favchar6" );
get( m_pFavCharView[6], "favchar7" );
get( m_pFavCharView[7], "favchar8" );
get( m_pFavCharView[8], "favchar9" );
get( m_pFavCharView[9], "favchar10" );
get( m_pFavCharView[10], "favchar11" );
get( m_pFavCharView[11], "favchar12" );
get( m_pFavCharView[12], "favchar13" );
get( m_pFavCharView[13], "favchar14" );
get( m_pFavCharView[14], "favchar15" );
get( m_pFavCharView[15], "favchar16" );
m_xHexCodeText->set_size_request(m_xHexCodeText->get_preferred_size().Width(), -1);
//so things don't jump around if all the children are hidden
m_xRecentGrid->set_size_request(-1, m_xRecentCharView[0]->get_preferred_size().Height());
m_xFavGrid->set_size_request(-1, m_xFavCharView[0]->get_preferred_size().Height());
init();
@@ -144,84 +146,49 @@ SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, const SfxItemSet* pSet,
SetCharFont( aTmpFont );
}
CreateOutputItemSet( pSet ? *pSet->GetPool() : SfxGetpApp()->GetPool() );
m_pShowSet->Show();
m_pSearchSet->Hide();
m_xOutputSet.reset(new SfxAllItemSet(pSet ? *pSet->GetPool() : SfxGetpApp()->GetPool()));
m_xShowSet->Show();
m_xSearchSet->Hide();
}
SvxCharacterMap::~SvxCharacterMap()
{
disposeOnce();
}
short SvxCharacterMap::Execute()
short SvxCharacterMap::execute()
{
if( SvxShowCharSet::getSelectedChar() == ' ')
{
m_pOKBtn->Disable();
m_xOKBtn->set_sensitive(false);
setFavButtonState(OUString(), OUString());
}
else
{
sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
// using the new UCS4 constructor
OUString aOUStr( &cChar, 1 );
m_pShowChar->SetText(aOUStr);
m_xShowChar->SetText(aOUStr);
setFavButtonState(aOUStr, m_pShowChar->GetFont().GetFamilyName());
m_pOKBtn->Enable();
setFavButtonState(aOUStr, m_xShowChar->GetFont().GetFamilyName());
m_xOKBtn->set_sensitive(true);
}
return SfxModalDialog::Execute();
return run();
}
void SvxCharacterMap::dispose()
{
for(int i = 0; i < 16; i++)
m_pRecentCharView[i].clear();
m_pShowSet.clear();
m_pSearchSet.clear();
m_pOKBtn.clear();
m_pFontText.clear();
m_pFontLB.clear();
m_pSubsetText.clear();
m_pSubsetLB.clear();
m_pShowChar.clear();
m_pHexCodeText.clear();
m_pDecimalCodeText.clear();
m_pCharName.clear();
maRecentCharList.clear();
maRecentCharFontList.clear();
maFavCharList.clear();
maFavCharFontList.clear();
m_pFavouritesBtn.clear();
m_pSearchText.clear();
SfxModalDialog::dispose();
}
void SvxCharacterMap::SetChar( sal_UCS4 c )
{
m_pShowSet->SelectCharacter( c );
m_xShowSet->SelectCharacter( c );
setFavButtonState(OUString(&c, 1), aFont.GetFamilyName());
}
sal_UCS4 SvxCharacterMap::GetChar() const
{
return (m_pShowChar->GetText()).toChar();
return (m_xShowChar->GetText()).toChar();
}
void SvxCharacterMap::DisableFontSelection()
{
m_pFontText->Disable();
m_pFontLB->Disable();
m_xFontText->set_sensitive(false);
m_xFontLB->set_sensitive(false);
}
@@ -270,17 +237,17 @@ void SvxCharacterMap::updateRecentCharControl()
it != maRecentCharList.end() || it2 != maRecentCharFontList.end();
++it, ++it2, i++)
{
m_pRecentCharView[i]->SetText(*it);
vcl::Font rFont = m_pRecentCharView[i]->GetControlFont();
m_xRecentCharView[i]->SetText(*it);
vcl::Font rFont = m_xRecentCharView[i]->GetFont();
rFont.SetFamilyName( *it2 );
m_pRecentCharView[i]->SetFont(rFont);
m_pRecentCharView[i]->Show();
m_xRecentCharView[i]->SetFont(rFont);
m_xRecentCharView[i]->Show();
}
for(; i < 16 ; i++)
{
m_pRecentCharView[i]->SetText(OUString());
m_pRecentCharView[i]->Hide();
m_xRecentCharView[i]->SetText(OUString());
m_xRecentCharView[i]->Hide();
}
}
@@ -377,23 +344,22 @@ void SvxCharacterMap::updateFavCharControl()
it != maFavCharList.end() || it2 != maFavCharFontList.end();
++it, ++it2, i++)
{
m_pFavCharView[i]->SetText(*it);
vcl::Font rFont = m_pFavCharView[i]->GetControlFont();
m_xFavCharView[i]->SetText(*it);
vcl::Font rFont = m_xFavCharView[i]->GetFont();
rFont.SetFamilyName( *it2 );
m_pFavCharView[i]->SetFont(rFont);
m_pFavCharView[i]->Show();
m_xFavCharView[i]->SetFont(rFont);
m_xFavCharView[i]->Show();
}
for(; i < 16 ; i++)
{
m_pFavCharView[i]->SetText(OUString());
m_pFavCharView[i]->Hide();
m_xFavCharView[i]->SetText(OUString());
m_xFavCharView[i]->Hide();
}
m_pShowSet->getFavCharacterList();
m_pSearchSet->getFavCharacterList();
m_xShowSet->getFavCharacterList();
m_xSearchSet->getFavCharacterList();
}
void SvxCharacterMap::deleteFavCharacterFromList(const OUString& sTitle, const OUString& rFont)
{
auto itChar = std::find_if(maFavCharList.begin(),
@@ -426,10 +392,9 @@ void SvxCharacterMap::deleteFavCharacterFromList(const OUString& sTitle, const O
batch->commit();
}
void SvxCharacterMap::init()
{
aFont = GetFont();
aFont = m_xVirDev->GetFont();
aFont.SetTransparent( true );
aFont.SetFamily( FAMILY_DONTKNOW );
aFont.SetPitch( PITCH_DONTKNOW );
@@ -437,28 +402,27 @@ void SvxCharacterMap::init()
OUString aDefStr( aFont.GetFamilyName() );
OUString aLastName;
int nCount = GetDevFontCount();
int nCount = m_xVirDev->GetDevFontCount();
for ( int i = 0; i < nCount; i++ )
{
OUString aFontName( GetDevFont( i ).GetFamilyName() );
if ( aFontName != aLastName )
OUString aFontName( m_xVirDev->GetDevFont( i ).GetFamilyName() );
if (aFontName != aLastName)
{
aLastName = aFontName;
const sal_Int32 nPos = m_pFontLB->InsertEntry( aFontName );
m_pFontLB->SetEntryData( nPos, reinterpret_cast<void*>(i) );
m_xFontLB->append(OUString::number(i), aFontName);
}
}
// 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 = (m_pFontLB->GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND );
if( !bFound )
bool bFound = (m_xFontLB->find_text(aDefStr) == -1);
if (!bFound)
{
sal_Int32 nIndex = 0;
do
{
OUString aToken = aDefStr.getToken(0, ';', nIndex);
if ( m_pFontLB->GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND )
if (m_xFontLB->find_text(aToken) != -1)
{
aDefStr = aToken;
bFound = true;
@@ -468,47 +432,46 @@ void SvxCharacterMap::init()
while ( nIndex >= 0 );
}
if ( bFound )
m_pFontLB->SelectEntry( aDefStr );
else if ( m_pFontLB->GetEntryCount() )
m_pFontLB->SelectEntryPos(0);
FontSelectHdl(*m_pFontLB);
if (bFound)
m_xFontLB->set_active(aDefStr);
else if (m_xFontLB->get_count() )
m_xFontLB->set_active(0);
FontSelectHdl(*m_xFontLB);
m_pFontLB->SetSelectHdl( LINK( this, SvxCharacterMap, FontSelectHdl ) );
m_pSubsetLB->SetSelectHdl( LINK( this, SvxCharacterMap, SubsetSelectHdl ) );
m_pOKBtn->SetClickHdl( LINK( this, SvxCharacterMap, InsertClickHdl ) );
m_pOKBtn->Show();
m_xFontLB->connect_changed(LINK( this, SvxCharacterMap, FontSelectHdl));
m_xSubsetLB->connect_changed(LINK( this, SvxCharacterMap, SubsetSelectHdl));
m_xOKBtn->connect_clicked(LINK(this, SvxCharacterMap, InsertClickHdl));
m_xOKBtn->show();
m_xShowSet->SetDoubleClickHdl( LINK( this, SvxCharacterMap, CharDoubleClickHdl ) );
m_xShowSet->SetSelectHdl( LINK( this, SvxCharacterMap, CharSelectHdl ) );
m_xShowSet->SetHighlightHdl( LINK( this, SvxCharacterMap, CharHighlightHdl ) );
m_xShowSet->SetPreSelectHdl( LINK( this, SvxCharacterMap, CharPreSelectHdl ) );
m_xShowSet->SetFavClickHdl( LINK( this, SvxCharacterMap, FavClickHdl ) );
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_pShowSet->SetFavClickHdl( LINK( this, SvxCharacterMap, FavClickHdl ) );
m_xSearchSet->SetDoubleClickHdl( LINK( this, SvxCharacterMap, SearchCharDoubleClickHdl ) );
m_xSearchSet->SetSelectHdl( LINK( this, SvxCharacterMap, SearchCharSelectHdl ) );
m_xSearchSet->SetHighlightHdl( LINK( this, SvxCharacterMap, SearchCharHighlightHdl ) );
m_xSearchSet->SetPreSelectHdl( LINK( this, SvxCharacterMap, SearchCharPreSelectHdl ) );
m_xSearchSet->SetFavClickHdl( LINK( this, SvxCharacterMap, FavClickHdl ) );
m_pSearchSet->SetDoubleClickHdl( LINK( this, SvxCharacterMap, SearchCharDoubleClickHdl ) );
m_pSearchSet->SetSelectHdl( LINK( this, SvxCharacterMap, SearchCharSelectHdl ) );
m_pSearchSet->SetHighlightHdl( LINK( this, SvxCharacterMap, SearchCharHighlightHdl ) );
m_pSearchSet->SetPreSelectHdl( LINK( this, SvxCharacterMap, SearchCharPreSelectHdl ) );
m_pSearchSet->SetFavClickHdl( LINK( this, SvxCharacterMap, FavClickHdl ) );
m_pDecimalCodeText->SetModifyHdl( LINK( this, SvxCharacterMap, DecimalCodeChangeHdl ) );
m_pHexCodeText->SetModifyHdl( LINK( this, SvxCharacterMap, HexCodeChangeHdl ) );
m_pFavouritesBtn->SetClickHdl( LINK(this, SvxCharacterMap, FavSelectHdl));
m_xDecimalCodeText->connect_changed( LINK( this, SvxCharacterMap, DecimalCodeChangeHdl ) );
m_xHexCodeText->connect_changed( LINK( this, SvxCharacterMap, HexCodeChangeHdl ) );
m_xFavouritesBtn->connect_clicked( LINK(this, SvxCharacterMap, FavSelectHdl));
if( SvxShowCharSet::getSelectedChar() == ' ')
{
m_pOKBtn->Disable();
m_xOKBtn->set_sensitive(false);
}
else
{
sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
// using the new UCS4 constructor
OUString aOUStr( &cChar, 1 );
m_pShowChar->SetText(aOUStr);
m_xShowChar->SetText(aOUStr);
setFavButtonState(aOUStr, aDefStr);
m_pOKBtn->Enable();
m_xOKBtn->set_sensitive(true);
}
getRecentCharacterList();
@@ -519,23 +482,22 @@ void SvxCharacterMap::init()
for(int i = 0; i < 16; i++)
{
m_pRecentCharView[i]->SetHasInsert(m_bHasInsert);
m_pRecentCharView[i]->setMouseClickHdl(LINK(this,SvxCharacterMap, CharClickHdl));
m_pRecentCharView[i]->setClearClickHdl(LINK(this,SvxCharacterMap, RecentClearClickHdl));
m_pRecentCharView[i]->setClearAllClickHdl(LINK(this,SvxCharacterMap, RecentClearAllClickHdl));
m_pRecentCharView[i]->SetLoseFocusHdl(LINK(this,SvxCharacterMap, LoseFocusHdl));
m_pFavCharView[i]->SetHasInsert(m_bHasInsert);
m_pFavCharView[i]->setMouseClickHdl(LINK(this,SvxCharacterMap, CharClickHdl));
m_pFavCharView[i]->setClearClickHdl(LINK(this,SvxCharacterMap, FavClearClickHdl));
m_pFavCharView[i]->setClearAllClickHdl(LINK(this,SvxCharacterMap, FavClearAllClickHdl));
m_pFavCharView[i]->SetLoseFocusHdl(LINK(this,SvxCharacterMap, LoseFocusHdl));
m_xRecentCharView[i]->SetHasInsert(m_bHasInsert);
m_xRecentCharView[i]->setMouseClickHdl(LINK(this,SvxCharacterMap, CharClickHdl));
m_xRecentCharView[i]->setClearClickHdl(LINK(this,SvxCharacterMap, RecentClearClickHdl));
m_xRecentCharView[i]->setClearAllClickHdl(LINK(this,SvxCharacterMap, RecentClearAllClickHdl));
m_xRecentCharView[i]->connect_focus_out(LINK(this,SvxCharacterMap, LoseFocusHdl));
m_xFavCharView[i]->SetHasInsert(m_bHasInsert);
m_xFavCharView[i]->setMouseClickHdl(LINK(this,SvxCharacterMap, CharClickHdl));
m_xFavCharView[i]->setClearClickHdl(LINK(this,SvxCharacterMap, FavClearClickHdl));
m_xFavCharView[i]->setClearAllClickHdl(LINK(this,SvxCharacterMap, FavClearAllClickHdl));
m_xFavCharView[i]->connect_focus_out(LINK(this,SvxCharacterMap, LoseFocusHdl));
}
setCharName(90);
m_pSearchText->SetGetFocusHdl(LINK( this, SvxCharacterMap, SearchFieldGetFocusHdl ));
m_pSearchText->SetUpdateDataHdl(LINK( this, SvxCharacterMap, SearchUpdateHdl ));
m_pSearchText->EnableUpdateData();
m_xSearchText->connect_focus_in(LINK( this, SvxCharacterMap, SearchFieldGetFocusHdl ));
m_xSearchText->connect_changed(LINK(this, SvxCharacterMap, SearchUpdateHdl));
}
bool SvxCharacterMap::isFavChar(const OUString& sTitle, const OUString& rFont)
@@ -560,24 +522,24 @@ void SvxCharacterMap::setFavButtonState(const OUString& sTitle, const OUString&
{
if(sTitle.isEmpty() || rFont.isEmpty())
{
m_pFavouritesBtn->Disable();
m_xFavouritesBtn->set_sensitive(false);
return;
}
else
m_pFavouritesBtn->Enable();
m_xFavouritesBtn->set_sensitive(true);
if(isFavChar(sTitle, rFont))
{
m_pFavouritesBtn->SetText(CuiResId(RID_SVXSTR_REMOVE_FAVORITES));
m_xFavouritesBtn->set_label(CuiResId(RID_SVXSTR_REMOVE_FAVORITES));
}
else
{
if(maFavCharList.size() == 16)
{
m_pFavouritesBtn->Disable();
m_xFavouritesBtn->set_sensitive(false);
}
m_pFavouritesBtn->SetText(CuiResId(RID_SVXSTR_ADD_FAVORITES));
m_xFavouritesBtn->set_label(CuiResId(RID_SVXSTR_ADD_FAVORITES));
}
}
@@ -586,33 +548,29 @@ void SvxCharacterMap::SetCharFont( const vcl::Font& rFont )
{
// first get the underlying info in order to get font names
// like "Times New Roman;Times" resolved
vcl::Font aTmp( GetFontMetric( rFont ) );
vcl::Font aTmp(m_xVirDev->GetFontMetric(rFont));
if (aTmp.GetFamilyName() == "StarSymbol" && m_pFontLB->GetEntryPos(aTmp.GetFamilyName()) == LISTBOX_ENTRY_NOTFOUND)
if (aTmp.GetFamilyName() == "StarSymbol" && m_xFontLB->find_text(aTmp.GetFamilyName()) == -1)
{
//if for some reason, like font in an old document, StarSymbol is requested and its not available, then
//try OpenSymbol instead
aTmp.SetFamilyName("OpenSymbol");
}
if ( m_pFontLB->GetEntryPos( aTmp.GetFamilyName() ) == LISTBOX_ENTRY_NOTFOUND )
if (m_xFontLB->find_text(aTmp.GetFamilyName()) == -1)
return;
m_pFontLB->SelectEntry( aTmp.GetFamilyName() );
m_xFontLB->set_active(aTmp.GetFamilyName());
aFont = aTmp;
FontSelectHdl(*m_pFontLB);
// for compatibility reasons
ModalDialog::SetFont( aFont );
FontSelectHdl(*m_xFontLB);
}
void SvxCharacterMap::fillAllSubsets(ListBox &rListBox)
void SvxCharacterMap::fillAllSubsets(weld::ComboBoxText& rListBox)
{
SubsetMap aAll(nullptr);
rListBox.Clear();
rListBox.clear();
for (auto & subset : aAll.GetSubsetMap())
rListBox.InsertEntry( subset.GetName() );
rListBox.append_text(subset.GetName());
}
@@ -635,27 +593,21 @@ void SvxCharacterMap::insertCharToDoc(const OUString& sGlyph)
updateRecentCharacterList(sGlyph, aFont.GetFamilyName());
} else {
SfxItemSet* pSet = GetOutputSetImpl();
if ( pSet )
{
sal_Int32 tmp = 0;
sal_UCS4 cChar = sGlyph.iterateCodePoints(&tmp);
const SfxItemPool* pPool = pSet->GetPool();
pSet->Put( SfxStringItem( pPool->GetWhich(SID_CHARMAP), sGlyph ) );
pSet->Put( SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(),
aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(), pPool->GetWhich(SID_ATTR_CHAR_FONT) ) );
pSet->Put( SfxStringItem( pPool->GetWhich(SID_FONT_NAME), aFont.GetFamilyName() ) );
pSet->Put( SfxInt32Item( pPool->GetWhich(SID_ATTR_CHAR), cChar ) );
}
sal_Int32 tmp = 0;
sal_UCS4 cChar = sGlyph.iterateCodePoints(&tmp);
const SfxItemPool* pPool = m_xOutputSet->GetPool();
m_xOutputSet->Put( SfxStringItem( pPool->GetWhich(SID_CHARMAP), sGlyph ) );
m_xOutputSet->Put( SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(),
aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(), pPool->GetWhich(SID_ATTR_CHAR_FONT) ) );
m_xOutputSet->Put( SfxStringItem( pPool->GetWhich(SID_FONT_NAME), aFont.GetFamilyName() ) );
m_xOutputSet->Put( SfxInt32Item( pPool->GetWhich(SID_ATTR_CHAR), cChar ) );
}
}
IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, ListBox&, void)
IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, weld::ComboBoxText&, void)
{
const sal_Int32 nPos = m_pFontLB->GetSelectedEntryPos();
const sal_uInt16 nFont = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pFontLB->GetEntryData( nPos )));
aFont = GetDevFont( nFont );
const sal_uInt32 nFont = m_xFontLB->get_active_id().toUInt32();
aFont = m_xVirDev->GetDevFont(nFont);
aFont.SetWeight( WEIGHT_DONTKNOW );
aFont.SetItalic( ITALIC_NONE );
aFont.SetWidthType( WIDTH_DONTKNOW );
@@ -663,13 +615,13 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, ListBox&, void)
aFont.SetFamily( FAMILY_DONTKNOW );
// notify children using this font
m_pShowSet->SetFont( aFont );
m_pSearchSet->SetFont( aFont );
m_pShowChar->SetFont( aFont );
if(isSearchMode)
m_xShowSet->SetFont( aFont );
m_xSearchSet->SetFont( aFont );
m_xShowChar->SetFont( aFont );
if (isSearchMode)
{
SearchUpdateHdl(*m_pSearchText);
SearchCharHighlightHdl(m_pSearchSet);
SearchUpdateHdl(*m_xSearchText);
SearchCharHighlightHdl(m_xSearchSet.get());
}
// setup unicode subset listbar with font specific subsets,
@@ -677,50 +629,50 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, ListBox&, void)
// TODO: get info from the Font once it provides it
delete pSubsetMap;
pSubsetMap = nullptr;
m_pSubsetLB->Clear();
m_xSubsetLB->clear();
bool bNeedSubset = (aFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL);
if( bNeedSubset )
if (bNeedSubset)
{
FontCharMapRef xFontCharMap( new FontCharMap() );
m_pShowSet->GetFontCharMap( xFontCharMap );
m_xShowSet->GetFontCharMap( xFontCharMap );
pSubsetMap = new SubsetMap( xFontCharMap );
// update subset listbox for new font's unicode subsets
bool bFirst = true;
for (auto const& subset : pSubsetMap->GetSubsetMap())
{
const sal_Int32 nPos_ = m_pSubsetLB->InsertEntry( subset.GetName() );
m_pSubsetLB->SetEntryData( nPos_, const_cast<Subset *>(&subset) );
m_xSubsetLB->append(OUString::number(reinterpret_cast<sal_uInt64>(&subset)), subset.GetName());
// NOTE: subset must live at least as long as the selected font
if( bFirst )
m_pSubsetLB->SelectEntryPos( nPos_ );
if (bFirst)
m_xSubsetLB->set_active(0);
bFirst = false;
}
if( m_pSubsetLB->GetEntryCount() <= 1 )
if (m_xSubsetLB->get_count() <= 1)
bNeedSubset = false;
}
m_pSubsetText->Enable(bNeedSubset);
m_pSubsetLB->Enable(bNeedSubset);
m_xSubsetText->set_sensitive(bNeedSubset);
m_xSubsetLB->set_sensitive(bNeedSubset);
}
void SvxCharacterMap::toggleSearchView(bool state)
{
isSearchMode = state;
m_pHexCodeText->SetReadOnly(state);
m_pDecimalCodeText->SetReadOnly(state);
m_pSubsetLB->Enable(!state);
m_xHexCodeText->set_editable(!state);
m_xDecimalCodeText->set_editable(!state);
m_xSubsetLB->set_sensitive(!state);
if(state)
{
m_pSearchSet->Show();
m_pShowSet->Hide();
m_xSearchSet->Show();
m_xShowSet->Hide();
}
else
{
m_pSearchSet->Hide();
m_pShowSet->Show();
m_xSearchSet->Hide();
m_xShowSet->Show();
}
}
@@ -733,34 +685,35 @@ void SvxCharacterMap::setCharName(sal_UCS4 nDecimalValue)
char buffer[100];
u_charName(nDecimalValue, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode);
if (U_SUCCESS(errorCode))
m_pCharName->SetText(OUString::createFromAscii(buffer));
m_xCharName->set_label(OUString::createFromAscii(buffer));
}
IMPL_LINK_NOARG(SvxCharacterMap, SubsetSelectHdl, ListBox&, void)
IMPL_LINK_NOARG(SvxCharacterMap, SubsetSelectHdl, weld::ComboBoxText&, void)
{
const sal_Int32 nPos = m_pSubsetLB->GetSelectedEntryPos();
const Subset* pSubset = static_cast<const Subset*> (m_pSubsetLB->GetEntryData(nPos));
const sal_Int32 nPos = m_xSubsetLB->get_active();
const Subset* pSubset = reinterpret_cast<const Subset*>(m_xSubsetLB->get_active_id().toUInt64());
if( pSubset && !isSearchMode)
{
sal_UCS4 cFirst = pSubset->GetRangeMin();
m_pShowSet->SelectCharacter( cFirst );
m_xShowSet->SelectCharacter( cFirst );
setFavButtonState(OUString(&cFirst, 1), aFont.GetFamilyName());
m_pSubsetLB->SelectEntryPos( nPos );
m_xSubsetLB->set_active(nPos);
}
else if( pSubset && isSearchMode)
{
m_pSearchSet->SelectCharacter( pSubset );
m_xSearchSet->SelectCharacter( pSubset );
const Subset* curSubset = nullptr;
if( pSubsetMap )
curSubset = pSubsetMap->GetSubsetByUnicode( m_pSearchSet->GetSelectCharacter() );
curSubset = pSubsetMap->GetSubsetByUnicode( m_xSearchSet->GetSelectCharacter() );
if( curSubset )
m_pSubsetLB->SelectEntry( curSubset->GetName() );
m_xSubsetLB->set_active(curSubset->GetName());
else
m_pSubsetLB->SetNoSelection();
m_xSubsetLB->set_active(-1);
sal_UCS4 sChar = m_pSearchSet->GetSelectCharacter();
sal_UCS4 sChar = m_xSearchSet->GetSelectCharacter();
setFavButtonState(OUString(&sChar, 1), aFont.GetFamilyName());
}
}
@@ -840,23 +793,22 @@ IMPL_LINK_NOARG(SvxCharacterMap, FavClearAllClickHdl, SvxCharView*, void)
updateFavCharControl();
}
IMPL_LINK_NOARG(SvxCharacterMap, SearchFieldGetFocusHdl, Control&, void)
IMPL_LINK_NOARG(SvxCharacterMap, SearchFieldGetFocusHdl, weld::Widget&, void)
{
m_pOKBtn->Disable();
m_xOKBtn->set_sensitive(false);
}
IMPL_LINK_NOARG(SvxCharacterMap, SearchUpdateHdl, Edit&, void)
IMPL_LINK_NOARG(SvxCharacterMap, SearchUpdateHdl, weld::Entry&, void)
{
if(!m_pSearchText->GetText().isEmpty())
if (!m_xSearchText->get_text().isEmpty())
{
m_pSearchSet->ClearPreviousData();
OUString aKeyword = m_pSearchText->GetText();
m_xSearchSet->ClearPreviousData();
OUString aKeyword = m_xSearchText->get_text();
toggleSearchView(true);
FontCharMapRef xFontCharMap(new FontCharMap());
m_pSearchSet->GetFontCharMap(xFontCharMap);
m_xSearchSet->GetFontCharMap(xFontCharMap);
sal_UCS4 sChar = xFontCharMap->GetFirstChar();
while(sChar != xFontCharMap->GetLastChar())
@@ -868,7 +820,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchUpdateHdl, Edit&, void)
{
OUString sName = OUString::createFromAscii(buffer);
if(!sName.isEmpty() && sName.toAsciiLowerCase().indexOf(aKeyword.toAsciiLowerCase()) >= 0)
m_pSearchSet->AppendCharToList(sChar);
m_xSearchSet->AppendCharToList(sChar);
}
sChar = xFontCharMap->GetNextChar(sChar);
}
@@ -880,11 +832,8 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchUpdateHdl, Edit&, void)
{
OUString sName = OUString::createFromAscii(buffer);
if(!sName.isEmpty() && sName.toAsciiLowerCase().indexOf(aKeyword.toAsciiLowerCase()) >= 0)
m_pSearchSet->AppendCharToList(sChar);
m_xSearchSet->AppendCharToList(sChar);
}
m_pSearchSet->Resize();
}
else
{
@@ -895,12 +844,12 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchUpdateHdl, Edit&, void)
IMPL_LINK(SvxCharacterMap, CharClickHdl, SvxCharView*, rView, void)
{
m_pShowChar->SetText( rView->GetText() );
m_pShowChar->SetFont(rView->GetFont());
m_pShowChar->Update();
m_xShowChar->SetText( rView->GetText() );
m_xShowChar->SetFont(rView->GetFont());
m_xShowChar->queue_draw();
setFavButtonState(rView->GetText(), rView->GetFont().GetFamilyName());//check state
rView->GrabFocus();
rView->grab_focus();
// Get the hexadecimal code
OUString charValue = rView->GetText();
@@ -911,17 +860,17 @@ IMPL_LINK(SvxCharacterMap, CharClickHdl, SvxCharView*, rView, void)
// Get the decimal code
OUString aDecimalText = OUString::number(cChar);
m_pHexCodeText->SetText( aHexText );
m_pDecimalCodeText->SetText( aDecimalText );
m_xHexCodeText->set_text(aHexText);
m_xDecimalCodeText->set_text(aDecimalText);
setCharName(cChar);
rView->Invalidate();
m_pOKBtn->Enable();
rView->queue_draw();
m_xOKBtn->set_sensitive(true);
}
IMPL_LINK_NOARG(SvxCharacterMap, CharDoubleClickHdl, SvxShowCharSet*, void)
{
sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
// using the new UCS4 constructor
OUString aOUStr( &cChar, 1 );
setFavButtonState(aOUStr, aFont.GetFamilyName());
@@ -930,7 +879,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharDoubleClickHdl, SvxShowCharSet*, void)
IMPL_LINK_NOARG(SvxCharacterMap, SearchCharDoubleClickHdl, SvxShowCharSet*, void)
{
sal_UCS4 cChar = m_pSearchSet->GetSelectCharacter();
sal_UCS4 cChar = m_xSearchSet->GetSelectCharacter();
// using the new UCS4 constructor
OUString aOUStr( &cChar, 1 );
setFavButtonState(aOUStr, aFont.GetFamilyName());
@@ -939,38 +888,37 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchCharDoubleClickHdl, SvxShowCharSet*, void
IMPL_LINK_NOARG(SvxCharacterMap, CharSelectHdl, SvxShowCharSet*, void)
{
m_pOKBtn->Enable();
m_xOKBtn->set_sensitive(true);
}
IMPL_LINK_NOARG(SvxCharacterMap, SearchCharSelectHdl, SvxShowCharSet*, void)
{
m_pOKBtn->Enable();
m_xOKBtn->set_sensitive(true);
}
IMPL_LINK_NOARG(SvxCharacterMap, InsertClickHdl, Button*, void)
IMPL_LINK_NOARG(SvxCharacterMap, InsertClickHdl, weld::Button&, void)
{
insertCharToDoc(m_pShowChar->GetText());
EndDialog(RET_OK);
insertCharToDoc(m_xShowChar->GetText());
m_xDialog->response(RET_OK);
}
IMPL_STATIC_LINK(SvxCharacterMap, LoseFocusHdl, Control&, pItem, void)
IMPL_STATIC_LINK(SvxCharacterMap, LoseFocusHdl, weld::Widget&, rItem, void)
{
pItem.Invalidate();
dynamic_cast<weld::DrawingArea&>(rItem).queue_draw();
}
IMPL_LINK_NOARG(SvxCharacterMap, FavSelectHdl, Button*, void)
IMPL_LINK_NOARG(SvxCharacterMap, FavSelectHdl, weld::Button&, void)
{
if(m_pFavouritesBtn->GetText().match(CuiResId(RID_SVXSTR_ADD_FAVORITES)))
if (m_xFavouritesBtn->get_label().match(CuiResId(RID_SVXSTR_ADD_FAVORITES)))
{
updateFavCharacterList(m_pShowChar->GetText(), m_pShowChar->GetFont().GetFamilyName());
setFavButtonState(m_pShowChar->GetText(), m_pShowChar->GetFont().GetFamilyName());
updateFavCharacterList(m_xShowChar->GetText(), m_xShowChar->GetFont().GetFamilyName());
setFavButtonState(m_xShowChar->GetText(), m_xShowChar->GetFont().GetFamilyName());
}
else
{
deleteFavCharacterFromList(m_pShowChar->GetText(), m_pShowChar->GetFont().GetFamilyName());
m_pFavouritesBtn->SetText(CuiResId(RID_SVXSTR_ADD_FAVORITES));
m_pFavouritesBtn->Disable();
deleteFavCharacterFromList(m_xShowChar->GetText(), m_xShowChar->GetFont().GetFamilyName());
m_xFavouritesBtn->set_label(CuiResId(RID_SVXSTR_ADD_FAVORITES));
m_xFavouritesBtn->set_sensitive(false);
}
updateFavCharControl();
@@ -987,7 +935,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void)
OUString aText;
OUString aHexText;
OUString aDecimalText;
sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
bool bSelect = (cChar > 0);
// show char sample
@@ -1000,16 +948,16 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void)
if( pSubsetMap )
pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
if( pSubset )
m_pSubsetLB->SelectEntry( pSubset->GetName() );
m_xSubsetLB->set_active(pSubset->GetName());
else
m_pSubsetLB->SetNoSelection();
m_xSubsetLB->set_active(-1);
}
if(m_pShowSet->HasFocus())
if (m_xShowSet->HasFocus())
{
m_pShowChar->SetText( aText );
m_pShowChar->SetFont( aFont );
m_pShowChar->Update();
m_xShowChar->SetText( aText );
m_xShowChar->SetFont( aFont );
m_xShowChar->queue_draw();
setFavButtonState(aText, aFont.GetFamilyName());
}
@@ -1025,10 +973,10 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void)
}
// Update the hex and decimal codes only if necessary
if (m_pHexCodeText->GetText() != aHexText)
m_pHexCodeText->SetText( aHexText );
if (m_pDecimalCodeText->GetText() != aDecimalText)
m_pDecimalCodeText->SetText( aDecimalText );
if (m_xHexCodeText->get_text() != aHexText)
m_xHexCodeText->set_text( aHexText );
if (m_xDecimalCodeText->get_text() != aDecimalText)
m_xDecimalCodeText->set_text( aDecimalText );
}
IMPL_LINK_NOARG(SvxCharacterMap, SearchCharHighlightHdl, SvxShowCharSet*, void)
@@ -1036,7 +984,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchCharHighlightHdl, SvxShowCharSet*, void)
OUString aText;
OUString aHexText;
OUString aDecimalText;
sal_UCS4 cChar = m_pSearchSet->GetSelectCharacter();
sal_UCS4 cChar = m_xSearchSet->GetSelectCharacter();
bool bSelect = (cChar > 0);
// show char sample
@@ -1050,25 +998,25 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchCharHighlightHdl, SvxShowCharSet*, void)
setCharName(cChar);
// Update the hex and decimal codes only if necessary
if (m_pHexCodeText->GetText() != aHexText)
m_pHexCodeText->SetText( aHexText );
if (m_pDecimalCodeText->GetText() != aDecimalText)
m_pDecimalCodeText->SetText( aDecimalText );
if (m_xHexCodeText->get_text() != aHexText)
m_xHexCodeText->set_text(aHexText);
if (m_xDecimalCodeText->get_text() != aDecimalText)
m_xDecimalCodeText->set_text( aDecimalText );
const Subset* pSubset = nullptr;
if( pSubsetMap )
pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
if( pSubset )
m_pSubsetLB->SelectEntry( pSubset->GetName() );
m_xSubsetLB->set_active(pSubset->GetName());
else
m_pSubsetLB->SetNoSelection();
m_xSubsetLB->set_active(-1);
}
if(m_pSearchSet->HasFocus())
if(m_xSearchSet->HasFocus())
{
m_pShowChar->SetText( aText );
m_pShowChar->SetFont( aFont );
m_pShowChar->Update();
m_xShowChar->SetText( aText );
m_xShowChar->SetFont( aFont );
m_xShowChar->queue_draw();
setFavButtonState(aText, aFont.GetFamilyName());
}
@@ -1080,28 +1028,28 @@ void SvxCharacterMap::selectCharByCode(Radix radix)
switch(radix)
{
case Radix::decimal:
aCodeString = m_pDecimalCodeText->GetText();
aCodeString = m_xDecimalCodeText->get_text();
break;
case Radix::hexadecimal:
aCodeString = m_pHexCodeText->GetText();
aCodeString = m_xHexCodeText->get_text();
break;
}
// Convert the code back to a character using the appropriate radix
sal_UCS4 cChar = aCodeString.toUInt32(static_cast<sal_Int16> (radix));
// Use FontCharMap::HasChar(sal_UCS4 cChar) to see if the desired character is in the font
FontCharMapRef xFontCharMap(new FontCharMap());
m_pShowSet->GetFontCharMap(xFontCharMap);
m_xShowSet->GetFontCharMap(xFontCharMap);
if (xFontCharMap->HasChar(cChar))
// Select the corresponding character
SetChar(cChar);
}
IMPL_LINK_NOARG(SvxCharacterMap, DecimalCodeChangeHdl, Edit&, void)
IMPL_LINK_NOARG(SvxCharacterMap, DecimalCodeChangeHdl, weld::Entry&, void)
{
selectCharByCode(Radix::decimal);
}
IMPL_LINK_NOARG(SvxCharacterMap, HexCodeChangeHdl, Edit&, void)
IMPL_LINK_NOARG(SvxCharacterMap, HexCodeChangeHdl, weld::Entry&, void)
{
selectCharByCode(Radix::hexadecimal);
}
@@ -1111,15 +1059,15 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharPreSelectHdl, SvxShowCharSet*, void)
// adjust subset selection
if( pSubsetMap )
{
sal_UCS4 cChar = m_pShowSet->GetSelectCharacter();
sal_UCS4 cChar = m_xShowSet->GetSelectCharacter();
setFavButtonState(OUString(&cChar, 1), aFont.GetFamilyName());
const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
if( pSubset )
m_pSubsetLB->SelectEntry( pSubset->GetName() );
m_xSubsetLB->set_active(pSubset->GetName());
}
m_pOKBtn->Enable();
m_xOKBtn->set_sensitive(true);
}
IMPL_LINK_NOARG(SvxCharacterMap, SearchCharPreSelectHdl, SvxShowCharSet*, void)
@@ -1127,32 +1075,42 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchCharPreSelectHdl, SvxShowCharSet*, void)
// adjust subset selection
if( pSubsetMap )
{
sal_UCS4 cChar = m_pSearchSet->GetSelectCharacter();
sal_UCS4 cChar = m_xSearchSet->GetSelectCharacter();
setFavButtonState(OUString(&cChar, 1), aFont.GetFamilyName());
const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
if( pSubset )
m_pSubsetLB->SelectEntry( pSubset->GetName() );
m_xSubsetLB->set_active(pSubset->GetName());
}
m_pOKBtn->Enable();
m_xOKBtn->set_sensitive(true);
}
// class SvxShowText =====================================================
SvxShowText::SvxShowText(vcl::Window* pParent)
: Control(pParent, WB_BORDER)
SvxShowText::SvxShowText(weld::Builder& rBuilder, const OString& rId, const VclPtr<VirtualDevice>& rVirDev)
: m_xDrawingArea(rBuilder.weld_drawing_area(rId))
, m_xVirDev(rVirDev)
, mnY(0)
, mbCenter(false)
{}
VCL_BUILDER_FACTORY(SvxShowText)
void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
{
rRenderContext.SetFont(maFont);
m_xDrawingArea->connect_size_allocate(LINK(this, SvxShowText, DoResize));
m_xDrawingArea->connect_draw(LINK(this, SvxShowText, DoPaint));
vcl::Font aFont = m_xVirDev->GetFont();
Size aFontSize(aFont.GetFontSize().Width() * 5, aFont.GetFontSize().Height() * 5);
aFont.SetFontSize(aFontSize);
m_xVirDev->Push(PUSH_ALLFONT);
m_xVirDev->SetFont(aFont);
m_xDrawingArea->set_size_request(m_xVirDev->approximate_digit_width() + 2 * 12,
m_xVirDev->LogicToPixel(aFontSize).Height() * 2);
m_xVirDev->Pop();
}
IMPL_LINK(SvxShowText, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
{
vcl::RenderContext& rRenderContext = aPayload.first;
rRenderContext.SetFont(m_aFont);
Color aTextCol = rRenderContext.GetTextColor();
Color aFillCol = rRenderContext.GetFillColor();
@@ -1164,10 +1122,9 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const ::tools::Recta
rRenderContext.SetFillColor(aWindowColor);
const OUString aText = GetText();
const Size aSize(GetOutputSizePixel());
long nAvailWidth = aSize.Width();
long nWinHeight = GetOutputSizePixel().Height();
long nAvailWidth = m_aSize.Width();
long nWinHeight = m_aSize.Height();
bool bGotBoundary = true;
bool bShrankFont = false;
@@ -1192,14 +1149,14 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const ::tools::Recta
aFontSize.setHeight( nFontHeight );
aFont.SetFontSize(aFontSize);
rRenderContext.SetFont(aFont);
mnY = (nWinHeight - GetTextHeight()) / 2;
mnY = (nWinHeight - rRenderContext.GetTextHeight()) / 2;
bShrankFont = true;
}
Point aPoint(2, mnY);
// adjust position using ink boundary if possible
if (!bGotBoundary)
aPoint.setX( (aSize.Width() - rRenderContext.GetTextWidth(aText)) / 2 );
aPoint.setX( (m_aSize.Width() - rRenderContext.GetTextWidth(aText)) / 2 );
else
{
// adjust position before it gets out of bounds
@@ -1207,7 +1164,7 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const ::tools::Recta
// shift back vertically if needed
int nYLDelta = aBoundRect.Top();
int nYHDelta = aSize.Height() - aBoundRect.Bottom();
int nYHDelta = m_aSize.Height() - aBoundRect.Bottom();
if( nYLDelta <= 0 )
aPoint.AdjustY( -(nYLDelta - 1) );
else if( nYHDelta <= 0 )
@@ -1216,13 +1173,13 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const ::tools::Recta
if (mbCenter)
{
// move glyph to middle of cell
aPoint.setX( -aBoundRect.Left() + (aSize.Width() - aBoundRect.GetWidth()) / 2 );
aPoint.setX( -aBoundRect.Left() + (m_aSize.Width() - aBoundRect.GetWidth()) / 2 );
}
else
{
// shift back horizontally if needed
int nXLDelta = aBoundRect.Left();
int nXHDelta = aSize.Width() - aBoundRect.Right();
int nXHDelta = m_aSize.Width() - aBoundRect.Right();
if( nXLDelta <= 0 )
aPoint.AdjustX( -(nXLDelta - 1) );
else if( nXHDelta <= 0 )
@@ -1230,7 +1187,7 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const ::tools::Recta
}
}
rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), Size(GetOutputSizePixel().Width(), GetOutputSizePixel().Height())));
rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), m_aSize));
rRenderContext.DrawText(aPoint, aText);
rRenderContext.SetTextColor(aTextCol);
rRenderContext.SetFillColor(aFillCol);
@@ -1241,39 +1198,32 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const ::tools::Recta
void SvxShowText::SetFont( const vcl::Font& rFont )
{
long nWinHeight = GetOutputSizePixel().Height();
maFont = vcl::Font(rFont);
maFont.SetWeight(WEIGHT_NORMAL);
maFont.SetAlignment(ALIGN_TOP);
maFont.SetFontSize(PixelToLogic(Size(0, nWinHeight / 2)));
maFont.SetTransparent(true);
Control::SetFont(maFont);
long nWinHeight = m_aSize.Height();
mnY = (nWinHeight - GetTextHeight()) / 2;
m_aFont = vcl::Font(rFont);
m_aFont.SetWeight(WEIGHT_NORMAL);
m_aFont.SetAlignment(ALIGN_TOP);
m_aFont.SetFontSize(m_xVirDev->PixelToLogic(Size(0, nWinHeight / 2)));
m_aFont.SetTransparent(true);
Invalidate();
m_xVirDev->Push(PUSH_ALLFONT);
m_xVirDev->SetFont(m_aFont);
mnY = (nWinHeight - m_xVirDev->GetTextHeight()) / 2;
m_xVirDev->Pop();
m_xDrawingArea->queue_draw();
}
Size SvxShowText::GetOptimalSize() const
IMPL_LINK(SvxShowText, DoResize, const Size&, rSize, void)
{
const vcl::Font &rFont = GetFont();
const Size rFontSize = rFont.GetFontSize();
long nWinHeight = LogicToPixel(rFontSize).Height() * 2;
return Size( GetTextWidth( GetText() ) + 2 * 12, nWinHeight );
}
void SvxShowText::Resize()
{
Control::Resize();
m_aSize = rSize;
SetFont(GetFont()); //force recalculation of size
}
void SvxShowText::SetText( const OUString& rText )
void SvxShowText::SetText(const OUString& rText)
{
Control::SetText( rText );
Invalidate();
m_sText = rText;
queue_draw();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/cuiexp.cxx b/cui/source/factory/cuiexp.cxx
index 94c5a16..9a8a26b 100644
--- a/cui/source/factory/cuiexp.cxx
+++ b/cui/source/factory/cuiexp.cxx
@@ -38,6 +38,7 @@
#include <postdlg.hxx>
#include <passwdomdlg.hxx>
#include <screenshotannotationdlg.hxx>
#include <cuicharmap.hxx>
#include <cuihyperdlg.hxx>
#include <cfgutil.hxx>
#include <SpellDialog.hxx>
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 5b4830a..0acd2cc 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -149,6 +149,21 @@ short AbstractPasswordToOpenModifyDialog_Impl::Execute()
return m_xDlg->run();
}
short AbstractSvxCharacterMapDialog_Impl::Execute()
{
return m_xDlg->run();
}
const SfxItemSet* AbstractSvxCharacterMapDialog_Impl::GetOutputItemSet() const
{
return m_xDlg->GetOutputItemSet();
}
void AbstractSvxCharacterMapDialog_Impl::SetText(const OUString& rStr)
{
m_xDlg->set_title(rStr);
}
IMPL_ABSTDLG_BASE(AbstractScreenshotAnnotationDlg_Impl);
@@ -1217,12 +1232,9 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxLineTabDialog(
return VclPtr<CuiAbstractTabDialog_Impl>::Create( pDlg );
}
VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateCharMapDialog( vcl::Window* pParent,
const SfxItemSet& rAttr,
bool bInsert )
VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, bool bInsert)
{
SfxModalDialog* pDlg = VclPtr<SvxCharacterMap>::Create(pParent, &rAttr, bInsert);
return VclPtr<CuiAbstractSfxDialog_Impl>::Create(pDlg);
return VclPtr<AbstractSvxCharacterMapDialog_Impl>::Create(new SvxCharacterMap(pParent, &rAttr, bInsert));
}
VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateEventConfigDialog( vcl::Window* pParent,
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 3aa4d92..4a77f17 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -471,6 +471,21 @@ public:
virtual bool IsRecommendToOpenReadonly() const override;
};
class SvxCharacterMap;
class AbstractSvxCharacterMapDialog_Impl : public SfxAbstractDialog
{
protected:
std::unique_ptr<SvxCharacterMap> m_xDlg;
public:
explicit AbstractSvxCharacterMapDialog_Impl(SvxCharacterMap* p)
: m_xDlg(p)
{
}
virtual short Execute() override;
virtual const SfxItemSet* GetOutputItemSet() const override;
virtual void SetText(const OUString& rStr) override;
};
class ScreenshotAnnotationDlg;
class AbstractScreenshotAnnotationDlg_Impl : public AbstractScreenshotAnnotationDlg
{
@@ -487,9 +502,9 @@ public:
const SfxItemSet& rAttr,
const SdrView* pView,
sal_uInt32 nResId ) override;
virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog( vcl::Window* pParent,
virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent,
const SfxItemSet& rAttr,
bool bInsert ) override;
bool bInsert) override;
virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog( vcl::Window* pParent,
const SfxItemSet& rAttr,
const css::uno::Reference< css::frame::XFrame >& _rxFrame
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
index 9fc291e..40de5c8 100644
--- a/cui/source/factory/init.cxx
+++ b/cui/source/factory/init.cxx
@@ -26,12 +26,12 @@ extern "C"
SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(vcl::Window* i_pParent, const vcl::Font& i_rFont, OUString& o_rResult)
{
bool bRet = false;
ScopedVclPtrInstance<SvxCharacterMap> aDlg(i_pParent);
aDlg->DisableFontSelection();
aDlg->SetCharFont(i_rFont);
if ( aDlg->Execute() == RET_OK )
SvxCharacterMap aDlg(i_pParent ? i_pParent->GetFrameWeld() : nullptr);
aDlg.DisableFontSelection();
aDlg.SetCharFont(i_rFont);
if (aDlg.execute() == RET_OK)
{
sal_UCS4 cChar = aDlg->GetChar();
sal_UCS4 cChar = aDlg.GetChar();
// using the new UCS4 constructor
OUString aOUStr( &cChar, 1 );
o_rResult = aOUStr;
diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx
index b1a06b4..74928b3 100644
--- a/cui/source/inc/cuicharmap.hxx
+++ b/cui/source/inc/cuicharmap.hxx
@@ -24,7 +24,9 @@
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/weld.hxx>
#include <sfx2/basedlgs.hxx>
#include <svl/itemset.hxx>
#include <svx/charmap.hxx>
#include <svx/searchcharmap.hxx>
#include <sfx2/charwin.hxx>
@@ -39,70 +41,75 @@ namespace svx
struct SvxShowCharSetItem;
}
class SvxShowText : public Control
class SvxShowText
{
public:
SvxShowText(vcl::Window* pParent);
private:
std::unique_ptr<weld::DrawingArea> m_xDrawingArea;
VclPtr<VirtualDevice> m_xVirDev;
Size m_aSize;
OUString m_sText;
long mnY;
bool mbCenter;
vcl::Font m_aFont;
void SetFont( const vcl::Font& rFont );
void SetText( const OUString& rText ) override;
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
DECL_LINK(DoResize, const Size& rSize, void);
public:
SvxShowText(weld::Builder& rBuilder, const OString& rId, const VclPtr<VirtualDevice>& rVirDev);
void SetFont(const vcl::Font& rFont);
vcl::Font GetFont() const { return m_aFont; }
void SetText(const OUString& rText);
OUString GetText() const { return m_sText; }
void SetCentered(bool bCenter) { mbCenter = bCenter; }
virtual void Resize() override;
virtual Size GetOptimalSize() const override;
protected:
virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&) override;
private:
long mnY;
bool mbCenter;
vcl::Font maFont;
void queue_draw() { m_xDrawingArea->queue_draw(); }
Size get_preferred_size() const { return m_xDrawingArea->get_preferred_size(); }
};
/** The main purpose of this dialog is to enable the use of characters
that are not easily accessible from the keyboard. */
class SvxCharacterMap : public SfxModalDialog
class SvxCharacterMap : public weld::GenericDialogController
{
private:
void init();
VclPtr<SvxShowCharSet> m_pShowSet;
VclPtr<SvxSearchCharSet> m_pSearchSet;
VclPtr<PushButton> m_pOKBtn;
VclPtr<FixedText> m_pFontText;
VclPtr<ListBox> m_pFontLB;
VclPtr<FixedText> m_pSubsetText;
VclPtr<ListBox> m_pSubsetLB;
VclPtr<SvxShowText> m_pShowChar;
VclPtr<Edit> m_pSearchText;
VclPtr<Edit> m_pHexCodeText;
VclPtr<Edit> m_pDecimalCodeText;
VclPtr<Button> m_pFavouritesBtn;
VclPtr<SvxCharView> m_pRecentCharView[16];
VclPtr<SvxCharView> m_pFavCharView[16];
VclPtr<VclMultiLineEdit> m_pCharName;
VclPtr<VirtualDevice> m_xVirDev;
vcl::Font aFont;
const SubsetMap* pSubsetMap;
bool isSearchMode;
bool m_bHasInsert;
std::deque<OUString> maRecentCharList;
std::deque<OUString> maRecentCharFontList;
std::deque<OUString> maFavCharList;
std::deque<OUString> maFavCharFontList;
uno::Reference< uno::XComponentContext > mxContext;
std::unique_ptr<weld::Button> m_xOKBtn;
std::unique_ptr<weld::Label> m_xFontText;
std::unique_ptr<weld::ComboBoxText> m_xFontLB;
std::unique_ptr<weld::Label> m_xSubsetText;
std::unique_ptr<weld::ComboBoxText> m_xSubsetLB;
std::unique_ptr<weld::Entry> m_xSearchText;
std::unique_ptr<weld::Entry> m_xHexCodeText;
std::unique_ptr<weld::Entry> m_xDecimalCodeText;
std::unique_ptr<weld::Button> m_xFavouritesBtn;
std::unique_ptr<weld::Label> m_xCharName;
std::unique_ptr<weld::Widget> m_xRecentGrid;
std::unique_ptr<weld::Widget> m_xFavGrid;
std::unique_ptr<SvxShowText> m_xShowChar;
std::unique_ptr<SvxCharView> m_xRecentCharView[16];
std::unique_ptr<SvxCharView> m_xFavCharView[16];
std::unique_ptr<SvxShowCharSet> m_xShowSet;
std::unique_ptr<SvxSearchCharSet> m_xSearchSet;
std::unique_ptr<SfxAllItemSet> m_xOutputSet;
enum class Radix : sal_Int16 {decimal = 10, hexadecimal=16};
DECL_LINK(FontSelectHdl, ListBox&, void);
DECL_LINK(SubsetSelectHdl, ListBox&, void);
DECL_LINK(FontSelectHdl, weld::ComboBoxText&, void);
DECL_LINK(SubsetSelectHdl, weld::ComboBoxText&, void);
DECL_LINK(CharDoubleClickHdl, SvxShowCharSet*,void);
DECL_LINK(CharSelectHdl, SvxShowCharSet*, void);
DECL_LINK(CharHighlightHdl, SvxShowCharSet*, void);
@@ -112,27 +119,29 @@ private:
DECL_LINK(SearchCharSelectHdl, SvxShowCharSet*, void);
DECL_LINK(SearchCharHighlightHdl, SvxShowCharSet*, void);
DECL_LINK(SearchCharPreSelectHdl, SvxShowCharSet*, void);
DECL_LINK(DecimalCodeChangeHdl, Edit&, void);
DECL_LINK(HexCodeChangeHdl, Edit&, void);
DECL_LINK(DecimalCodeChangeHdl, weld::Entry&, void);
DECL_LINK(HexCodeChangeHdl, weld::Entry&, void);
DECL_LINK(CharClickHdl, SvxCharView*, void);
DECL_LINK(RecentClearClickHdl, SvxCharView*, void);
DECL_LINK(FavClearClickHdl, SvxCharView*, void);
DECL_LINK(RecentClearAllClickHdl, SvxCharView*, void);
DECL_LINK(FavClearAllClickHdl, SvxCharView*, void);
DECL_LINK(InsertClickHdl, Button*, void);
DECL_STATIC_LINK(SvxCharacterMap, LoseFocusHdl, Control&, void);
DECL_LINK(FavSelectHdl, Button*, void);
DECL_LINK(SearchUpdateHdl, Edit&, void);
DECL_LINK(SearchFieldGetFocusHdl, Control&, void);
DECL_LINK(InsertClickHdl, weld::Button&, void);
DECL_STATIC_LINK(SvxCharacterMap, LoseFocusHdl, weld::Widget&, void);
DECL_LINK(FavSelectHdl, weld::Button&, void);
DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
DECL_LINK(SearchFieldGetFocusHdl, weld::Widget&, void);
static void fillAllSubsets(ListBox &rListBox);
static void fillAllSubsets(weld::ComboBoxText& rListBox);
void selectCharByCode(Radix radix);
public:
SvxCharacterMap( vcl::Window* pParent, const SfxItemSet* pSet=nullptr, const bool bInsert=true);
virtual ~SvxCharacterMap() override;
virtual short Execute() override;
virtual void dispose() override;
SvxCharacterMap(weld::Window* pParent, const SfxItemSet* pSet=nullptr, const bool bInsert=true);
short execute();
void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); }
void DisableFontSelection();
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index d65a0a0..6e4ca0f3 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -727,15 +727,15 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl, Button*, void)
if( nSelEntryPos == REPLACE_BULLETS ||
nSelEntryPos == APPLY_NUMBERING)
{
ScopedVclPtrInstance< SvxCharacterMap > pMapDlg(this, nullptr, false);
SvxCharacterMap aMapDlg(GetFrameWeld(), nullptr, false);
ImpUserData* pUserData = static_cast<ImpUserData*>(m_pCheckLB->FirstSelected()->GetUserData());
pMapDlg->SetCharFont(*pUserData->pFont);
pMapDlg->SetChar( (*pUserData->pString)[0] );
if(RET_OK == pMapDlg->Execute())
aMapDlg.SetCharFont(*pUserData->pFont);
aMapDlg.SetChar( (*pUserData->pString)[0] );
if (RET_OK == aMapDlg.execute())
{
vcl::Font aFont(pMapDlg->GetCharFont());
vcl::Font aFont(aMapDlg.GetCharFont());
*pUserData->pFont = aFont;
sal_UCS4 aChar = pMapDlg->GetChar();
sal_UCS4 aChar = aMapDlg.GetChar();
// using the UCS4 constructor
OUString aOUStr( &aChar, 1 );
*pUserData->pString = aOUStr;
@@ -2047,10 +2047,10 @@ IMPL_LINK( OfaQuoteTabPage, QuoteHdl, Button*, pBtn, void )
else if (pBtn == m_pDblEndQuotePB)
nMode = DBL_END;
// start character selection dialog
ScopedVclPtrInstance< SvxCharacterMap > pMap( this, nullptr, false );
pMap->SetCharFont( OutputDevice::GetDefaultFont(DefaultFontType::LATIN_TEXT,
SvxCharacterMap aMap(GetFrameWeld(), nullptr, false);
aMap.SetCharFont( OutputDevice::GetDefaultFont(DefaultFontType::LATIN_TEXT,
LANGUAGE_ENGLISH_US, GetDefaultFontFlags::OnlyOne ));
pMap->SetText(nMode < SGL_END ? CuiResId(RID_SVXSTR_STARTQUOTE) : CuiResId(RID_SVXSTR_ENDQUOTE) );
aMap.set_title(nMode < SGL_END ? CuiResId(RID_SVXSTR_STARTQUOTE) : CuiResId(RID_SVXSTR_ENDQUOTE));
sal_UCS4 cDlg;
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType();
@@ -2082,11 +2082,11 @@ IMPL_LINK( OfaQuoteTabPage, QuoteHdl, Button*, pBtn, void )
break;
}
pMap->SetChar( cDlg );
pMap->DisableFontSelection();
if(pMap->Execute() == RET_OK)
aMap.SetChar( cDlg );
aMap.DisableFontSelection();
if (aMap.execute() == RET_OK)
{
sal_UCS4 cNewChar = pMap->GetChar();
sal_UCS4 cNewChar = aMap.GetChar();
switch( nMode )
{
case SGL_START:
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 2ad91da..3c6afa8 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -3205,12 +3205,12 @@ void SvxCharTwoLinesPage::Initialize()
void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
{
bool bStart = pBox == m_pStartBracketLB;
VclPtrInstance< SvxCharacterMap > aDlg( this, nullptr, false );
aDlg->DisableFontSelection();
SvxCharacterMap aDlg(GetFrameWeld(), nullptr, false);
aDlg.DisableFontSelection();
if ( aDlg->Execute() == RET_OK )
if (aDlg.execute() == RET_OK)
{
sal_Unicode cChar = static_cast<sal_Unicode>(aDlg->GetChar());
sal_Unicode cChar = static_cast<sal_Unicode>(aDlg.GetChar());
SetBracket( cChar, bStart );
}
else
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 2577fd8..816ae97 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -2036,7 +2036,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, MenuButton *, void)
IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, Button*, void)
{
VclPtrInstance< SvxCharacterMap > pMap( this, nullptr, false );
SvxCharacterMap aMap(GetFrameWeld(), nullptr, false);
sal_uInt16 nMask = 1;
const vcl::Font* pFmtFont = nullptr;
@@ -2065,16 +2065,16 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, Button*, void)
}
if(pFmtFont)
pMap->SetCharFont(*pFmtFont);
if (pFmtFont)
aMap.SetCharFont(*pFmtFont);
else
pMap->SetCharFont(aActBulletFont);
if(bSameBullet)
pMap->SetChar( cBullet );
if(pMap->Execute() == RET_OK)
aMap.SetCharFont(aActBulletFont);
if (bSameBullet)
aMap.SetChar(cBullet);
if (aMap.execute() == RET_OK)
{
// change Font Numrules
aActBulletFont = pMap->GetCharFont();
aActBulletFont = aMap.GetCharFont();
sal_uInt16 _nMask = 1;
for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
@@ -2083,7 +2083,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, Button*, void)
{
SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
aNumFmt.SetBulletFont(&aActBulletFont);
aNumFmt.SetBulletChar( static_cast<sal_Unicode>(pMap->GetChar()) );
aNumFmt.SetBulletChar( static_cast<sal_Unicode>(aMap.GetChar()) );
pActNum->SetLevel(i, aNumFmt);
}
_nMask <<= 1;
diff --git a/cui/uiconfig/ui/specialcharacters.ui b/cui/uiconfig/ui/specialcharacters.ui
index 7e70cb0..2185a83 100644
--- a/cui/uiconfig/ui/specialcharacters.ui
+++ b/cui/uiconfig/ui/specialcharacters.ui
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.2 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<requires lib="" version="3.0"/>
<!-- interface-local-resource-path /home/akki/libreoffice/extras/source/glade -->
<object class="GtkDialog" id="SpecialCharactersDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="specialcharacters|SpecialCharactersDialog">Special Characters</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
@@ -18,12 +19,11 @@
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<!-- OK and Insert buttons are the same button. The correct one is set to visible incode. -->
<child>
<object class="GtkButton" id="insert">
<property name="label" translatable="yes" context="specialcharacters|insert">_Insert</property>
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
@@ -37,8 +37,8 @@
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
@@ -57,7 +57,6 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="xalign">0.50999999046325684</property>
</object>
<packing>
<property name="expand">False</property>
@@ -100,7 +99,6 @@
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="subsetft">
@@ -116,17 +114,6 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="fontlb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="fontft">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -140,17 +127,6 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="subsetlb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="srchft">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -173,6 +149,34 @@
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="subsetlb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="fontlb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -184,16 +188,13 @@
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="cuilo-SvxShowText" id="showchar">
<property name="width_request">80</property>
<property name="height_request">150</property>
<object class="GtkDrawingArea" id="showchar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="vexpand">True</property>
</object>
<packing>
@@ -214,8 +215,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="specialcharacters|hexlabel">Hexadecimal:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -265,8 +266,8 @@
<object class="GtkLabel" id="decimallabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="specialcharacters|decimallabel">Decimal:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -307,13 +308,13 @@
</packing>
</child>
<child>
<object class="GtkTextView" id="charname">
<object class="GtkLabel" id="charname">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
<property name="justification">center</property>
<property name="cursor_visible">False</property>
<property name="use_underline">True</property>
<property name="wrap">True</property>
<property name="mnemonic_widget">showchar</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -347,14 +348,15 @@
</packing>
</child>
<child>
<object class="GtkBox" id="box3">
<object class="GtkBox" id="viewgrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="sfxlo-SvxCharView" id="viewchar1">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -363,10 +365,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar2">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -375,10 +377,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar3">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -387,10 +389,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar4">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -399,10 +401,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar5">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -411,10 +413,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar6">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar6">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -423,10 +425,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar7">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar7">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -435,10 +437,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar8">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar8">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -447,10 +449,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar9">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar9">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -459,10 +461,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar10">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar10">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -471,10 +473,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar11">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar11">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -483,10 +485,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar12">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar12">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -495,10 +497,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar13">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar13">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -507,10 +509,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar14">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar14">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -519,10 +521,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar15">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar15">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -531,10 +533,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar16">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="viewchar16">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="expand">False</property>
@@ -578,14 +580,15 @@
</packing>
</child>
<child>
<object class="GtkGrid" id="grid6">
<object class="GtkGrid" id="favgrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">2</property>
<child>
<object class="sfxlo-SvxCharView" id="favchar1">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -593,10 +596,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar2">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -604,10 +607,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar4">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">3</property>
@@ -615,10 +618,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar3">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">2</property>
@@ -626,10 +629,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar5">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">4</property>
@@ -637,10 +640,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar6">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar6">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">5</property>
@@ -648,10 +651,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar7">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar7">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">6</property>
@@ -659,10 +662,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar8">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar8">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">7</property>
@@ -670,10 +673,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar16">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar16">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">15</property>
@@ -681,10 +684,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar15">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar15">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">14</property>
@@ -692,10 +695,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar14">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar14">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">13</property>
@@ -703,10 +706,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar13">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar13">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">12</property>
@@ -714,10 +717,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar12">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar12">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">11</property>
@@ -725,10 +728,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar11">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar11">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">10</property>
@@ -736,10 +739,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar10">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar10">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">9</property>
@@ -747,10 +750,10 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar9">
<property name="width_request">40</property>
<property name="height_request">35</property>
<object class="GtkDrawingArea" id="favchar9">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
<packing>
<property name="left_attach">8</property>
@@ -775,15 +778,33 @@
<object class="GtkBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="svxlo-SvxShowCharSet" id="showcharset">
<property name="width_request">580</property>
<property name="height_request">250</property>
<object class="GtkScrolledWindow" id="showscroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="showcharset">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -792,13 +813,27 @@
</packing>
</child>
<child>
<object class="svxlo-SvxSearchCharSet" id="searchcharset">
<property name="width_request">580</property>
<property name="height_request">250</property>
<object class="GtkScrolledWindow" id="searchscroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="searchcharset">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -826,5 +861,14 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">80</property>
<property name="step_increment">1</property>
<property name="page_increment">7</property>
<property name="page_size">8</property>
</object>
</interface>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 71f2c26..5770537 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -257,9 +257,6 @@
<glade-widget-class title="Show Math Symbol" name="smlo-SmShowSymbol"
generic-name="Show Math Symbol" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Show Math Char" name="smlo-SmShowChar"
generic-name="Show Math Char" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Gallery Preview" name="svxcorelo-GalleryPreview"
generic-name="Gallery Preview" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
@@ -269,12 +266,6 @@
<glade-widget-class title="Math Symbol Selection" name="smlo-SmShowSymbolSet"
generic-name="Math Symbol Selection" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Math Char Selection" name="svxlo-SvxShowCharSet"
generic-name="Math Char Selection" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Math Char Selection" name="svxlo-SvxSearchCharSet"
generic-name="Math Char Selection" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Number Preview" name="cuilo-SvxNumberPreview"
generic-name="Number Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
@@ -811,10 +802,7 @@
<glade-widget-class title="Ruby RadioButton" name="cuilo-RubyRadioButton"
generic-name="RubyRadioButton" parent="GtkRadioButton"
icon-name="widget-gtk-radiobutton"/>
<glade-widget-class title="Show Text" name="cuilo-SvxShowText"
generic-name="ShowText" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Char Win" name="sfxlo-SvxCharView"
<glade-widget-class title="Char Win" name="sfxlo-SvxCharViewControl"
generic-name="ShowText" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Notebook switching tabs depending on context" name="sfxlo-NotebookbarTabControl"
diff --git a/include/sfx2/charmapcontrol.hxx b/include/sfx2/charmapcontrol.hxx
index 92796714..716f7ba 100644
--- a/include/sfx2/charmapcontrol.hxx
+++ b/include/sfx2/charmapcontrol.hxx
@@ -27,7 +27,7 @@
#include <sfx2/charwin.hxx>
#include <vcl/button.hxx>
class SvxCharView;
class SvxCharViewControl;
class SFX2_DLLPUBLIC SfxCharmapCtrl : public SfxPopupWindow
{
@@ -40,15 +40,15 @@ public:
virtual void dispose() override;
private:
VclPtr<SvxCharView> m_pRecentCharView[16];
VclPtr<SvxCharView> m_pFavCharView[16];
VclPtr<SvxCharViewControl> m_pRecentCharView[16];
VclPtr<SvxCharViewControl> m_pFavCharView[16];
std::deque<OUString> maRecentCharList;
std::deque<OUString> maRecentCharFontList;
std::deque<OUString> maFavCharList;
std::deque<OUString> maFavCharFontList;
VclPtr<Button> maDlgBtn;
DECL_LINK(CharClickHdl, SvxCharView*, void);
DECL_LINK(CharClickHdl, SvxCharViewControl*, void);
DECL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, void);
DECL_LINK(OpenDlgHdl, Button*, void);
diff --git a/include/sfx2/charwin.hxx b/include/sfx2/charwin.hxx
index f8c01a1..1978121 100644
--- a/include/sfx2/charwin.hxx
+++ b/include/sfx2/charwin.hxx
@@ -22,11 +22,62 @@
#include <sfx2/tbxctrl.hxx>
#include <sfx2/dllapi.h>
#include <vcl/weld.hxx>
class SFX2_DLLPUBLIC SvxCharView : public Control
class SFX2_DLLPUBLIC SvxCharView
{
private:
VclPtr<VirtualDevice> mxVirDev;
std::unique_ptr<weld::DrawingArea> mxDrawingArea;
Size m_aSize;
long mnY;
Point maPosition;
vcl::Font maFont;
bool maHasInsert;
OUString m_sText;
Link<SvxCharView*, void> maMouseClickHdl;
Link<SvxCharView*, void> maClearClickHdl;
Link<SvxCharView*, void> maClearAllClickHdl;
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
DECL_LINK(DoResize, const Size& rSize, void);
DECL_LINK(DoMouseButtonDown, const MouseEvent&, void);
DECL_LINK(DoKeyDown, const KeyEvent&, bool);
public:
SvxCharView(weld::Builder& rBuilder, const OString& rId, const VclPtr<VirtualDevice>& rVirDev);
void SetFont( const vcl::Font& rFont );
vcl::Font GetFont() const { return maFont; }
void SetText( const OUString& rText );
OUString GetText() const { return m_sText; }
void Show() { mxDrawingArea->show(); }
void Hide() { mxDrawingArea->hide(); }
void SetHasInsert( bool bInsert );
void InsertCharToDoc();
void createContextMenu();
void grab_focus() { mxDrawingArea->grab_focus(); }
void queue_draw() { mxDrawingArea->queue_draw(); }
Size get_preferred_size() const { return mxDrawingArea->get_preferred_size(); }
void connect_focus_in(const Link<weld::Widget&, void>& rLink) { mxDrawingArea->connect_focus_in(rLink); }
void connect_focus_out(const Link<weld::Widget&, void>& rLink) { mxDrawingArea->connect_focus_out(rLink); }
void setMouseClickHdl(const Link<SvxCharView*,void> &rLink);
void setClearClickHdl(const Link<SvxCharView*,void> &rLink);
void setClearAllClickHdl(const Link<SvxCharView*,void> &rLink);
void ContextMenuSelect(const OString& rIdent);
};
class SFX2_DLLPUBLIC SvxCharViewControl : public Control
{
public:
SvxCharView(vcl::Window* pParent);
SvxCharViewControl(vcl::Window* pParent);
void SetFont( const vcl::Font& rFont );
void SetText( const OUString& rText ) override;
@@ -39,9 +90,9 @@ public:
virtual Size GetOptimalSize() const override;
void setMouseClickHdl(const Link<SvxCharView*,void> &rLink);
void setClearClickHdl(const Link<SvxCharView*,void> &rLink);
void setClearAllClickHdl(const Link<SvxCharView*,void> &rLink);
void setMouseClickHdl(const Link<SvxCharViewControl*,void> &rLink);
void setClearClickHdl(const Link<SvxCharViewControl*,void> &rLink);
void setClearAllClickHdl(const Link<SvxCharViewControl*,void> &rLink);
DECL_LINK(ContextMenuSelectHdl, Menu*, bool);
@@ -58,9 +109,11 @@ private:
vcl::Font maFont;
bool maHasInsert;
Link<SvxCharView*, void> maMouseClickHdl;
Link<SvxCharView*, void> maClearClickHdl;
Link<SvxCharView*, void> maClearAllClickHdl;
Link<SvxCharViewControl*, void> maMouseClickHdl;
Link<SvxCharViewControl*, void> maClearClickHdl;
Link<SvxCharViewControl*, void> maClearAllClickHdl;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index 2cb8702..3df3769 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -35,6 +35,7 @@
#include <vcl/outdev.hxx>
#include <vcl/metric.hxx>
#include <vcl/vclptr.hxx>
#include <vcl/weld.hxx>
#include <vcl/window.hxx>
#include <vcl/textview.hxx>
@@ -49,22 +50,25 @@ using namespace ::com::sun::star;
#define COLUMN_COUNT 16
#define ROW_COUNT 8
class CommandEvent;
class ScrollBar;
namespace svx
{
struct SvxShowCharSetItem;
class SvxShowCharSetVirtualAcc;
class SvxShowCharSetAcc;
}
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxShowCharSet : public Control
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxShowCharSet
{
protected:
VclPtr<VirtualDevice> mxVirDev;
std::unique_ptr<weld::DrawingArea> mxDrawingArea;
std::unique_ptr<weld::ScrolledWindow> mxScrollArea;
vcl::Font maFont;
Size maSize;
public:
SvxShowCharSet( vcl::Window* pParent );
virtual ~SvxShowCharSet() override;
virtual void dispose() override;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
SvxShowCharSet(weld::Builder& rBuilder, const OString& rDrawingId,
const OString& rScrollId, const VclPtr<VirtualDevice>& rVirDev);
virtual ~SvxShowCharSet();
virtual void RecalculateFont(vcl::RenderContext& rRenderContext);
@@ -79,6 +83,8 @@ public:
void SetFavClickHdl( const Link<SvxShowCharSet*,void>& rHdl ) { aFavClickHdl = rHdl; }
static sal_uInt32& getSelectedChar();
void SetFont( const vcl::Font& rFont );
vcl::Font GetFont() const { return mxVirDev->GetFont(); }
bool GetFontCharMap(FontCharMapRef& rxFontCharMap) const { return mxVirDev->GetFontCharMap(rxFontCharMap); }
bool isFavChar(const OUString& sTitle, const OUString& rFont);
void getFavCharacterList(); //gets both Fav char and Fav char font list
void updateFavCharacterList(const OUString& rChar, const OUString& rFont);
@@ -96,27 +102,29 @@ public:
static sal_uInt16 GetRowPos(sal_uInt16 _nPos);
static sal_uInt16 GetColumnPos(sal_uInt16 _nPos);
ScrollBar& getScrollBar() { return *aVscrollSB.get();}
void ReleaseAccessible();
virtual sal_Int32 getMaxCharCount() const;
virtual void Resize() override;
void Show() { mxScrollArea->show(); }
void Hide() { mxScrollArea->hide(); }
bool HasFocus() const { return mxDrawingArea->has_focus(); }
void GrabFocus() { mxDrawingArea->grab_focus(); }
bool IsEnabled() const { return mxDrawingArea->get_sensitive(); }
bool IsVisible() const { return mxDrawingArea->get_visible(); }
const Size& GetSize() const { return maSize; }
virtual FactoryFunction GetUITestFactory() const override;
uno::Reference<css::accessibility::XAccessible> getAccessibleParent() { return mxDrawingArea->get_accessible_parent(); }
protected:
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
virtual void MouseMove( const MouseEvent& rMEvt ) override;
virtual void Command( const CommandEvent& rCEvt ) override;
virtual void KeyInput( const KeyEvent& rKEvt ) override;
virtual void GetFocus() override;
virtual void LoseFocus() override;
virtual void StateChanged( StateChangedType nStateChange ) override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
private:
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
DECL_LINK(DoResize, const Size& rSize, void);
DECL_LINK(DoMouseButtonDown, const MouseEvent& rMEvt, void);
DECL_LINK(DoMouseMove, const MouseEvent& rMEvt, void);
DECL_LINK(DoMouseButtonUp, const MouseEvent& rMEvt, void);
DECL_LINK(DoKeyDown, const KeyEvent& rKEvt, bool);
DECL_LINK(DoGetFocus, weld::Widget&, void);
DECL_LINK(DoLoseFocus, weld::Widget&, void);
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
css::uno::Reference<css::accessibility::XAccessible> CreateAccessible();
protected:
typedef std::map<sal_Int32, std::shared_ptr<svx::SvxShowCharSetItem> > ItemsMap;
@@ -130,7 +138,7 @@ protected:
std::deque<OUString> maFavCharList;
std::deque<OUString> maFavCharFontList;
rtl::Reference<svx::SvxShowCharSetVirtualAcc> m_xAccessible;
rtl::Reference<svx::SvxShowCharSetAcc> m_xAccessible;
uno::Reference< uno::XComponentContext > mxContext;
long nX;
long nY;
@@ -143,7 +151,6 @@ protected:
FontCharMapRef mxFontCharMap;
Size maFontSize;
Point maPosition;
VclPtr<ScrollBar> aVscrollSB;
bool mbRecalculateFont : 1;
bool mbUpdateForeground : 1;
@@ -155,8 +162,8 @@ protected:
void InitSettings(vcl::RenderContext& rRenderContext);
// abstraction layers are: Unicode<->MapIndex<->Pixel
Point MapIndexToPixel( int) const;
DECL_LINK(VscrollHdl, ScrollBar*, void);
DECL_LINK(ContextMenuSelectHdl, Menu*, bool);
DECL_LINK(VscrollHdl, weld::ScrolledWindow&, void);
void ContextMenuSelect(const OString& rIdent);
void init();
tools::Rectangle getGridRectangle(const Point &rPointUL, const Size &rOutputSize);
diff --git a/include/svx/searchcharmap.hxx b/include/svx/searchcharmap.hxx
index cfb4603..8f23c4b 100644
--- a/include/svx/searchcharmap.hxx
+++ b/include/svx/searchcharmap.hxx
@@ -50,18 +50,12 @@ namespace vcl { class Font; }
class CommandEvent;
class ScrollBar;
namespace svx
{
struct SvxShowCharSetItem;
class SvxShowCharSetVirtualAcc;
}
class SVX_DLLPUBLIC SvxSearchCharSet : public SvxShowCharSet
{
public:
SvxSearchCharSet( vcl::Window* pParent );
SvxSearchCharSet(weld::Builder& rBuilder, const OString& rDrawingId,
const OString& rScrollId, const VclPtr<VirtualDevice> &rDevice);
virtual ~SvxSearchCharSet() override;
virtual void dispose() override;
virtual void RecalculateFont(vcl::RenderContext& rRenderContext) override;
@@ -76,10 +70,6 @@ public:
virtual sal_Int32 getMaxCharCount() const override;
protected:
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
virtual void KeyInput( const KeyEvent& rKEvt ) override;
private:
sal_Int32 nCount;
@@ -88,6 +78,8 @@ private:
std::unordered_map<sal_Int32, sal_UCS4> m_aItemList;
private:
virtual void DrawChars_Impl(vcl::RenderContext& rRenderContext, int n1, int n2) override;
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
DECL_LINK(DoKeyDown, const KeyEvent&, bool);
};
#endif
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index c9f4fd2..16dbd5f 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -1356,11 +1356,6 @@
// String for saving modified image (instead of original)
#define RID_SVXSTR_SAVE_MODIFIED_IMAGE NC_("RID_SVXSTR_SAVE_MODIFIED_IMAGE", "The image has been modified. By default the original image will be saved.\nDo you want to save the modified version instead?")
#define RID_ADD_TO_FAVORITES NC_("RID_SUBSETMAP", "Add to favorites")
#define RID_REMOVE_FAVORITES NC_("RID_SUBSETMAP", "Remove from favorites")
#define RID_INSERT NC_("RID_SUBSETMAP", "Insert into document")
#define RID_COPY_CLIPBOARD NC_("RID_SUBSETMAP", "Copy to clipboard")
#define RID_SUBSETSTR_BASIC_LATIN NC_("RID_SUBSETMAP", "Basic Latin")
#define RID_SUBSETSTR_LATIN_1 NC_("RID_SUBSETMAP", "Latin-1")
#define RID_SUBSETSTR_LATIN_EXTENDED_A NC_("RID_SUBSETMAP", "Latin Extended-A")
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index dff3fc0..3899e4a 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -438,9 +438,7 @@ public:
const SfxItemSet& rAttr,
const SdrView* pView,
sal_uInt32 nResId )=0;
virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog( vcl::Window* pParent,
const SfxItemSet& rAttr,
bool bInsert )=0;
virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, bool bInsert) = 0;
virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog( vcl::Window* pParent,
const SfxItemSet& rAttr,
const css::uno::Reference< css::frame::XFrame >& _rxFrame )=0;
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 6af0686..47b80fd 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -613,11 +613,15 @@ public:
class VCL_DLLPUBLIC VclDrawingArea : public Control
{
private:
FactoryFunction m_pFactoryFunction;
void* m_pUserData;
Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void> m_aPaintHdl;
Link<const Size&, void> m_aResizeHdl;
Link<const Point&, void> m_aMousePressHdl;
Link<const Point&, void> m_aMouseMotionHdl;
Link<const Point&, void> m_aMouseReleaseHdl;
Link<const MouseEvent&, void> m_aMousePressHdl;
Link<const MouseEvent&, void> m_aMouseMotionHdl;
Link<const MouseEvent&, void> m_aMouseReleaseHdl;
Link<const KeyEvent&, bool> m_aKeyPressHdl;
Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
{
@@ -629,22 +633,65 @@ private:
}
virtual void MouseMove(const MouseEvent& rMEvt) override
{
m_aMouseMotionHdl.Call(rMEvt.GetPosPixel());
m_aMouseMotionHdl.Call(rMEvt);
}
virtual void MouseButtonDown(const MouseEvent& rMEvt) override
{
m_aMousePressHdl.Call(rMEvt.GetPosPixel());
m_aMousePressHdl.Call(rMEvt);
}
virtual void MouseButtonUp(const MouseEvent& rMEvt) override
{
m_aMouseReleaseHdl.Call(rMEvt.GetPosPixel());
m_aMouseReleaseHdl.Call(rMEvt);
}
virtual void KeyInput(const KeyEvent& rKEvt) override
{
if (!m_aKeyPressHdl.Call(rKEvt))
Control::KeyInput(rKEvt);
}
virtual void KeyUp(const KeyEvent& rKEvt) override
{
if (!m_aKeyReleaseHdl.Call(rKEvt))
Control::KeyUp(rKEvt);
}
virtual void StateChanged(StateChangedType nType) override
{
Control::StateChanged(nType);
if (nType == StateChangedType::ControlForeground || nType == StateChangedType::ControlBackground)
Invalidate();
}
virtual void DataChanged(const DataChangedEvent& rDCEvt) override
{
Control::DataChanged(rDCEvt);
if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
Invalidate();
}
virtual FactoryFunction GetUITestFactory() const override
{
if (m_pFactoryFunction)
return m_pFactoryFunction;
return Control::GetUITestFactory();
}
public:
VclDrawingArea(vcl::Window *pParent, WinBits nStyle)
: Control(pParent, nStyle)
, m_pFactoryFunction(nullptr)
, m_pUserData(nullptr)
{
}
void SetUITestFactory(FactoryFunction pFactoryFunction, void* pUserData)
{
m_pFactoryFunction = pFactoryFunction;
m_pUserData = pUserData;
}
void* GetUserData() const
{
return m_pUserData;
}
void SetPaintHdl(const Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>& rLink)
{
m_aPaintHdl = rLink;
@@ -653,18 +700,26 @@ public:
{
m_aResizeHdl = rLink;
}
void SetMousePressHdl(const Link<const Point&, void>& rLink)
void SetMousePressHdl(const Link<const MouseEvent&, void>& rLink)
{
m_aMousePressHdl = rLink;
}
void SetMouseMoveHdl(const Link<const Point&, void>& rLink)
void SetMouseMoveHdl(const Link<const MouseEvent&, void>& rLink)
{
m_aMouseMotionHdl = rLink;
}
void SetMouseReleaseHdl(const Link<const Point&, void>& rLink)
void SetMouseReleaseHdl(const Link<const MouseEvent&, void>& rLink)
{
m_aMouseReleaseHdl = rLink;
}
void SetKeyPressHdl(const Link<const KeyEvent&, bool>& rLink)
{
m_aKeyPressHdl = rLink;
}
void SetKeyReleaseHdl(const Link<const KeyEvent&, bool>& rLink)
{
m_aKeyReleaseHdl = rLink;
}
};
//Get first window of a pTopLevel window as
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 4a8340e..e791724 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -71,6 +71,9 @@ public:
virtual void connect_focus_in(const Link<Widget&, void>& rLink) = 0;
virtual void connect_focus_out(const Link<Widget&, void>& rLink) = 0;
virtual void grab_add() = 0;
virtual void grab_remove() = 0;
virtual Container* weld_parent() const = 0;
virtual ~Widget() {}
@@ -83,6 +86,26 @@ public:
virtual void add(weld::Widget* pWidget) = 0;
};
class VCL_DLLPUBLIC ScrolledWindow : virtual public Container
{
protected:
Link<ScrolledWindow&, void> m_aVChangeHdl;
void signal_vadjustment_changed() { m_aVChangeHdl.Call(*this); }
public:
virtual void set_user_managed_scrolling() = 0;
virtual void vadjustment_configure(int value, int lower, int upper, int step_increment,
int page_increment, int page_size)
= 0;
virtual int vadjustment_get_value() const = 0;
virtual void vadjustment_set_value(int value) = 0;
void connect_vadjustment_changed(const Link<ScrolledWindow&, void>& rLink)
{
m_aVChangeHdl = rLink;
}
};
class VCL_DLLPUBLIC Frame : virtual public Container
{
public:
@@ -199,6 +222,12 @@ public:
void set_active(const OUString& rStr) { set_active(find_text(rStr)); }
virtual void set_entry_text(const OUString& rStr) = 0;
virtual void select_entry_region(int nStartPos, int nEndPos) = 0;
virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) = 0;
virtual void unset_entry_completion() = 0;
void save_value() { m_sSavedValue = get_active_text(); }
bool get_value_changed_from_saved() const { return m_sSavedValue != get_active_text(); }
@@ -341,6 +370,7 @@ public:
virtual void set_width_chars(int nChars) = 0;
virtual void set_max_length(int nChars) = 0;
virtual void select_region(int nStartPos, int nEndPos) = 0;
virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
virtual void set_position(int nCursorPos) = 0;
virtual void set_editable(bool bEditable) = 0;
@@ -545,21 +575,41 @@ public:
protected:
Link<draw_args, void> m_aDrawHdl;
Link<const Size&, void> m_aSizeAllocateHdl;
Link<const Point&, void> m_aMousePressHdl;
Link<const Point&, void> m_aMouseMotionHdl;
Link<const Point&, void> m_aMouseReleaseHdl;
Link<const MouseEvent&, void> m_aMousePressHdl;
Link<const MouseEvent&, void> m_aMouseMotionHdl;
Link<const MouseEvent&, void> m_aMouseReleaseHdl;
Link<const KeyEvent&, bool> m_aKeyPressHdl;
Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
public:
void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; }
void connect_size_allocate(const Link<const Size&, void>& rLink) { m_aSizeAllocateHdl = rLink; }
void connect_mouse_press(const Link<const Point&, void>& rLink) { m_aMousePressHdl = rLink; }
void connect_mouse_move(const Link<const Point&, void>& rLink) { m_aMouseMotionHdl = rLink; }
void connect_mouse_release(const Link<const Point&, void>& rLink)
void connect_mouse_press(const Link<const MouseEvent&, void>& rLink)
{
m_aMousePressHdl = rLink;
}
void connect_mouse_move(const Link<const MouseEvent&, void>& rLink)
{
m_aMouseMotionHdl = rLink;
}
void connect_mouse_release(const Link<const MouseEvent&, void>& rLink)
{
m_aMouseReleaseHdl = rLink;
}
void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; }
void connect_key_release(const Link<const KeyEvent&, bool>& rLink) { m_aKeyReleaseHdl = rLink; }
virtual void queue_draw() = 0;
virtual void queue_draw_area(int x, int y, int width, int height) = 0;
virtual a11yref get_accessible_parent() = 0;
};
class VCL_DLLPUBLIC Menu
{
public:
virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) = 0;
virtual void set_sensitive(const OString& rIdent, bool bSensitive) = 0;
virtual void show(const OString& rIdent, bool bShow) = 0;
virtual ~Menu() {}
};
class VCL_DLLPUBLIC Builder
@@ -583,6 +633,8 @@ public:
virtual Container* weld_container(const OString& id, bool bTakeOwnership = false) = 0;
virtual Button* weld_button(const OString& id, bool bTakeOwnership = false) = 0;
virtual Frame* weld_frame(const OString& id, bool bTakeOwnership = false) = 0;
virtual ScrolledWindow* weld_scrolled_window(const OString& id, bool bTakeOwnership = false)
= 0;
virtual Notebook* weld_notebook(const OString& id, bool bTakeOwnership = false) = 0;
virtual RadioButton* weld_radio_button(const OString& id, bool bTakeOwnership = false) = 0;
virtual CheckButton* weld_check_button(const OString& id, bool bTakeOwnership = false) = 0;
@@ -598,8 +650,10 @@ public:
virtual Expander* weld_expander(const OString& id, bool bTakeOwnership = false) = 0;
virtual Entry* weld_entry(const OString& id, bool bTakeOwnership = false) = 0;
virtual DrawingArea* weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
bool bTakeOwnership = false)
FactoryFunction pUITestFactoryFunction = nullptr,
void* pUserData = nullptr, bool bTakeOwnership = false)
= 0;
virtual Menu* weld_menu(const OString& id, bool bTakeOwnership = true) = 0;
virtual ~Builder() {}
};
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 3fabad0..67c2afa 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -1831,6 +1831,13 @@ void OStorage::InternalDispose( bool bNotifyImpl )
// since the listeners could dispose the object while being notified
lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) );
m_pData->m_aListenersContainer.disposeAndClear( aSource );
if ( !m_pImpl )
{
SAL_INFO("package.xstor", THROW_WHERE "Disposed!");
throw lang::DisposedException( THROW_WHERE );
}
m_pImpl->m_nModifiedListenerCount = 0;
if ( m_pData->m_bReadOnlyWrap )
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index a36745ce..e67ace0 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2468,7 +2468,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
aSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
aSet.Put( SvxFontItem( aCurFont.GetFamilyType(), aCurFont.GetFamilyName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), GetPool().GetWhich(SID_ATTR_CHAR_FONT) ) );
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog( pTabViewShell->GetDialogParent(), aSet, true ));
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(pTabViewShell->GetFrameWeld(), aSet, true));
pDlg->Execute();
}
break;
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 76198a2..c7a8a30 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -335,7 +335,7 @@ bool ScViewUtil::ExecuteCharMap( const SvxFontItem& rOldFont,
SfxAllItemSet aSet( rFrame.GetObjectShell()->GetPool() );
aSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
aSet.Put( SvxFontItem( rOldFont.GetFamily(), rOldFont.GetFamilyName(), rOldFont.GetStyleName(), rOldFont.GetPitch(), rOldFont.GetCharSet(), aSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ) ) );
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog( &rFrame.GetWindow(), aSet, true ));
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rFrame.GetWindow().GetFrameWeld(), aSet, true));
pDlg->Execute();
}
return bRet;
diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx
index 1762d86..db6df94 100644
--- a/sd/source/ui/func/fubullet.cxx
+++ b/sd/source/ui/func/fubullet.cxx
@@ -189,7 +189,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq )
aSet.Put( *pFontItem );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact ? pFact->CreateCharMapDialog( &mpView->GetViewShell()->GetViewFrame()->GetWindow(), aSet,
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact ? pFact->CreateCharMapDialog(mpView->GetViewShell()->GetFrameWeld(), aSet,
true ) : nullptr);
if( !pDlg )
return;
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index b62db55..25fa661 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/bookmarkdialog \
sfx2/uiconfig/ui/bookmarkmenu \
sfx2/uiconfig/ui/charmapcontrol \
sfx2/uiconfig/ui/charviewmenu \
sfx2/uiconfig/ui/checkin \
sfx2/uiconfig/ui/cmisinfopage \
sfx2/uiconfig/ui/cmisline \
diff --git a/sfx2/source/control/charmapcontrol.cxx b/sfx2/source/control/charmapcontrol.cxx
index e763135..7c5a01e 100644
--- a/sfx2/source/control/charmapcontrol.cxx
+++ b/sfx2/source/control/charmapcontrol.cxx
@@ -184,7 +184,7 @@ IMPL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, pItem, void)
}
IMPL_LINK(SfxCharmapCtrl, CharClickHdl, SvxCharView*, rView, void)
IMPL_LINK(SfxCharmapCtrl, CharClickHdl, SvxCharViewControl*, rView, void)
{
rView->GrabFocus();
rView->Invalidate();
diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx
index f58c76e..625cc01 100644
--- a/sfx2/source/control/charwin.cxx
+++ b/sfx2/source/control/charwin.cxx
@@ -29,8 +29,237 @@
using namespace com::sun::star;
SvxCharView::SvxCharView(weld::Builder& rBuilder, const OString& rId, const VclPtr<VirtualDevice>& rVirDev)
: mxVirDev(rVirDev)
, mxDrawingArea(rBuilder.weld_drawing_area(rId))
, mnY(0)
, maPosition(0,0)
, maHasInsert(true)
{
mxDrawingArea->connect_size_allocate(LINK(this, SvxCharView, DoResize));
mxDrawingArea->connect_draw(LINK(this, SvxCharView, DoPaint));
mxDrawingArea->connect_mouse_press(LINK(this, SvxCharView, DoMouseButtonDown));
mxDrawingArea->connect_key_press(LINK(this, SvxCharView, DoKeyDown));
SvxCharView::SvxCharView(vcl::Window* pParent)
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
vcl::Font aFont = rStyleSettings.GetLabelFont();
const Size aFontSize = aFont.GetFontSize();
aFont.SetFontSize(Size(aFontSize.Width() * 2.5, aFontSize.Height() * 2.5));
mxVirDev->Push(PUSH_ALLFONT);
mxVirDev->SetFont(aFont);
mxDrawingArea->set_size_request(mxVirDev->approximate_digit_width() * 2,
mxVirDev->GetTextHeight());
mxVirDev->Pop();
}
IMPL_LINK(SvxCharView, DoMouseButtonDown, const MouseEvent&, rMEvt, void)
{
if ( rMEvt.IsLeft() )
{
if ( !(rMEvt.GetClicks() % 2) && maHasInsert )
{
InsertCharToDoc();
}
maMouseClickHdl.Call(this);
}
if (rMEvt.IsRight())
{
Point aPosition(rMEvt.GetPosPixel());
maPosition = aPosition;
mxDrawingArea->grab_focus();
mxDrawingArea->queue_draw();
createContextMenu();
}
}
IMPL_LINK(SvxCharView, DoKeyDown, const KeyEvent&, rKEvt, bool)
{
bool bRet = false;
vcl::KeyCode aCode = rKEvt.GetKeyCode();
switch (aCode.GetCode())
{
case KEY_SPACE:
case KEY_RETURN:
InsertCharToDoc();
bRet = true;
break;
}
return bRet;
}
void SvxCharView::InsertCharToDoc()
{
if (GetText().isEmpty())
return;
uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
uno::Sequence<beans::PropertyValue> aArgs(2);
aArgs[0].Name = "Symbols";
aArgs[0].Value <<= GetText();
aArgs[1].Name = "FontName";
aArgs[1].Value <<= maFont.GetFamilyName();
comphelper::dispatchCommand(".uno:InsertSymbol", aArgs);
}
void SvxCharView::createContextMenu()
{
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(mxDrawingArea.get(), "sfx/ui/charviewmenu.ui"));
std::unique_ptr<weld::Menu> xItemMenu(xBuilder->weld_menu("charviewmenu"));
ContextMenuSelect(xItemMenu->popup_at_rect(mxDrawingArea.get(), tools::Rectangle(maPosition, Size(1,1))));
queue_draw();
}
void SvxCharView::ContextMenuSelect(const OString& rMenuId)
{
if (rMenuId == "clearchar")
maClearClickHdl.Call(this);
else if (rMenuId == "clearallchar")
maClearAllClickHdl.Call(this);
}
IMPL_LINK(SvxCharView, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
{
vcl::RenderContext& rRenderContext = aPayload.first;
rRenderContext.SetFont(maFont);
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const Color aWindowTextColor(rStyleSettings.GetFieldTextColor());
Color aHighlightColor(rStyleSettings.GetHighlightColor());
Color aHighlightTextColor(rStyleSettings.GetHighlightTextColor());
Color aFillColor(rStyleSettings.GetWindowColor());
Color aTextColor(rStyleSettings.GetWindowTextColor());
const OUString aText = GetText();
long nAvailWidth = m_aSize.Width();
long nWinHeight = m_aSize.Height();
bool bGotBoundary = true;
bool bShrankFont = false;
vcl::Font aOrigFont(rRenderContext.GetFont());
Size aFontSize(aOrigFont.GetFontSize());
::tools::Rectangle aBoundRect;
for (long nFontHeight = aFontSize.Height(); nFontHeight > 0; nFontHeight -= 1)
{
if (!rRenderContext.GetTextBoundRect( aBoundRect, aText ) || aBoundRect.IsEmpty())
{
bGotBoundary = false;
break;
}
//only shrink in the single glyph large view mode
long nTextWidth = aBoundRect.GetWidth();
if (nAvailWidth > nTextWidth)
break;
vcl::Font aFont(aOrigFont);
aFontSize.setHeight( nFontHeight );
aFont.SetFontSize(aFontSize);
rRenderContext.SetFont(aFont);
mnY = (nWinHeight - rRenderContext.GetTextHeight()) / 2;
bShrankFont = true;
}
Point aPoint(2, mnY);
if (!bGotBoundary)
aPoint.setX( (m_aSize.Width() - rRenderContext.GetTextWidth(aText)) / 2 );
else
{
// adjust position
aBoundRect += aPoint;
// vertical adjustment
int nYLDelta = aBoundRect.Top();
int nYHDelta = m_aSize.Height() - aBoundRect.Bottom();
if( nYLDelta <= 0 )
aPoint.AdjustY( -(nYLDelta - 1) );
else if( nYHDelta <= 0 )
aPoint.AdjustY(nYHDelta - 1 );
// centrally align glyph
aPoint.setX( -aBoundRect.Left() + (m_aSize.Width() - aBoundRect.GetWidth()) / 2 );
}
if (mxDrawingArea->has_focus())
{
rRenderContext.SetFillColor(aHighlightColor);
rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), m_aSize));
rRenderContext.SetTextColor(aHighlightTextColor);
rRenderContext.DrawText(aPoint, aText);
}
else
{
rRenderContext.SetFillColor(aFillColor);
rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), m_aSize));
rRenderContext.SetTextColor(aWindowTextColor);
rRenderContext.DrawText(aPoint, aText);
}
rRenderContext.SetFillColor(aFillColor);
rRenderContext.SetTextColor(aTextColor);
if (bShrankFont)
rRenderContext.SetFont(aOrigFont);
}
void SvxCharView::setMouseClickHdl(const Link<SvxCharView*,void> &rLink)
{
maMouseClickHdl = rLink;
}
void SvxCharView::setClearClickHdl(const Link<SvxCharView*,void> &rLink)
{
maClearClickHdl = rLink;
}
void SvxCharView::setClearAllClickHdl(const Link<SvxCharView*,void> &rLink)
{
maClearAllClickHdl = rLink;
}
void SvxCharView::SetFont( const vcl::Font& rFont )
{
long nWinHeight = m_aSize.Height();
maFont = vcl::Font(rFont);
maFont.SetWeight(WEIGHT_NORMAL);
maFont.SetAlignment(ALIGN_TOP);
maFont.SetFontSize(mxVirDev->PixelToLogic(Size(0, nWinHeight / 2)));
maFont.SetTransparent(true);
mxVirDev->Push(PUSH_ALLFONT);
mxVirDev->SetFont(maFont);
mnY = (nWinHeight - mxVirDev->GetTextHeight()) / 2;
mxVirDev->Pop();
queue_draw();
}
IMPL_LINK(SvxCharView, DoResize, const Size&, rSize, void)
{
m_aSize = rSize;
SetFont(GetFont()); //force recalculation of size
}
void SvxCharView::SetText( const OUString& rText )
{
m_sText = rText;
queue_draw();
}
void SvxCharView::SetHasInsert( bool bInsert )
{
maHasInsert = bInsert;
}
SvxCharViewControl::SvxCharViewControl(vcl::Window* pParent)
: Control(pParent, WB_TABSTOP | WB_BORDER)
, mnY(0)
, maPosition(0,0)
@@ -38,9 +267,9 @@ SvxCharView::SvxCharView(vcl::Window* pParent)
{
}
VCL_BUILDER_FACTORY(SvxCharView)
VCL_BUILDER_FACTORY(SvxCharViewControl)
void SvxCharView::MouseButtonDown( const MouseEvent& rMEvt )
void SvxCharViewControl::MouseButtonDown( const MouseEvent& rMEvt )
{
Control::MouseButtonDown(rMEvt);
@@ -65,7 +294,7 @@ void SvxCharView::MouseButtonDown( const MouseEvent& rMEvt )
}
}
void SvxCharView::KeyInput( const KeyEvent& rKEvt )
void SvxCharViewControl::KeyInput( const KeyEvent& rKEvt )
{
vcl::KeyCode aCode = rKEvt.GetKeyCode();
@@ -79,7 +308,7 @@ void SvxCharView::KeyInput( const KeyEvent& rKEvt )
Control::KeyInput(rKEvt);
}
void SvxCharView::InsertCharToDoc()
void SvxCharViewControl::InsertCharToDoc()
{
if(GetText().isEmpty())
return;
@@ -96,17 +325,17 @@ void SvxCharView::InsertCharToDoc()
comphelper::dispatchCommand(".uno:InsertSymbol", aArgs);
}
void SvxCharView::createContextMenu()
void SvxCharViewControl::createContextMenu()
{
ScopedVclPtrInstance<PopupMenu> pItemMenu;
pItemMenu->InsertItem(0,SfxResId(STR_CLEAR_CHAR));
pItemMenu->InsertItem(1,SfxResId(STR_CLEAR_ALL_CHAR));
pItemMenu->SetSelectHdl(LINK(this, SvxCharView, ContextMenuSelectHdl));
pItemMenu->SetSelectHdl(LINK(this, SvxCharViewControl, ContextMenuSelectHdl));
pItemMenu->Execute(this, tools::Rectangle(maPosition,Size(1,1)), PopupMenuFlags::ExecuteDown);
Invalidate();
}
IMPL_LINK(SvxCharView, ContextMenuSelectHdl, Menu*, pMenu, bool)
IMPL_LINK(SvxCharViewControl, ContextMenuSelectHdl, Menu*, pMenu, bool)
{
sal_uInt16 nMenuId = pMenu->GetCurItemId();
@@ -124,7 +353,7 @@ IMPL_LINK(SvxCharView, ContextMenuSelectHdl, Menu*, pMenu, bool)
return false;
}
void SvxCharView::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
void SvxCharViewControl::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
{
rRenderContext.SetFont(maFont);
@@ -211,22 +440,22 @@ void SvxCharView::Paint(vcl::RenderContext& rRenderContext, const ::tools::Recta
rRenderContext.SetFont(aOrigFont);
}
void SvxCharView::setMouseClickHdl(const Link<SvxCharView*,void> &rLink)
void SvxCharViewControl::setMouseClickHdl(const Link<SvxCharViewControl*,void> &rLink)
{
maMouseClickHdl = rLink;
}
void SvxCharView::setClearClickHdl(const Link<SvxCharView*,void> &rLink)
void SvxCharViewControl::setClearClickHdl(const Link<SvxCharViewControl*,void> &rLink)
{
maClearClickHdl = rLink;
}
void SvxCharView::setClearAllClickHdl(const Link<SvxCharView*,void> &rLink)
void SvxCharViewControl::setClearAllClickHdl(const Link<SvxCharViewControl*,void> &rLink)
{
maClearAllClickHdl = rLink;
}
void SvxCharView::SetFont( const vcl::Font& rFont )
void SvxCharViewControl::SetFont( const vcl::Font& rFont )
{
long nWinHeight = GetOutputSizePixel().Height();
maFont = vcl::Font(rFont);
@@ -241,7 +470,7 @@ void SvxCharView::SetFont( const vcl::Font& rFont )
Invalidate();
}
Size SvxCharView::GetOptimalSize() const
Size SvxCharViewControl::GetOptimalSize() const
{
const vcl::Font &rFont = GetFont();
const Size rFontSize = rFont.GetFontSize();
@@ -249,20 +478,22 @@ Size SvxCharView::GetOptimalSize() const
return Size( GetTextWidth( GetText() ) + 2 * 12, nWinHeight );
}
void SvxCharView::Resize()
void SvxCharViewControl::Resize()
{
Control::Resize();
SetFont(GetFont());
}
void SvxCharView::SetText( const OUString& rText )
void SvxCharViewControl::SetText( const OUString& rText )
{
Control::SetText( rText );
Invalidate();
}
void SvxCharView::SetHasInsert( bool bInsert )
void SvxCharViewControl::SetHasInsert( bool bInsert )
{
maHasInsert = bInsert;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sfx2/uiconfig/ui/charmapcontrol.ui b/sfx2/uiconfig/ui/charmapcontrol.ui
index af77f15..510b079 100644
--- a/sfx2/uiconfig/ui/charmapcontrol.ui
+++ b/sfx2/uiconfig/ui/charmapcontrol.ui
@@ -37,7 +37,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="sfxlo-SvxCharView" id="favchar1">
<object class="sfxlo-SvxCharViewControl" id="favchar1">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -49,7 +49,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar2">
<object class="sfxlo-SvxCharViewControl" id="favchar2">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -61,7 +61,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar4">
<object class="sfxlo-SvxCharViewControl" id="favchar4">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -73,7 +73,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar3">
<object class="sfxlo-SvxCharViewControl" id="favchar3">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -85,7 +85,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar5">
<object class="sfxlo-SvxCharViewControl" id="favchar5">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -97,7 +97,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar6">
<object class="sfxlo-SvxCharViewControl" id="favchar6">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -109,7 +109,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar7">
<object class="sfxlo-SvxCharViewControl" id="favchar7">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -121,7 +121,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar8">
<object class="sfxlo-SvxCharViewControl" id="favchar8">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -133,7 +133,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar9">
<object class="sfxlo-SvxCharViewControl" id="favchar9">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -145,7 +145,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar10">
<object class="sfxlo-SvxCharViewControl" id="favchar10">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -157,7 +157,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar11">
<object class="sfxlo-SvxCharViewControl" id="favchar11">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -169,7 +169,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar12">
<object class="sfxlo-SvxCharViewControl" id="favchar12">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -181,7 +181,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar13">
<object class="sfxlo-SvxCharViewControl" id="favchar13">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -193,7 +193,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar14">
<object class="sfxlo-SvxCharViewControl" id="favchar14">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -205,7 +205,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar15">
<object class="sfxlo-SvxCharViewControl" id="favchar15">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -217,7 +217,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="favchar16">
<object class="sfxlo-SvxCharViewControl" id="favchar16">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -260,7 +260,7 @@
<property name="row_homogeneous">True</property>
<property name="column_homogeneous">True</property>
<child>
<object class="sfxlo-SvxCharView" id="viewchar1">
<object class="sfxlo-SvxCharViewControl" id="viewchar1">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -272,7 +272,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar2">
<object class="sfxlo-SvxCharViewControl" id="viewchar2">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -284,7 +284,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar4">
<object class="sfxlo-SvxCharViewControl" id="viewchar4">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -296,7 +296,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar3">
<object class="sfxlo-SvxCharViewControl" id="viewchar3">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -308,7 +308,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar5">
<object class="sfxlo-SvxCharViewControl" id="viewchar5">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -320,7 +320,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar6">
<object class="sfxlo-SvxCharViewControl" id="viewchar6">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -332,7 +332,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar16">
<object class="sfxlo-SvxCharViewControl" id="viewchar16">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -344,7 +344,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar15">
<object class="sfxlo-SvxCharViewControl" id="viewchar15">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -356,7 +356,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar14">
<object class="sfxlo-SvxCharViewControl" id="viewchar14">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -368,7 +368,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar13">
<object class="sfxlo-SvxCharViewControl" id="viewchar13">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -380,7 +380,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar12">
<object class="sfxlo-SvxCharViewControl" id="viewchar12">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -392,7 +392,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar11">
<object class="sfxlo-SvxCharViewControl" id="viewchar11">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -404,7 +404,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar10">
<object class="sfxlo-SvxCharViewControl" id="viewchar10">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -416,7 +416,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar9">
<object class="sfxlo-SvxCharViewControl" id="viewchar9">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -428,7 +428,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar8">
<object class="sfxlo-SvxCharViewControl" id="viewchar8">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
@@ -440,7 +440,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SvxCharView" id="viewchar7">
<object class="sfxlo-SvxCharViewControl" id="viewchar7">
<property name="width_request">35</property>
<property name="height_request">35</property>
<property name="visible">True</property>
diff --git a/sfx2/uiconfig/ui/charviewmenu.ui b/sfx2/uiconfig/ui/charviewmenu.ui
new file mode 100644
index 0000000..f0ff54e
--- /dev/null
+++ b/sfx2/uiconfig/ui/charviewmenu.ui
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkMenu" id="charviewmenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="clearchar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="charviewmenu|clearchar">Remove</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="clearallchar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="charviewmenu|clearallchar">Clear All</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</interface>
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 6b71b27..2b5556a 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -382,62 +382,76 @@ public:
};
class SmShowChar : public Control
class SmShowChar
{
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
virtual void Resize() override;
private:
std::unique_ptr<weld::DrawingArea> m_xDrawingArea;
OUString m_aText;
vcl::Font m_aFont;
Size m_aSize;
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
DECL_LINK(DoResize, const Size& rSize, void);
public:
SmShowChar(vcl::Window *pParent, WinBits nStyle)
: Control(pParent, nStyle)
SmShowChar(weld::DrawingArea* pDrawingArea)
: m_xDrawingArea(pDrawingArea)
{
m_xDrawingArea->connect_size_allocate(LINK(this, SmShowChar, DoResize));
m_xDrawingArea->connect_draw(LINK(this, SmShowChar, DoPaint));
m_xDrawingArea->set_size_request(m_xDrawingArea->get_approximate_digit_width() * 7,
m_xDrawingArea->get_text_height() * 3);
}
void SetSymbol( const SmSym *pSym );
void SetSymbol( sal_UCS4 cChar, const vcl::Font &rFont );
void SetSymbol(const SmSym *pSym);
void SetSymbol(sal_UCS4 cChar, const vcl::Font &rFont);
void SetText(const OUString& rText) { m_aText = rText; }
const OUString& GetText() const { return m_aText; }
void SetFont(const vcl::Font& rFont) { m_aFont = rFont; }
const vcl::Font& GetFont() const { return m_aFont; }
void queue_draw() { m_xDrawingArea->queue_draw(); }
};
class SmSymDefineDialog : public ModalDialog
class SmSymDefineDialog : public weld::GenericDialogController
{
VclPtr<ComboBox> pOldSymbols;
VclPtr<ComboBox> pOldSymbolSets;
VclPtr<SvxShowCharSet> pCharsetDisplay;
VclPtr<ComboBox> pSymbols;
VclPtr<ComboBox> pSymbolSets;
VclPtr<ListBox> pFonts;
VclPtr<ListBox> pFontsSubsetLB;
VclPtr<FontStyleBox> pStyles;
VclPtr<FixedText> pOldSymbolName;
VclPtr<SmShowChar> pOldSymbolDisplay;
VclPtr<FixedText> pOldSymbolSetName;
VclPtr<FixedText> pSymbolName;
VclPtr<SmShowChar> pSymbolDisplay;
VclPtr<FixedText> pSymbolSetName;
VclPtr<PushButton> pAddBtn;
VclPtr<PushButton> pChangeBtn;
VclPtr<PushButton> pDeleteBtn;
VclPtr<VirtualDevice> m_xVirDev;
SmSymbolManager m_aSymbolMgrCopy;
SmSymbolManager& m_rSymbolMgr;
std::unique_ptr<SmSym> m_xOrigSymbol;
std::unique_ptr<SubsetMap> m_xSubsetMap;
std::unique_ptr<FontList> m_xFontList;
std::unique_ptr<weld::ComboBoxText> m_xOldSymbols;
std::unique_ptr<weld::ComboBoxText> m_xOldSymbolSets;
std::unique_ptr<weld::ComboBoxText> m_xSymbols;
std::unique_ptr<weld::ComboBoxText> m_xSymbolSets;
std::unique_ptr<weld::ComboBoxText> m_xFonts;
std::unique_ptr<weld::ComboBoxText> m_xFontsSubsetLB;
std::unique_ptr<weld::ComboBoxText> m_xStyles;
std::unique_ptr<weld::Label> m_xOldSymbolName;
std::unique_ptr<weld::Label> m_xOldSymbolSetName;
std::unique_ptr<weld::Label> m_xSymbolName;
std::unique_ptr<weld::Label> m_xSymbolSetName;
std::unique_ptr<weld::Button> m_xAddBtn;
std::unique_ptr<weld::Button> m_xChangeBtn;
std::unique_ptr<weld::Button> m_xDeleteBtn;
std::unique_ptr<SmShowChar> m_xOldSymbolDisplay;
std::unique_ptr<SmShowChar> m_xSymbolDisplay;
std::unique_ptr<SvxShowCharSet> m_xCharsetDisplay;
SmSymbolManager aSymbolMgrCopy,
&rSymbolMgr;
std::unique_ptr<SmSym> pOrigSymbol;
std::unique_ptr<SubsetMap> pSubsetMap;
FontList *pFontList;
DECL_LINK(OldSymbolChangeHdl, ComboBox&, void);
DECL_LINK(OldSymbolSetChangeHdl, ComboBox&, void);
DECL_LINK(ModifyHdl, Edit&, void);
DECL_LINK(FontChangeHdl, ListBox&, void);
DECL_LINK(SubsetChangeHdl, ListBox&, void);
DECL_LINK(StyleChangeHdl, ComboBox&, void);
DECL_LINK(OldSymbolChangeHdl, weld::ComboBoxText&, void);
DECL_LINK(OldSymbolSetChangeHdl, weld::ComboBoxText&, void);
DECL_LINK(ModifyHdl, weld::ComboBoxText&, void);
DECL_LINK(FontChangeHdl, weld::ComboBoxText&, void);
DECL_LINK(SubsetChangeHdl, weld::ComboBoxText&, void);
DECL_LINK(StyleChangeHdl, weld::ComboBoxText&, void);
DECL_LINK(CharHighlightHdl, SvxShowCharSet*, void);
DECL_LINK(AddClickHdl, Button *, void);
DECL_LINK(ChangeClickHdl, Button *, void);
DECL_LINK(DeleteClickHdl, Button *, void);
DECL_LINK(AddClickHdl, weld::Button&, void);
DECL_LINK(ChangeClickHdl, weld::Button&, void);
DECL_LINK(DeleteClickHdl, weld::Button&, void);
void FillSymbols(ComboBox &rComboBox, bool bDeleteText = true);
void FillSymbolSets(ComboBox &rComboBox, bool bDeleteText = true);
void FillSymbols(weld::ComboBoxText& rComboBox, bool bDeleteText = true);
void FillSymbolSets(weld::ComboBoxText& rComboBox, bool bDeleteText = true);
void FillFonts();
void FillStyles();
@@ -446,49 +460,43 @@ class SmSymDefineDialog : public ModalDialog
void SetOrigSymbol(const SmSym *pSymbol, const OUString &rSymbolSetName);
void UpdateButtons();
bool SelectSymbolSet(ComboBox &rComboBox, const OUString &rSymbolSetName,
bool SelectSymbolSet(weld::ComboBoxText &rComboBox, const OUString &rSymbolSetName,
bool bDeleteText);
bool SelectSymbol(ComboBox &rComboBox, const OUString &rSymbolName,
bool SelectSymbol(weld::ComboBoxText& rComboBox, const OUString &rSymbolName,
bool bDeleteText);
bool SelectFont(const OUString &rFontName, bool bApplyFont);
bool SelectStyle(const OUString &rStyleName, bool bApplyFont);
SmSym * GetSymbol(const ComboBox &rComboBox);
const SmSym * GetSymbol(const ComboBox &rComboBox) const
SmSym* GetSymbol(const weld::ComboBoxText& rComboBox);
const SmSym* GetSymbol(const weld::ComboBoxText& rComboBox) const
{
return const_cast<SmSymDefineDialog *>(this)->GetSymbol(rComboBox);
}
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
public:
SmSymDefineDialog(vcl::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr);
SmSymDefineDialog(weld::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr);
virtual ~SmSymDefineDialog() override;
virtual void dispose() override;
using OutputDevice::SetFont;
// Dialog
virtual short Execute() override;
short execute();
void SelectOldSymbolSet(const OUString &rSymbolSetName)
{
SelectSymbolSet(*pOldSymbolSets, rSymbolSetName, false);
SelectSymbolSet(*m_xOldSymbolSets, rSymbolSetName, false);
}
void SelectOldSymbol(const OUString &rSymbolName)
{
SelectSymbol(*pOldSymbols, rSymbolName, false);
SelectSymbol(*m_xOldSymbols, rSymbolName, false);
}
bool SelectSymbolSet(const OUString &rSymbolSetName)
{
return SelectSymbolSet(*pSymbolSets, rSymbolSetName, false);
return SelectSymbolSet(*m_xSymbolSets, rSymbolSetName, false);
}
bool SelectSymbol(const OUString &rSymbolName)
{
return SelectSymbol(*pSymbols, rSymbolName, false);
return SelectSymbol(*m_xSymbols, rSymbolName, false);
}
bool SelectFont(const OUString &rFontName) { return SelectFont(rFontName, true); }
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 7c90245..38a4415 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1424,15 +1424,15 @@ IMPL_LINK_NOARG( SmSymbolDialog, SymbolChangeHdl, SmShowSymbolSetWindow&, void )
IMPL_LINK_NOARG(SmSymbolDialog, EditClickHdl, Button*, void)
{
ScopedVclPtrInstance<SmSymDefineDialog> pDialog(this, pFontListDev, rSymbolMgr);
SmSymDefineDialog aDialog(GetFrameWeld(), pFontListDev, rSymbolMgr);
// set current symbol and SymbolSet for the new dialog
const OUString aSymSetName (m_pSymbolSets->GetSelectedEntry()),
aSymName (m_pSymbolName->GetText());
pDialog->SelectOldSymbolSet(aSymSetName);
pDialog->SelectOldSymbol(aSymName);
pDialog->SelectSymbolSet(aSymSetName);
pDialog->SelectSymbol(aSymName);
aDialog.SelectOldSymbolSet(aSymSetName);
aDialog.SelectOldSymbol(aSymName);
aDialog.SelectSymbolSet(aSymSetName);
aDialog.SelectSymbol(aSymName);
// remember old SymbolSet
OUString aOldSymbolSet (m_pSymbolSets->GetSelectedEntry());
@@ -1440,7 +1440,7 @@ IMPL_LINK_NOARG(SmSymbolDialog, EditClickHdl, Button*, void)
sal_uInt16 nSymPos = m_pSymbolSetDisplay->GetSelectSymbol();
// adapt dialog to data of the SymbolSet manager, which might have changed
if (pDialog->Execute() == RET_OK && rSymbolMgr.IsModified())
if (aDialog.execute() == RET_OK && rSymbolMgr.IsModified())
{
rSymbolMgr.Save();
FillSymbolSets();
@@ -1607,22 +1607,49 @@ const SmSym* SmSymbolDialog::GetSymbol() const
return bValid ? aSymbolSet[ nSymbolNo ] : nullptr;
}
VCL_BUILDER_FACTORY_CONSTRUCTOR(SmShowChar, 0)
void SmShowChar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect)
IMPL_LINK(SmShowChar, DoResize, const Size&, rSize, void)
{
Control::Paint(rRenderContext, rRect);
m_aSize = rSize;
OUString aText( GetText() );
if (!aText.isEmpty())
{
Size aTextSize(rRenderContext.GetTextWidth(aText), rRenderContext.GetTextHeight());
rRenderContext.DrawText(Point((GetOutputSize().Width() - aTextSize.Width()) / 2,
(GetOutputSize().Height() * 7/10)), aText);
}
const OUString &rText = GetText();
if (rText.isEmpty())
return;
sal_Int32 nStrIndex = 0;
sal_UCS4 cChar = rText.iterateCodePoints(&nStrIndex);
SetSymbol(cChar, GetFont()); //force recalculation of size
}
IMPL_LINK(SmShowChar, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
{
vcl::RenderContext& rRenderContext = aPayload.first;
Color aTextCol = rRenderContext.GetTextColor();
Color aFillCol = rRenderContext.GetFillColor();
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const Color aWindowTextColor(rStyleSettings.GetDialogTextColor());
const Color aWindowColor(rStyleSettings.GetWindowColor());
rRenderContext.SetTextColor(aWindowTextColor);
rRenderContext.SetFillColor(aWindowColor);
rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), m_aSize));
OUString aText(GetText());
if (!aText.isEmpty())
{
vcl::Font aFont(m_aFont);
aFont.SetAlignment(ALIGN_TOP);
rRenderContext.SetFont(aFont);
Size aTextSize(rRenderContext.GetTextWidth(aText), rRenderContext.GetTextHeight());
rRenderContext.DrawText(Point((m_aSize.Width() - aTextSize.Width()) / 2,
(m_aSize.Height() - aTextSize.Height()) / 2), aText);
}
rRenderContext.SetTextColor(aTextCol);
rRenderContext.SetFillColor(aFillCol);
}
void SmShowChar::SetSymbol( const SmSym *pSym )
{
@@ -1634,191 +1661,168 @@ void SmShowChar::SetSymbol( const SmSym *pSym )
void SmShowChar::SetSymbol( sal_UCS4 cChar, const vcl::Font &rFont )
{
vcl::Font aFont( rFont );
aFont.SetFontSize( Size(0, GetOutputSize().Height() - GetOutputSize().Height() / 3) );
aFont.SetFontSize(Size(0, m_aSize.Height() - m_aSize.Height() / 3));
aFont.SetAlignment(ALIGN_BASELINE);
SetFont(aFont);
aFont.SetTransparent(true);
OUString aText(&cChar, 1);
SetText( aText );
Invalidate();
m_xDrawingArea->queue_draw();
}
void SmShowChar::Resize()
void SmSymDefineDialog::FillSymbols(weld::ComboBoxText& rComboBox, bool bDeleteText)
{
Control::Resize();
const OUString &rText = GetText();
if (rText.isEmpty())
return;
sal_Int32 nStrIndex = 0;
sal_UCS4 cChar = rText.iterateCodePoints(&nStrIndex);
SetSymbol(cChar, GetFont()); //force recalculation of size
}
assert((&rComboBox == m_xOldSymbols.get() || &rComboBox == m_xSymbols.get()) && "Sm : wrong ComboBox");
void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, bool bDeleteText)
{
assert((&rComboBox == pOldSymbols || &rComboBox == pSymbols) && "Sm : wrong ComboBox");
rComboBox.Clear();
rComboBox.clear();
if (bDeleteText)
rComboBox.SetText(OUString());
rComboBox.set_entry_text(OUString());
ComboBox &rBox = &rComboBox == pOldSymbols ? *pOldSymbolSets : *pSymbolSets;
SymbolPtrVec_t aSymSet( aSymbolMgrCopy.GetSymbolSet( rBox.GetText() ) );
weld::ComboBoxText& rBox = &rComboBox == m_xOldSymbols.get() ? *m_xOldSymbolSets : *m_xSymbolSets;
SymbolPtrVec_t aSymSet(m_aSymbolMgrCopy.GetSymbolSet(rBox.get_active_text()));
for (const SmSym* i : aSymSet)
rComboBox.InsertEntry( i->GetName() );
rComboBox.append_text(i->GetName());
}
void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, bool bDeleteText)
void SmSymDefineDialog::FillSymbolSets(weld::ComboBoxText& rComboBox, bool bDeleteText)
{
assert((&rComboBox == pOldSymbolSets || &rComboBox == pSymbolSets) && "Sm : wrong ComboBox");
assert((&rComboBox == m_xOldSymbolSets.get() || &rComboBox == m_xSymbolSets.get()) && "Sm : wrong ComboBox");
rComboBox.Clear();
rComboBox.clear();
if (bDeleteText)
rComboBox.SetText(OUString());
rComboBox.set_entry_text(OUString());
const std::set< OUString > aSymbolSetNames( aSymbolMgrCopy.GetSymbolSetNames() );
const std::set< OUString > aSymbolSetNames( m_aSymbolMgrCopy.GetSymbolSetNames() );
std::set< OUString >::const_iterator aIt( aSymbolSetNames.begin() );
for ( ; aIt != aSymbolSetNames.end(); ++aIt)
rComboBox.InsertEntry( *aIt );
rComboBox.append_text(*aIt);
}
void SmSymDefineDialog::FillFonts()
{
pFonts->Clear();
pFonts->SetNoSelection();
m_xFonts->clear();
m_xFonts->set_active(-1);
// Include all fonts of FontList into the font list.
// If there are duplicates, only include one entry of each font since the style will be
// already selected using the FontStyleBox.
if (pFontList)
if (m_xFontList)
{
sal_uInt16 nCount = pFontList->GetFontNameCount();
for (sal_uInt16 i = 0; i < nCount; i++)
pFonts->InsertEntry( pFontList->GetFontName(i).GetFamilyName() );
sal_uInt16 nCount = m_xFontList->GetFontNameCount();
for (sal_uInt16 i = 0; i < nCount; ++i)
m_xFonts->append_text(m_xFontList->GetFontName(i).GetFamilyName());
}
}
void SmSymDefineDialog::FillStyles()
{
pStyles->Clear();
pStyles->SetText(OUString());
m_xStyles->clear();
// pStyles->SetText(OUString());
OUString aText (pFonts->GetSelectedEntry());
OUString aText(m_xFonts->get_active_text());
if (!aText.isEmpty())
{
// use own StyleNames
const SmFontStyles &rStyles = GetFontStyles();
for (sal_uInt16 i = 0; i < SmFontStyles::GetCount(); i++)
pStyles->InsertEntry( rStyles.GetStyleName(i) );
for (sal_uInt16 i = 0; i < SmFontStyles::GetCount(); ++i)
m_xStyles->append_text(rStyles.GetStyleName(i));
assert(pStyles->GetEntryCount() > 0 && "Sm : no styles available");
pStyles->SetText( pStyles->GetEntry(0) );
assert(m_xStyles->get_count() > 0 && "Sm : no styles available");
m_xStyles->set_active(0);
}
}
SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox)
SmSym* SmSymDefineDialog::GetSymbol(const weld::ComboBoxText& rComboBox)
{
assert((&rComboBox == pOldSymbols || &rComboBox == pSymbols) && "Sm : wrong combobox");
return aSymbolMgrCopy.GetSymbolByName(rComboBox.GetText());
assert((&rComboBox == m_xOldSymbols.get() || &rComboBox == m_xSymbols.get()) && "Sm : wrong combobox");
return m_aSymbolMgrCopy.GetSymbolByName(rComboBox.get_active_text());
}
IMPL_LINK( SmSymDefineDialog, OldSymbolChangeHdl, ComboBox&, rComboBox, void )
IMPL_LINK(SmSymDefineDialog, OldSymbolChangeHdl, weld::ComboBoxText&, rComboBox, void)
{
(void) rComboBox;
assert(&rComboBox == pOldSymbols && "Sm : wrong argument");
SelectSymbol(*pOldSymbols, pOldSymbols->GetText(), false);
assert(&rComboBox == m_xOldSymbols.get() && "Sm : wrong argument");
SelectSymbol(*m_xOldSymbols, m_xOldSymbols->get_active_text(), false);
}
IMPL_LINK( SmSymDefineDialog, OldSymbolSetChangeHdl, ComboBox&, rComboBox, void )
IMPL_LINK( SmSymDefineDialog, OldSymbolSetChangeHdl, weld::ComboBoxText&, rComboBox, void )
{
(void) rComboBox;
assert(&rComboBox == pOldSymbolSets && "Sm : wrong argument");
SelectSymbolSet(*pOldSymbolSets, pOldSymbolSets->GetText(), false);
assert(&rComboBox == m_xOldSymbolSets.get() && "Sm : wrong argument");
SelectSymbolSet(*m_xOldSymbolSets, m_xOldSymbolSets->get_active_text(), false);
}
IMPL_LINK( SmSymDefineDialog, ModifyHdl, Edit&, rEdit, void )
IMPL_LINK(SmSymDefineDialog, ModifyHdl, weld::ComboBoxText&, rComboBox, void)
{
ComboBox& rComboBox = static_cast<ComboBox&>(rEdit);
// remember cursor position for later restoring of it
Selection aSelection (rComboBox.GetSelection());
int nStartPos, nEndPos;
rComboBox.get_entry_selection_bounds(nStartPos, nEndPos);
if (&rComboBox == pSymbols)
SelectSymbol(*pSymbols, pSymbols->GetText(), false);
else if (&rComboBox == pSymbolSets)
SelectSymbolSet(*pSymbolSets, pSymbolSets->GetText(), false);
else if (&rComboBox == pOldSymbols)
if (&rComboBox == m_xSymbols.get())
SelectSymbol(*m_xSymbols, m_xSymbols->get_active_text(), false);
else if (&rComboBox == m_xSymbolSets.get())
SelectSymbolSet(*m_xSymbolSets, m_xSymbolSets->get_active_text(), false);
else if (&rComboBox == m_xOldSymbols.get())
// allow only names from the list
SelectSymbol(*pOldSymbols, pOldSymbols->GetText(), true);
else if (&rComboBox == pOldSymbolSets)
SelectSymbol(*m_xOldSymbols, m_xOldSymbols->get_active_text(), true);
else if (&rComboBox == m_xOldSymbolSets.get())
// allow only names from the list
SelectSymbolSet(*pOldSymbolSets, pOldSymbolSets->GetText(), true);
else if (&rComboBox == pStyles)
SelectSymbolSet(*m_xOldSymbolSets, m_xOldSymbolSets->get_active_text(), true);
else if (&rComboBox == m_xStyles.get())
// allow only names from the list (that's the case here anyway)
SelectStyle(pStyles->GetText(), true);
SelectStyle(m_xStyles->get_active_text(), true);
else
SAL_WARN("starmath", "wrong combobox argument");
rComboBox.SetSelection(aSelection);
rComboBox.select_entry_region(nStartPos, nEndPos);
UpdateButtons();
}
IMPL_LINK( SmSymDefineDialog, FontChangeHdl, ListBox&, rListBox, void )
IMPL_LINK(SmSymDefineDialog, FontChangeHdl, weld::ComboBoxText&, rListBox, void)
{
(void) rListBox;
assert(&rListBox == pFonts && "Sm : wrong argument");
assert(&rListBox == m_xFonts.get() && "Sm : wrong argument");
SelectFont(pFonts->GetSelectedEntry());
SelectFont(m_xFonts->get_active_text());
}
IMPL_LINK_NOARG( SmSymDefineDialog, SubsetChangeHdl, ListBox&, void )
IMPL_LINK_NOARG(SmSymDefineDialog, SubsetChangeHdl, weld::ComboBoxText&, void)
{
sal_Int32 nPos = pFontsSubsetLB->GetSelectedEntryPos();
if (LISTBOX_ENTRY_NOTFOUND != nPos)
int nPos = m_xFontsSubsetLB->get_active();
if (nPos != -1)
{
const Subset* pSubset = static_cast<const Subset*> (pFontsSubsetLB->GetEntryData( nPos ));
const Subset* pSubset = reinterpret_cast<const Subset*>(m_xFontsSubsetLB->get_active_id().toUInt64());
if (pSubset)
{
pCharsetDisplay->SelectCharacter( pSubset->GetRangeMin() );
m_xCharsetDisplay->SelectCharacter( pSubset->GetRangeMin() );
}
}
}
IMPL_LINK( SmSymDefineDialog, StyleChangeHdl, ComboBox&, rComboBox, void )
IMPL_LINK( SmSymDefineDialog, StyleChangeHdl, weld::ComboBoxText&, rComboBox, void )
{
(void) rComboBox;
assert(&rComboBox == pStyles && "Sm : wrong argument");
assert(&rComboBox == m_xStyles.get() && "Sm : wrong argument");
SelectStyle(pStyles->GetText());
SelectStyle(m_xStyles->get_active_text());
}
IMPL_LINK_NOARG(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet*, void)
{
sal_UCS4 cChar = pCharsetDisplay->GetSelectCharacter();
sal_UCS4 cChar = m_xCharsetDisplay->GetSelectCharacter();
assert(pSubsetMap && "SubsetMap missing");
if (pSubsetMap)
if (m_xSubsetMap)
{
const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
const Subset* pSubset = m_xSubsetMap->GetSubsetByUnicode(cChar);
if (pSubset)
pFontsSubsetLB->SelectEntry( pSubset->GetName() );
m_xFontsSubsetLB->set_active(pSubset->GetName());
else
pFontsSubsetLB->SetNoSelection();
m_xFontsSubsetLB->set_active(-1);
}
pSymbolDisplay->SetSymbol( cChar, pCharsetDisplay->GetFont() );
m_xSymbolDisplay->SetSymbol(cChar, m_xCharsetDisplay->GetFont());
UpdateButtons();
@@ -1827,311 +1831,260 @@ IMPL_LINK_NOARG(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet*, void)
const OUString aPattern( (aHex.getLength() > 4) ? OUString("Ux000000") : OUString("Ux0000") );
OUString aUnicodePos( aPattern.copy( 0, aPattern.getLength() - aHex.getLength() ) );
aUnicodePos += aHex;
pSymbols->SetText( aUnicodePos );
pSymbolName->SetText( aUnicodePos );
m_xSymbols->set_entry_text(aUnicodePos);
m_xSymbolName->set_label(aUnicodePos);
}
IMPL_LINK( SmSymDefineDialog, AddClickHdl, Button *, pButton, void )
IMPL_LINK( SmSymDefineDialog, AddClickHdl, weld::Button&, rButton, void )
{
(void) pButton;
assert(pButton == pAddBtn && "Sm : wrong argument");
assert(pButton->IsEnabled() && "Sm : requirements met ??");
(void) rButton;
assert(&rButton == m_xAddBtn.get() && "Sm : wrong argument");
assert(rButton.get_sensitive() && "Sm : requirements met ??");
// add symbol
const SmSym aNewSymbol( pSymbols->GetText(), pCharsetDisplay->GetFont(),
pCharsetDisplay->GetSelectCharacter(), pSymbolSets->GetText() );
//OSL_ENSURE( aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" );
aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol );
const SmSym aNewSymbol(m_xSymbols->get_active_text(), m_xCharsetDisplay->GetFont(),
m_xCharsetDisplay->GetSelectCharacter(), m_xSymbolSets->get_active_text());
//OSL_ENSURE( m_aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" );
m_aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol );
// update display of new symbol
pSymbolDisplay->SetSymbol( &aNewSymbol );
pSymbolName->SetText( aNewSymbol.GetName() );
pSymbolSetName->SetText( aNewSymbol.GetSymbolSetName() );
m_xSymbolDisplay->SetSymbol( &aNewSymbol );
m_xSymbolName->set_label(aNewSymbol.GetName());
m_xSymbolSetName->set_label(aNewSymbol.GetSymbolSetName());
// update list box entries
FillSymbolSets(*pOldSymbolSets, false);
FillSymbolSets(*pSymbolSets, false);
FillSymbols(*pOldSymbols ,false);
FillSymbols(*pSymbols ,false);
FillSymbolSets(*m_xOldSymbolSets, false);
FillSymbolSets(*m_xSymbolSets, false);
FillSymbols(*m_xOldSymbols, false);
FillSymbols(*m_xSymbols, false);
UpdateButtons();
}
IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, Button *, pButton, void )
IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, weld::Button&, rButton, void )
{
(void) pButton;
assert(pButton == pChangeBtn && "Sm : wrong argument");
assert(pChangeBtn->IsEnabled() && "Sm : requirements met ??");
(void) rButton;
assert(&rButton == m_xChangeBtn.get() && "Sm : wrong argument");
assert(m_xChangeBtn->get_sensitive() && "Sm : requirements met ??");
// get new Sybol to use
//! get font from symbol-disp lay since charset-display does not keep
//! the bold attribute.
const SmSym aNewSymbol( pSymbols->GetText(), pCharsetDisplay->GetFont(),
pCharsetDisplay->GetSelectCharacter(), pSymbolSets->GetText() );
const SmSym aNewSymbol(m_xSymbols->get_active_text(), m_xCharsetDisplay->GetFont(),
m_xCharsetDisplay->GetSelectCharacter(), m_xSymbolSets->get_active_text());
// remove old symbol if the name was changed then add new one
const bool bNameChanged = pOldSymbols->GetText() != pSymbols->GetText();
const bool bNameChanged = m_xOldSymbols->get_active_text() != m_xSymbols->get_active_text();
if (bNameChanged)
aSymbolMgrCopy.RemoveSymbol( pOldSymbols->GetText() );
aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol, true );
m_aSymbolMgrCopy.RemoveSymbol(m_xOldSymbols->get_active_text());
m_aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol, true );
// clear display for original symbol if necessary
if (bNameChanged)
SetOrigSymbol(nullptr, OUString());
// update display of new symbol
pSymbolDisplay->SetSymbol( &aNewSymbol );
pSymbolName->SetText( aNewSymbol.GetName() );
pSymbolSetName->SetText( aNewSymbol.GetSymbolSetName() );
m_xSymbolDisplay->SetSymbol(&aNewSymbol);
m_xSymbolName->set_label(aNewSymbol.GetName());
m_xSymbolSetName->set_label(aNewSymbol.GetSymbolSetName());
// update list box entries
FillSymbolSets(*pOldSymbolSets, false);
FillSymbolSets(*pSymbolSets, false);
FillSymbols(*pOldSymbols ,false);
FillSymbols(*pSymbols ,false);
FillSymbolSets(*m_xOldSymbolSets, false);
FillSymbolSets(*m_xSymbolSets, false);
FillSymbols(*m_xOldSymbols, false);
FillSymbols(*m_xSymbols, false);
UpdateButtons();
}
IMPL_LINK( SmSymDefineDialog, DeleteClickHdl, Button *, pButton, void )
IMPL_LINK(SmSymDefineDialog, DeleteClickHdl, weld::Button&, rButton, void)
{
(void) pButton;
assert(pButton == pDeleteBtn && "Sm : wrong argument");
assert(pDeleteBtn->IsEnabled() && "Sm : requirements met ??");
(void) rButton;
assert(&rButton == m_xDeleteBtn.get() && "Sm : wrong argument");
assert(m_xDeleteBtn->get_sensitive() && "Sm : requirements met ??");
if (pOrigSymbol)
if (m_xOrigSymbol)
{
aSymbolMgrCopy.RemoveSymbol( pOrigSymbol->GetName() );
m_aSymbolMgrCopy.RemoveSymbol(m_xOrigSymbol->GetName());
// clear display for original symbol
SetOrigSymbol(nullptr, OUString());
// update list box entries
FillSymbolSets(*pOldSymbolSets, false);
FillSymbolSets(*pSymbolSets, false);
FillSymbols(*pOldSymbols ,false);
FillSymbols(*pSymbols ,false);
FillSymbolSets(*m_xOldSymbolSets, false);
FillSymbolSets(*m_xSymbolSets, false);
FillSymbols(*m_xOldSymbols ,false);
FillSymbols(*m_xSymbols ,false);
}
UpdateButtons();
}
void SmSymDefineDialog::UpdateButtons()
{
bool bAdd = false,
bChange = false,
bDelete = false;
OUString aTmpSymbolName (pSymbols->GetText()),
aTmpSymbolSetName (pSymbolSets->GetText());
OUString aTmpSymbolName(m_xSymbols->get_active_text()),
aTmpSymbolSetName(m_xSymbolSets->get_active_text());
if (!aTmpSymbolName.isEmpty() && !aTmpSymbolSetName.isEmpty())
{
// are all settings equal?
//! (Font-, Style- and SymbolSet name comparison is not case sensitive)
bool bEqual = pOrigSymbol
&& aTmpSymbolSetName.equalsIgnoreAsciiCase(pOldSymbolSetName->GetText())
&& aTmpSymbolName == pOrigSymbol->GetName()
&& pFonts->GetSelectedEntry().equalsIgnoreAsciiCase(
pOrigSymbol->GetFace().GetFamilyName())
&& pStyles->GetText().equalsIgnoreAsciiCase(
GetFontStyles().GetStyleName(pOrigSymbol->GetFace()))
&& pCharsetDisplay->GetSelectCharacter() == pOrigSymbol->GetCharacter();
bool bEqual = m_xOrigSymbol
&& aTmpSymbolSetName.equalsIgnoreAsciiCase(m_xOldSymbolSetName->get_label())
&& aTmpSymbolName == m_xOrigSymbol->GetName()
&& m_xFonts->get_active_text().equalsIgnoreAsciiCase(
m_xOrigSymbol->GetFace().GetFamilyName())
&& m_xStyles->get_active_text().equalsIgnoreAsciiCase(
GetFontStyles().GetStyleName(m_xOrigSymbol->GetFace()))
&& m_xCharsetDisplay->GetSelectCharacter() == m_xOrigSymbol->GetCharacter();
// only add it if there isn't already a symbol with the same name
bAdd = aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == nullptr;
bAdd = m_aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == nullptr;
// only delete it if all settings are equal
bDelete = bool(pOrigSymbol);
bDelete = bool(m_xOrigSymbol);
// only change it if the old symbol exists and the new one is different
bChange = pOrigSymbol && !bEqual;
bChange = m_xOrigSymbol && !bEqual;
}
pAddBtn ->Enable(bAdd);
pChangeBtn->Enable(bChange);
pDeleteBtn->Enable(bDelete);
m_xAddBtn->set_sensitive(bAdd);
m_xChangeBtn->set_sensitive(bChange);
m_xDeleteBtn->set_sensitive(bDelete);
}
SmSymDefineDialog::SmSymDefineDialog(vcl::Window * pParent,
OutputDevice *pFntListDevice, SmSymbolManager &rMgr) :
ModalDialog (pParent, "EditSymbols", "modules/smath/ui/symdefinedialog.ui"),
rSymbolMgr (rMgr),
pOrigSymbol (),
pSubsetMap (),
pFontList (nullptr)
SmSymDefineDialog::SmSymDefineDialog(weld::Window* pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr)
: GenericDialogController(pParent, "modules/smath/ui/symdefinedialog.ui", "EditSymbols")
, m_xVirDev(VclPtr<VirtualDevice>::Create())
, m_rSymbolMgr(rMgr)
, m_xFontList(new FontList(pFntListDevice))
, m_xOldSymbols(m_xBuilder->weld_combo_box_text("oldSymbols"))
, m_xOldSymbolSets(m_xBuilder->weld_combo_box_text("oldSymbolSets"))
, m_xSymbols(m_xBuilder->weld_combo_box_text("symbols"))
, m_xSymbolSets(m_xBuilder->weld_combo_box_text("symbolSets"))
, m_xFonts(m_xBuilder->weld_combo_box_text("fonts"))
, m_xFontsSubsetLB(m_xBuilder->weld_combo_box_text("fontsSubsetLB"))
, m_xStyles(m_xBuilder->weld_combo_box_text("styles"))
, m_xOldSymbolName(m_xBuilder->weld_label("oldSymbolName"))
, m_xOldSymbolSetName(m_xBuilder->weld_label("oldSymbolSetName"))
, m_xSymbolName(m_xBuilder->weld_label("symbolName"))
, m_xSymbolSetName(m_xBuilder->weld_label("symbolSetName"))
, m_xAddBtn(m_xBuilder->weld_button("add"))
, m_xChangeBtn(m_xBuilder->weld_button("modify"))
, m_xDeleteBtn(m_xBuilder->weld_button("delete"))
, m_xOldSymbolDisplay(new SmShowChar(m_xBuilder->weld_drawing_area("oldSymbolDisplay")))
, m_xSymbolDisplay(new SmShowChar(m_xBuilder->weld_drawing_area("symbolDisplay")))
, m_xCharsetDisplay(new SvxShowCharSet(*m_xBuilder, "charsetDisplay", "showscroll", m_xVirDev))
{
get(pOldSymbols, "oldSymbols");
get(pOldSymbolSets, "oldSymbolSets");
get(pCharsetDisplay, "charsetDisplay");
get(pSymbols, "symbols");
get(pSymbolSets, "symbolSets");
get(pFonts, "fonts");
get(pFontsSubsetLB, "fontsSubsetLB");
get(pStyles, "styles");
get(pOldSymbolName, "oldSymbolName");
get(pOldSymbolDisplay, "oldSymbolDisplay");
get(pOldSymbolSetName, "oldSymbolSetName");
get(pSymbolName, "symbolName");
get(pSymbolDisplay, "symbolDisplay");
get(pSymbolSetName, "symbolSetName");
get(pAddBtn, "add");
get(pChangeBtn, "modify");
get(pDeleteBtn, "delete");
pFontList = new FontList( pFntListDevice );
// auto completion is troublesome since that symbols character also gets automatically selected in the
// display and if the user previously selected a character to define/redefine that one this is bad
pOldSymbols->EnableAutocomplete( false, true );
pSymbols->EnableAutocomplete( false, true );
m_xOldSymbols->unset_entry_completion();
m_xSymbols->unset_entry_completion();
FillFonts();
if (pFonts->GetEntryCount() > 0)
SelectFont(pFonts->GetEntry(0));
if (m_xFonts->get_count() > 0)
SelectFont(m_xFonts->get_text(0));
SetSymbolSetManager(rSymbolMgr);
SetSymbolSetManager(m_rSymbolMgr);
pOldSymbols ->SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolChangeHdl));
pOldSymbolSets ->SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolSetChangeHdl));
pSymbolSets ->SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
pOldSymbolSets ->SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
pSymbols ->SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
pOldSymbols ->SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
pStyles ->SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
pFonts ->SetSelectHdl(LINK(this, SmSymDefineDialog, FontChangeHdl));
pFontsSubsetLB ->SetSelectHdl(LINK(this, SmSymDefineDialog, SubsetChangeHdl));
pStyles ->SetSelectHdl(LINK(this, SmSymDefineDialog, StyleChangeHdl));
pAddBtn ->SetClickHdl (LINK(this, SmSymDefineDialog, AddClickHdl));
pChangeBtn ->SetClickHdl (LINK(this, SmSymDefineDialog, ChangeClickHdl));
pDeleteBtn ->SetClickHdl (LINK(this, SmSymDefineDialog, DeleteClickHdl));
pCharsetDisplay ->SetHighlightHdl( LINK( this, SmSymDefineDialog, CharHighlightHdl ) );
// preview like controls should have a 2D look
pOldSymbolDisplay->SetBorderStyle( WindowBorderStyle::MONO );
pSymbolDisplay ->SetBorderStyle( WindowBorderStyle::MONO );
m_xOldSymbols->connect_changed(LINK(this, SmSymDefineDialog, OldSymbolChangeHdl));
m_xOldSymbolSets->connect_changed(LINK(this, SmSymDefineDialog, OldSymbolSetChangeHdl));
m_xSymbolSets->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
m_xOldSymbolSets->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
m_xSymbols->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
m_xOldSymbols->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
m_xStyles->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
m_xFonts->connect_changed(LINK(this, SmSymDefineDialog, FontChangeHdl));
m_xFontsSubsetLB->connect_changed(LINK(this, SmSymDefineDialog, SubsetChangeHdl));
m_xStyles->connect_changed(LINK(this, SmSymDefineDialog, StyleChangeHdl));
m_xAddBtn->connect_clicked(LINK(this, SmSymDefineDialog, AddClickHdl));
m_xChangeBtn->connect_clicked(LINK(this, SmSymDefineDialog, ChangeClickHdl));
m_xDeleteBtn->connect_clicked(LINK(this, SmSymDefineDialog, DeleteClickHdl));
m_xCharsetDisplay->SetHighlightHdl( LINK( this, SmSymDefineDialog, CharHighlightHdl ) );
}
SmSymDefineDialog::~SmSymDefineDialog()
{
disposeOnce();
}
void SmSymDefineDialog::dispose()
short SmSymDefineDialog::execute()
{
pSubsetMap.reset();
pOrigSymbol.reset();
pOldSymbols.clear();
pOldSymbolSets.clear();
pCharsetDisplay.clear();
pSymbols.clear();
pSymbolSets.clear();
pFonts.clear();
pFontsSubsetLB.clear();
pStyles.clear();
pOldSymbolName.clear();
pOldSymbolDisplay.clear();
pOldSymbolSetName.clear();
pSymbolName.clear();
pSymbolDisplay.clear();
pSymbolSetName.clear();
pAddBtn.clear();
pChangeBtn.clear();
pDeleteBtn.clear();
ModalDialog::dispose();
}
void SmSymDefineDialog::DataChanged( const DataChangedEvent& rDCEvt )
{
if (rDCEvt.GetType() == DataChangedEventType::SETTINGS && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
{
Invalidate();
}
ModalDialog::DataChanged( rDCEvt );
}
short SmSymDefineDialog::Execute()
{
short nResult = ModalDialog::Execute();
short nResult = m_xDialog->run();
// apply changes if dialog was closed by clicking OK
if (aSymbolMgrCopy.IsModified() && nResult == RET_OK)
rSymbolMgr = aSymbolMgrCopy;
if (m_aSymbolMgrCopy.IsModified() && nResult == RET_OK)
m_rSymbolMgr = m_aSymbolMgrCopy;
return nResult;
}
void SmSymDefineDialog::SetSymbolSetManager(const SmSymbolManager &rMgr)
{
aSymbolMgrCopy = rMgr;
m_aSymbolMgrCopy = rMgr;
// Set the modified flag of the copy to false so that
// we can check later on if anything has been changed
aSymbolMgrCopy.SetModified(false);
m_aSymbolMgrCopy.SetModified(false);
FillSymbolSets(*pOldSymbolSets);
if (pOldSymbolSets->GetEntryCount() > 0)
SelectSymbolSet(pOldSymbolSets->GetEntry(0));
FillSymbolSets(*pSymbolSets);
if (pSymbolSets->GetEntryCount() > 0)
SelectSymbolSet(pSymbolSets->GetEntry(0));
FillSymbols(*pOldSymbols);
if (pOldSymbols->GetEntryCount() > 0)
SelectSymbol(pOldSymbols->GetEntry(0));
FillSymbols(*pSymbols);
if (pSymbols->GetEntryCount() > 0)
SelectSymbol(pSymbols->GetEntry(0));
FillSymbolSets(*m_xOldSymbolSets);
if (m_xOldSymbolSets->get_count() > 0)
SelectSymbolSet(m_xOldSymbolSets->get_text(0));
FillSymbolSets(*m_xSymbolSets);
if (m_xSymbolSets->get_count() > 0)
SelectSymbolSet(m_xSymbolSets->get_text(0));
FillSymbols(*m_xOldSymbols);
if (m_xOldSymbols->get_count() > 0)
SelectSymbol(m_xOldSymbols->get_text(0));
FillSymbols(*m_xSymbols);
if (m_xSymbols->get_count() > 0)
SelectSymbol(m_xSymbols->get_text(0));
UpdateButtons();
}
bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
bool SmSymDefineDialog::SelectSymbolSet(weld::ComboBoxText& rComboBox,
const OUString &rSymbolSetName, bool bDeleteText)
{
assert((&rComboBox == pOldSymbolSets || &rComboBox == pSymbolSets) && "Sm : wrong ComboBox");
assert((&rComboBox == m_xOldSymbolSets.get() || &rComboBox == m_xSymbolSets.get()) && "Sm : wrong ComboBox");
// trim SymbolName (no leading and trailing blanks)
OUString aNormName (rSymbolSetName);
aNormName = comphelper::string::stripStart(aNormName, ' ');
aNormName = comphelper::string::stripEnd(aNormName, ' ');
// and remove possible deviations within the input
rComboBox.SetText(aNormName);
rComboBox.set_entry_text(aNormName);
bool bRet = false;
sal_Int32 nPos = rComboBox.GetEntryPos(aNormName);
int nPos = rComboBox.find_text(aNormName);
if (nPos != COMBOBOX_ENTRY_NOTFOUND)
if (nPos != -1)
{
rComboBox.SetText(rComboBox.GetEntry(nPos));
rComboBox.set_active(nPos);
bRet = true;
}
else if (bDeleteText)
rComboBox.SetText(OUString());
rComboBox.set_entry_text(OUString());
bool bIsOld = &rComboBox == pOldSymbolSets;
bool bIsOld = &rComboBox == m_xOldSymbolSets.get();
// setting the SymbolSet name at the associated display
FixedText &rFT = bIsOld ? *pOldSymbolSetName : *pSymbolSetName;
rFT.SetText(rComboBox.GetText());
weld::Label& rFT = bIsOld ? *m_xOldSymbolSetName : *m_xSymbolSetName;
rFT.set_label(rComboBox.get_active_text());
// set the symbol name which belongs to the SymbolSet at the associated combobox
ComboBox &rCB = bIsOld ? *pOldSymbols : *pSymbols;
weld::ComboBoxText& rCB = bIsOld ? *m_xOldSymbols : *m_xSymbols;
FillSymbols(rCB, false);
// display a valid respectively no symbol when changing the SymbolSets
if (bIsOld)
{
OUString aTmpOldSymbolName;
if (pOldSymbols->GetEntryCount() > 0)
aTmpOldSymbolName = pOldSymbols->GetEntry(0);
SelectSymbol(*pOldSymbols, aTmpOldSymbolName, true);
OUString aTmpOldSymbolName;
if (m_xOldSymbols->get_count() > 0)
aTmpOldSymbolName = m_xOldSymbols->get_text(0);
SelectSymbol(*m_xOldSymbols, aTmpOldSymbolName, true);
}
UpdateButtons();
@@ -2139,56 +2092,55 @@ bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
return bRet;
}
void SmSymDefineDialog::SetOrigSymbol(const SmSym *pSymbol,
const OUString &rSymbolSetName)
{
// clear old symbol
pOrigSymbol.reset();
m_xOrigSymbol.reset();
OUString aSymName,
aSymSetName;
if (pSymbol)
{
// set new symbol
pOrigSymbol.reset(new SmSym( *pSymbol ));
m_xOrigSymbol.reset(new SmSym(*pSymbol));
aSymName = pSymbol->GetName();
aSymSetName = rSymbolSetName;
pOldSymbolDisplay->SetSymbol( pSymbol );
m_xOldSymbolDisplay->SetSymbol( pSymbol );
}
else
{ // delete displayed symbols
pOldSymbolDisplay->SetText(OUString());
pOldSymbolDisplay->Invalidate();
m_xOldSymbolDisplay->SetText(OUString());
m_xOldSymbolDisplay->queue_draw();
}
pOldSymbolName->SetText(aSymName);
pOldSymbolSetName->SetText(aSymSetName);
m_xOldSymbolName->set_label(aSymName);
m_xOldSymbolSetName->set_label(aSymSetName);
}
bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
bool SmSymDefineDialog::SelectSymbol(weld::ComboBoxText& rComboBox,
const OUString &rSymbolName, bool bDeleteText)
{
assert((&rComboBox == pOldSymbols || &rComboBox == pSymbols) && "Sm : wrong ComboBox");
assert((&rComboBox == m_xOldSymbols.get() || &rComboBox == m_xSymbols.get()) && "Sm : wrong ComboBox");
// trim SymbolName (no blanks)
OUString aNormName = rSymbolName.replaceAll(" ", "");
// and remove possible deviations within the input
rComboBox.SetText(aNormName);
rComboBox.set_entry_text(aNormName);
bool bRet = false;
sal_Int32 nPos = rComboBox.GetEntryPos(aNormName);
int nPos = rComboBox.find_text(aNormName);
bool bIsOld = &rComboBox == pOldSymbols;
bool bIsOld = &rComboBox == m_xOldSymbols.get();
if (nPos != COMBOBOX_ENTRY_NOTFOUND)
if (nPos != -1)
{
rComboBox.SetText(rComboBox.GetEntry(nPos));
rComboBox.set_active(nPos);
if (!bIsOld)
{
const SmSym *pSymbol = GetSymbol(*pSymbols);
const SmSym *pSymbol = GetSymbol(*m_xSymbols);
if (pSymbol)
{
// choose font and style accordingly
@@ -2199,22 +2151,22 @@ bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
// Since setting the Font via the Style name of the SymbolFonts doesn't
// work really well (e.g. it can be empty even though the font itself is
// bold or italic) we're manually setting the Font with respect to the Symbol
pCharsetDisplay->SetFont(rFont);
pSymbolDisplay->SetFont(rFont);
m_xCharsetDisplay->SetFont(rFont);
m_xSymbolDisplay->SetFont(rFont);
// select associated character
SelectChar(pSymbol->GetCharacter());
// since SelectChar will also set the unicode point as text in the
// symbols box, we have to set the symbol name again to get that one displayed
pSymbols->SetText( pSymbol->GetName() );
m_xSymbols->set_entry_text(pSymbol->GetName());
}
}
bRet = true;
}
else if (bDeleteText)
rComboBox.SetText(OUString());
rComboBox.set_entry_text(OUString());
if (bIsOld)
{
@@ -2223,13 +2175,13 @@ bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
OUString aTmpOldSymbolSetName;
if (nPos != COMBOBOX_ENTRY_NOTFOUND)
{
pOldSymbol = aSymbolMgrCopy.GetSymbolByName(aNormName);
aTmpOldSymbolSetName = pOldSymbolSets->GetText();
pOldSymbol = m_aSymbolMgrCopy.GetSymbolByName(aNormName);
aTmpOldSymbolSetName = m_xOldSymbolSets->get_active_text();
}
SetOrigSymbol(pOldSymbol, aTmpOldSymbolSetName);
}
else
pSymbolName->SetText(rComboBox.GetText());
m_xSymbolName->set_label(rComboBox.get_active_text());
UpdateButtons();
@@ -2241,54 +2193,52 @@ void SmSymDefineDialog::SetFont(const OUString &rFontName, const OUString &rStyl
{
// get Font (FontInfo) matching name and style
FontMetric aFontMetric;
if (pFontList)
aFontMetric = pFontList->Get(rFontName, WEIGHT_NORMAL, ITALIC_NONE);
if (m_xFontList)
aFontMetric = m_xFontList->Get(rFontName, WEIGHT_NORMAL, ITALIC_NONE);
SetFontStyle(rStyleName, aFontMetric);
pCharsetDisplay->SetFont(aFontMetric);
pSymbolDisplay->SetFont(aFontMetric);
m_xCharsetDisplay->SetFont(aFontMetric);
m_xSymbolDisplay->SetFont(aFontMetric);
// update subset listbox for new font's unicode subsets
FontCharMapRef xFontCharMap;
pCharsetDisplay->GetFontCharMap( xFontCharMap );
pSubsetMap.reset(new SubsetMap( xFontCharMap ));
m_xCharsetDisplay->GetFontCharMap( xFontCharMap );
m_xSubsetMap.reset(new SubsetMap( xFontCharMap ));
pFontsSubsetLB->Clear();
m_xFontsSubsetLB->clear();
bool bFirst = true;
for (auto & subset : pSubsetMap->GetSubsetMap())
for (auto & subset : m_xSubsetMap->GetSubsetMap())
{
const sal_Int32 nPos = pFontsSubsetLB->InsertEntry( subset.GetName());
pFontsSubsetLB->SetEntryData( nPos, const_cast<Subset *>(&subset) );
m_xFontsSubsetLB->append(OUString::number(reinterpret_cast<sal_uInt64>(&subset)), subset.GetName());
// subset must live at least as long as the selected font !!!
if( bFirst )
pFontsSubsetLB->SelectEntryPos( nPos );
if (bFirst)
m_xFontsSubsetLB->set_active(0);
bFirst = false;
}
if( bFirst )
pFontsSubsetLB->SetNoSelection();
pFontsSubsetLB->Enable( !bFirst );
if (bFirst)
m_xFontsSubsetLB->set_active(-1);
m_xFontsSubsetLB->set_sensitive(!bFirst);
}
bool SmSymDefineDialog::SelectFont(const OUString &rFontName, bool bApplyFont)
{
bool bRet = false;
sal_Int32 nPos = pFonts->GetEntryPos(rFontName);
int nPos = m_xFonts->find_text(rFontName);
if (nPos != LISTBOX_ENTRY_NOTFOUND)
if (nPos != -1)
{
pFonts->SelectEntryPos(nPos);
if (pStyles->GetEntryCount() > 0)
SelectStyle(pStyles->GetEntry(0));
m_xFonts->set_active(nPos);
if (m_xStyles->get_count() > 0)
SelectStyle(m_xStyles->get_text(0));
if (bApplyFont)
{
SetFont(pFonts->GetSelectedEntry(), pStyles->GetText());
pSymbolDisplay->SetSymbol( pCharsetDisplay->GetSelectCharacter(), pCharsetDisplay->GetFont() );
SetFont(m_xFonts->get_active_text(), m_xStyles->get_active_text());
m_xSymbolDisplay->SetSymbol(m_xCharsetDisplay->GetSelectCharacter(), m_xCharsetDisplay->GetFont());
}
bRet = true;
}
else
pFonts->SetNoSelection();
m_xFonts->set_active(-1);
FillStyles();
UpdateButtons();
@@ -2300,40 +2250,36 @@ bool SmSymDefineDialog::SelectFont(const OUString &rFontName, bool bApplyFont)
bool SmSymDefineDialog::SelectStyle(const OUString &rStyleName, bool bApplyFont)
{
bool bRet = false;
sal_Int32 nPos = pStyles->GetEntryPos(rStyleName);
int nPos = m_xStyles->find_text(rStyleName);
// if the style is not available take the first available one (if existent)
if (nPos == COMBOBOX_ENTRY_NOTFOUND && pStyles->GetEntryCount() > 0)
if (nPos == -1 && m_xStyles->get_count() > 0)
nPos = 0;
if (nPos != COMBOBOX_ENTRY_NOTFOUND)
if (nPos != -1)
{
pStyles->SetText(pStyles->GetEntry(nPos));
m_xStyles->set_active(nPos);
if (bApplyFont)
{
SetFont(pFonts->GetSelectedEntry(), pStyles->GetText());
pSymbolDisplay->SetSymbol( pCharsetDisplay->GetSelectCharacter(), pCharsetDisplay->GetFont() );
SetFont(m_xFonts->get_active_text(), m_xStyles->get_active_text());
m_xSymbolDisplay->SetSymbol(m_xCharsetDisplay->GetSelectCharacter(), m_xCharsetDisplay->GetFont());
}
bRet = true;
}
else
pStyles->SetText(OUString());
m_xStyles->set_entry_text(OUString());
UpdateButtons();
return bRet;
}
void SmSymDefineDialog::SelectChar(sal_Unicode cChar)
{
pCharsetDisplay->SelectCharacter( cChar );
pSymbolDisplay->SetSymbol( cChar, pCharsetDisplay->GetFont() );
m_xCharsetDisplay->SelectCharacter( cChar );
m_xSymbolDisplay->SetSymbol(cChar, m_xCharsetDisplay->GetFont());
UpdateButtons();
}
/**************************************************************************/
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/uiconfig/smath/ui/symdefinedialog.ui b/starmath/uiconfig/smath/ui/symdefinedialog.ui
index 389e9db..154723e 100644
--- a/starmath/uiconfig/smath/ui/symdefinedialog.ui
+++ b/starmath/uiconfig/smath/ui/symdefinedialog.ui
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.2 -->
<interface domain="sm">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="EditSymbols">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@@ -12,446 +11,12 @@
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">18</property>
<child>
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="oldSymbolSetText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="symdefinedialog|oldSymbolSetText">O_ld symbol set:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">oldSymbolSets</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="oldSymbolSets">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry1">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="oldSymbolText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="symdefinedialog|oldSymbolText">_Old symbol:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">oldSymbols</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="oldSymbols">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry5">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="svxlo-SvxShowCharSet" id="charsetDisplay">
<property name="width_request">250</property>
<property name="height_request">250</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">18</property>
<child>
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="symbolText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="symdefinedialog|symbolText">_Symbol:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">symbols</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="symbolSetText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="symdefinedialog|symbolSetText">Symbol s_et:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">symbolSets</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="fontText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="symdefinedialog|fontText">_Font:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">fonts</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="styleText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="symdefinedialog|styleText">S_tyle:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">styles</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="fontsSubsetFT">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="symdefinedialog|fontsSubsetFT">S_ubset:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">fontsSubsetLB</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="fonts">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="fontsSubsetLB">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="symbols">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry2">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="symbolSets">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry3">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="svtlo-FontStyleBox" id="styles">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">end</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkLabel" id="oldSymbolName">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="smlo-SmShowChar" id="oldSymbolDisplay:border">
<property name="width_request">60</property>
<property name="height_request">60</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="oldSymbolSetName">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="symbolName">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="smlo-SmShowChar" id="symbolDisplay:border">
<property name="width_request">60</property>
<property name="height_request">60</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="symbolSetName">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="modify">
<property name="label" translatable="yes" context="symdefinedialog|modify">_Modify</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="add">
<property name="label">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkImage" id="rightArrow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="pixbuf">starmath/res/ar_right.png</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="layout_style">start</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
@@ -498,6 +63,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
@@ -508,6 +74,500 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">18</property>
<child>
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="oldSymbolSetText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="symdefinedialog|oldSymbolSetText">O_ld symbol set:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">oldSymbolSets</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="oldSymbolSets">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry1">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="oldSymbolText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="label" translatable="yes" context="symdefinedialog|oldSymbolText">_Old symbol:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">oldSymbols</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="oldSymbols">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry5">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkScrolledWindow" id="showscroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="charsetDisplay">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="add">
<property name="label">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="modify">
<property name="label" translatable="yes" context="symdefinedialog|modify">_Modify</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">18</property>
<child>
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="symbolText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="symdefinedialog|symbolText">_Symbol:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">symbols</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="symbolSetText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="symdefinedialog|symbolSetText">Symbol s_et:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">symbolSets</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="fontText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="symdefinedialog|fontText">_Font:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">fonts</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="styleText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="symdefinedialog|styleText">S_tyle:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">styles</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="fontsSubsetFT">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="symdefinedialog|fontsSubsetFT">S_ubset:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">fontsSubsetLB</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="fonts">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="fontsSubsetLB">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="symbols">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry2">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="symbolSets">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry3">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="styles">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">end</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="oldSymbolName">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">middle</property>
<property name="width_chars">10</property>
<property name="single_line_mode">True</property>
<property name="max_width_chars">10</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkDrawingArea" id="oldSymbolDisplay">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="oldSymbolSetName">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">middle</property>
<property name="width_chars">10</property>
<property name="single_line_mode">True</property>
<property name="max_width_chars">10</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="symbolName">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">middle</property>
<property name="width_chars">10</property>
<property name="single_line_mode">True</property>
<property name="max_width_chars">10</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkDrawingArea" id="symbolDisplay">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="symbolSetName">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ellipsize">middle</property>
<property name="width_chars">10</property>
<property name="single_line_mode">True</property>
<property name="max_width_chars">10</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkImage" id="rightArrow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon_name">starmath/res/ar_right.png</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
@@ -515,6 +575,9 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<property name="mode">vertical</property>
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index 449dae7..9d2f605 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/addsubmissiondialog \
svx/uiconfig/ui/asianphoneticguidedialog \
svx/uiconfig/ui/cellmenu \
svx/uiconfig/ui/charsetmenu \
svx/uiconfig/ui/chineseconversiondialog \
svx/uiconfig/ui/chinesedictionary \
svx/uiconfig/ui/classificationdialog \
diff --git a/svx/inc/uiobject.hxx b/svx/inc/uiobject.hxx
index 33189352..1cf2a33 100644
--- a/svx/inc/uiobject.hxx
+++ b/svx/inc/uiobject.hxx
@@ -17,11 +17,10 @@ class SvxShowCharSet;
class SvxShowCharSetUIObject : public WindowUIObject
{
VclPtr<SvxShowCharSet> mxCharSet;
SvxShowCharSet* mpCharSet;
public:
SvxShowCharSetUIObject(const VclPtr<SvxShowCharSet>& xCharSet);
SvxShowCharSetUIObject(const VclPtr<vcl::Window>& xCharSetWin, SvxShowCharSet* pCharSet);
virtual StringMap get_state() override;
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
index 1f19eaf..8e6da5d 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -40,186 +40,6 @@ namespace svx
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::accessibility;
SvxShowCharSetVirtualAcc::SvxShowCharSetVirtualAcc( SvxShowCharSet* pParent ) : mpParent( pParent )
{
osl_atomic_increment(&m_refCount);
{
lateInit(this);
}
osl_atomic_decrement(&m_refCount);
}
SvxShowCharSetVirtualAcc::~SvxShowCharSetVirtualAcc()
{
ensureDisposed();
}
IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetVirtualAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetVirtualAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
void SvxShowCharSetVirtualAcc::fireEvent(
const sal_Int16 _nEventId,
const css::uno::Any& _rOldValue,
const css::uno::Any& _rNewValue
)
{
if ( m_xTable.is() )
m_xTable->fireEvent(_nEventId,_rOldValue,_rNewValue);
}
sal_Int32 SvxShowCharSetVirtualAcc::getImplAccessibleChildCount() const
{
return mpParent->getScrollBar().IsVisible() ? 2 : 1;
}
sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChildCount()
{
OExternalLockGuard aGuard( this );
return getImplAccessibleChildCount();
}
uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleAtPoint( const awt::Point& aPoint )
{
OExternalLockGuard aGuard( this );
uno::Reference< css::accessibility::XAccessible > xRet;
const sal_uInt16 nItemId = sal::static_int_cast<sal_uInt16>(mpParent->PixelToMapIndex( Point( aPoint.X, aPoint.Y ) ));
if( sal_uInt16(-1) != nItemId )
{
if ( !m_xTable.is() )
m_xTable = new SvxShowCharSetAcc(this);
xRet = m_xTable.get();
}
else if ( mpParent->getScrollBar().IsVisible() )
{
const Point aOutPos( mpParent->getScrollBar().GetPosPixel() );
const Size aScrollBar = mpParent->getScrollBar().GetOutputSizePixel();
tools::Rectangle aRect(aOutPos,aScrollBar);
if ( aRect.IsInside(VCLPoint(aPoint)) )
xRet = mpParent->getScrollBar().GetAccessible();
}
return xRet;
}
void SAL_CALL SvxShowCharSetVirtualAcc::grabFocus()
{
OExternalLockGuard aGuard( this );
mpParent->GrabFocus();
}
Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChild( sal_Int32 i )
{
OExternalLockGuard aGuard( this );
sal_Int32 nCount = getImplAccessibleChildCount();
if (i >= nCount)
throw IndexOutOfBoundsException();
if (i == 0 && mpParent->getScrollBar().IsVisible())
return mpParent->getScrollBar().GetAccessible();
if (!m_xTable.is())
m_xTable = new SvxShowCharSetAcc(this);
return m_xTable.get();
}
Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleParent( )
{
OExternalLockGuard aGuard( this );
vcl::Window* pParent = mpParent->GetParent();
uno::Reference< css::accessibility::XAccessible > xRet;
if ( pParent )
xRet = pParent->GetAccessible();
return xRet;
}
css::awt::Rectangle SvxShowCharSetVirtualAcc::implGetBounds( )
{
css::awt::Rectangle aBounds ( 0, 0, 0, 0 );
vcl::Window* pWindow = mpParent;
if ( pWindow )
{
tools::Rectangle aRect = pWindow->GetWindowExtentsRelative( nullptr );
aBounds = AWTRectangle( aRect );
vcl::Window* pParent = pWindow->GetAccessibleParentWindow();
if ( pParent )
{
tools::Rectangle aParentRect = pParent->GetWindowExtentsRelative( nullptr );
css::awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() );
aBounds.X -= aParentScreenLoc.X;
aBounds.Y -= aParentScreenLoc.Y;
}
}
return aBounds;
}
sal_Int16 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleRole( )
{
return css::accessibility::AccessibleRole::SCROLL_PANE;
}
OUString SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleDescription( )
{
OExternalLockGuard aGuard( this );
return SvxResId( RID_SVXSTR_CHARACTER_SELECTION);
}
OUString SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleName( )
{
OExternalLockGuard aGuard( this );
return SvxResId( RID_SVXSTR_CHAR_SEL_DESC);
}
Reference< XAccessibleRelationSet > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleRelationSet( )
{
return Reference< XAccessibleRelationSet >();
}
Reference< XAccessibleStateSet > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleStateSet( )
{
OExternalLockGuard aGuard( this );
::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
if( mpParent )
{
// SELECTABLE
pStateSet->AddState( AccessibleStateType::FOCUSABLE );
if ( mpParent->HasFocus() )
pStateSet->AddState( AccessibleStateType::FOCUSED );
if ( mpParent->IsActive() )
pStateSet->AddState( AccessibleStateType::ACTIVE );
if ( mpParent->IsEnabled() )
{
pStateSet->AddState( AccessibleStateType::ENABLED );
pStateSet->AddState( AccessibleStateType::SENSITIVE );
}
if ( mpParent->IsReallyVisible() )
pStateSet->AddState( AccessibleStateType::VISIBLE );
}
return pStateSet;
}
void SAL_CALL SvxShowCharSetVirtualAcc::disposing()
{
OAccessibleContextHelper::disposing();
if ( m_xTable.is() )
m_xTable->dispose();
m_xTable.clear();
}
SvxShowCharSetItem::SvxShowCharSetItem( SvxShowCharSet& rParent,SvxShowCharSetAcc* _pParent,sal_uInt16 _nPos ) :
mrParent( rParent )
,mnId( _nPos )
@@ -227,7 +47,6 @@ SvxShowCharSetItem::SvxShowCharSetItem( SvxShowCharSet& rParent,SvxShowCharSetAc
{
}
SvxShowCharSetItem::~SvxShowCharSetItem()
{
if ( m_xItem.is() )
@@ -237,7 +56,6 @@ SvxShowCharSetItem::~SvxShowCharSetItem()
}
}
uno::Reference< css::accessibility::XAccessible > SvxShowCharSetItem::GetAccessible()
{
if( !m_xItem.is() )
@@ -248,9 +66,8 @@ uno::Reference< css::accessibility::XAccessible > SvxShowCharSetItem::GetAccessi
return m_xItem.get();
}
SvxShowCharSetAcc::SvxShowCharSetAcc( SvxShowCharSetVirtualAcc* _pParent ) : m_pParent( _pParent )
SvxShowCharSetAcc::SvxShowCharSetAcc(SvxShowCharSet* pParent)
: m_pParent(pParent)
{
osl_atomic_increment(&m_refCount);
{
@@ -259,7 +76,6 @@ SvxShowCharSetAcc::SvxShowCharSetAcc( SvxShowCharSetVirtualAcc* _pParent ) : m_p
osl_atomic_decrement(&m_refCount);
}
SvxShowCharSetAcc::~SvxShowCharSetAcc()
{
ensureDisposed();
@@ -282,7 +98,7 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetAcc, OAccessibleSelectionHelper,
bool SvxShowCharSetAcc::implIsSelected( sal_Int32 nAccessibleChildIndex )
{
return m_pParent && m_pParent->getCharSetControl()->IsSelected(
return m_pParent && m_pParent->IsSelected(
sal::static_int_cast<sal_uInt16>(nAccessibleChildIndex));
}
@@ -292,21 +108,16 @@ void SvxShowCharSetAcc::implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect
if ( m_pParent )
{
if ( bSelect )
m_pParent->getCharSetControl()->SelectIndex(nAccessibleChildIndex, true);
m_pParent->SelectIndex(nAccessibleChildIndex, true);
else
m_pParent->getCharSetControl()->DeSelect();
m_pParent->DeSelect();
}
}
css::awt::Rectangle SvxShowCharSetAcc::implGetBounds( )
css::awt::Rectangle SvxShowCharSetAcc::implGetBounds()
{
const Point aOutPos;//( m_pParent->getCharSetControl()->GetPosPixel() );
Size aOutSize( m_pParent->getCharSetControl()->GetOutputSizePixel());
if ( m_pParent->getCharSetControl()->getScrollBar().IsVisible() )
{
const Size aScrollBar = m_pParent->getCharSetControl()->getScrollBar().GetOutputSizePixel();
aOutSize.AdjustWidth( -(aScrollBar.Width()) );
}
const Point aOutPos;//( m_pParent->GetPosPixel() );
Size aOutSize( m_pParent->GetSize());
awt::Rectangle aRet;
@@ -322,16 +133,20 @@ sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleChildCount()
{
OExternalLockGuard aGuard( this );
return m_pParent->getCharSetControl()->getMaxCharCount();
return m_pParent->getMaxCharCount();
}
sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleIndexInParent()
{
return 0;
}
uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleChild( sal_Int32 i )
{
OExternalLockGuard aGuard( this );
uno::Reference< css::accessibility::XAccessible > xRet;
SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem( static_cast< sal_uInt16 >( i ) );
SvxShowCharSetItem* pItem = m_pParent->ImplGetItem( static_cast< sal_uInt16 >( i ) );
if( !pItem )
throw lang::IndexOutOfBoundsException();
@@ -343,21 +158,18 @@ uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::ge
return xRet;
}
uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleParent()
{
OExternalLockGuard aGuard( this );
return m_pParent;
return m_pParent->getAccessibleParent();
}
sal_Int16 SAL_CALL SvxShowCharSetAcc::getAccessibleRole()
{
return css::accessibility::AccessibleRole::TABLE;
}
OUString SAL_CALL SvxShowCharSetAcc::getAccessibleDescription()
{
OExternalLockGuard aGuard( this );
@@ -385,20 +197,21 @@ uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSe
::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
if( m_pParent->getCharSetControl() )
if (m_pParent)
{
// SELECTABLE
pStateSet->AddState( AccessibleStateType::FOCUSABLE );
if ( m_pParent->getCharSetControl()->HasFocus() )
if (m_pParent->HasFocus())
{
pStateSet->AddState( AccessibleStateType::FOCUSED );
if ( m_pParent->getCharSetControl()->IsActive() )
pStateSet->AddState( AccessibleStateType::ACTIVE );
if ( m_pParent->getCharSetControl()->IsEnabled() )
}
if (m_pParent->IsEnabled())
{
pStateSet->AddState( AccessibleStateType::ENABLED );
pStateSet->AddState( AccessibleStateType::SENSITIVE );
}
if ( m_pParent->getCharSetControl()->IsReallyVisible() )
if (m_pParent->IsVisible())
pStateSet->AddState( AccessibleStateType::VISIBLE );
pStateSet->AddState( AccessibleStateType::MANAGES_DESCENDANTS );
@@ -414,11 +227,11 @@ uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::ge
uno::Reference< css::accessibility::XAccessible > xRet;
const sal_uInt16 nItemId = sal::static_int_cast<sal_uInt16>(
m_pParent->getCharSetControl()->PixelToMapIndex( Point( aPoint.X, aPoint.Y ) ));
m_pParent->PixelToMapIndex( Point( aPoint.X, aPoint.Y ) ));
if( sal_uInt16(-1) != nItemId )
{
SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem( nItemId );
SvxShowCharSetItem* pItem = m_pParent->ImplGetItem( nItemId );
xRet = pItem->GetAccessible();
}
return xRet;
@@ -428,7 +241,7 @@ void SAL_CALL SvxShowCharSetAcc::grabFocus()
{
OExternalLockGuard aGuard( this );
m_pParent->getCharSetControl()->GrabFocus();
m_pParent->GrabFocus();
}
sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRowCount( )
@@ -476,7 +289,7 @@ Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleRows( )
OExternalLockGuard aGuard( this );
Sequence< sal_Int32 > aSel(1);
aSel[0] = SvxShowCharSet::GetRowPos(m_pParent->getCharSetControl()->GetSelectIndexId());
aSel[0] = SvxShowCharSet::GetRowPos(m_pParent->GetSelectIndexId());
return aSel;
}
@@ -485,7 +298,7 @@ Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleColumns(
OExternalLockGuard aGuard( this );
Sequence< sal_Int32 > aSel(1);
aSel[0] = SvxShowCharSet::GetColumnPos(m_pParent->getCharSetControl()->GetSelectIndexId());
aSel[0] = SvxShowCharSet::GetColumnPos(m_pParent->GetSelectIndexId());
return aSel;
}
@@ -493,21 +306,21 @@ sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleRowSelected( sal_Int32 nRow )
{
OExternalLockGuard aGuard( this );
return SvxShowCharSet::GetRowPos(m_pParent->getCharSetControl()->GetSelectIndexId()) == nRow;
return SvxShowCharSet::GetRowPos(m_pParent->GetSelectIndexId()) == nRow;
}
sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleColumnSelected( sal_Int32 nColumn )
{
OExternalLockGuard aGuard( this );
ensureAlive();
return SvxShowCharSet::GetColumnPos(m_pParent->getCharSetControl()->GetSelectIndexId()) == nColumn;
return SvxShowCharSet::GetColumnPos(m_pParent->GetSelectIndexId()) == nColumn;
}
Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
{
OExternalLockGuard aGuard( this );
svx::SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem(
svx::SvxShowCharSetItem* pItem = m_pParent->ImplGetItem(
sal::static_int_cast<sal_uInt16>(getAccessibleIndex(nRow,nColumn) ));
if ( !pItem )
throw IndexOutOfBoundsException();
@@ -528,7 +341,7 @@ sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleSelected( sal_Int32 nRow, sal_I
{
OExternalLockGuard aGuard( this );
return m_pParent->getCharSetControl()->GetSelectIndexId() == getAccessibleIndex(nRow,nColumn);
return m_pParent->GetSelectIndexId() == getAccessibleIndex(nRow,nColumn);
}
sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
@@ -570,14 +383,12 @@ SvxShowCharSetItemAcc::~SvxShowCharSetItemAcc()
IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetItemAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_3 )
IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetItemAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_3 )
void SvxShowCharSetItemAcc::ParentDestroyed()
{
const ::osl::MutexGuard aGuard( GetMutex() );
mpParent = nullptr;
}
sal_Int32 SAL_CALL SvxShowCharSetItemAcc::getAccessibleChildCount()
{
return 0;
@@ -738,7 +549,7 @@ awt::Rectangle SvxShowCharSetItemAcc::implGetBounds( )
if( mpParent )
{
tools::Rectangle aRect( mpParent->maRect );
tools::Rectangle aParentRect( Point(), mpParent->mrParent.GetOutputSizePixel() );
tools::Rectangle aParentRect(Point(), mpParent->mrParent.GetSize());
aRect.Intersection( aParentRect );
@@ -756,65 +567,24 @@ uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc
return uno::Reference< css::accessibility::XAccessible >();
}
sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getForeground( )
{
OExternalLockGuard aGuard( this );
Color nColor;
if ( mpParent )
{
if ( mpParent->IsControlForeground() )
nColor = mpParent->GetControlForeground();
else
{
vcl::Font aFont;
if ( mpParent->IsControlFont() )
aFont = mpParent->GetControlFont();
else
aFont = mpParent->GetFont();
nColor = aFont.GetColor();
}
}
return sal_Int32(nColor);
}
sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getBackground( )
{
OExternalLockGuard aGuard( this );
Color nColor;
if ( mpParent )
{
if ( mpParent->IsControlBackground() )
nColor = mpParent->GetControlBackground();
else
nColor = mpParent->GetBackground().GetColor();
}
return sal_Int32(nColor);
}
sal_Int32 SAL_CALL SvxShowCharSetAcc::getForeground( )
{
OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0;
if ( m_pParent )
nColor = m_pParent->getForeground();
return nColor;
//see SvxShowCharSet::InitSettings
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
return static_cast<sal_Int32>(rStyleSettings.GetDialogTextColor());
}
sal_Int32 SAL_CALL SvxShowCharSetAcc::getBackground( )
{
OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0;
if ( m_pParent )
nColor = m_pParent->getBackground();
return nColor;
//see SvxShowCharSet::InitSettings
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
return static_cast<sal_Int32>(rStyleSettings.GetWindowColor());
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index bf18ee5..31db13c 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -39,8 +39,8 @@
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
#include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp>
#include <officecfg/Office/Common.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/dispatchcommand.hxx>
@@ -61,21 +61,34 @@ sal_uInt32& SvxShowCharSet::getSelectedChar()
return cSelectedChar;
}
SvxShowCharSet::SvxShowCharSet(vcl::Window* pParent)
: Control(pParent, WB_TABSTOP | WB_BORDER)
SvxShowCharSet::SvxShowCharSet(weld::Builder& rBuilder, const OString& rDrawingId,
const OString& rScrollId, const VclPtr<VirtualDevice>& rVirDev)
: mxVirDev(rVirDev)
, mxContext(comphelper::getProcessComponentContext())
, maFontSize(0, 0)
, maPosition(0,0)
, aVscrollSB( VclPtr<ScrollBar>::Create(this, WB_VERT) )
, mbRecalculateFont(true)
, mbUpdateForeground(true)
, mbUpdateBackground(true)
{
init();
}
mxDrawingArea.reset(rBuilder.weld_drawing_area(rDrawingId, CreateAccessible(), SvxShowCharSetUIObject::create, this));
mxScrollArea.reset(rBuilder.weld_scrolled_window(rScrollId));
void SvxShowCharSet::ApplySettings(vcl::RenderContext& /*rRenderContext*/ )
{
init();
mxScrollArea->set_user_managed_scrolling();
mxDrawingArea->connect_size_allocate(LINK(this, SvxShowCharSet, DoResize));
mxDrawingArea->connect_draw(LINK(this, SvxShowCharSet, DoPaint));
mxDrawingArea->connect_mouse_press(LINK(this, SvxShowCharSet, DoMouseButtonDown));
mxDrawingArea->connect_mouse_move(LINK(this, SvxShowCharSet, DoMouseMove));
mxDrawingArea->connect_mouse_release(LINK(this, SvxShowCharSet, DoMouseButtonUp));
mxDrawingArea->connect_key_press(LINK(this, SvxShowCharSet, DoKeyDown));
mxDrawingArea->connect_focus_in(LINK(this, SvxShowCharSet, DoGetFocus));
mxDrawingArea->connect_focus_out(LINK(this, SvxShowCharSet, DoLoseFocus));
mxScrollArea->set_size_request(COLUMN_COUNT * mxDrawingArea->get_approximate_digit_width() * 4,
ROW_COUNT * mxDrawingArea->get_text_height() * 2);
}
void SvxShowCharSet::init()
@@ -84,76 +97,39 @@ void SvxShowCharSet::init()
m_nXGap = 0;
m_nYGap = 0;
SetStyle(GetStyle() | WB_CLIPCHILDREN);
aVscrollSB->SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) );
aVscrollSB->EnableDrag();
mxScrollArea->connect_vadjustment_changed(LINK(this, SvxShowCharSet, VscrollHdl));
getFavCharacterList();
// other settings like aVscroll depend on selected font => see RecalculateFont
// other settings depend on selected font => see RecalculateFont
bDrag = false;
}
void SvxShowCharSet::Resize()
IMPL_LINK(SvxShowCharSet, DoResize, const Size&, rSize, void)
{
Control::Resize();
maSize = rSize;
mbRecalculateFont = true;
Invalidate();
mxDrawingArea->queue_draw();
}
VCL_BUILDER_FACTORY(SvxShowCharSet)
void SvxShowCharSet::GetFocus()
IMPL_LINK_NOARG(SvxShowCharSet, DoGetFocus, weld::Widget&, void)
{
Control::GetFocus();
SelectIndex( nSelectedIndex, true );
SelectIndex(nSelectedIndex, true);
}
void SvxShowCharSet::LoseFocus()
IMPL_LINK_NOARG(SvxShowCharSet, DoLoseFocus, weld::Widget&, void)
{
Control::LoseFocus();
SelectIndex( nSelectedIndex );
SelectIndex(nSelectedIndex);
}
void SvxShowCharSet::StateChanged(StateChangedType nType)
{
if (nType == StateChangedType::ControlForeground)
mbUpdateForeground = true;
else if (nType == StateChangedType::ControlBackground)
mbUpdateBackground = true;
Invalidate();
Control::StateChanged( nType );
}
void SvxShowCharSet::DataChanged( const DataChangedEvent& rDCEvt )
{
if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS)
&& (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
{
mbUpdateForeground = true;
mbUpdateBackground = true;
}
else
{
Control::DataChanged(rDCEvt);
}
}
void SvxShowCharSet::MouseButtonDown( const MouseEvent& rMEvt )
IMPL_LINK(SvxShowCharSet, DoMouseButtonDown, const MouseEvent&, rMEvt, void)
{
if ( rMEvt.IsLeft() )
{
if ( rMEvt.GetClicks() == 1 )
{
GrabFocus();
mxDrawingArea->grab_focus();
bDrag = true;
CaptureMouse();
mxDrawingArea->grab_add();
int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() );
// Fire the focus event
@@ -175,26 +151,24 @@ void SvxShowCharSet::MouseButtonDown( const MouseEvent& rMEvt )
}
}
void SvxShowCharSet::MouseButtonUp( const MouseEvent& rMEvt )
IMPL_LINK(SvxShowCharSet, DoMouseButtonUp, const MouseEvent&, rMEvt, void)
{
if ( bDrag && rMEvt.IsLeft() )
{
// released mouse over character map
if ( tools::Rectangle(Point(), GetOutputSize()).IsInside(rMEvt.GetPosPixel()))
if ( tools::Rectangle(Point(), maSize).IsInside(rMEvt.GetPosPixel()))
aSelectHdl.Call( this );
ReleaseMouse();
mxDrawingArea->grab_remove();
bDrag = false;
}
}
void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt )
IMPL_LINK(SvxShowCharSet, DoMouseMove, const MouseEvent&, rMEvt, void)
{
if ( rMEvt.IsLeft() && bDrag )
{
Point aPos = rMEvt.GetPosPixel();
Size aSize = GetSizePixel();
Size aSize = maSize;
if ( aPos.X() < 0 )
aPos.setX( 0 );
@@ -211,14 +185,6 @@ void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt )
}
}
void SvxShowCharSet::Command( const CommandEvent& rCEvt )
{
if( !HandleScrollCommand( rCEvt, nullptr, aVscrollSB.get() ) )
Control::Command( rCEvt );
}
sal_uInt16 SvxShowCharSet::GetRowPos(sal_uInt16 _nPos)
{
return _nPos / COLUMN_COUNT ;
@@ -262,64 +228,51 @@ bool SvxShowCharSet::isFavChar(const OUString& sTitle, const OUString& rFont)
void SvxShowCharSet::createContextMenu()
{
ScopedVclPtrInstance<PopupMenu> pItemMenu;
pItemMenu->InsertItem(0,SvxResId(RID_INSERT));
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(mxDrawingArea.get(), "svx/ui/charsetmenu.ui"));
std::unique_ptr<weld::Menu> xItemMenu(xBuilder->weld_menu("charsetmenu"));
sal_UCS4 cChar = GetSelectCharacter();
OUString aOUStr( &cChar, 1 );
if(!isFavChar(aOUStr, GetFont().GetFamilyName()))
{
if(maFavCharList.size() < 16)
pItemMenu->InsertItem(1,SvxResId(RID_ADD_TO_FAVORITES));
}
if (isFavChar(aOUStr, mxVirDev->GetFont().GetFamilyName()) || maFavCharList.size() >= 16)
xItemMenu->show("add", false);
else
pItemMenu->InsertItem(1,SvxResId(RID_REMOVE_FAVORITES));
xItemMenu->show("remove", false);
pItemMenu->InsertItem(2, SvxResId(RID_COPY_CLIPBOARD ));
pItemMenu->SetSelectHdl(LINK(this, SvxShowCharSet, ContextMenuSelectHdl));
pItemMenu->Execute(this, tools::Rectangle(maPosition,Size(1,1)), PopupMenuFlags::ExecuteDown);
GrabFocus();
Invalidate();
ContextMenuSelect(xItemMenu->popup_at_rect(mxDrawingArea.get(), tools::Rectangle(maPosition, Size(1,1))));
mxDrawingArea->grab_focus();
mxDrawingArea->queue_draw();
}
IMPL_LINK(SvxShowCharSet, ContextMenuSelectHdl, Menu*, pMenu, bool)
void SvxShowCharSet::ContextMenuSelect(const OString& rIdent)
{
sal_uInt16 nMenuId = pMenu->GetCurItemId();
sal_UCS4 cChar = GetSelectCharacter();
OUString aOUStr( &cChar, 1 );
OUString aOUStr(&cChar, 1);
switch(nMenuId)
{
case 0:
if (rIdent == "insert")
aDoubleClkHdl.Call(this);
break;
case 1:
updateFavCharacterList(aOUStr, GetFont().GetFamilyName());
else if (rIdent == "add" || rIdent == "remove")
{
updateFavCharacterList(aOUStr, mxVirDev->GetFont().GetFamilyName());
aFavClickHdl.Call(this);
break;
case 2:
CopyToClipboard(aOUStr);
break;
default:
break;
}
return false;
else if (rIdent == "copy")
CopyToClipboard(aOUStr);
}
void SvxShowCharSet::CopyToClipboard(const OUString& aOUStr)
void SvxShowCharSet::CopyToClipboard(const OUString& rOUStr)
{
css::uno::Reference<css::datatransfer::clipboard::XClipboard> rxClipboard(GetClipboard());
css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext());
if ( rxClipboard.is() )
if (xClipboard.is())
{
TETextDataObject* pDataObj = new TETextDataObject( aOUStr );
TETextDataObject* pDataObj = new TETextDataObject(rOUStr);
try
{
rxClipboard->setContents( pDataObj, nullptr );
xClipboard->setContents( pDataObj, nullptr );
css::uno::Reference< css::datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( rxClipboard, css::uno::UNO_QUERY );
css::uno::Reference<css::datatransfer::clipboard::XFlushableClipboard> xFlushableClipboard(xClipboard, css::uno::UNO_QUERY);
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
}
@@ -329,7 +282,6 @@ void SvxShowCharSet::CopyToClipboard(const OUString& aOUStr)
}
}
void SvxShowCharSet::updateFavCharacterList(const OUString& sTitle, const OUString& rFont)
{
if(isFavChar(sTitle, rFont))
@@ -404,22 +356,16 @@ void SvxShowCharSet::updateFavCharacterList(const OUString& sTitle, const OUStri
batch->commit();
}
sal_uInt16 SvxShowCharSet::GetColumnPos(sal_uInt16 _nPos)
{
return _nPos % COLUMN_COUNT ;
}
int SvxShowCharSet::FirstInView() const
{
int nIndex = 0;
if (aVscrollSB->IsVisible())
nIndex += aVscrollSB->GetThumbPos() * COLUMN_COUNT;
return nIndex;
return mxScrollArea->vadjustment_get_value() * COLUMN_COUNT;
}
int SvxShowCharSet::LastInView() const
{
sal_uIntPtr nIndex = FirstInView();
@@ -430,7 +376,6 @@ int SvxShowCharSet::LastInView() const
return nIndex;
}
Point SvxShowCharSet::MapIndexToPixel( int nIndex ) const
{
const int nBase = FirstInView();
@@ -446,16 +391,14 @@ int SvxShowCharSet::PixelToMapIndex( const Point& point) const
return (nBase + ((point.X() - m_nXGap)/nX) + ((point.Y() - m_nYGap)/nY) * COLUMN_COUNT);
}
void SvxShowCharSet::KeyInput(const KeyEvent& rKEvt)
IMPL_LINK(SvxShowCharSet, DoKeyDown, const KeyEvent&, rKEvt, bool)
{
vcl::KeyCode aCode = rKEvt.GetKeyCode();
if (aCode.GetModifier())
{
Control::KeyInput(rKEvt);
return;
}
return false;
bool bRet = true;
int tmpSelected = nSelectedIndex;
@@ -491,20 +434,21 @@ void SvxShowCharSet::KeyInput(const KeyEvent& rKEvt)
case KEY_TAB: // some fonts have a character at these unicode control codes
case KEY_ESCAPE:
case KEY_RETURN:
Control::KeyInput(rKEvt);
tmpSelected = - 1; // mark as invalid
bRet = false;
break;
default:
{
sal_UCS4 cChar = rKEvt.GetCharCode();
sal_UCS4 cNext = mxFontCharMap->GetNextChar(cChar - 1);
tmpSelected = mxFontCharMap->GetIndexFromChar(cNext);
if (tmpSelected < 0 || (cChar != cNext))
{
sal_UCS4 cChar = rKEvt.GetCharCode();
sal_UCS4 cNext = mxFontCharMap->GetNextChar(cChar - 1);
tmpSelected = mxFontCharMap->GetIndexFromChar(cNext);
if (tmpSelected < 0 || (cChar != cNext))
{
Control::KeyInput(rKEvt);
tmpSelected = - 1; // mark as invalid
}
tmpSelected = - 1; // mark as invalid
bRet = false;
}
break;
}
}
if ( tmpSelected >= 0 )
@@ -512,11 +456,13 @@ void SvxShowCharSet::KeyInput(const KeyEvent& rKEvt)
SelectIndex( tmpSelected, true );
aPreSelectHdl.Call( this );
}
return bRet;
}
void SvxShowCharSet::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& )
IMPL_LINK(SvxShowCharSet, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
{
vcl::RenderContext& rRenderContext = aPayload.first;
InitSettings(rRenderContext);
RecalculateFont(rRenderContext);
DrawChars_Impl(rRenderContext, FirstInView(), LastInView());
@@ -524,14 +470,14 @@ void SvxShowCharSet::Paint( vcl::RenderContext& rRenderContext, const tools::Rec
void SvxShowCharSet::SetFont( const vcl::Font& rFont )
{
Control::SetFont(rFont);
maFont = rFont;
mbRecalculateFont = true;
Invalidate();
mxDrawingArea->queue_draw();
}
void SvxShowCharSet::DeSelect()
{
Invalidate();
mxDrawingArea->queue_draw();
}
// stretch a grid rectangle if its at the edge to fill unused space
@@ -570,9 +516,7 @@ void SvxShowCharSet::DrawChars_Impl(vcl::RenderContext& rRenderContext, int n1,
if (n1 > LastInView() || n2 < FirstInView())
return;
Size aOutputSize(GetOutputSizePixel());
if (aVscrollSB->IsVisible())
aOutputSize.AdjustWidth( -(aVscrollSB->GetOptimalSize().Width()) );
Size aOutputSize(maSize);
int i;
for (i = 1; i < COLUMN_COUNT; ++i)
@@ -686,34 +630,24 @@ void SvxShowCharSet::InitSettings(vcl::RenderContext& rRenderContext)
if (mbUpdateForeground)
{
Color aTextColor(rStyleSettings.GetDialogTextColor());
if (IsControlForeground())
aTextColor = GetControlForeground();
rRenderContext.SetTextColor(aTextColor);
rRenderContext.SetTextColor(rStyleSettings.GetDialogTextColor());
mbUpdateForeground = false;
}
if (mbUpdateBackground)
{
if (IsControlBackground())
rRenderContext.SetBackground(GetControlBackground());
else
rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
mbUpdateBackground = false;
}
vcl::Font aFont(rRenderContext.GetFont());
vcl::Font aFont(maFont);
aFont.SetWeight(WEIGHT_LIGHT);
aFont.SetAlignment(ALIGN_TOP);
aFont.SetFontSize(maFontSize);
aFont.SetTransparent(true);
rRenderContext.SetFont(aFont);
}
sal_UCS4 SvxShowCharSet::GetSelectCharacter() const
{
if( nSelectedIndex >= 0 )
@@ -731,11 +665,9 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
if (nSelectedIndex >= 0)
getSelectedChar() = mxFontCharMap->GetCharFromIndex(nSelectedIndex);
Size aSize(GetOutputSizePixel());
long nSBWidth = aVscrollSB->GetOptimalSize().Width();
aSize.AdjustWidth( -nSBWidth );
Size aSize(maSize);
vcl::Font aFont = rRenderContext.GetFont();
vcl::Font aFont = maFont;
aFont.SetWeight(WEIGHT_LIGHT);
aFont.SetAlignment(ALIGN_TOP);
int nFontHeight = (aSize.Height() - 5) * 2 / (3 * ROW_COUNT);
@@ -749,19 +681,13 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
nX = aSize.Width() / COLUMN_COUNT;
nY = aSize.Height() / ROW_COUNT;
aVscrollSB->setPosSizePixel(aSize.Width(), 0, nSBWidth, aSize.Height());
aVscrollSB->SetRangeMin(0);
int nLastRow = (mxFontCharMap->GetCharCount() - 1 + COLUMN_COUNT) / COLUMN_COUNT;
aVscrollSB->SetRangeMax(nLastRow);
aVscrollSB->SetPageSize(ROW_COUNT - 1);
aVscrollSB->SetVisibleSize(ROW_COUNT);
mxScrollArea->vadjustment_configure(mxScrollArea->vadjustment_get_value(), 0, nLastRow, 1, ROW_COUNT - 1, ROW_COUNT);
// restore last selected unicode
int nMapIndex = mxFontCharMap->GetIndexFromChar(getSelectedChar());
SelectIndex(nMapIndex);
aVscrollSB->Show();
// rearrange CharSet element in sync with nX- and nY-multiples
Size aDrawSize(nX * COLUMN_COUNT, nY * ROW_COUNT);
m_nXGap = (aSize.Width() - aDrawSize.Width()) / 2;
@@ -770,14 +696,10 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
mbRecalculateFont = false;
}
void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
void SvxShowCharSet::SelectIndex(int nNewIndex, bool bFocus)
{
if( !aVscrollSB )
return;
if ( !mxFontCharMap.is() )
RecalculateFont( *this );
if (!mxFontCharMap.is())
RecalculateFont(*mxVirDev);
if( nNewIndex < 0 )
{
@@ -785,39 +707,39 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
sal_uInt32 cPrev = mxFontCharMap->GetPrevChar( getSelectedChar() );
int nMapIndex = mxFontCharMap->GetIndexFromChar( cPrev );
int nNewPos = nMapIndex / COLUMN_COUNT;
aVscrollSB->SetThumbPos( nNewPos );
mxScrollArea->vadjustment_set_value(nNewPos);
nSelectedIndex = bFocus ? nMapIndex+1 : -1;
Invalidate();
mxDrawingArea->queue_draw();
}
else if( nNewIndex < FirstInView() )
{
// need to scroll up to see selected item
int nOldPos = aVscrollSB->GetThumbPos();
int nOldPos = mxScrollArea->vadjustment_get_value();
int nDelta = (FirstInView() - nNewIndex + COLUMN_COUNT-1) / COLUMN_COUNT;
aVscrollSB->SetThumbPos( nOldPos - nDelta );
mxScrollArea->vadjustment_set_value(nOldPos - nDelta);
nSelectedIndex = nNewIndex;
Invalidate();
mxDrawingArea->queue_draw();
}
else if( nNewIndex > LastInView() )
{
// need to scroll down to see selected item
int nOldPos = aVscrollSB->GetThumbPos();
int nOldPos = mxScrollArea->vadjustment_get_value();
int nDelta = (nNewIndex - LastInView() + COLUMN_COUNT) / COLUMN_COUNT;
aVscrollSB->SetThumbPos( nOldPos + nDelta );
mxScrollArea->vadjustment_set_value(nOldPos + nDelta);
if( nNewIndex < mxFontCharMap->GetCharCount() )
{
nSelectedIndex = nNewIndex;
Invalidate();
mxDrawingArea->queue_draw();
}
else if (nOldPos != aVscrollSB->GetThumbPos())
else if (nOldPos != mxScrollArea->vadjustment_get_value())
{
Invalidate();
mxDrawingArea->queue_draw();
}
}
else
{
nSelectedIndex = nNewIndex;
Invalidate();
mxDrawingArea->queue_draw();
}
if( nSelectedIndex >= 0 )
@@ -846,7 +768,6 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
aHighHdl.Call( this );
}
void SvxShowCharSet::OutputIndex( int nNewIndex )
{
SelectIndex( nNewIndex, true );
@@ -857,7 +778,7 @@ void SvxShowCharSet::OutputIndex( int nNewIndex )
void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew )
{
if ( !mxFontCharMap.is() )
RecalculateFont( *this );
RecalculateFont(*mxVirDev);
// get next available char of current font
sal_UCS4 cNext = mxFontCharMap->GetNextChar( (cNew > 0) ? cNew - 1 : cNew );
@@ -865,12 +786,11 @@ void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew )
int nMapIndex = mxFontCharMap->GetIndexFromChar( cNext );
SelectIndex( nMapIndex );
// move selected item to top row if not in focus
aVscrollSB->SetThumbPos( nMapIndex / COLUMN_COUNT );
Invalidate();
mxScrollArea->vadjustment_set_value(nMapIndex / COLUMN_COUNT);
mxDrawingArea->queue_draw();
}
IMPL_LINK_NOARG(SvxShowCharSet, VscrollHdl, ScrollBar*, void)
IMPL_LINK_NOARG(SvxShowCharSet, VscrollHdl, weld::ScrolledWindow&, void)
{
if( nSelectedIndex < FirstInView() )
{
@@ -891,33 +811,23 @@ IMPL_LINK_NOARG(SvxShowCharSet, VscrollHdl, ScrollBar*, void)
SelectIndex( (LastInView() - COLUMN_COUNT + 1) + (nSelectedIndex % COLUMN_COUNT) );
}
Invalidate();
mxDrawingArea->queue_draw();
}
SvxShowCharSet::~SvxShowCharSet()
{
disposeOnce();
}
void SvxShowCharSet::dispose()
{
if ( m_xAccessible.is() )
ReleaseAccessible();
aVscrollSB.disposeAndClear();
Control::dispose();
}
void SvxShowCharSet::ReleaseAccessible()
{
m_aItems.clear();
m_xAccessible.clear();
if (m_xAccessible.is())
{
m_aItems.clear();
m_xAccessible->clearCharSetControl();
m_xAccessible.clear();
}
}
css::uno::Reference< XAccessible > SvxShowCharSet::CreateAccessible()
{
OSL_ENSURE(!m_xAccessible.is(),"Accessible already created!");
m_xAccessible = new svx::SvxShowCharSetVirtualAcc(this);
m_xAccessible = new svx::SvxShowCharSetAcc(this);
return m_xAccessible.get();
}
@@ -928,7 +838,7 @@ svx::SvxShowCharSetItem* SvxShowCharSet::ImplGetItem( int _nPos )
{
OSL_ENSURE(m_xAccessible.is(), "Who wants to create a child of my table without a parent?");
std::shared_ptr<svx::SvxShowCharSetItem> xItem(new svx::SvxShowCharSetItem(*this,
m_xAccessible->getTable(), sal::static_int_cast< sal_uInt16 >(_nPos)));
m_xAccessible.get(), sal::static_int_cast< sal_uInt16 >(_nPos)));
aFind = m_aItems.emplace(_nPos, xItem).first;
OUStringBuffer buf;
buf.appendUtf32( mxFontCharMap->GetCharFromIndex( _nPos ) );
@@ -946,11 +856,6 @@ sal_Int32 SvxShowCharSet::getMaxCharCount() const
return mxFontCharMap->GetCharCount();
}
FactoryFunction SvxShowCharSet::GetUITestFactory() const
{
return SvxShowCharSetUIObject::create;
}
// TODO: should be moved into Font Attributes stuff
// we let it mature here though because it is currently the only use
diff --git a/svx/source/dialog/searchcharmap.cxx b/svx/source/dialog/searchcharmap.cxx
index 97f130d..22166a4 100644
--- a/svx/source/dialog/searchcharmap.cxx
+++ b/svx/source/dialog/searchcharmap.cxx
@@ -50,15 +50,14 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
SvxSearchCharSet::SvxSearchCharSet(vcl::Window* pParent)
: SvxShowCharSet(pParent),
nCount(0)
SvxSearchCharSet::SvxSearchCharSet(weld::Builder& rBuilder, const OString& rDrawingId,
const OString& rScrollId, const VclPtr<VirtualDevice>& rVirDev)
: SvxShowCharSet(rBuilder, rDrawingId, rScrollId, rVirDev)
, nCount(0)
{
mxDrawingArea->connect_key_press(LINK(this, SvxSearchCharSet, DoKeyDown));
}
VCL_BUILDER_FACTORY(SvxSearchCharSet)
int SvxSearchCharSet::LastInView() const
{
sal_uIntPtr nIndex = FirstInView();
@@ -69,19 +68,17 @@ int SvxSearchCharSet::LastInView() const
return nIndex;
}
void SvxSearchCharSet::KeyInput(const KeyEvent& rKEvt)
IMPL_LINK(SvxSearchCharSet, DoKeyDown, const KeyEvent&, rKEvt, bool)
{
vcl::KeyCode aCode = rKEvt.GetKeyCode();
if (aCode.GetModifier())
{
Control::KeyInput(rKEvt);
return;
}
return false;
int tmpSelected = nSelectedIndex;
bool bRet = true;
switch (aCode.GetCode())
{
case KEY_SPACE:
@@ -114,13 +111,13 @@ void SvxSearchCharSet::KeyInput(const KeyEvent& rKEvt)
case KEY_TAB: // some fonts have a character at these unicode control codes
case KEY_ESCAPE:
case KEY_RETURN:
Control::KeyInput(rKEvt);
bRet = false;
tmpSelected = - 1; // mark as invalid
break;
default:
{
tmpSelected = -1;
}
tmpSelected = -1;
bRet = false;
break;
}
if ( tmpSelected >= 0 )
@@ -128,12 +125,14 @@ void SvxSearchCharSet::KeyInput(const KeyEvent& rKEvt)
SelectIndex( tmpSelected, true );
aPreSelectHdl.Call( this );
}
return bRet;
}
void SvxSearchCharSet::SelectCharacter( const Subset* sub )
{
if ( !mxFontCharMap.is() )
RecalculateFont( *this );
if (!mxFontCharMap.is())
RecalculateFont(*mxVirDev);
// get next available char of current font
sal_UCS4 cChar = sub->GetRangeMin();
@@ -156,12 +155,13 @@ void SvxSearchCharSet::SelectCharacter( const Subset* sub )
SelectIndex( nMapIndex );
aHighHdl.Call(this);
// move selected item to top row if not in focus
aVscrollSB->SetThumbPos( nMapIndex / COLUMN_COUNT );
Invalidate();
//TO.DO aVscrollSB->SetThumbPos( nMapIndex / COLUMN_COUNT );
mxDrawingArea->queue_draw();
}
void SvxSearchCharSet::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& )
IMPL_LINK(SvxSearchCharSet, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
{
vcl::RenderContext& rRenderContext = aPayload.first;
InitSettings(rRenderContext);
RecalculateFont(rRenderContext);
DrawChars_Impl(rRenderContext, FirstInView(), LastInView());
@@ -172,9 +172,7 @@ void SvxSearchCharSet::DrawChars_Impl(vcl::RenderContext& rRenderContext, int n1
if (n1 > LastInView() || n2 < FirstInView())
return;
Size aOutputSize(GetOutputSizePixel());
if (aVscrollSB->IsVisible())
aOutputSize.AdjustWidth( -(aVscrollSB->GetOptimalSize().Width()) );
Size aOutputSize(maSize);
int i;
for (i = 1; i < COLUMN_COUNT; ++i)
@@ -308,9 +306,7 @@ void SvxSearchCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
if (!mbRecalculateFont)
return;
Size aSize(GetOutputSizePixel());
long nSBWidth = aVscrollSB->GetOptimalSize().Width();
aSize.AdjustWidth( -nSBWidth );
Size aSize(maSize);
vcl::Font aFont = rRenderContext.GetFont();
aFont.SetWeight(WEIGHT_LIGHT);
@@ -327,14 +323,8 @@ void SvxSearchCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
nY = aSize.Height() / ROW_COUNT;
//scrollbar settings -- error
aVscrollSB->setPosSizePixel(aSize.Width(), 0, nSBWidth, aSize.Height());
aVscrollSB->SetRangeMin(0);
int nLastRow = (nCount - 1 + COLUMN_COUNT) / COLUMN_COUNT;
aVscrollSB->SetRangeMax(nLastRow);
aVscrollSB->SetPageSize(ROW_COUNT - 1);
aVscrollSB->SetVisibleSize(ROW_COUNT);
aVscrollSB->Show();
mxScrollArea->vadjustment_configure(mxScrollArea->vadjustment_get_value(), 0, nLastRow, 1, ROW_COUNT - 1, ROW_COUNT);
// rearrange CharSet element in sync with nX- and nY-multiples
Size aDrawSize(nX * COLUMN_COUNT, nY * ROW_COUNT);
@@ -344,53 +334,52 @@ void SvxSearchCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
mbRecalculateFont = false;
}
void SvxSearchCharSet::SelectIndex( int nNewIndex, bool bFocus )
void SvxSearchCharSet::SelectIndex(int nNewIndex, bool bFocus)
{
if( !aVscrollSB )
return;
if ( !mxFontCharMap.is() )
RecalculateFont( *this );
if (!mxFontCharMap.is())
RecalculateFont(*mxVirDev);
if( nNewIndex < 0 )
{
aVscrollSB->SetThumbPos( 0 );
mxScrollArea->vadjustment_set_value(0);
nSelectedIndex = bFocus ? 0 : -1;
Invalidate();
mxDrawingArea->queue_draw();
}
else if( nNewIndex < FirstInView() )
{
// need to scroll up to see selected item
int nOldPos = aVscrollSB->GetThumbPos();
int nOldPos = mxScrollArea->vadjustment_get_value();
int nDelta = (FirstInView() - nNewIndex + COLUMN_COUNT-1) / COLUMN_COUNT;
aVscrollSB->SetThumbPos( nOldPos - nDelta );
mxScrollArea->vadjustment_set_value(nOldPos - nDelta);
nSelectedIndex = nNewIndex;
Invalidate();
mxDrawingArea->queue_draw();
}
else if( nNewIndex > LastInView() )
{
// need to scroll down to see selected item
int nOldPos = aVscrollSB->GetThumbPos();
int nOldPos = mxScrollArea->vadjustment_get_value();
int nDelta = (nNewIndex - LastInView() + COLUMN_COUNT) / COLUMN_COUNT;
aVscrollSB->SetThumbPos( nOldPos + nDelta );
mxScrollArea->vadjustment_set_value(nOldPos + nDelta);
if( nNewIndex < nCount )
{
nSelectedIndex = nNewIndex;
Invalidate();
mxDrawingArea->queue_draw();
}
else if (nOldPos != aVscrollSB->GetThumbPos())
else if (nOldPos != mxScrollArea->vadjustment_get_value())
{
Invalidate();
mxDrawingArea->queue_draw();
}
}
else
{
nSelectedIndex = nNewIndex;
Invalidate();
mxDrawingArea->queue_draw();
}
if( nSelectedIndex >= 0 )
{
#if 0
if( m_xAccessible.is() )
{
svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex);
@@ -410,20 +399,13 @@ void SvxSearchCharSet::SelectIndex( int nNewIndex, bool bFocus )
aNewAny <<= AccessibleStateType::SELECTED;
pItem->m_xItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
}
#endif
}
aHighHdl.Call( this );
}
SvxSearchCharSet::~SvxSearchCharSet()
{
disposeOnce();
}
void SvxSearchCharSet::dispose()
{
m_aItemList.clear();
SvxShowCharSet::dispose();
}
svx::SvxShowCharSetItem* SvxSearchCharSet::ImplGetItem( int _nPos )
@@ -433,7 +415,7 @@ svx::SvxShowCharSetItem* SvxSearchCharSet::ImplGetItem( int _nPos )
{
OSL_ENSURE(m_xAccessible.is(), "Who wants to create a child of my table without a parent?");
std::shared_ptr<svx::SvxShowCharSetItem> xItem(new svx::SvxShowCharSetItem(*this,
m_xAccessible->getTable(), sal::static_int_cast< sal_uInt16 >(_nPos)));
m_xAccessible.get(), sal::static_int_cast< sal_uInt16 >(_nPos)));
aFind = m_aItems.emplace(_nPos, xItem).first;
OUStringBuffer buf;
std::unordered_map<sal_Int32,sal_UCS4>::const_iterator got = m_aItemList.find (_nPos);
@@ -456,7 +438,7 @@ void SvxSearchCharSet::ClearPreviousData()
{
m_aItemList.clear();
nCount = 0;
Invalidate();
mxDrawingArea->queue_draw();
}
void SvxSearchCharSet::AppendCharToList(sal_UCS4 sChar)
diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx
index 785ff05..346add7 100644
--- a/svx/source/inc/charmapacc.hxx
+++ b/svx/source/inc/charmapacc.hxx
@@ -34,59 +34,6 @@ namespace svx
> OAccessibleHelper_Base_2;
class SvxShowCharSetAcc;
/** The class SvxShowCharSetVirtualAcc is used as a virtual class which contains the table and the scrollbar.
In the vcl control, the table and the scrollbar exists in one class. This is not feasible for the accessibility api.
*/
class SvxShowCharSetVirtualAcc : public ::comphelper::OAccessibleComponentHelper,
public OAccessibleHelper_Base_2
{
VclPtr<SvxShowCharSet> mpParent; // the vcl control
rtl::Reference<SvxShowCharSetAcc> m_xTable; // the table, which holds the characters shown by the vcl control
sal_Int32 getImplAccessibleChildCount() const;
protected:
virtual ~SvxShowCharSetVirtualAcc() override;
virtual void SAL_CALL disposing() override;
virtual css::awt::Rectangle implGetBounds( ) override;
public:
SvxShowCharSetVirtualAcc( SvxShowCharSet* pParent );
// XInterface
DECLARE_XINTERFACE( )
DECLARE_XTYPEPROVIDER( )
// XAccessibleComponent
virtual void SAL_CALL grabFocus( ) override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
//OAccessibleContextHelper
// XAccessibleContext - still waiting to be overwritten
virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
virtual OUString SAL_CALL getAccessibleDescription( ) override;
virtual OUString SAL_CALL getAccessibleName( ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override { return this; }
virtual sal_Int32 SAL_CALL getForeground( ) override;
virtual sal_Int32 SAL_CALL getBackground( ) override;
// call the fireEvent method from the table when it exists.
void fireEvent(
const sal_Int16 _nEventId,
const css::uno::Any& _rOldValue,
const css::uno::Any& _rNewValue
);
// simple access methods
SvxShowCharSetAcc* getTable() const { return m_xTable.get(); }
SvxShowCharSet* getCharSetControl() const { return mpParent; }
};
class SvxShowCharSetItemAcc;
@@ -123,11 +70,11 @@ namespace svx
public OAccessibleHelper_Base
{
::std::vector< css::uno::Reference< css::accessibility::XAccessible > > m_aChildren;
SvxShowCharSetVirtualAcc* m_pParent; // the virtual parent
SvxShowCharSet* m_pParent; // the vcl control
protected:
virtual void SAL_CALL disposing() override;
public:
SvxShowCharSetAcc( SvxShowCharSetVirtualAcc* _pParent );
SvxShowCharSetAcc(SvxShowCharSet* pParent);
DECLARE_XINTERFACE( )
DECLARE_XTYPEPROVIDER( )
@@ -138,7 +85,8 @@ namespace svx
//OAccessibleContextHelper
// XAccessibleContext - still waiting to be overwritten
virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override;
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
@@ -181,6 +129,8 @@ namespace svx
{
NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue);
}
void clearCharSetControl() { m_pParent = nullptr; }
protected:
virtual ~SvxShowCharSetAcc() override;
diff --git a/svx/source/uitest/uiobject.cxx b/svx/source/uitest/uiobject.cxx
index 496a5d1..b393ea8 100644
--- a/svx/source/uitest/uiobject.cxx
+++ b/svx/source/uitest/uiobject.cxx
@@ -9,12 +9,12 @@
#include <memory>
#include <uiobject.hxx>
#include <svx/charmap.hxx>
#include <vcl/layout.hxx>
SvxShowCharSetUIObject::SvxShowCharSetUIObject(const VclPtr<SvxShowCharSet>& xCharSet):
WindowUIObject(xCharSet),
mxCharSet(xCharSet)
SvxShowCharSetUIObject::SvxShowCharSetUIObject(const VclPtr<vcl::Window>& xCharSetWin, SvxShowCharSet* pCharSet):
WindowUIObject(xCharSetWin),
mpCharSet(pCharSet)
{
}
@@ -35,7 +35,7 @@ void SvxShowCharSetUIObject::execute(const OUString& rAction,
OUString aIndexStr = rParameters.find("INDEX")->second;
sal_Int32 nIndex = aIndexStr.toInt32();
mxCharSet->OutputIndex(nIndex);
mpCharSet->OutputIndex(nIndex);
}
else if (rParameters.find("COLUMN") != rParameters.end() &&
rParameters.find("ROW") != rParameters.end())
@@ -47,7 +47,7 @@ void SvxShowCharSetUIObject::execute(const OUString& rAction,
sal_Int32 nRow = aRowStr.toInt32();
sal_Int32 nIndex = nColumn * COLUMN_COUNT + nRow;
mxCharSet->OutputIndex(nIndex);
mpCharSet->OutputIndex(nIndex);
}
}
else
@@ -56,9 +56,9 @@ void SvxShowCharSetUIObject::execute(const OUString& rAction,
std::unique_ptr<UIObject> SvxShowCharSetUIObject::create(vcl::Window* pWindow)
{
SvxShowCharSet* pCharSet = dynamic_cast<SvxShowCharSet*>(pWindow);
assert(pCharSet);
return std::unique_ptr<UIObject>(new SvxShowCharSetUIObject(pCharSet));
VclDrawingArea* pCharSetWin = dynamic_cast<VclDrawingArea*>(pWindow);
assert(pCharSetWin);
return std::unique_ptr<UIObject>(new SvxShowCharSetUIObject(pCharSetWin, static_cast<SvxShowCharSet*>(pCharSetWin->GetUserData())));
}
OUString SvxShowCharSetUIObject::get_name() const
diff --git a/svx/uiconfig/ui/charsetmenu.ui b/svx/uiconfig/ui/charsetmenu.ui
new file mode 100644
index 0000000..5511cc2
--- /dev/null
+++ b/svx/uiconfig/ui/charsetmenu.ui
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkMenu" id="charsetmenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="insert">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="charviewmenu|STR_CLEAR_CHAR">Insert into document</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="add">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="charviewmenu|STR_CLEAR_ALL_CHAR">Add to favorites</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="remove">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="charviewmenu|STR_CLEAR_ALL_CHAR">Remove from favorites</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="copy">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="charviewmenu|STR_CLEAR_ALL_CHAR">Copy to clipboard</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</interface>
diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx
index 72eae98..9a3aea7 100644
--- a/sw/source/ui/misc/insfnote.cxx
+++ b/sw/source/ui/misc/insfnote.cxx
@@ -105,7 +105,7 @@ IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberExtCharHdl, Button*, void)
aAllSet.Put( rFont );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog( this, aAllSet, false ));
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetFrameWeld(), aAllSet, false));
if (RET_OK == pDlg->Execute())
{
const SfxStringItem* pItem = SfxItemSet::GetItem<SfxStringItem>(pDlg->GetOutputItemSet(), SID_CHARMAP, false);
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index 3d0d33f..cfade1d 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -338,8 +338,7 @@ IMPL_LINK_NOARG(SwSortDlg, DelimCharHdl, weld::Button&, void)
{
SfxAllItemSet aSet( rSh.GetAttrPool() );
aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) );
//TODO ScopedVclPtr<SfxAbstractDialog> pMap(pFact->CreateCharMapDialog( m_xDelimPB, aSet, false ));
ScopedVclPtr<SfxAbstractDialog> pMap(pFact->CreateCharMapDialog(nullptr, aSet, false));
ScopedVclPtr<SfxAbstractDialog> pMap(pFact->CreateCharMapDialog(m_xDialog.get(), aSet, false));
if( RET_OK == pMap->Execute() )
{
const SfxInt32Item* pItem = SfxItemSet::GetItem<SfxInt32Item>(pMap->GetOutputItemSet(), SID_ATTR_CHAR, false);
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index ba020cb..c0f5d44 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1749,7 +1749,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) );
// If character is selected then it can be shown.
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rView.GetWindow(), aAllSet, true));
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rView.GetFrameWeld(), aAllSet, true));
pDlg->Execute();
return;
}
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index e6401dd..78d9378 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -726,7 +726,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
// If character is selected, it can be shown
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog( rView.GetWindow(), aAllSet, true ));
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rView.GetFrameWeld(), aAllSet, true));
pDlg->Execute();
return;
}
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index 2b9780d..c2747c8 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -933,7 +933,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog( GetView().GetWindow(), aAllSet, true ));
ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetView().GetFrameWeld(), aAllSet, true));
pDlg->Execute();
return;
}
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 160a440..3db18f0 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -557,6 +557,10 @@ public:
static guint32 GetLastInputEventTime();
static void UpdateLastInputEventTime(guint32 nUserInputTime);
static sal_uInt16 GetMouseModCode(guint nState);
static sal_uInt16 GetKeyCode(guint nKeyVal);
static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group);
static sal_uInt16 GetKeyModCode(guint nState);
};
#define OOO_TYPE_FIXED ooo_fixed_get_type()
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 9e0b4eb..e4b5560 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -323,6 +323,16 @@ public:
m_aFocusOutHdl = rLink;
}
virtual void grab_add() override
{
m_xWidget->CaptureMouse();
}
virtual void grab_remove() override
{
m_xWidget->ReleaseMouse();
}
virtual weld::Container* weld_parent() const override;
virtual ~SalInstanceWidget() override
@@ -356,6 +366,41 @@ IMPL_LINK_NOARG(SalInstanceWidget, FocusOutHdl, Control&, void)
signal_focus_out();
}
class SalInstanceMenu : public weld::Menu
{
private:
VclPtr<PopupMenu> m_xMenu;
bool m_bTakeOwnership;
public:
SalInstanceMenu(PopupMenu* pMenu, bool bTakeOwnership)
: m_xMenu(pMenu)
, m_bTakeOwnership(bTakeOwnership)
{
}
virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle &rRect) override
{
SalInstanceWidget* pVclWidget = dynamic_cast<SalInstanceWidget*>(pParent);
assert(pVclWidget);
m_xMenu->Execute(pVclWidget->getWidget(), rRect, PopupMenuFlags::ExecuteDown);
return m_xMenu->GetCurItemIdent();
}
virtual void set_sensitive(const OString& rIdent, bool bSensitive) override
{
m_xMenu->EnableItem(rIdent, bSensitive);
}
virtual void show(const OString& rIdent, bool bShow) override
{
m_xMenu->ShowItem(m_xMenu->GetItemId(rIdent), bShow);
}
virtual ~SalInstanceMenu() override
{
if (m_bTakeOwnership)
m_xMenu.disposeAndClear();
}
};
class SalInstanceContainer : public SalInstanceWidget, public virtual weld::Container
{
private:
@@ -368,15 +413,15 @@ public:
}
virtual void remove(weld::Widget* pWidget) override
{
SalInstanceWidget* pGtkWidget = dynamic_cast<SalInstanceWidget*>(pWidget);
assert(pGtkWidget);
pGtkWidget->getWidget()->SetParent(nullptr);
SalInstanceWidget* pVclWidget = dynamic_cast<SalInstanceWidget*>(pWidget);
assert(pVclWidget);
pVclWidget->getWidget()->SetParent(nullptr);
}
virtual void add(weld::Widget* pWidget) override
{
SalInstanceWidget* pGtkWidget = dynamic_cast<SalInstanceWidget*>(pWidget);
assert(pGtkWidget);
pGtkWidget->getWidget()->SetParent(m_xContainer);
SalInstanceWidget* pVclWidget = dynamic_cast<SalInstanceWidget*>(pWidget);
assert(pVclWidget);
pVclWidget->getWidget()->SetParent(m_xContainer);
}
};
@@ -577,6 +622,64 @@ public:
}
};
class SalInstanceScrolledWindow : public SalInstanceContainer, public virtual weld::ScrolledWindow
{
private:
VclPtr<VclScrolledWindow> m_xScrolledWindow;
DECL_LINK(VscrollHdl, ScrollBar*, void);
public:
SalInstanceScrolledWindow(VclScrolledWindow* pScrolledWindow, bool bTakeOwnership)
: SalInstanceContainer(pScrolledWindow, bTakeOwnership)
, m_xScrolledWindow(pScrolledWindow)
{
ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
rVertScrollBar.SetScrollHdl(LINK(this, SalInstanceScrolledWindow, VscrollHdl));
}
virtual void vadjustment_configure(int value, int lower, int upper,
int step_increment, int page_increment,
int page_size) override
{
ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
rVertScrollBar.SetRangeMin(lower);
rVertScrollBar.SetRangeMax(upper);
rVertScrollBar.SetLineSize(step_increment);
rVertScrollBar.SetPageSize(page_increment);
rVertScrollBar.SetThumbPos(value);
rVertScrollBar.SetVisibleSize(page_size);
}
virtual int vadjustment_get_value() const override
{
ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
return rVertScrollBar.GetThumbPos();
}
virtual void vadjustment_set_value(int value) override
{
ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
rVertScrollBar.SetThumbPos(value);
}
virtual void set_user_managed_scrolling() override
{
m_xScrolledWindow->setUserManagedScrolling(true);
}
virtual ~SalInstanceScrolledWindow() override
{
ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
rVertScrollBar.SetScrollHdl(Link<ScrollBar*, void>());
}
};
IMPL_LINK_NOARG(SalInstanceScrolledWindow, VscrollHdl, ScrollBar*, void)
{
signal_vadjustment_changed();
}
class SalInstanceNotebook : public SalInstanceContainer, public virtual weld::Notebook
{
private:
@@ -862,6 +965,14 @@ public:
m_xEntry->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX : nEndPos));
}
bool get_selection_bounds(int& rStartPos, int &rEndPos) override
{
const Selection& rSelection = m_xEntry->GetSelection();
rStartPos = rSelection.Min();
rEndPos = rSelection.Max();
return rSelection.Len();
}
virtual void set_position(int nCursorPos) override
{
if (nCursorPos < 0)
@@ -1219,21 +1330,27 @@ private:
typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> target_and_area;
DECL_LINK(PaintHdl, target_and_area, void);
DECL_LINK(ResizeHdl, const Size&, void);
DECL_LINK(MousePressHdl, const Point&, void);
DECL_LINK(MouseMoveHdl, const Point&, void);
DECL_LINK(MouseReleaseHdl, const Point&, void);
DECL_LINK(MousePressHdl, const MouseEvent&, void);
DECL_LINK(MouseMoveHdl, const MouseEvent&, void);
DECL_LINK(MouseReleaseHdl, const MouseEvent&, void);
DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
public:
SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, const a11yref& rAlly, bool bTakeOwnership)
SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, const a11yref& rAlly,
FactoryFunction pUITestFactoryFunction, void* pUserData, bool bTakeOwnership)
: SalInstanceWidget(pDrawingArea, bTakeOwnership)
, m_xDrawingArea(pDrawingArea)
{
m_xDrawingArea->SetAccessible(rAlly);
m_xDrawingArea->SetUITestFactory(pUITestFactoryFunction, pUserData);
m_xDrawingArea->SetPaintHdl(LINK(this, SalInstanceDrawingArea, PaintHdl));
m_xDrawingArea->SetResizeHdl(LINK(this, SalInstanceDrawingArea, ResizeHdl));
m_xDrawingArea->SetMousePressHdl(LINK(this, SalInstanceDrawingArea, MousePressHdl));
m_xDrawingArea->SetMouseMoveHdl(LINK(this, SalInstanceDrawingArea, MouseMoveHdl));
m_xDrawingArea->SetMouseReleaseHdl(LINK(this, SalInstanceDrawingArea, MouseReleaseHdl));
m_xDrawingArea->SetKeyPressHdl(LINK(this, SalInstanceDrawingArea, KeyPressHdl));
m_xDrawingArea->SetKeyReleaseHdl(LINK(this, SalInstanceDrawingArea, KeyReleaseHdl));
}
virtual void queue_draw() override
@@ -1246,8 +1363,21 @@ public:
m_xDrawingArea->Invalidate(tools::Rectangle(Point(x, y), Size(width, height)));
}
virtual a11yref get_accessible_parent() override
{
vcl::Window* pParent = m_xDrawingArea->GetParent();
if (pParent)
return pParent->GetAccessible();
return css::uno::Reference<css::accessibility::XAccessible>();
}
virtual ~SalInstanceDrawingArea() override
{
m_xDrawingArea->SetMousePressHdl(Link<const MouseEvent&, void>());
m_xDrawingArea->SetMouseMoveHdl(Link<const MouseEvent&, void>());
m_xDrawingArea->SetMouseReleaseHdl(Link<const MouseEvent&, void>());
m_xDrawingArea->SetKeyPressHdl(Link<const KeyEvent&, bool>());
m_xDrawingArea->SetKeyReleaseHdl(Link<const KeyEvent&, bool>());
m_xDrawingArea->SetResizeHdl(Link<const Size&, void>());
m_xDrawingArea->SetPaintHdl(Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>());
}
@@ -1263,19 +1393,29 @@ IMPL_LINK(SalInstanceDrawingArea, ResizeHdl, const Size&, rSize, void)
m_aSizeAllocateHdl.Call(rSize);
}
IMPL_LINK(SalInstanceDrawingArea, MousePressHdl, const Point&, rPos, void)
IMPL_LINK(SalInstanceDrawingArea, MousePressHdl, const MouseEvent&, rEvent, void)
{
m_aMousePressHdl.Call(rPos);
m_aMousePressHdl.Call(rEvent);
}
IMPL_LINK(SalInstanceDrawingArea, MouseMoveHdl, const Point&, rPos, void)
IMPL_LINK(SalInstanceDrawingArea, MouseMoveHdl, const MouseEvent&, rEvent, void)
{
m_aMouseMotionHdl.Call(rPos);
m_aMouseMotionHdl.Call(rEvent);
}
IMPL_LINK(SalInstanceDrawingArea, MouseReleaseHdl, const Point&, rPos, void)
IMPL_LINK(SalInstanceDrawingArea, MouseReleaseHdl, const MouseEvent&, rEvent, void)
{
m_aMouseReleaseHdl.Call(rPos);
m_aMouseReleaseHdl.Call(rEvent);
}
IMPL_LINK(SalInstanceDrawingArea, KeyPressHdl, const KeyEvent&, rEvent, bool)
{
return m_aKeyPressHdl.Call(rEvent);
}
IMPL_LINK(SalInstanceDrawingArea, KeyReleaseHdl, const KeyEvent&, rEvent, bool)
{
return m_aKeyReleaseHdl.Call(rEvent);
}
//ComboBox and ListBox have similar apis, ComboBoxes in LibreOffice have an edit box and ListBoxes
@@ -1429,6 +1569,27 @@ public:
assert(false);
}
virtual void set_entry_text(const OUString& /*rText*/) override
{
assert(false);
}
virtual void select_entry_region(int /*nStartPos*/, int /*nEndPos*/) override
{
assert(false);
}
virtual bool get_entry_selection_bounds(int& /*rStartPos*/, int& /*rEndPos*/) override
{
assert(false);
return false;
}
virtual void unset_entry_completion() override
{
assert(false);
}
virtual ~SalInstanceComboBoxTextWithoutEdit() override
{
m_xComboBoxText->SetSelectHdl(Link<ListBox&, void>());
@@ -1459,6 +1620,29 @@ public:
m_xComboBoxText->SetControlForeground();
}
virtual void set_entry_text(const OUString& rText) override
{
m_xComboBoxText->SetText(rText);
}
virtual void unset_entry_completion() override
{
m_xComboBoxText->EnableAutocomplete(false);
}
virtual void select_entry_region(int nStartPos, int nEndPos) override
{
m_xComboBoxText->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX : nEndPos));
}
virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override
{
const Selection& rSelection = m_xComboBoxText->GetSelection();
rStartPos = rSelection.Min();
rEndPos = rSelection.Max();
return rSelection.Len();
}
virtual ~SalInstanceComboBoxTextWithEdit() override
{
m_xComboBoxText->SetModifyHdl(Link<Edit&, void>());
@@ -1532,6 +1716,12 @@ public:
return pFrame ? new SalInstanceFrame(pFrame, bTakeOwnership) : nullptr;
}
virtual weld::ScrolledWindow* weld_scrolled_window(const OString &id, bool bTakeOwnership) override
{
VclScrolledWindow* pScrolledWindow = m_xBuilder->get<VclScrolledWindow>(id);
return pScrolledWindow ? new SalInstanceScrolledWindow(pScrolledWindow, bTakeOwnership) : nullptr;
}
virtual weld::Notebook* weld_notebook(const OString &id, bool bTakeOwnership) override
{
TabControl* pNotebook = m_xBuilder->get<TabControl>(id);
@@ -1602,10 +1792,18 @@ public:
return pExpander ? new SalInstanceExpander(pExpander, bTakeOwnership) : nullptr;
}
virtual weld::DrawingArea* weld_drawing_area(const OString &id, const a11yref& rA11yImpl, bool bTakeOwnership) override
virtual weld::DrawingArea* weld_drawing_area(const OString &id, const a11yref& rA11yImpl,
FactoryFunction pUITestFactoryFunction, void* pUserData, bool bTakeOwnership) override
{
VclDrawingArea* pDrawingArea = m_xBuilder->get<VclDrawingArea>(id);
return pDrawingArea ? new SalInstanceDrawingArea(pDrawingArea, rA11yImpl, bTakeOwnership) : nullptr;
return pDrawingArea ? new SalInstanceDrawingArea(pDrawingArea, rA11yImpl,
pUITestFactoryFunction, pUserData, bTakeOwnership) : nullptr;
}
virtual weld::Menu* weld_menu(const OString &id, bool bTakeOwnership) override
{
PopupMenu* pMenu = m_xBuilder->get_menu(id);
return pMenu ? new SalInstanceMenu(pMenu, bTakeOwnership) : nullptr;
}
virtual ~SalInstanceBuilder() override
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index fab9cdf..d95fa6e 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -94,7 +94,7 @@ int GtkSalFrame::m_nFloats = 0;
static GDBusConnection* pSessionBus = nullptr;
#endif
static sal_uInt16 GetKeyModCode( guint state )
sal_uInt16 GtkSalFrame::GetKeyModCode( guint state )
{
sal_uInt16 nCode = 0;
if( state & GDK_SHIFT_MASK )
@@ -111,7 +111,7 @@ static sal_uInt16 GetKeyModCode( guint state )
return nCode;
}
static sal_uInt16 GetMouseModCode( guint state )
sal_uInt16 GtkSalFrame::GetMouseModCode( guint state )
{
sal_uInt16 nCode = GetKeyModCode( state );
if( state & GDK_BUTTON1_MASK )
@@ -124,7 +124,7 @@ static sal_uInt16 GetMouseModCode( guint state )
return nCode;
}
static sal_uInt16 GetKeyCode( guint keyval )
sal_uInt16 GtkSalFrame::GetKeyCode(guint keyval)
{
sal_uInt16 nCode = 0;
if( keyval >= GDK_KEY_0 && keyval <= GDK_KEY_9 )
@@ -330,7 +330,7 @@ static sal_uInt16 GetKeyCode( guint keyval )
return nCode;
}
static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group)
guint GtkSalFrame::GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group)
{
guint updated_keyval = 0;
gdk_keymap_translate_keyboard_state(pKeyMap, hardware_keycode,
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index f9208e0..4ba26b0 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -110,7 +110,7 @@ int GtkSalFrame::m_nFloats = 0;
static GDBusConnection* pSessionBus = nullptr;
static sal_uInt16 GetKeyModCode( guint state )
sal_uInt16 GtkSalFrame::GetKeyModCode( guint state )
{
sal_uInt16 nCode = 0;
if( state & GDK_SHIFT_MASK )
@@ -124,7 +124,7 @@ static sal_uInt16 GetKeyModCode( guint state )
return nCode;
}
static sal_uInt16 GetMouseModCode( guint state )
sal_uInt16 GtkSalFrame::GetMouseModCode( guint state )
{
sal_uInt16 nCode = GetKeyModCode( state );
if( state & GDK_BUTTON1_MASK )
@@ -137,7 +137,7 @@ static sal_uInt16 GetMouseModCode( guint state )
return nCode;
}
static sal_uInt16 GetKeyCode( guint keyval )
sal_uInt16 GtkSalFrame::GetKeyCode(guint keyval)
{
sal_uInt16 nCode = 0;
if( keyval >= GDK_KEY_0 && keyval <= GDK_KEY_9 )
@@ -333,7 +333,7 @@ static sal_uInt16 GetKeyCode( guint keyval )
return nCode;
}
static guint GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group)
guint GtkSalFrame::GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, guint8 group)
{
guint updated_keyval = 0;
gdk_keymap_translate_keyboard_state(pKeyMap, hardware_keycode,
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 7ab817b0..f64dc04 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1378,6 +1378,16 @@ public:
m_aFocusOutHdl = rLink;
}
virtual void grab_add() override
{
gtk_grab_add(m_pWidget);
}
virtual void grab_remove() override
{
gtk_grab_remove(m_pWidget);
}
virtual ~GtkInstanceWidget() override
{
if (m_nFocusInSignalId)
@@ -1390,10 +1400,118 @@ public:
virtual void disable_notify_events()
{
if (m_nFocusInSignalId)
g_signal_handler_block(m_pWidget, m_nFocusInSignalId);
if (m_nFocusOutSignalId)
g_signal_handler_block(m_pWidget, m_nFocusOutSignalId);
}
virtual void enable_notify_events()
{
if (m_nFocusOutSignalId)
g_signal_handler_unblock(m_pWidget, m_nFocusOutSignalId);
if (m_nFocusInSignalId)
g_signal_handler_unblock(m_pWidget, m_nFocusInSignalId);
}
};
class GtkInstanceMenu : public weld::Menu
{
protected:
GtkMenu* m_pMenu;
OString m_sActivated;
std::map<OString, GtkMenuItem*> m_aMap;
private:
bool m_bTakeOwnership;
static void collect(GtkWidget* pItem, gpointer widget)
{
GtkMenuItem* pMenuItem = GTK_MENU_ITEM(pItem);
if (GtkWidget* pSubMenu = gtk_menu_item_get_submenu(pMenuItem))
gtk_container_foreach(GTK_CONTAINER(pSubMenu), collect, widget);
else
{
GtkInstanceMenu* pThis = static_cast<GtkInstanceMenu*>(widget);
pThis->add_to_map(pMenuItem);
}
}
void add_to_map(GtkMenuItem* pMenuItem)
{
const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pMenuItem));
OString id(pStr, pStr ? strlen(pStr) : 0);
m_aMap[id] = pMenuItem;
}
static void signalActivate(GtkMenuItem* pItem, gpointer widget)
{
GtkInstanceMenu* pThis = static_cast<GtkInstanceMenu*>(widget);
pThis->signal_activate(pItem);
}
void signal_activate(GtkMenuItem* pItem)
{
const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pItem));
m_sActivated = OString(pStr, pStr ? strlen(pStr) : 0);
}
public:
GtkInstanceMenu(GtkMenu* pMenu, bool bTakeOwnership)
: m_pMenu(pMenu)
, m_bTakeOwnership(bTakeOwnership)
{
gtk_container_foreach(GTK_CONTAINER(m_pMenu), collect, this);
for (auto& a : m_aMap)
g_signal_connect(a.second, "activate", G_CALLBACK(signalActivate), this);
}
virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle &rRect) override
{
m_sActivated.clear();
GtkInstanceWidget* pGtkWidget = dynamic_cast<GtkInstanceWidget*>(pParent);
assert(pGtkWidget);
GtkWidget* pWidget = pGtkWidget->getWidget();
gtk_menu_attach_to_widget(m_pMenu, pWidget, nullptr);
//run in a sub main loop because we need to keep vcl PopupMenu alive to use
//it during DispatchCommand, returning now to the outer loop causes the
//launching PopupMenu to be destroyed, instead run the subloop here
//until the gtk menu is destroyed
GMainLoop* pLoop = g_main_loop_new(nullptr, true);
gulong nSignalId = g_signal_connect_swapped(G_OBJECT(m_pMenu), "deactivate", G_CALLBACK(g_main_loop_quit), pLoop);
GdkRectangle aRect{static_cast<int>(rRect.Left()), static_cast<int>(rRect.Top()),
static_cast<int>(rRect.GetWidth()), static_cast<int>(rRect.GetHeight())};
gtk_menu_popup_at_rect(m_pMenu, gtk_widget_get_window(pWidget), &aRect, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, nullptr);
if (g_main_loop_is_running(pLoop))
{
gdk_threads_leave();
g_main_loop_run(pLoop);
gdk_threads_enter();
}
g_main_loop_unref(pLoop);
g_signal_handler_disconnect(m_pMenu, nSignalId);
return m_sActivated;
}
virtual void set_sensitive(const OString& rIdent, bool bSensitive) override
{
gtk_widget_set_sensitive(GTK_WIDGET(m_aMap[rIdent]), bSensitive);
}
virtual void show(const OString& rIdent, bool bShow) override
{
GtkWidget* pWidget = GTK_WIDGET(m_aMap[rIdent]);
if (bShow)
gtk_widget_show(pWidget);
else
gtk_widget_hide(pWidget);
}
virtual ~GtkInstanceMenu() override
{
for (auto& a : m_aMap)
g_signal_handlers_disconnect_by_data(a.second, this);
if (m_bTakeOwnership)
gtk_widget_destroy(GTK_WIDGET(m_pMenu));
}
};
@@ -1763,6 +1881,256 @@ public:
}
};
GType crippled_viewport_get_type();
#define CRIPPLED_TYPE_VIEWPORT (crippled_viewport_get_type ())
#define CRIPPLED_VIEWPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CRIPPLED_TYPE_VIEWPORT, CrippledViewport))
#ifndef NDEBUG
# define CRIPPLED_IS_VIEWPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CRIPPLED_TYPE_VIEWPORT))
#endif
struct CrippledViewport
{
GtkViewport viewport;
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
};
enum
{
PROP_0,
PROP_HADJUSTMENT,
PROP_VADJUSTMENT,
PROP_HSCROLL_POLICY,
PROP_VSCROLL_POLICY,
PROP_SHADOW_TYPE
};
static void viewport_set_adjustment(CrippledViewport *viewport,
GtkOrientation orientation,
GtkAdjustment *adjustment)
{
if (!adjustment)
adjustment = gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (viewport->hadjustment)
g_object_unref(viewport->hadjustment);
viewport->hadjustment = adjustment;
}
else
{
if (viewport->vadjustment)
g_object_unref(viewport->vadjustment);
viewport->vadjustment = adjustment;
}
g_object_ref_sink(adjustment);
}
static void
crippled_viewport_set_property(GObject* object,
guint prop_id,
const GValue* value,
GParamSpec* /*pspec*/)
{
CrippledViewport *viewport = CRIPPLED_VIEWPORT(object);
switch (prop_id)
{
case PROP_HADJUSTMENT:
viewport_set_adjustment(viewport, GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT(g_value_get_object(value)));
break;
case PROP_VADJUSTMENT:
viewport_set_adjustment(viewport, GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT(g_value_get_object(value)));
break;
case PROP_HSCROLL_POLICY:
case PROP_VSCROLL_POLICY:
break;
default:
SAL_WARN( "vcl.gtk", "unknown property\n");
break;
}
}
static void
crippled_viewport_get_property(GObject* object,
guint prop_id,
GValue* value,
GParamSpec* /*pspec*/)
{
CrippledViewport *viewport = CRIPPLED_VIEWPORT(object);
switch (prop_id)
{
case PROP_HADJUSTMENT:
g_value_set_object(value, viewport->hadjustment);
break;
case PROP_VADJUSTMENT:
g_value_set_object(value, viewport->vadjustment);
break;
case PROP_HSCROLL_POLICY:
g_value_set_enum(value, GTK_SCROLL_MINIMUM);
break;
case PROP_VSCROLL_POLICY:
g_value_set_enum(value, GTK_SCROLL_MINIMUM);
break;
default:
SAL_WARN( "vcl.gtk", "unknown property\n");
break;
}
}
static void crippled_viewport_class_init(GtkViewportClass *klass)
{
GObjectClass* o_class = G_OBJECT_CLASS(klass);
/* GObject signals */
o_class->set_property = crippled_viewport_set_property;
o_class->get_property = crippled_viewport_get_property;
// o_class->finalize = gtk_tree_view_finalize;
/* Properties */
g_object_class_override_property(o_class, PROP_HADJUSTMENT, "hadjustment");
g_object_class_override_property(o_class, PROP_VADJUSTMENT, "vadjustment");
g_object_class_override_property(o_class, PROP_HSCROLL_POLICY, "hscroll-policy");
g_object_class_override_property(o_class, PROP_VSCROLL_POLICY, "vscroll-policy");
}
GType crippled_viewport_get_type()
{
static GType type = 0;
if (!type)
{
static const GTypeInfo tinfo =
{
sizeof (GtkViewportClass),
nullptr, /* base init */
nullptr, /* base finalize */
reinterpret_cast<GClassInitFunc>(crippled_viewport_class_init), /* class init */
nullptr, /* class finalize */
nullptr, /* class data */
sizeof (CrippledViewport), /* instance size */
0, /* nb preallocs */
nullptr, /* instance init */
nullptr /* value table */
};
type = g_type_register_static( GTK_TYPE_VIEWPORT, "CrippledViewport",
&tinfo, GTypeFlags(0));
}
return type;
}
class GtkInstanceScrolledWindow : public GtkInstanceContainer, public virtual weld::ScrolledWindow
{
private:
GtkScrolledWindow* m_pScrolledWindow;
GtkWidget *m_pOrigViewport;
GtkAdjustment* m_pVAdjustment;
gulong m_nVAdjustChangedSignalId;
static void signalVAdjustValueChanged(GtkAdjustment*, gpointer widget)
{
GtkInstanceScrolledWindow* pThis = static_cast<GtkInstanceScrolledWindow*>(widget);
pThis->signal_vadjustment_changed();
}
public:
GtkInstanceScrolledWindow(GtkScrolledWindow* pScrolledWindow, bool bTakeOwnership)
: GtkInstanceContainer(GTK_CONTAINER(pScrolledWindow), bTakeOwnership)
, m_pScrolledWindow(pScrolledWindow)
, m_pOrigViewport(nullptr)
, m_pVAdjustment(gtk_scrolled_window_get_vadjustment(m_pScrolledWindow))
, m_nVAdjustChangedSignalId(g_signal_connect(m_pVAdjustment, "value-changed", G_CALLBACK(signalVAdjustValueChanged), this))
{
}
virtual void vadjustment_configure(int value, int lower, int upper,
int step_increment, int page_increment,
int page_size) override
{
disable_notify_events();
gtk_adjustment_configure(m_pVAdjustment, value, lower, upper, step_increment, page_increment, page_size);
enable_notify_events();
}
virtual int vadjustment_get_value() const override
{
return gtk_adjustment_get_value(m_pVAdjustment);
}
virtual void vadjustment_set_value(int value) override
{
disable_notify_events();
gtk_adjustment_set_value(m_pVAdjustment, value);
enable_notify_events();
}
virtual void set_user_managed_scrolling() override
{
disable_notify_events();
//remove the original viewport and replace it with our bodged one which
//doesn't do any scrolling and expects its child to figure it out somehow
assert(!m_pOrigViewport);
GtkWidget *pViewport = gtk_bin_get_child(GTK_BIN(m_pScrolledWindow));
assert(GTK_IS_VIEWPORT(pViewport));
GtkWidget *pChild = gtk_bin_get_child(GTK_BIN(pViewport));
g_object_ref(pChild);
gtk_container_remove(GTK_CONTAINER(pViewport), pChild);
g_object_ref(pViewport);
gtk_container_remove(GTK_CONTAINER(m_pScrolledWindow), pViewport);
GtkWidget* pNewViewport = GTK_WIDGET(g_object_new(crippled_viewport_get_type(), nullptr));
gtk_widget_show(pNewViewport);
gtk_container_add(GTK_CONTAINER(m_pScrolledWindow), pNewViewport);
gtk_container_add(GTK_CONTAINER(pNewViewport), pChild);
g_object_unref(pChild);
m_pOrigViewport = pViewport;
enable_notify_events();
}
virtual void disable_notify_events() override
{
g_signal_handler_block(m_pVAdjustment, m_nVAdjustChangedSignalId);
GtkInstanceContainer::disable_notify_events();
}
virtual void enable_notify_events() override
{
GtkInstanceContainer::enable_notify_events();
g_signal_handler_unblock(m_pVAdjustment, m_nVAdjustChangedSignalId);
}
virtual ~GtkInstanceScrolledWindow() override
{
//put it back the way it was
if (m_pOrigViewport)
{
disable_notify_events();
GtkWidget *pViewport = gtk_bin_get_child(GTK_BIN(m_pScrolledWindow));
assert(CRIPPLED_IS_VIEWPORT(pViewport));
GtkWidget *pChild = gtk_bin_get_child(GTK_BIN(pViewport));
g_object_ref(pChild);
gtk_container_remove(GTK_CONTAINER(pViewport), pChild);
g_object_ref(pViewport);
gtk_container_remove(GTK_CONTAINER(m_pScrolledWindow), pViewport);
gtk_container_add(GTK_CONTAINER(m_pScrolledWindow), m_pOrigViewport);
g_object_unref(m_pOrigViewport);
gtk_container_add(GTK_CONTAINER(m_pOrigViewport), pChild);
g_object_unref(pChild);
gtk_widget_destroy(pViewport);
g_object_unref(pViewport);
m_pOrigViewport = nullptr;
enable_notify_events();
}
g_signal_handler_disconnect(m_pVAdjustment, m_nVAdjustChangedSignalId);
}
};
class GtkInstanceNotebook : public GtkInstanceContainer, public virtual weld::Notebook
{
private:
@@ -2094,7 +2462,14 @@ public:
virtual void select_region(int nStartPos, int nEndPos) override
{
disable_notify_events();
gtk_editable_select_region(GTK_EDITABLE(m_pEntry), nStartPos, nEndPos);
enable_notify_events();
}
bool get_selection_bounds(int& rStartPos, int& rEndPos) override
{
return gtk_editable_get_selection_bounds(GTK_EDITABLE(m_pEntry), &rStartPos, &rEndPos);
}
virtual void set_position(int nCursorPos) override
@@ -2611,6 +2986,34 @@ public:
};
static MouseEventModifiers ImplGetMouseButtonMode(sal_uInt16 nButton, sal_uInt16 nCode)
{
MouseEventModifiers nMode = MouseEventModifiers::NONE;
if ( nButton == MOUSE_LEFT )
nMode |= MouseEventModifiers::SIMPLECLICK;
if ( (nButton == MOUSE_LEFT) && !(nCode & (MOUSE_MIDDLE | MOUSE_RIGHT)) )
nMode |= MouseEventModifiers::SELECT;
if ( (nButton == MOUSE_LEFT) && (nCode & KEY_MOD1) &&
!(nCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_SHIFT)) )
nMode |= MouseEventModifiers::MULTISELECT;
if ( (nButton == MOUSE_LEFT) && (nCode & KEY_SHIFT) &&
!(nCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_MOD1)) )
nMode |= MouseEventModifiers::RANGESELECT;
return nMode;
}
static MouseEventModifiers ImplGetMouseMoveMode(sal_uInt16 nCode)
{
MouseEventModifiers nMode = MouseEventModifiers::NONE;
if ( !nCode )
nMode |= MouseEventModifiers::SIMPLEMOVE;
if ( (nCode & MOUSE_LEFT) && !(nCode & KEY_MOD1) )
nMode |= MouseEventModifiers::DRAGMOVE;
if ( (nCode & MOUSE_LEFT) && (nCode & KEY_MOD1) )
nMode |= MouseEventModifiers::DRAGCOPY;
return nMode;
}
class GtkInstanceDrawingArea : public GtkInstanceWidget, public virtual weld::DrawingArea
{
private:
@@ -2625,6 +3028,9 @@ private:
gulong m_nButtonPressSignalId;
gulong m_nMotionSignalId;
gulong m_nButtonReleaseSignalId;
gulong m_nKeyPressSignalId;
gulong m_nKeyReleaseSignalId;
static gboolean signalDraw(GtkWidget*, cairo_t* cr, gpointer widget)
{
GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
@@ -2637,6 +3043,7 @@ private:
if (!gdk_cairo_get_clip_rectangle(cr, &rect))
return;
tools::Rectangle aRect(Point(rect.x, rect.y), Size(rect.width, rect.height));
m_xDevice->Erase(aRect);
m_aDrawHdl.Call(std::pair<vcl::RenderContext&, const tools::Rectangle&>(*m_xDevice, aRect));
cairo_surface_mark_dirty(m_pSurface);
@@ -2672,20 +3079,65 @@ private:
}
bool signal_button(GdkEventButton* pEvent)
{
Point aEvent(pEvent->x, pEvent->y);
int nClicks = 1;
SalEvent nEventType = SalEvent::NONE;
switch (pEvent->type)
{
case GDK_BUTTON_PRESS:
m_aMousePressHdl.Call(aEvent);
if (GdkEvent* pPeekEvent = gdk_event_peek())
{
bool bSkip = pPeekEvent->type == GDK_2BUTTON_PRESS ||
pPeekEvent->type == GDK_3BUTTON_PRESS;
gdk_event_free(pPeekEvent);
if (bSkip)
{
return true;
}
}
nEventType = SalEvent::MouseButtonDown;
break;
case GDK_2BUTTON_PRESS:
nClicks = 2;
nEventType = SalEvent::MouseButtonDown;
break;
case GDK_3BUTTON_PRESS:
nClicks = 3;
nEventType = SalEvent::MouseButtonDown;
break;
case GDK_BUTTON_RELEASE:
m_aMouseReleaseHdl.Call(aEvent);
nEventType = SalEvent::MouseButtonUp;
break;
default:
return false;
}
sal_uInt16 nButton;
switch (pEvent->button)
{
case 1:
nButton = MOUSE_LEFT;
break;
case 2:
nButton = MOUSE_MIDDLE;
break;
case 3:
nButton = MOUSE_RIGHT;
break;
default:
return false;
}
Point aPos(pEvent->x, pEvent->y);
sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
sal_uInt16 nCode = nButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
MouseEvent aMEvt(aPos, nClicks, ImplGetMouseButtonMode(nButton, nModCode), nCode, nCode);
if (nEventType == SalEvent::MouseButtonDown)
m_aMousePressHdl.Call(aMEvt);
else
m_aMouseReleaseHdl.Call(aMEvt);
return true;
}
static gboolean signalMotion(GtkWidget*, GdkEventMotion* pEvent, gpointer widget)
@@ -2695,10 +3147,38 @@ private:
}
bool signal_motion(GdkEventMotion* pEvent)
{
Point aEvent(pEvent->x, pEvent->y);
m_aMouseMotionHdl.Call(aEvent);
Point aPos(pEvent->x, pEvent->y);
sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
sal_uInt16 nCode = (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
MouseEvent aMEvt(aPos, 0, ImplGetMouseMoveMode(nModCode), nCode, nCode);
m_aMouseMotionHdl.Call(aMEvt);
return true;
}
static gboolean signalKey(GtkWidget*, GdkEventKey* pEvent, gpointer widget)
{
GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
return pThis->signal_key(pEvent);
}
gboolean signal_key(GdkEventKey* pEvent)
{
sal_uInt16 nKeyCode = GtkSalFrame::GetKeyCode(pEvent->keyval);
if (nKeyCode == 0)
{
guint updated_keyval = GtkSalFrame::GetKeyValFor(gdk_keymap_get_default(), pEvent->hardware_keycode, pEvent->group);
nKeyCode = GtkSalFrame::GetKeyCode(updated_keyval);
}
nKeyCode |= GtkSalFrame::GetKeyModCode(pEvent->state);
KeyEvent aKeyEvt(gdk_keyval_to_unicode(pEvent->keyval), nKeyCode, 0);
bool bProcessed;
if (pEvent->type == GDK_KEY_PRESS)
bProcessed = m_aKeyPressHdl.Call(aKeyEvt);
else
bProcessed = m_aKeyReleaseHdl.Call(aKeyEvt);
return bProcessed;
}
public:
GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, const a11yref& rA11y, bool bTakeOwnership)
@@ -2713,6 +3193,8 @@ public:
, m_nButtonPressSignalId(g_signal_connect(m_pDrawingArea, "button-press-event", G_CALLBACK(signalButton), this))
, m_nMotionSignalId(g_signal_connect(m_pDrawingArea, "motion-notify-event", G_CALLBACK(signalMotion), this))
, m_nButtonReleaseSignalId(g_signal_connect(m_pDrawingArea, "button-release-event", G_CALLBACK(signalButton), this))
, m_nKeyPressSignalId(g_signal_connect(m_pDrawingArea, "key-press-event", G_CALLBACK(signalKey), this))
, m_nKeyReleaseSignalId(g_signal_connect(m_pDrawingArea,"key-release-event", G_CALLBACK(signalKey), this))
{
g_object_set_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea", this);
}
@@ -2720,7 +3202,10 @@ public:
AtkObject* GetAtkObject()
{
if (!m_pAccessible && m_xAccessible.is())
m_pAccessible = atk_object_wrapper_new(m_xAccessible);
{
GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
m_pAccessible = atk_object_wrapper_new(m_xAccessible, gtk_widget_get_accessible(pParent));
}
return m_pAccessible;
}
@@ -2734,6 +3219,16 @@ public:
gtk_widget_queue_draw_area(GTK_WIDGET(m_pDrawingArea), x, y, width, height);
}
virtual a11yref get_accessible_parent() override
{
//get_accessible_parent should only be needed for the vcl implementation,
//in the gtk impl the native AtkObject parent set via
//atk_object_wrapper_new(m_xAccessible, gtk_widget_get_accessible(pParent));
//should negate the need.
assert(false && "get_accessible_parent should only be called on a vcl impl");
return uno::Reference<css::accessibility::XAccessible>();
}
virtual ~GtkInstanceDrawingArea() override
{
g_object_steal_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea");
@@ -2741,6 +3236,8 @@ public:
g_object_unref(m_pAccessible);
if (m_pSurface)
cairo_surface_destroy(m_pSurface);
g_signal_handler_disconnect(m_pDrawingArea, m_nKeyPressSignalId);
g_signal_handler_disconnect(m_pDrawingArea, m_nKeyReleaseSignalId);
g_signal_handler_disconnect(m_pDrawingArea, m_nButtonPressSignalId);
g_signal_handler_disconnect(m_pDrawingArea, m_nMotionSignalId);
g_signal_handler_disconnect(m_pDrawingArea, m_nButtonReleaseSignalId);
@@ -2948,6 +3445,42 @@ public:
gtk_entry_set_icon_from_icon_name(pEntry, GTK_ENTRY_ICON_SECONDARY, nullptr);
}
virtual void set_entry_text(const OUString& rText) override
{
GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pComboBoxText));
assert(pChild && GTK_IS_ENTRY(pChild));
GtkEntry* pEntry = GTK_ENTRY(pChild);
disable_notify_events();
gtk_entry_set_text(pEntry, OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr());
enable_notify_events();
}
virtual void select_entry_region(int nStartPos, int nEndPos) override
{
GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pComboBoxText));
assert(pChild && GTK_IS_ENTRY(pChild));
GtkEntry* pEntry = GTK_ENTRY(pChild);
disable_notify_events();
gtk_editable_select_region(GTK_EDITABLE(pEntry), nStartPos, nEndPos);
enable_notify_events();
}
virtual bool get_entry_selection_bounds(int& rStartPos, int &rEndPos) override
{
GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pComboBoxText));
assert(pChild && GTK_IS_ENTRY(pChild));
GtkEntry* pEntry = GTK_ENTRY(pChild);
return gtk_editable_get_selection_bounds(GTK_EDITABLE(pEntry), &rStartPos, &rEndPos);
}
virtual void unset_entry_completion() override
{
GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pComboBoxText));
assert(pChild && GTK_IS_ENTRY(pChild));
GtkEntry* pEntry = GTK_ENTRY(pChild);
gtk_entry_set_completion(pEntry, nullptr);
}
virtual void disable_notify_events() override
{
g_signal_handler_block(m_pComboBoxText, m_nSignalId);
@@ -3250,6 +3783,15 @@ public:
return new GtkInstanceFrame(pFrame, bTakeOwnership);
}
virtual weld::ScrolledWindow* weld_scrolled_window(const OString &id, bool bTakeOwnership) override
{
GtkScrolledWindow* pScrolledWindow = GTK_SCROLLED_WINDOW(gtk_builder_get_object(m_pBuilder, id.getStr()));
if (!pScrolledWindow)
return nullptr;
auto_add_parentless_widgets_to_container(GTK_WIDGET(pScrolledWindow));
return new GtkInstanceScrolledWindow(pScrolledWindow, bTakeOwnership);
}
virtual weld::Notebook* weld_notebook(const OString &id, bool bTakeOwnership) override
{
GtkNotebook* pNotebook = GTK_NOTEBOOK(gtk_builder_get_object(m_pBuilder, id.getStr()));
@@ -3349,7 +3891,8 @@ public:
return new GtkInstanceExpander(pExpander, bTakeOwnership);
}
virtual weld::DrawingArea* weld_drawing_area(const OString &id, const a11yref& rA11y, bool bTakeOwnership) override
virtual weld::DrawingArea* weld_drawing_area(const OString &id, const a11yref& rA11y,
FactoryFunction /*pUITestFactoryFunction*/, void* /*pUserData*/, bool bTakeOwnership) override
{
GtkDrawingArea* pDrawingArea = GTK_DRAWING_AREA(gtk_builder_get_object(m_pBuilder, id.getStr()));
if (!pDrawingArea)
@@ -3357,6 +3900,14 @@ public:
auto_add_parentless_widgets_to_container(GTK_WIDGET(pDrawingArea));
return new GtkInstanceDrawingArea(pDrawingArea, rA11y, bTakeOwnership);
}
virtual weld::Menu* weld_menu(const OString &id, bool bTakeOwnership) override
{
GtkMenu* pMenu = GTK_MENU(gtk_builder_get_object(m_pBuilder, id.getStr()));
if (!pMenu)
return nullptr;
return new GtkInstanceMenu(pMenu, bTakeOwnership);
}
};
void GtkInstanceWindow::help()