summaryrefslogtreecommitdiff
path: root/sw/source/ui/config
diff options
context:
space:
mode:
authorVitaliy Anderson <vanderson@smartru.com>2017-01-13 08:37:39 -0800
committerMike Kaganski <mike.kaganski@collabora.com>2017-01-18 08:47:22 +0000
commitfb4943338317c8f24b143d7d1f0b8f2069af1577 (patch)
tree5b5bb0df8f8fa88f15832b9e149191e477bfba59 /sw/source/ui/config
parentc8bdf901efd034f24bacf5e2d617a00bb1692238 (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/source/ui/config')
-rw-r--r--sw/source/ui/config/optcomp.cxx34
1 files changed, 26 insertions, 8 deletions
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;