summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-14 11:17:10 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-10-14 15:53:55 +0200
commit6a9e20e16701014e432aeec7a4a6705a2d6013b9 (patch)
treec5c05f2f8561082b1c94e8fde422044936254267
parent77d083f2cbe496274cdab38a3a34497d1b742d86 (diff)
SvxLanguageComboBox is unused
Change-Id: I8f5fc0a80e84dc4aa79f7488591fb4904e5f5338 Reviewed-on: https://gerrit.libreoffice.org/80763 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/dialogs/SpellDialog.cxx1
-rw-r--r--cui/source/options/treeopt.cxx1
-rw-r--r--include/svx/langbox.hxx29
-rwxr-xr-xsolenv/bin/native-code.py1
-rw-r--r--svx/source/dialog/langbox.cxx160
-rw-r--r--svx/source/dialog/txencbox.cxx1
6 files changed, 3 insertions, 190 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 2574dd84a25e..366c2662b865 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
#include <sfx2/app.hxx>
+#include <vcl/edit.hxx>
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
#include <vcl/texteng.hxx>
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index b9d79d0d579a..b923e4b0bc2a 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -95,6 +95,7 @@
#include <unotools/moduleoptions.hxx>
#include <unotools/optionsdlg.hxx>
#include <unotools/viewoptions.hxx>
+#include <vcl/edit.hxx>
#include <vcl/help.hxx>
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx
index 9d20e2912a5d..9f93df3ea341 100644
--- a/include/svx/langbox.hxx
+++ b/include/svx/langbox.hxx
@@ -25,7 +25,6 @@
#include <svx/svxdllapi.h>
#include <vcl/image.hxx>
#include <vcl/lstbox.hxx>
-#include <vcl/combobox.hxx>
#include <vcl/weld.hxx>
#include <o3tl/typed_flags_set.hxx>
@@ -175,34 +174,6 @@ public:
weld::ComboBox* get_widget() { return m_xControl.get(); }
};
-class SVX_DLLPUBLIC SvxLanguageComboBox : public ComboBox, public SvxLanguageBoxBase
-{
-public:
- SvxLanguageComboBox( vcl::Window* pParent, WinBits nBits );
-
- enum class EditedAndValid
- {
- No,
- Valid,
- Invalid
- };
-
-private:
- EditedAndValid meEditedAndValid;
-
- SVX_DLLPRIVATE virtual sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ) override;
-
- SVX_DLLPRIVATE virtual void ImplClear() override;
- SVX_DLLPRIVATE virtual sal_Int32 ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ) override;
- SVX_DLLPRIVATE virtual void ImplSetEntryData( sal_Int32 nPos, void* pData ) override;
- SVX_DLLPRIVATE virtual sal_Int32 ImplGetSelectedEntryPos() const override;
- SVX_DLLPRIVATE virtual void* ImplGetEntryData( sal_Int32 nPos ) const override;
- SVX_DLLPRIVATE virtual void ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ) override;
- SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryPos( const void* pData ) const override;
-
- DECL_LINK( EditModifyHdl, Edit&, void );
-};
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index e854f84fdf74..ab2f87894b80 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -506,7 +506,6 @@ custom_widgets = [
'SvxFillAttrBox',
'SvxFillTypeBox',
'SvxLanguageBox',
- 'SvxLanguageComboBox',
'SvxLightCtl3D',
'SvxRelativeField',
'SvxTextEncodingBox',
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index b30d234aed4a..eb099005d2e6 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -40,9 +40,6 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::linguistic2;
using namespace ::com::sun::star::uno;
-
-static_assert((LISTBOX_APPEND == COMBOBOX_APPEND) && (LISTBOX_ENTRY_NOTFOUND == COMBOBOX_ENTRY_NOTFOUND), "If these ever dispersed we'd need a solution");
-
OUString GetDicInfoStr( const OUString& rName, const LanguageType nLang, bool bNeg )
{
INetURLObject aURLObj;
@@ -108,21 +105,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void makeSvxLanguageBox(VclPtr<vcl::Window> & rR
rRet = pLanguageBox;
}
-extern "C" SAL_DLLPUBLIC_EXPORT void makeSvxLanguageComboBox(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap)
-{
- static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>,
- decltype(makeSvxLanguageComboBox)>);
- WinBits nBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP;
- bool bDropdown = BuilderUtils::extractDropdown(rMap);
- if (bDropdown)
- nBits |= WB_DROPDOWN;
- else
- nBits |= WB_BORDER;
- VclPtrInstance<SvxLanguageComboBox> pLanguageBox(pParent, nBits);
- pLanguageBox->EnableAutoSize(true);
- rRet = pLanguageBox;
-}
-
SvxLanguageBoxBase::SvxLanguageBoxBase()
: m_bWithCheckmark(false)
{
@@ -734,188 +716,46 @@ SvxLanguageBox::SvxLanguageBox( vcl::Window* pParent, WinBits nBits )
ImplLanguageBoxBaseInit();
}
-SvxLanguageComboBox::SvxLanguageComboBox( vcl::Window* pParent, WinBits nBits )
- : ComboBox( pParent, nBits )
- , SvxLanguageBoxBase()
- , meEditedAndValid( EditedAndValid::No )
-{
- // display entries sorted
- SetStyle( GetStyle() | WB_SORT );
-
- EnableMultiSelection( false );
-
- ImplLanguageBoxBaseInit();
-
- SetModifyHdl( LINK( this, SvxLanguageComboBox, EditModifyHdl ) );
-}
-
sal_Int32 SvxLanguageBox::ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked )
{
return InsertEntry( rEntry, (bChecked ? m_aCheckedImage : m_aNotCheckedImage), nPos );
}
-sal_Int32 SvxLanguageComboBox::ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked )
-{
- return InsertEntryWithImage( rEntry, (bChecked ? m_aCheckedImage : m_aNotCheckedImage), nPos );
-}
-
-
void SvxLanguageBox::ImplClear()
{
Clear();
}
-void SvxLanguageComboBox::ImplClear()
-{
- Clear();
-}
-
-
sal_Int32 SvxLanguageBox::ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos )
{
return InsertEntry( rEntry, nPos);
}
-sal_Int32 SvxLanguageComboBox::ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos )
-{
- return InsertEntry( rEntry, nPos);
-}
-
-
void SvxLanguageBox::ImplSetEntryData( sal_Int32 nPos, void* pData )
{
SetEntryData( nPos, pData);
}
-void SvxLanguageComboBox::ImplSetEntryData( sal_Int32 nPos, void* pData )
-{
- SetEntryData( nPos, pData);
-}
-
-
sal_Int32 SvxLanguageBox::ImplGetSelectedEntryPos() const
{
return GetSelectedEntryPos();
}
-sal_Int32 SvxLanguageComboBox::ImplGetSelectedEntryPos() const
-{
- return GetSelectedEntryPos();
-}
-
-
void* SvxLanguageBox::ImplGetEntryData( sal_Int32 nPos ) const
{
return GetEntryData( nPos);
}
-void* SvxLanguageComboBox::ImplGetEntryData( sal_Int32 nPos ) const
-{
- return GetEntryData( nPos);
-}
-
-
void SvxLanguageBox::ImplSelectEntryPos( sal_Int32 nPos, bool bSelect )
{
SelectEntryPos( nPos, bSelect);
}
-void SvxLanguageComboBox::ImplSelectEntryPos( sal_Int32 nPos, bool bSelect )
-{
- SelectEntryPos( nPos, bSelect);
-}
-
-
sal_Int32 SvxLanguageBox::ImplGetEntryPos( const void* pData ) const
{
return GetEntryPos( pData);
}
-sal_Int32 SvxLanguageComboBox::ImplGetEntryPos( const void* pData ) const
-{
- return GetEntryPos( pData);
-}
-
-
-IMPL_LINK_NOARG( SvxLanguageComboBox, EditModifyHdl, Edit&, void )
-{
- EditedAndValid eOldState = meEditedAndValid;
- OUString aStr( vcl::I18nHelper::filterFormattingChars( GetText()));
- if (aStr.isEmpty())
- meEditedAndValid = EditedAndValid::Invalid;
- else
- {
- const sal_Int32 nPos = GetEntryPos( aStr);
- if (nPos != COMBOBOX_ENTRY_NOTFOUND)
- {
- Selection aSel( GetSelection());
-
- // Select the corresponding listbox entry if not current. This
- // invalidates the Edit Selection thus has to happen between
- // obtaining the Selection and setting the new Selection.
- sal_Int32 nSelPos = ImplGetSelectedEntryPos();
- bool bSetEditSelection;
- if (nSelPos == nPos)
- bSetEditSelection = false;
- else
- {
- ImplSelectEntryPos( nPos, true);
- bSetEditSelection = true;
- }
-
- // If typing into the Edit control led us here, advance start of a
- // full selection by one so the next character will already
- // continue the string instead of having to type the same character
- // again to start a new string. The selection includes formatting
- // characters and is reverse when obtained from the Edit control.
- if (aSel.Max() == 1)
- {
- OUString aText( GetText());
- if (aSel.Min() == aText.getLength())
- {
- ++aSel.Max();
- bSetEditSelection = true;
- }
- }
-
- if (bSetEditSelection)
- SetSelection( aSel);
-
- meEditedAndValid = EditedAndValid::No;
- }
- else
- {
- OUString aCanonicalized;
- bool bValid = LanguageTag::isValidBcp47( aStr, &aCanonicalized, true);
- meEditedAndValid = (bValid ? EditedAndValid::Valid : EditedAndValid::Invalid);
- if (bValid && aCanonicalized != aStr)
- {
- SetText( aCanonicalized);
- SetSelection( Selection( aCanonicalized.getLength()));
- }
- }
- }
- if (eOldState != meEditedAndValid)
- {
- if (meEditedAndValid == EditedAndValid::Invalid)
- {
-#if 0
- //! Gives white on white!?! instead of white on reddish.
- SetControlBackground( ::Color( Color( 0xff, 0x65, 0x63)));
- SetControlForeground( ::COL_WHITE);
-#else
- SetControlForeground( ::Color( 0xf0, 0, 0) );
-#endif
- }
- else
- {
- SetControlForeground();
- SetControlBackground();
- }
- }
-}
-
-
sal_Int32 LanguageBox::SaveEditedAsEntry()
{
if (m_eEditedAndValid != EditedAndValid::Valid)
diff --git a/svx/source/dialog/txencbox.cxx b/svx/source/dialog/txencbox.cxx
index 68a6aaea3313..ab64466281ae 100644
--- a/svx/source/dialog/txencbox.cxx
+++ b/svx/source/dialog/txencbox.cxx
@@ -27,6 +27,7 @@
#include <svx/dbcharsethelper.hxx>
#endif
#include <vcl/builderfactory.hxx>
+#include <unotools/syslocale.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <rtl/tencinfo.h>