summaryrefslogtreecommitdiffstats
path: root/cui
diff options
context:
space:
mode:
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/swpossizetabpage.hxx1
-rw-r--r--cui/source/inc/treeopt.hxx4
-rw-r--r--cui/source/options/optlanguagetool.cxx35
-rw-r--r--cui/source/options/treeopt.cxx22
-rw-r--r--cui/source/tabpages/swpossizetabpage.cxx27
-rw-r--r--cui/uiconfig/ui/optviewpage.ui3
6 files changed, 50 insertions, 42 deletions
diff --git a/cui/source/inc/swpossizetabpage.hxx b/cui/source/inc/swpossizetabpage.hxx
index eb73196986..ede7fd4231 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -52,6 +52,7 @@ class SvxSwPosSizeTabPage : public SfxTabPage
bool m_bPositioningDisabled;
bool m_bIsMultiSelection;
bool m_bIsInRightToLeft;
+ bool m_bDoNotMirrorRtlDrawObjs = false;
TriState m_nProtectSizeState;
SwFrameExample m_aExampleWN;
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 307c70f9ed..1522ded3d7 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -229,8 +229,8 @@ public:
void ActivatePage( const OUString& rPageURL );
void ApplyItemSets();
- // default value initializes all dialogs
- void initializeFirstNDialog(sal_Int16 nNumberOfNode = -1);
+ // initialize all dialogs in "Tools > Options"
+ void initializeAllDialogs();
// helper functions to call the Languages and Locales TabPage from the SpellDialog
static void ApplyLanguageOptions(const SfxItemSet& rSet);
diff --git a/cui/source/options/optlanguagetool.cxx b/cui/source/options/optlanguagetool.cxx
index 8c56a40e72..3979b42c05 100644
--- a/cui/source/options/optlanguagetool.cxx
+++ b/cui/source/options/optlanguagetool.cxx
@@ -25,6 +25,7 @@
using LanguageToolCfg = officecfg::Office::Linguistic::GrammarChecking::LanguageTool;
constexpr OUString LANGUAGETOOL_DEFAULT_URL = u"https://api.languagetool.org/v2"_ustr;
+constexpr OUString LANGUAGETOOLPLUS_DEFAULT_URL = u"https://api.languagetoolplus.com/v2"_ustr;
OptLanguageToolTabPage::OptLanguageToolTabPage(weld::Container* pPage,
weld::DialogController* pController,
@@ -81,20 +82,21 @@ IMPL_LINK_NOARG(OptLanguageToolTabPage, CheckHdl, weld::Toggleable&, void)
void OptLanguageToolTabPage::Reset(const SfxItemSet*)
{
// tdf#150494 If no URL has been set, use the default URL
- OUString aBaseURL = LanguageToolCfg::BaseURL::get().value_or("");
- if (aBaseURL.isEmpty())
- m_xBaseURLED->set_text(LANGUAGETOOL_DEFAULT_URL);
- else
- m_xBaseURLED->set_text(aBaseURL);
+ OUString aUsername = LanguageToolCfg::Username::get().value_or("");
+ OUString aApiKey = LanguageToolCfg::ApiKey::get().value_or("");
+ OUString aBaseURL = LanguageToolCfg::BaseURL::get().value_or(
+ (aUsername.isEmpty() && aApiKey.isEmpty()) ? LANGUAGETOOL_DEFAULT_URL
+ : LANGUAGETOOLPLUS_DEFAULT_URL);
+ m_xBaseURLED->set_text(aBaseURL);
m_xBaseURLED->set_sensitive(!LanguageToolCfg::BaseURL::isReadOnly());
m_xBaseURLImg->set_visible(LanguageToolCfg::BaseURL::isReadOnly());
- m_xUsernameED->set_text(LanguageToolCfg::Username::get().value_or(""));
+ m_xUsernameED->set_text(aUsername);
m_xUsernameED->set_sensitive(!LanguageToolCfg::Username::isReadOnly());
m_xUsernameImg->set_visible(LanguageToolCfg::Username::isReadOnly());
- m_xApiKeyED->set_text(LanguageToolCfg::ApiKey::get().value_or(""));
+ m_xApiKeyED->set_text(aApiKey);
m_xApiKeyED->set_sensitive(!LanguageToolCfg::ApiKey::isReadOnly());
m_xApiKeyImg->set_visible(LanguageToolCfg::ApiKey::isReadOnly());
@@ -139,14 +141,21 @@ bool OptLanguageToolTabPage::FillItemSet(SfxItemSet*)
auto batch(comphelper::ConfigurationChanges::create());
// tdf#150494 If no URL has been set, then save the default URL
+ // tdf#159395 If Username and ApiKey are set, then save the default URL for paid service
OUString aBaseURL = m_xBaseURLED->get_text();
- if (aBaseURL.isEmpty())
- LanguageToolCfg::BaseURL::set(LANGUAGETOOL_DEFAULT_URL, batch);
- else
- LanguageToolCfg::BaseURL::set(aBaseURL, batch);
+ OUString aUsername = m_xUsernameED->get_text();
+ OUString aApiKey = m_xApiKeyED->get_text();
- LanguageToolCfg::Username::set(m_xUsernameED->get_text(), batch);
- LanguageToolCfg::ApiKey::set(m_xApiKeyED->get_text(), batch);
+ if (aBaseURL.isEmpty()
+ || (aUsername.isEmpty() && aApiKey.isEmpty() && aBaseURL == LANGUAGETOOLPLUS_DEFAULT_URL))
+ aBaseURL = LANGUAGETOOL_DEFAULT_URL;
+
+ if (!aUsername.isEmpty() && !aApiKey.isEmpty() && aBaseURL == LANGUAGETOOL_DEFAULT_URL)
+ aBaseURL = LANGUAGETOOLPLUS_DEFAULT_URL;
+
+ LanguageToolCfg::BaseURL::set(aBaseURL, batch);
+ LanguageToolCfg::Username::set(aUsername, batch);
+ LanguageToolCfg::ApiKey::set(aApiKey, batch);
LanguageToolCfg::RestProtocol::set(m_xRestProtocol->get_text(), batch);
LanguageToolCfg::SSLCertVerify::set(!m_xSSLDisableVerificationBox->get_active(), batch);
batch->commit();
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index d8fe793e10..029c5f773f 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -790,7 +790,7 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, SearchUpdateHdl, weld::Entry&, void)
IMPL_LINK_NOARG(OfaTreeOptionsDialog, ImplUpdateDataHdl, Timer*, void)
{
- // initializeFirstNDialog() can take a long time, show wait cursor and disable input
+ // initializeAllDialogs() can take a long time, show wait cursor and disable input
std::unique_ptr<weld::WaitObject> xWait(m_pParent ? new weld::WaitObject(m_pParent) : nullptr);
// Pause redraw
@@ -801,7 +801,7 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, ImplUpdateDataHdl, Timer*, void)
m_xSearchEdit->freeze();
xTreeLB->hide();
- initializeFirstNDialog();
+ initializeAllDialogs();
m_xSearchEdit->thaw();
xTreeLB->show();
@@ -847,10 +847,9 @@ void OfaTreeOptionsDialog::selectFirstEntry()
}
}
-void OfaTreeOptionsDialog::initializeFirstNDialog(sal_Int16 nNumberOfNode)
+void OfaTreeOptionsDialog::initializeAllDialogs()
{
std::unique_ptr<weld::TreeIter> xEntry;
- sal_Int16 nCount = 0;
std::unique_ptr<weld::TreeIter> xTemp = xTreeLB->make_iterator();
bool bTemp = xTreeLB->get_iter_first(*xTemp);
@@ -877,12 +876,6 @@ void OfaTreeOptionsDialog::initializeFirstNDialog(sal_Int16 nNumberOfNode)
}
}
- /* if nNumberOfNode is -1 (which is the default value if no parameter provided),
- this function will initialize all dialogs since nCount always greater than -1 */
- if (nCount == nNumberOfNode)
- break;
-
- ++nCount;
bTemp = xTreeLB->iter_next(*xTemp);
}
}
@@ -1187,15 +1180,6 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
xTreeLB->select(*xEntry);
m_xSearchEdit->grab_focus();
SelectHdl_Impl();
-
- // initializeFirstNDialog() can take a long time, show wait cursor
- std::unique_ptr<weld::WaitObject> xWait(m_pParent ? new weld::WaitObject(m_pParent) : nullptr);
-
- /* initialize first 25 dialogs which are almost half of the dialogs
- in a row while Options dialog opens. then clear&reselect to avoid UI test failures. */
- initializeFirstNDialog(25);
- clearOptionsDialog();
- SelectHdl_Impl();
}
void OfaTreeOptionsDialog::InitItemSets(OptionsGroupInfo& rGroupInfo)
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 060f7b44ce..8de586a74d 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -37,6 +37,7 @@
#include <svx/svxids.hrc>
#include <svtools/unitconv.hxx>
#include <osl/diagnose.h>
+#include <svl/grabbagitem.hxx>
using namespace ::com::sun::star::text;
@@ -431,14 +432,16 @@ static std::size_t lcl_GetFrmMapCount(const FrmMap* pMap)
}
static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(
- SvxSwFramePosString::StringId eStringId, bool bVertical, bool bRTL)
+ SvxSwFramePosString::StringId eStringId, bool bVertical, bool bRTL, bool bDontMirrorRTL)
{
//special handling of STR_FROMLEFT
if(SvxSwFramePosString::FROMLEFT == eStringId)
{
+ bool bMirrorRtlDrawObjs = !bDontMirrorRTL;
+ bool bSwapLR = bRTL && bMirrorRtlDrawObjs;
eStringId = bVertical ?
bRTL ? SvxSwFramePosString::FROMBOTTOM : SvxSwFramePosString::FROMTOP :
- bRTL ? SvxSwFramePosString::FROMRIGHT : SvxSwFramePosString::FROMLEFT;
+ bSwapLR ? SvxSwFramePosString::FROMRIGHT : SvxSwFramePosString::FROMLEFT;
return eStringId;
}
if(bVertical)
@@ -728,7 +731,8 @@ WhichRangesContainer SvxSwPosSizeTabPage::GetRanges()
SID_ATTR_TRANSFORM_AUTOWIDTH, SID_ATTR_TRANSFORM_VERT_ORIENT,
SID_HTML_MODE, SID_HTML_MODE,
SID_SW_FOLLOW_TEXT_FLOW, SID_SW_FOLLOW_TEXT_FLOW,
- SID_ATTR_TRANSFORM_HORI_POSITION, SID_ATTR_TRANSFORM_VERT_POSITION
+ SID_ATTR_TRANSFORM_HORI_POSITION, SID_ATTR_TRANSFORM_VERT_POSITION,
+ SID_ATTR_CHAR_GRABBAG, SID_ATTR_CHAR_GRABBAG
>);
return ranges;
}
@@ -967,6 +971,17 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet)
}
m_xFollowCB->save_state();
+ const SfxGrabBagItem* pGrabBag = GetItem(*rSet, SID_ATTR_CHAR_GRABBAG);
+ if (pGrabBag)
+ {
+ const std::map<OUString, css::uno::Any>& rMap = pGrabBag->GetGrabBag();
+ auto it = rMap.find("DoNotMirrorRtlDrawObjs");
+ if (it != rMap.end())
+ {
+ it->second >>= m_bDoNotMirrorRtlDrawObjs;
+ }
+ }
+
if(m_bHtmlMode)
{
m_xHoriMirrorCB->hide();
@@ -1651,7 +1666,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
{
SvxSwFramePosString::StringId sStrId1 = aAsCharRelationMap[nRelPos].eStrId;
- sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft);
+ sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft, m_bDoNotMirrorRtlDrawObjs);
OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
rLB.append(weld::toId(&aAsCharRelationMap[nRelPos]), sEntry);
if (pMap[_nMapPos].nAlign == nAlign)
@@ -1706,7 +1721,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
if (aRelationMap[nRelPos].nLBRelation == static_cast<LB>(nBit))
{
SvxSwFramePosString::StringId sStrId1 = m_xHoriMirrorCB->get_active() ? aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId;
- sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft);
+ sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft, m_bDoNotMirrorRtlDrawObjs);
OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
rLB.append(weld::toId(&aRelationMap[nRelPos]), sEntry);
if (sSelEntry.isEmpty() && aRelationMap[nRelPos].nRelation == nRel)
@@ -1783,7 +1798,7 @@ sal_uInt16 SvxSwPosSizeTabPage::FillPosLB(FrmMap const *_pMap,
for (std::size_t i = 0; _pMap && i < nCount; ++i)
{
SvxSwFramePosString::StringId eStrId = m_xHoriMirrorCB->get_active() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
- eStrId = lcl_ChangeResIdToVerticalOrRTL(eStrId, m_bIsVerticalFrame, m_bIsInRightToLeft);
+ eStrId = lcl_ChangeResIdToVerticalOrRTL(eStrId, m_bIsVerticalFrame, m_bIsInRightToLeft, m_bDoNotMirrorRtlDrawObjs);
OUString sEntry(SvxSwFramePosString::GetString(eStrId));
if (_rLB.find_text(sEntry) == -1)
{
diff --git a/cui/uiconfig/ui/optviewpage.ui b/cui/uiconfig/ui/optviewpage.ui
index ce89f11d4d..6ad8478301 100644
--- a/cui/uiconfig/ui/optviewpage.ui
+++ b/cui/uiconfig/ui/optviewpage.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
<interface domain="cui">
<requires lib="gtk+" version="3.20"/>
<object class="GtkAdjustment" id="adjustment2">
@@ -27,7 +27,6 @@
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="hexpand">True</property>
<property name="row-spacing">12</property>
<child>
<object class="GtkFrame" id="frame4">