diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-09-23 18:51:54 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-09-24 20:58:13 +0200 |
commit | 68aec8fd57eda8c05926b7f361dc102772f2c501 (patch) | |
tree | 055781b9c27e02ab52b5764240fa26137e2ec92b /sw/source | |
parent | 38aa699f265c17548769aaa4f20e1ae35d18f202 (diff) |
tdf#134782 sw,unotools,officecfg: adapt configuration and UI
Store AddParaLineSpacingToTableCells in configuration as
"AddTableLineSpacing", consistently inconsistent like AddTableSpacing
(the <desc> elements are not subject to translation).
Adapt SwCompatibilityOptPage with some ugly hacks to allow 3 different
states (TriState) for the corresponding checkbox that map to false/false,
true/false and true/true.
The checkbox widget doesn't allow to change *to* indeterminate but at
least the status of the document can be displayed this way,
with a non-obvious tweak to optcompatpage.ui to reference "checktri1"
column.
Change-Id: I5f32e05c93b5e16e782cba5d1d055809d9e5e251
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103318
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/DocumentSettingManager.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/config/optcomp.cxx | 48 |
3 files changed, 48 insertions, 7 deletions
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index febce5528ea7..5f609221752f 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -117,7 +117,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbAddExternalLeading = !aOptions.GetDefault( SvtCompatibilityEntry::Index::NoExtLeading ); mbOldLineSpacing = aOptions.GetDefault( SvtCompatibilityEntry::Index::UseLineSpacing ); mbAddParaSpacingToTableCells = aOptions.GetDefault( SvtCompatibilityEntry::Index::AddTableSpacing ); - mbAddParaLineSpacingToTableCells = aOptions.GetDefault( SvtCompatibilityEntry::Index::AddTableSpacing ); // FIXME? separate UI? + mbAddParaLineSpacingToTableCells = aOptions.GetDefault( SvtCompatibilityEntry::Index::AddTableLineSpacing ); mbUseFormerObjectPos = aOptions.GetDefault( SvtCompatibilityEntry::Index::UseObjectPositioning ); mbUseFormerTextWrapping = aOptions.GetDefault( SvtCompatibilityEntry::Index::UseOurTextWrapping ); mbConsiderWrapOnObjPos = aOptions.GetDefault( SvtCompatibilityEntry::Index::ConsiderWrappingStyle ); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 7f2f6e4466bb..52a82345ef65 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -822,10 +822,13 @@ void SwViewShell::SetUseVirDev( bool bNewVirtual ) void SwViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells ) { IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess(); - if ( rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells ) + if (rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells + || rIDSA.get(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells) { SwWait aWait( *GetDoc()->GetDocShell(), true ); rIDSA.set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells ); + // note: the dialog can't change the value to indeterminate, so only false/false and true/true + rIDSA.set(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells ); const SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea; lcl_InvalidateAllContent( *this, nInv ); } diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index ac0d1c3ed063..a3c3837006ce 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -65,7 +65,9 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(weld::Container* pPage, weld::Dia m_xGlobalOptionsCLB->enable_toggle_buttons(weld::ColumnToggleType::Check); int nPos = 0; - for ( int i = static_cast<int>(SvtCompatibilityEntry::Index::Module) + 1; i < static_cast<int>(SvtCompatibilityEntry::Index::INVALID); ++i ) + for (int i = static_cast<int>(SvtCompatibilityEntry::Index::Module) + 1; + i < static_cast<int>(SvtCompatibilityEntry::Index::INVALID) - 1; // omit AddTableLineSpacing + ++i) { int nCoptIdx = i - 2; /* Do not consider "Name" & "Module" indexes */ @@ -115,6 +117,7 @@ static sal_uInt32 convertBools2Ulong_Impl bool _bNoExtLeading, bool _bUseLineSpacing, bool _bAddTableSpacing, + bool _bAddTableLineSpacing, bool _bUseObjPos, bool _bUseOurTextWrapping, bool _bConsiderWrappingStyle, @@ -149,6 +152,9 @@ static sal_uInt32 convertBools2Ulong_Impl if ( _bAddTableSpacing ) nRet |= nSetBit; nSetBit = nSetBit << 1; + if (_bAddTableLineSpacing) + nRet |= nSetBit; + nSetBit = nSetBit << 1; if ( _bUseObjPos ) nRet |= nSetBit; nSetBit = nSetBit << 1; @@ -246,6 +252,7 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet ) aEntry.getValue<bool>( SvtCompatibilityEntry::Index::NoExtLeading ), aEntry.getValue<bool>( SvtCompatibilityEntry::Index::UseLineSpacing ), aEntry.getValue<bool>( SvtCompatibilityEntry::Index::AddTableSpacing ), + aEntry.getValue<bool>(SvtCompatibilityEntry::Index::AddTableLineSpacing), aEntry.getValue<bool>( SvtCompatibilityEntry::Index::UseObjectPositioning ), aEntry.getValue<bool>( SvtCompatibilityEntry::Index::UseOurTextWrapping ), aEntry.getValue<bool>( SvtCompatibilityEntry::Index::ConsiderWrappingStyle ), @@ -282,6 +289,15 @@ IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl, weld::Button&, void) int nCoptIdx = i + 2; /* Consider "Name" & "Module" indexes */ pItem->setValue<bool>( SvtCompatibilityEntry::Index(nCoptIdx), bChecked ); + if (nCoptIdx == int(SvtCompatibilityEntry::Index::AddTableSpacing)) + { + bool const isLineSpacing = m_xOptionsLB->get_toggle(i) == TRISTATE_TRUE; + pItem->setValue<bool>(SvtCompatibilityEntry::Index::AddTableLineSpacing, isLineSpacing); + } + else + { + assert(m_xOptionsLB->get_toggle(i) != TRISTATE_INDET); + } } } @@ -295,7 +311,17 @@ void SwCompatibilityOptPage::SetCurrentOptions( sal_uInt32 nOptions ) for (int i = 0; i < nCount; ++i) { bool bChecked = ( ( nOptions & 0x00000001 ) == 0x00000001 ); - m_xOptionsLB->set_toggle(i, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE); + TriState value = bChecked ? TRISTATE_TRUE : TRISTATE_FALSE; + if (i == int(SvtCompatibilityEntry::Index::AddTableSpacing) - 2) + { // hack: map 2 bools to 1 tristate + nOptions = nOptions >> 1; + if (value == TRISTATE_TRUE + && (nOptions & 0x00000001) != 0x00000001) // ADD_PARA_LINE_SPACING_TO_TABLE_CELLS + { + value = TRISTATE_INDET; // 3 values possible here + } + } + m_xOptionsLB->set_toggle(i, value); nOptions = nOptions >> 1; } } @@ -314,6 +340,7 @@ sal_uInt32 SwCompatibilityOptPage::GetDocumentOptions() const !rIDocumentSettingAccess.get( DocumentSettingId::ADD_EXT_LEADING ), rIDocumentSettingAccess.get( DocumentSettingId::OLD_LINE_SPACING ), rIDocumentSettingAccess.get( DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS ), + rIDocumentSettingAccess.get( DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS ), rIDocumentSettingAccess.get( DocumentSettingId::USE_FORMER_OBJECT_POS ), rIDocumentSettingAccess.get( DocumentSettingId::USE_FORMER_TEXT_WRAPPING ), rIDocumentSettingAccess.get( DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION ), @@ -349,10 +376,21 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* ) for (int i = 0; i < nCount; ++i) { - bool bChecked = m_xOptionsLB->get_toggle(i) == TRISTATE_TRUE; - bool bSavedChecked = ( ( nSavedOptions & 0x00000001 ) == 0x00000001 ); - if ( bChecked != bSavedChecked ) + TriState const current = m_xOptionsLB->get_toggle(i); + TriState saved = ((nSavedOptions & 0x00000001) == 0x00000001) ? TRISTATE_TRUE : TRISTATE_FALSE; + if (i == int(SvtCompatibilityEntry::Index::AddTableSpacing) - 2) + { // hack: map 2 bools to 1 tristate + nSavedOptions = nSavedOptions >> 1; + if (saved == TRISTATE_TRUE + && ((nSavedOptions & 0x00000001) != 0x00000001)) + { + saved = TRISTATE_INDET; + } + } + if (current != saved) { + bool const bChecked(current != TRISTATE_FALSE); + assert(current != TRISTATE_INDET); // can't *change* it to that int nCoptIdx = i + 2; /* Consider "Name" & "Module" indexes */ switch ( SvtCompatibilityEntry::Index(nCoptIdx) ) { |