Kaydet (Commit) 374599f8 authored tarafından Caolán McNamara's avatar Caolán McNamara

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/52084Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 2d3a5e81
......@@ -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 )
{
......
......@@ -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;
......
......@@ -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>
......
......@@ -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,
......
......@@ -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
......
......@@ -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;
......
......@@ -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
{
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;
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
DECL_LINK(DoResize, const Size& rSize, void);
public:
SvxShowText(vcl::Window* pParent);
SvxShowText(weld::Builder& rBuilder, const OString& rId, const VclPtr<VirtualDevice>& rVirDev);
void SetFont( const vcl::Font& rFont );
void SetText( const OUString& rText ) override;
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();
......
......@@ -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:
......
......@@ -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
......
......@@ -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;
......
......@@ -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"
......
......@@ -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);
......
......@@ -22,27 +22,78 @@
#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(vcl::Window* pParent);
SvxCharView(weld::Builder& rBuilder, const OString& rId, const VclPtr<VirtualDevice>& rVirDev);
void SetFont( const vcl::Font& rFont );
void SetText( const OUString& rText ) override;
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();
virtual void Resize() override;
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); }
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 ContextMenuSelect(const OString& rIdent);
};
class SFX2_DLLPUBLIC SvxCharViewControl : public Control
{
public:
SvxCharViewControl(vcl::Window* pParent);
void SetFont( const vcl::Font& rFont );
void SetText( const OUString& rText ) override;
void SetHasInsert( bool bInsert );
void InsertCharToDoc();
void createContextMenu();
virtual void Resize() override;
virtual Size GetOptimalSize() const override;
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);
protected:
......@@ -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: */
......@@ -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: