2010-10-12 15:57:08 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-12 17:02:47 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2007-01-02 14:51:44 +00:00
|
|
|
|
|
|
|
#include "basidesh.hxx"
|
|
|
|
#include "basobj.hxx"
|
2011-11-06 22:13:59 -05:00
|
|
|
#include "iderdll.hxx"
|
|
|
|
#include "iderid.hxx"
|
|
|
|
#include "localizationmgr.hxx"
|
|
|
|
#include "managelang.hxx"
|
2007-01-02 14:51:44 +00:00
|
|
|
|
2011-11-30 22:03:58 -05:00
|
|
|
#include "dlgresid.hrc"
|
2007-01-02 14:51:44 +00:00
|
|
|
#include "helpid.hrc"
|
|
|
|
|
2012-02-15 15:26:43 +01:00
|
|
|
#include <com/sun/star/i18n/Boundary.hpp>
|
2007-01-29 16:01:16 +00:00
|
|
|
#include <com/sun/star/i18n/WordType.hpp>
|
2012-02-15 15:26:43 +01:00
|
|
|
#include <com/sun/star/i18n/XBreakIterator.hpp>
|
2011-11-06 22:13:59 -05:00
|
|
|
#include <editeng/unolingu.hxx>
|
|
|
|
#include <sfx2/bindings.hxx>
|
|
|
|
#include <svtools/langtab.hxx>
|
2011-11-30 22:03:58 -05:00
|
|
|
#include <svx/langbox.hxx>
|
2007-01-29 16:01:16 +00:00
|
|
|
#include <vcl/unohelp.hxx>
|
2007-01-02 14:51:44 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
2014-08-25 13:19:06 +01:00
|
|
|
#include <vcl/layout.hxx>
|
2014-01-02 23:52:37 +01:00
|
|
|
#include <vcl/settings.hxx>
|
2007-01-02 14:51:44 +00:00
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
namespace basctl
|
|
|
|
{
|
|
|
|
|
2007-01-29 16:01:16 +00:00
|
|
|
using namespace ::com::sun::star::i18n;
|
2007-01-02 14:51:44 +00:00
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::resource;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
|
|
|
bool localesAreEqual( const Locale& rLocaleLeft, const Locale& rLocaleRight )
|
|
|
|
{
|
|
|
|
bool bRet = ( rLocaleLeft.Language.equals( rLocaleRight.Language ) &&
|
|
|
|
rLocaleLeft.Country.equals( rLocaleRight.Country ) &&
|
|
|
|
rLocaleLeft.Variant.equals( rLocaleRight.Variant ) );
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2016-08-23 10:57:32 +02:00
|
|
|
ManageLanguageDialog::ManageLanguageDialog(vcl::Window* pParent, std::shared_ptr<LocalizationMgr> const & xLMgr)
|
2014-02-11 10:31:42 +00:00
|
|
|
: ModalDialog(pParent, "ManageLanguagesDialog", "modules/BasicIDE/ui/managelanguages.ui")
|
|
|
|
, m_xLocalizationMgr(xLMgr)
|
|
|
|
, m_sDefLangStr(IDE_RESSTR(RID_STR_DEF_LANG))
|
|
|
|
, m_sCreateLangStr(IDE_RESSTR(RID_STR_CREATE_LANG))
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2014-02-11 10:31:42 +00:00
|
|
|
get(m_pLanguageLB, "treeview");
|
|
|
|
m_pLanguageLB->set_height_request(m_pLanguageLB->GetTextHeight() * 10);
|
|
|
|
m_pLanguageLB->set_width_request(m_pLanguageLB->approximate_char_width() * 50);
|
|
|
|
get(m_pAddPB, "add");
|
|
|
|
get(m_pDeletePB, "delete");
|
|
|
|
get(m_pMakeDefPB, "default");
|
2007-01-02 14:51:44 +00:00
|
|
|
|
|
|
|
Init();
|
|
|
|
FillLanguageBox();
|
2015-10-04 15:05:38 +02:00
|
|
|
SelectHdl( *m_pLanguageLB );
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ManageLanguageDialog::~ManageLanguageDialog()
|
2015-01-14 16:16:15 +02:00
|
|
|
{
|
2015-03-10 09:07:06 +02:00
|
|
|
disposeOnce();
|
2015-01-14 16:16:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ManageLanguageDialog::dispose()
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
|
|
|
ClearLanguageBox();
|
2015-03-09 14:29:30 +02:00
|
|
|
m_pLanguageLB.clear();
|
|
|
|
m_pAddPB.clear();
|
|
|
|
m_pDeletePB.clear();
|
|
|
|
m_pMakeDefPB.clear();
|
2015-01-14 16:16:15 +02:00
|
|
|
ModalDialog::dispose();
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ManageLanguageDialog::Init()
|
|
|
|
{
|
|
|
|
// get current IDE
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
Shell* pShell = GetShell();
|
2012-10-22 22:11:23 -02:00
|
|
|
OUString sLibName = pShell->GetCurLibName();
|
2007-01-02 14:51:44 +00:00
|
|
|
// set dialog title with library name
|
2012-10-22 22:11:23 -02:00
|
|
|
OUString sText = GetText();
|
2012-03-08 00:49:32 +01:00
|
|
|
sText = sText.replaceAll("$1", sLibName);
|
2007-01-02 14:51:44 +00:00
|
|
|
SetText( sText );
|
|
|
|
// set handler
|
2014-02-11 10:31:42 +00:00
|
|
|
m_pAddPB->SetClickHdl( LINK( this, ManageLanguageDialog, AddHdl ) );
|
|
|
|
m_pDeletePB->SetClickHdl( LINK( this, ManageLanguageDialog, DeleteHdl ) );
|
|
|
|
m_pMakeDefPB->SetClickHdl( LINK( this, ManageLanguageDialog, MakeDefHdl ) );
|
|
|
|
m_pLanguageLB->SetSelectHdl( LINK( this, ManageLanguageDialog, SelectHdl ) );
|
2007-01-02 14:51:44 +00:00
|
|
|
|
2014-02-11 10:31:42 +00:00
|
|
|
m_pLanguageLB->EnableMultiSelection( true );
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ManageLanguageDialog::FillLanguageBox()
|
|
|
|
{
|
2014-01-03 20:53:11 +00:00
|
|
|
DBG_ASSERT( m_xLocalizationMgr, "ManageLanguageDialog::FillLanguageBox(): no localization manager" );
|
2007-01-02 14:51:44 +00:00
|
|
|
|
2014-01-03 20:53:11 +00:00
|
|
|
if ( m_xLocalizationMgr->isLibraryLocalized() )
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2014-01-03 20:53:11 +00:00
|
|
|
Locale aDefaultLocale = m_xLocalizationMgr->getStringResourceManager()->getDefaultLocale();
|
|
|
|
Sequence< Locale > aLocaleSeq = m_xLocalizationMgr->getStringResourceManager()->getLocales();
|
2007-01-02 14:51:44 +00:00
|
|
|
const Locale* pLocale = aLocaleSeq.getConstArray();
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_Int32 i, nCount = aLocaleSeq.getLength();
|
2007-01-02 14:51:44 +00:00
|
|
|
for ( i = 0; i < nCount; ++i )
|
|
|
|
{
|
|
|
|
bool bIsDefault = localesAreEqual( aDefaultLocale, pLocale[i] );
|
2013-07-13 02:54:05 +02:00
|
|
|
LanguageType eLangType = LanguageTag::convertToLanguageType( pLocale[i] );
|
2014-04-17 22:58:40 +02:00
|
|
|
OUString sLanguage = SvtLanguageTable::GetLanguageString( eLangType );
|
2007-01-02 14:51:44 +00:00
|
|
|
if ( bIsDefault )
|
|
|
|
{
|
2013-08-17 21:46:26 +02:00
|
|
|
sLanguage += " " + m_sDefLangStr;
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
2015-08-30 23:08:29 +02:00
|
|
|
const sal_Int32 nPos = m_pLanguageLB->InsertEntry( sLanguage );
|
2015-11-20 11:48:33 +02:00
|
|
|
m_pLanguageLB->SetEntryData( nPos, new LanguageEntry( pLocale[i], bIsDefault ) );
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2014-02-11 10:31:42 +00:00
|
|
|
m_pLanguageLB->InsertEntry( m_sCreateLangStr );
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ManageLanguageDialog::ClearLanguageBox()
|
|
|
|
{
|
2015-08-30 23:08:29 +02:00
|
|
|
const sal_Int32 nCount = m_pLanguageLB->GetEntryCount();
|
|
|
|
for ( sal_Int32 i = 0; i < nCount; ++i )
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2015-03-28 18:57:52 +01:00
|
|
|
LanguageEntry* pEntry = static_cast<LanguageEntry*>(m_pLanguageLB->GetEntryData(i));
|
2012-01-26 01:02:30 +09:00
|
|
|
delete pEntry;
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
2014-02-11 10:31:42 +00:00
|
|
|
m_pLanguageLB->Clear();
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl, Button*, void)
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2015-03-31 23:04:14 +01:00
|
|
|
ScopedVclPtrInstance< SetDefaultLanguageDialog > aDlg( this, m_xLocalizationMgr );
|
2015-02-11 14:42:23 +02:00
|
|
|
if ( RET_OK == aDlg->Execute() )
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2016-11-01 12:19:08 +01:00
|
|
|
// add new locales
|
|
|
|
Sequence< Locale > aLocaleSeq = aDlg->GetLocales();
|
|
|
|
m_xLocalizationMgr->handleAddLocales( aLocaleSeq );
|
|
|
|
// update listbox
|
|
|
|
ClearLanguageBox();
|
|
|
|
FillLanguageBox();
|
2007-01-02 14:51:44 +00:00
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
if (SfxBindings* pBindings = GetBindingsPtr())
|
2007-01-02 14:51:44 +00:00
|
|
|
pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
IMPL_LINK_NOARG(ManageLanguageDialog, DeleteHdl, Button*, void)
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2015-08-07 09:10:57 +01:00
|
|
|
ScopedVclPtrInstance< MessageDialog > aQBox(this, "DeleteLangDialog", "modules/BasicIDE/ui/deletelangdialog.ui");
|
2015-02-11 14:42:23 +02:00
|
|
|
if ( aQBox->Execute() == RET_OK )
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2015-08-30 23:08:29 +02:00
|
|
|
sal_Int32 nCount = m_pLanguageLB->GetSelectEntryCount();
|
|
|
|
sal_Int32 nPos = m_pLanguageLB->GetSelectEntryPos();
|
2007-01-02 14:51:44 +00:00
|
|
|
// remove locales
|
|
|
|
Sequence< Locale > aLocaleSeq( nCount );
|
2015-08-30 23:08:29 +02:00
|
|
|
for ( sal_Int32 i = 0; i < nCount; ++i )
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2015-08-30 23:08:29 +02:00
|
|
|
const sal_Int32 nSelPos = m_pLanguageLB->GetSelectEntryPos(i);
|
2015-03-28 18:57:52 +01:00
|
|
|
LanguageEntry* pEntry = static_cast<LanguageEntry*>(m_pLanguageLB->GetEntryData( nSelPos ));
|
2007-01-02 14:51:44 +00:00
|
|
|
if ( pEntry )
|
|
|
|
aLocaleSeq[i] = pEntry->m_aLocale;
|
|
|
|
}
|
2014-01-03 20:53:11 +00:00
|
|
|
m_xLocalizationMgr->handleRemoveLocales( aLocaleSeq );
|
2007-01-02 14:51:44 +00:00
|
|
|
// update listbox
|
|
|
|
ClearLanguageBox();
|
|
|
|
FillLanguageBox();
|
|
|
|
// reset selection
|
2014-02-11 10:31:42 +00:00
|
|
|
nCount = m_pLanguageLB->GetEntryCount();
|
2007-01-02 14:51:44 +00:00
|
|
|
if ( nCount <= nPos )
|
|
|
|
nPos = nCount - 1;
|
2014-02-11 10:31:42 +00:00
|
|
|
m_pLanguageLB->SelectEntryPos( nPos );
|
2015-10-04 15:05:38 +02:00
|
|
|
SelectHdl( *m_pLanguageLB );
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
IMPL_LINK_NOARG(ManageLanguageDialog, MakeDefHdl, Button*, void)
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2015-08-30 23:08:29 +02:00
|
|
|
const sal_Int32 nPos = m_pLanguageLB->GetSelectEntryPos();
|
2015-03-28 18:57:52 +01:00
|
|
|
LanguageEntry* pSelectEntry = static_cast<LanguageEntry*>(m_pLanguageLB->GetEntryData( nPos ));
|
2007-01-02 14:51:44 +00:00
|
|
|
if ( pSelectEntry && !pSelectEntry->m_bIsDefault )
|
|
|
|
{
|
|
|
|
// set new default entry
|
2014-01-03 20:53:11 +00:00
|
|
|
m_xLocalizationMgr->handleSetDefaultLocale( pSelectEntry->m_aLocale );
|
2007-01-02 14:51:44 +00:00
|
|
|
// update Listbox
|
|
|
|
ClearLanguageBox();
|
|
|
|
FillLanguageBox();
|
|
|
|
// reset selection
|
2014-02-11 10:31:42 +00:00
|
|
|
m_pLanguageLB->SelectEntryPos( nPos );
|
2015-10-04 15:05:38 +02:00
|
|
|
SelectHdl( *m_pLanguageLB );
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
IMPL_LINK_NOARG(ManageLanguageDialog, SelectHdl, ListBox&, void)
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2015-08-30 23:08:29 +02:00
|
|
|
const sal_Int32 nCount = m_pLanguageLB->GetEntryCount();
|
2007-01-02 14:51:44 +00:00
|
|
|
bool bEmpty = ( !nCount ||
|
2014-02-11 10:31:42 +00:00
|
|
|
m_pLanguageLB->GetEntryPos( m_sCreateLangStr ) != LISTBOX_ENTRY_NOTFOUND );
|
|
|
|
bool bSelect = ( m_pLanguageLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND );
|
2014-05-09 20:59:53 +02:00
|
|
|
bool bEnable = !bEmpty && bSelect;
|
2007-01-02 14:51:44 +00:00
|
|
|
|
2014-05-09 20:59:53 +02:00
|
|
|
m_pDeletePB->Enable(bEnable);
|
|
|
|
m_pMakeDefPB->Enable(bEnable && nCount > 1 && m_pLanguageLB->GetSelectEntryCount() == 1);
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// class SetDefaultLanguageDialog -----------------------------------------------
|
|
|
|
|
2016-08-23 10:57:32 +02:00
|
|
|
SetDefaultLanguageDialog::SetDefaultLanguageDialog(vcl::Window* pParent, std::shared_ptr<LocalizationMgr> const & xLMgr)
|
2014-01-03 20:53:11 +00:00
|
|
|
: ModalDialog(pParent, "DefaultLanguageDialog", "modules/BasicIDE/ui/defaultlanguage.ui")
|
2015-11-10 10:10:16 +01:00
|
|
|
, m_pCheckLangLB(nullptr)
|
2014-01-03 20:53:11 +00:00
|
|
|
, m_xLocalizationMgr(xLMgr)
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2014-01-03 20:53:11 +00:00
|
|
|
get(m_pLanguageLB, "entries");
|
|
|
|
get(m_pCheckLangLB, "checkedentries");
|
|
|
|
get(m_pDefinedFT, "defined");
|
|
|
|
get(m_pAddedFT, "added");
|
|
|
|
get(m_pLanguageFT, "defaultlabel");
|
|
|
|
get(m_pCheckLangFT, "checkedlabel");
|
|
|
|
|
|
|
|
m_pLanguageLB->set_height_request(m_pLanguageLB->GetTextHeight() * 10);
|
|
|
|
m_pCheckLangLB->set_height_request(m_pCheckLangLB->GetTextHeight() * 10);
|
|
|
|
|
|
|
|
if (m_xLocalizationMgr->isLibraryLocalized())
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
|
|
|
// change to "Add Interface Language" mode
|
2014-01-03 20:53:11 +00:00
|
|
|
m_pLanguageLB->Hide();
|
|
|
|
m_pCheckLangLB->Show();
|
|
|
|
SetText(get<FixedText>("alttitle")->GetText());
|
|
|
|
m_pLanguageFT->Hide();
|
|
|
|
m_pCheckLangFT->Show();
|
|
|
|
m_pDefinedFT->Hide();
|
|
|
|
m_pAddedFT->Show();
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FillLanguageBox();
|
|
|
|
}
|
|
|
|
|
2015-03-09 14:29:30 +02:00
|
|
|
SetDefaultLanguageDialog::~SetDefaultLanguageDialog()
|
|
|
|
{
|
2015-03-10 09:07:06 +02:00
|
|
|
disposeOnce();
|
2015-03-09 14:29:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetDefaultLanguageDialog::dispose()
|
|
|
|
{
|
|
|
|
m_pLanguageFT.clear();
|
|
|
|
m_pLanguageLB.clear();
|
|
|
|
m_pCheckLangFT.clear();
|
|
|
|
m_pCheckLangLB.clear();
|
|
|
|
m_pDefinedFT.clear();
|
|
|
|
m_pAddedFT.clear();
|
|
|
|
ModalDialog::dispose();
|
|
|
|
}
|
|
|
|
|
2007-01-02 14:51:44 +00:00
|
|
|
void SetDefaultLanguageDialog::FillLanguageBox()
|
|
|
|
{
|
|
|
|
// fill list with all languages
|
2015-04-22 16:19:37 +02:00
|
|
|
m_pLanguageLB->SetLanguageList( SvxLanguageListFlags::ALL, false );
|
2015-08-22 11:25:13 +01:00
|
|
|
|
2014-01-03 20:53:11 +00:00
|
|
|
if ( m_xLocalizationMgr->isLibraryLocalized() )
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2015-08-22 11:25:13 +01:00
|
|
|
// remove the already localized languages
|
|
|
|
Sequence< Locale > aLocaleSeq = m_xLocalizationMgr->getStringResourceManager()->getLocales();
|
|
|
|
const Locale* pLocale = aLocaleSeq.getConstArray();
|
2015-08-30 23:08:29 +02:00
|
|
|
const sal_Int32 nCountLoc = aLocaleSeq.getLength();
|
|
|
|
for ( sal_Int32 i = 0; i < nCountLoc; ++i )
|
2015-08-22 11:25:13 +01:00
|
|
|
m_pLanguageLB->RemoveLanguage( LanguageTag::convertToLanguageType( pLocale[i] ) );
|
|
|
|
|
|
|
|
// fill checklistbox if not in default mode
|
2015-08-30 23:08:29 +02:00
|
|
|
const sal_Int32 nCountLang = m_pLanguageLB->GetEntryCount();
|
|
|
|
for ( sal_Int32 j = 0; j < nCountLang; ++j )
|
2007-01-29 16:01:16 +00:00
|
|
|
{
|
|
|
|
m_pCheckLangLB->InsertEntry(
|
|
|
|
m_pLanguageLB->GetEntry(j), LISTBOX_APPEND, m_pLanguageLB->GetEntryData(j) );
|
|
|
|
}
|
2015-11-10 10:10:16 +01:00
|
|
|
m_pLanguageLB = nullptr;
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
// preselect current UI language
|
2012-11-22 12:26:52 +01:00
|
|
|
m_pLanguageLB->SelectLanguage( Application::GetSettings().GetUILanguageTag().getLanguageType() );
|
2007-01-29 16:01:16 +00:00
|
|
|
}
|
|
|
|
|
2007-01-02 14:51:44 +00:00
|
|
|
Sequence< Locale > SetDefaultLanguageDialog::GetLocales() const
|
|
|
|
{
|
2014-01-03 20:53:11 +00:00
|
|
|
bool bNotLocalized = !m_xLocalizationMgr->isLibraryLocalized();
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_Int32 nSize = bNotLocalized ? 1 : m_pCheckLangLB->GetCheckedEntryCount();
|
2007-01-02 14:51:44 +00:00
|
|
|
Sequence< Locale > aLocaleSeq( nSize );
|
|
|
|
if ( bNotLocalized )
|
|
|
|
{
|
2012-11-24 18:54:09 +01:00
|
|
|
aLocaleSeq[0] = LanguageTag( m_pLanguageLB->GetSelectLanguage() ).getLocale();
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-30 23:08:29 +02:00
|
|
|
const sal_Int32 nCount = m_pCheckLangLB->GetEntryCount();
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_Int32 j = 0;
|
2015-08-30 23:08:29 +02:00
|
|
|
for ( sal_Int32 i = 0; i < nCount; ++i )
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2007-01-29 16:01:16 +00:00
|
|
|
if ( m_pCheckLangLB->IsChecked(i) )
|
2007-01-02 14:51:44 +00:00
|
|
|
{
|
2014-10-21 09:12:47 +02:00
|
|
|
LanguageType eType = LanguageType( reinterpret_cast<sal_uLong>(m_pCheckLangLB->GetEntryData(i)) );
|
2013-07-13 02:54:05 +02:00
|
|
|
aLocaleSeq[j++] = LanguageTag::convertToLocale( eType );
|
2007-01-02 14:51:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DBG_ASSERT( nSize == j, "SetDefaultLanguageDialog::GetLocales(): invalid indexes" );
|
|
|
|
}
|
|
|
|
return aLocaleSeq;
|
|
|
|
}
|
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
} // namespace basctl
|
|
|
|
|
2010-10-12 15:57:08 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|