diff options
author | Vitaliy Anderson <vanderson@smartru.com> | 2017-01-13 08:37:39 -0800 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-01-18 08:47:22 +0000 |
commit | fb4943338317c8f24b143d7d1f0b8f2069af1577 (patch) | |
tree | 5b5bb0df8f8fa88f15832b9e149191e477bfba59 /sw | |
parent | c8bdf901efd034f24bacf5e2d617a00bb1692238 (diff) |
tdf#104349, tdf#104668 MS Word compatibility trailing blanks option part 2
Create the option in Tools->Options->LibreOffice Writer->Compatibility
Change-Id: I7c766138db9210d3e7a97eea48b9265ee9762199
Reviewed-on: https://gerrit.libreoffice.org/33148
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/DocumentSettingManager.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/config/optcomp.cxx | 34 | ||||
-rw-r--r-- | sw/source/uibase/uno/SwXDocumentSettings.cxx | 13 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/optcompatpage.ui | 1 |
4 files changed, 43 insertions, 10 deletions
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index f0066826b810..64644c53241c 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -109,8 +109,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbUseFormerObjectPos = aOptions.IsUseObjectPositioning(); mbUseFormerTextWrapping = aOptions.IsUseOurTextWrapping(); mbConsiderWrapOnObjPos = aOptions.IsConsiderWrappingStyle(); - - mbDoNotJustifyLinesWithManualBreak = !aOptions.IsExpandWordSpace(); + mbDoNotJustifyLinesWithManualBreak = !aOptions.IsExpandWordSpace(); + mbMsWordCompTrailingBlanks = aOptions.IsMsWordCompTrailingBlanks(); } else { @@ -125,6 +125,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbUseFormerTextWrapping = false; mbConsiderWrapOnObjPos = false; mbDoNotJustifyLinesWithManualBreak = true; + mbMsWordCompTrailingBlanks = false; } // COMPATIBILITY FLAGS END diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index 2e72a027984b..69e54a3bbcf7 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -57,6 +57,7 @@ struct CompatibilityItem bool m_bConsiderWrappingStyle; bool m_bExpandWordSpace; bool m_bProtectForm; + bool m_bMsWordCompTrailingBlanks; bool m_bIsDefault; CompatibilityItem( const OUString& _rName, const OUString& _rModule, @@ -64,7 +65,7 @@ struct CompatibilityItem bool _bUseOurTabStops, bool _bNoExtLeading, bool _bUseLineSpacing, bool _bAddTableSpacing, bool _bUseObjPos, bool _bUseOurTextWrapping, bool _bConsiderWrappingStyle, bool _bExpandWordSpace, bool _bProtectForm, - bool _bIsDefault ) : + bool _bMsWordCompTrailingBlanks, bool _bIsDefault ) : m_sName ( _rName ), m_sModule ( _rModule ), @@ -80,6 +81,7 @@ struct CompatibilityItem m_bConsiderWrappingStyle( _bConsiderWrappingStyle ), m_bExpandWordSpace ( _bExpandWordSpace ), m_bProtectForm ( _bProtectForm), + m_bMsWordCompTrailingBlanks( _bMsWordCompTrailingBlanks), m_bIsDefault ( _bIsDefault ) {} }; @@ -102,7 +104,7 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxIt get(m_pOptionsLB, "options"); get(m_pDefaultPB, "default"); - for (sal_Int32 nId = COPT_USE_PRINTERDEVICE; nId <= COPT_PROTECT_FORM; ++nId) + for (sal_Int32 nId = COPT_USE_PRINTERDEVICE; nId <= COPT_MS_WORD_COMP_TRAILING_BLANKS; ++nId) { const OUString sEntry = m_pFormattingLB->GetEntry(nId); SvTreeListEntry* pEntry = m_pOptionsLB->SvTreeListBox::InsertEntry( sEntry ); @@ -153,7 +155,8 @@ sal_uLong convertBools2Ulong_Impl bool _bUseOurTextWrapping, bool _bConsiderWrappingStyle, bool _bExpandWordSpace, - bool _bProtectForm + bool _bProtectForm, + bool _bMsWordCompTrailingBlanks ) { sal_uLong nRet = 0; @@ -194,6 +197,9 @@ sal_uLong convertBools2Ulong_Impl nSetBit = nSetBit << 1; if ( _bProtectForm ) nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bMsWordCompTrailingBlanks ) + nRet |= nSetBit; return nRet; } @@ -235,6 +241,7 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet ) bool bConsiderWrappingStyle = false; bool bExpandWordSpace = false; bool bProtectForm = false; + bool bMsWordCompTrailingBlanks = false; const sal_Int32 nCount = aList.getLength(); for ( sal_Int32 i = 0; i < nCount; ++i ) { @@ -271,6 +278,8 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet ) aValue.Value >>= bExpandWordSpace; else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_PROTECTFORM ) aValue.Value >>= bProtectForm; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_MSWORDTRAILINGBLANKS ) + aValue.Value >>= bMsWordCompTrailingBlanks; } const bool bIsUserEntry = sName == "_user"; @@ -280,8 +289,8 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet ) sName, sModule, bUsePrtMetrics, bAddSpacing, bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading, bUseLineSpacing, bAddTableSpacing, bUseObjPos, - bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace, bProtectForm, - bIsDefaultEntry ); + bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace, + bProtectForm, bMsWordCompTrailingBlanks, bIsDefaultEntry ); m_pImpl->m_aList.push_back( aItem ); if ( aItem.m_bIsDefault ) @@ -306,7 +315,8 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet ) bUsePrtMetrics, bAddSpacing, bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading, bUseLineSpacing, bAddTableSpacing, bUseObjPos, bUseOurTextWrapping, - bConsiderWrappingStyle, bExpandWordSpace, bProtectForm ); + bConsiderWrappingStyle, bExpandWordSpace, bProtectForm, + bMsWordCompTrailingBlanks ); m_pFormattingLB->SetEntryData( nPos, reinterpret_cast<void*>((sal_IntPtr)nOptions) ); } @@ -350,6 +360,7 @@ IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl, Button*, void) case COPT_CONSIDER_WRAPPINGSTYLE: pItem->m_bConsiderWrappingStyle = bChecked; break; case COPT_EXPAND_WORDSPACE: pItem->m_bExpandWordSpace = bChecked; break; case COPT_PROTECT_FORM: pItem->m_bProtectForm = bChecked; break; + case COPT_MS_WORD_COMP_TRAILING_BLANKS: pItem->m_bMsWordCompTrailingBlanks = bChecked; break; default: { OSL_FAIL("SwCompatibilityOptPage::UseAsDefaultHdl(): wrong option" ); @@ -394,7 +405,8 @@ sal_uLong SwCompatibilityOptPage::GetDocumentOptions() const rIDocumentSettingAccess.get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING), rIDocumentSettingAccess.get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION), !rIDocumentSettingAccess.get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK), - rIDocumentSettingAccess.get(DocumentSettingId::PROTECT_FORM)); + rIDocumentSettingAccess.get(DocumentSettingId::PROTECT_FORM), + rIDocumentSettingAccess.get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS)); } return nRet; } @@ -410,7 +422,8 @@ void SwCompatibilityOptPage::WriteOptions() pItem->m_bNoExtLeading, pItem->m_bUseLineSpacing, pItem->m_bAddTableSpacing, pItem->m_bUseObjPos, pItem->m_bUseOurTextWrapping, pItem->m_bConsiderWrappingStyle, - pItem->m_bExpandWordSpace, pItem->m_bProtectForm ); + pItem->m_bExpandWordSpace, pItem->m_bProtectForm, + pItem->m_bMsWordCompTrailingBlanks ); } VclPtr<SfxTabPage> SwCompatibilityOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) @@ -488,6 +501,11 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* ) m_pWrtShell->SetProtectForm( bChecked ); bModified = true; } + else if ( COPT_MS_WORD_COMP_TRAILING_BLANKS == nOption ) + { + m_pWrtShell->SetMsWordCompTrailingBlanks( bChecked ); + bModified = true; + } } nSavedOptions = nSavedOptions >> 1; diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 22a82a3743cf..f11fae73cf95 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -112,6 +112,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, HANDLE_USE_OLD_PRINTER_METRICS, HANDLE_PROTECT_FORM, + HANDLE_MS_WORD_COMP_TRAILING_BLANKS, HANDLE_TABS_RELATIVE_TO_INDENT, HANDLE_RSID, HANDLE_RSID_ROOT, @@ -191,6 +192,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0}, { OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0}, { OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0}, + { OUString("MsWordCompTrailingBlanks"), HANDLE_MS_WORD_COMP_TRAILING_BLANKS, cppu::UnoType<bool>::get(), 0 }, { OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0}, { OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0}, { OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0}, @@ -720,6 +722,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FORM, bTmp); } break; + case HANDLE_MS_WORD_COMP_TRAILING_BLANKS: + { + bool bTmp = *o3tl::doAccess<bool>(rValue); + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS, bTmp); + } + break; case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: { bool bTmp = *o3tl::doAccess<bool>(rValue); @@ -1175,6 +1183,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM); } break; + case HANDLE_MS_WORD_COMP_TRAILING_BLANKS: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS); + } + break; case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: { rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST); diff --git a/sw/uiconfig/swriter/ui/optcompatpage.ui b/sw/uiconfig/swriter/ui/optcompatpage.ui index 4ba4e48f1b72..3c2eb9330dae 100644 --- a/sw/uiconfig/swriter/ui/optcompatpage.ui +++ b/sw/uiconfig/swriter/ui/optcompatpage.ui @@ -65,6 +65,7 @@ <item translatable="yes">Consider wrapping style when positioning objects</item> <item translatable="yes">Expand word space on lines with manual line breaks in justified paragraphs</item> <item translatable="yes">Protect form</item> + <item translatable="yes">MS Word-compatible trailing blanks</item> <item translatable="yes"><User settings></item> </items> </object> |