31#include <sfx2/sfxsids.hrc>
50 bool bRet = ( rLocaleLeft.Language == rLocaleRight.Language &&
51 rLocaleLeft.Country == rLocaleRight.Country &&
52 rLocaleLeft.Variant == rLocaleRight.Variant );
57 : GenericDialogController(pParent,
"modules/BasicIDE/ui/managelanguages.ui",
"ManageLanguagesDialog")
58 , m_xLocalizationMgr(
std::move(xLMgr))
59 , m_sDefLangStr(
IDEResId(RID_STR_DEF_LANG))
60 , m_sCreateLangStr(
IDEResId(RID_STR_CREATE_LANG))
61 , m_xLanguageLB(m_xBuilder->weld_tree_view(
"treeview"))
62 , m_xAddPB(m_xBuilder->weld_button(
"add"))
63 , m_xDeletePB(m_xBuilder->weld_button(
"delete"))
64 , m_xMakeDefPB(m_xBuilder->weld_button(
"default"))
86 sText = sText.replaceAll(
"$1", sLibName);
106 sal_Int32
i,
nCount = aLocaleSeq.getLength();
137 auto xDlg = std::make_shared<SetDefaultLanguageDialog>(
m_xDialog.get(), m_xLocalizationMgr);
144 m_xLocalizationMgr->handleAddLocales( aLocaleSeq );
150 pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
157 std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog(
"DeleteLangDialog"));
158 if (xQBox->run() !=
RET_OK)
161 std::vector<int> aSelection = m_xLanguageLB->get_selected_rows();
162 int nCount = aSelection.size();
163 int nPos = m_xLanguageLB->get_selected_index();
166 auto aLocaleSeqRange = asNonConstRange(aLocaleSeq);
169 const sal_Int32 nSelPos = aSelection[
i];
170 LanguageEntry* pEntry = weld::fromId<LanguageEntry*>(m_xLanguageLB->get_id(nSelPos));
174 m_xLocalizationMgr->handleRemoveLocales( aLocaleSeq );
179 nCount = m_xLanguageLB->n_children();
182 m_xLanguageLB->select(
nPos);
183 SelectHdl( *m_xLanguageLB );
188 const sal_Int32
nPos = m_xLanguageLB->get_selected_index();
189 LanguageEntry* pSelectEntry = weld::fromId<LanguageEntry*>(m_xLanguageLB->get_id(
nPos));
193 m_xLocalizationMgr->handleSetDefaultLocale( pSelectEntry->
m_aLocale );
198 m_xLanguageLB->select(
nPos);
199 SelectHdl( *m_xLanguageLB );
205 const sal_Int32
nCount = m_xLanguageLB->n_children();
206 bool bEmpty = ( !
nCount ||
207 m_xLanguageLB->find_text(m_sCreateLangStr) != -1 );
208 bool bSelect = ( m_xLanguageLB->get_selected_index() != -1 );
209 bool bEnable = !bEmpty && bSelect;
211 m_xDeletePB->set_sensitive(bEnable);
212 m_xMakeDefPB->set_sensitive(bEnable &&
nCount > 1 && m_xLanguageLB->count_selected_rows() == 1);
218 : GenericDialogController(pParent,
"modules/BasicIDE/ui/defaultlanguage.ui",
"DefaultLanguageDialog")
219 , m_xLocalizationMgr(
std::move(xLMgr))
220 , m_xLanguageFT(m_xBuilder->weld_label(
"defaultlabel"))
221 , m_xLanguageLB(m_xBuilder->weld_tree_view(
"entries"))
222 , m_xCheckLangFT(m_xBuilder->weld_label(
"checkedlabel"))
223 , m_xCheckLangLB(m_xBuilder->weld_tree_view(
"checkedentries"))
224 , m_xDefinedFT(m_xBuilder->weld_label(
"defined"))
225 , m_xAddedFT(m_xBuilder->weld_label(
"added"))
226 , m_xAltTitle(m_xBuilder->weld_label(
"alttitle"))
227 , m_xLanguageCB(new
SvxLanguageBox(m_xBuilder->weld_combo_box(
"hidden")))
255 m_xLanguageCB->SetLanguageList(SvxLanguageListFlags::ALL,
false);
262 const sal_Int32 nCountLoc = aLocaleSeq.getLength();
263 for ( sal_Int32
i = 0;
i < nCountLoc; ++
i )
268 for (sal_Int32 j = 0; j < nCountLang; ++j)
283 for (sal_Int32 j = 0; j < nCountLang; ++j)
303 std::vector<Locale> aLocaleSeq;
Reference< XExecutableDialog > m_xDialog
static const AllSettings & GetSettings()
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
static OUString GetLanguageString(const LanguageType eType)
std::unique_ptr< weld::Button > m_xDeletePB
std::unique_ptr< weld::Button > m_xMakeDefPB
OUString m_sCreateLangStr
std::unique_ptr< weld::Button > m_xAddPB
ManageLanguageDialog(weld::Window *pParent, std::shared_ptr< LocalizationMgr > _pLMgr)
std::shared_ptr< LocalizationMgr > m_xLocalizationMgr
virtual ~ManageLanguageDialog() override
std::unique_ptr< weld::TreeView > m_xLanguageLB
SetDefaultLanguageDialog(weld::Window *pParent, std::shared_ptr< LocalizationMgr > xLMgr)
std::unique_ptr< weld::Label > m_xAltTitle
virtual ~SetDefaultLanguageDialog() override
std::unique_ptr< weld::Label > m_xCheckLangFT
std::unique_ptr< weld::Label > m_xLanguageFT
css::uno::Sequence< css::lang::Locale > GetLocales() const
std::unique_ptr< weld::Label > m_xAddedFT
std::shared_ptr< LocalizationMgr > m_xLocalizationMgr
std::unique_ptr< SvxLanguageBox > m_xLanguageCB
std::unique_ptr< weld::Label > m_xDefinedFT
std::unique_ptr< weld::TreeView > m_xCheckLangLB
std::unique_ptr< weld::TreeView > m_xLanguageLB
OUString const & GetCurLibName() const
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
std::shared_ptr< weld::Dialog > m_xDialog
#define DBG_ASSERT(sCon, aError)
#define LINK(Instance, Class, Member)
SfxBindings * GetBindingsPtr()
bool localesAreEqual(const Locale &rLocaleLeft, const Locale &rLocaleRight)
IMPL_LINK_NOARG(EditorWindow, SetSourceInBasicHdl, void *, void)
OUString IDEResId(TranslateId aId)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString toId(const void *pValue)
css::lang::Locale m_aLocale
UNDERLYING_TYPE get() const