diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-01-08 11:57:13 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-01-08 15:08:14 +0100 |
commit | 908bcce46c54e999916b32dffef34d34f21878d4 (patch) | |
tree | 91990a433b1f2370fd3e63cb8b4b2b3a61be507d /sw | |
parent | cf24316f4b07b0a4a0ae3c1a7e8214e1630982f8 (diff) |
n#793998 sw: add TabOverMargin compat mode
In case the right margin is larger then the tab position (e.g. the right
margin of 7cm, there is a tab position at 16cm and right margin begins
at 9cm), we have a conflicting case. In Word, the tab has priority, so
in this conflicting case, the text can be outside the specified margin.
In Writer, the right margin has priority. Add a compat flag to let
the tab have priority in Writer as well for Word formats.
This is similar to TabOverflow, but that was only applied to left tabs
and only in case there were no characters after the tabs in the
paragraph.
(cherry picked from commit bdfc6363d66aa079512cc8008996b633f693fed1)
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/IDocumentSettingAccess.hxx | 1 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/text/txttab.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 7 | ||||
-rw-r--r-- | sw/source/ui/uno/SwXDocumentSettings.cxx | 16 |
8 files changed, 35 insertions, 2 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 2c02236f8338..8214f1abf282 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -77,6 +77,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd UNBREAKABLE_NUMBERINGS, CLIPPED_PICTURES, BACKGROUND_PARA_OVER_DRAWINGS, + TAB_OVER_MARGIN, // COMPATIBILITY FLAGS END BROWSE_MODE, diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index bfe2826f52d8..34ba7dfb6b1b 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -578,6 +578,7 @@ private: bool mbUnbreakableNumberings; bool mbClippedPictures; bool mbBackgroundParaOverDrawings; + bool mbTabOverMargin; bool mbLastBrowseMode : 1; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index dda0b6dce46e..80cfa846fd4d 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -192,6 +192,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings; case CLIPPED_PICTURES: return mbClippedPictures; case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings; + case TAB_OVER_MARGIN: return mbTabOverMargin; case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked! case HTML_MODE: return mbHTMLMode; @@ -347,6 +348,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) mbBackgroundParaOverDrawings = value; break; + case TAB_OVER_MARGIN: + mbTabOverMargin = value; + break; + // COMPATIBILITY FLAGS END case BROWSE_MODE: //can be used temporary (load/save) when no ViewShell is avaiable diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 730fe5670bf3..d5f55f77fcbd 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -317,6 +317,7 @@ SwDoc::SwDoc() mbUnbreakableNumberings(false), mbClippedPictures(false), mbBackgroundParaOverDrawings(false), + mbTabOverMargin(false), mbLastBrowseMode( false ), n32DummyCompatabilityOptions1(0), n32DummyCompatabilityOptions2(0), diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index a83ea96583d0..124fa8f79f52 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -486,7 +486,10 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf ) sal_Bool SwTabPortion::PostFormat( SwTxtFormatInfo &rInf ) { - const KSHORT nRight = Min( GetTabPos(), rInf.Width() ); + const bool bTabOverMargin = rInf.GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_OVER_MARGIN); + // If the tab position is larger than the right margin, it gets scaled down by default. + // However, if compat mode enabled, we allow tabs to go over the margin: the rest of the paragraph is not broken into lines. + const KSHORT nRight = bTabOverMargin ? GetTabPos() : Min(GetTabPos(), rInf.Width()); const SwLinePortion *pPor = GetPortion(); KSHORT nPorWidth = 0; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 22c49fd20020..8760c7232d56 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1524,6 +1524,7 @@ void SwWW8ImplReader::ImportDop() rDoc.set(IDocumentSettingAccess::TAB_OVERFLOW, true); rDoc.set(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS, true); rDoc.set(IDocumentSettingAccess::CLIPPED_PICTURES, true); + rDoc.set(IDocumentSettingAccess::TAB_OVER_MARGIN, true); // // COMPATIBILITY FLAGS END diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 637ef884190f..a6cdc422caa5 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1142,6 +1142,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC aSet.insert(String("UnbreakableNumberings", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("ClippedPictures", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("BackgroundParaOverDrawings", RTL_TEXTENCODING_ASCII_US)); + aSet.insert(String("TabOverMargin", RTL_TEXTENCODING_ASCII_US)); sal_Int32 nCount = aConfigProps.getLength(); const PropertyValue* pValues = aConfigProps.getConstArray(); @@ -1175,6 +1176,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bool bUnbreakableNumberings = false; bool bClippedPictures = false; bool bBackgroundParaOverDrawings = false; + bool bTabOverMargin = false; OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) ); @@ -1267,6 +1269,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bClippedPictures = true; else if ( pValues->Name == "BackgroundParaOverDrawings" ) bBackgroundParaOverDrawings = true; + else if ( pValues->Name == "TabOverMargin" ) + bTabOverMargin = true; } catch( Exception& ) { @@ -1454,6 +1458,9 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if ( !bBackgroundParaOverDrawings ) xProps->setPropertyValue("BackgroundParaOverDrawings", makeAny( false ) ); + if ( !bTabOverMargin ) + xProps->setPropertyValue("TabOverMargin", makeAny( false ) ); + Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY ); Reference < XText > xText = xTextDoc->getText(); Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY); diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index ede40fd2b794..828b6037e763 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -122,7 +122,8 @@ enum SwDocumentSettingsPropertyHandles HANDLE_CLIPPED_PICTURES, HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, HANDLE_EMBED_FONTS, - HANDLE_EMBED_SYSTEM_FONTS + HANDLE_EMBED_SYSTEM_FONTS, + HANDLE_TAB_OVER_MARGIN, }; static MasterPropertySetInfo * lcl_createSettingsInfo() @@ -191,6 +192,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { RTL_CONSTASCII_STRINGPARAM("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("EmbedFonts"), HANDLE_EMBED_FONTS, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, CPPUTYPE_BOOLEAN, 0, 0}, + { RTL_CONSTASCII_STRINGPARAM("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, CPPUTYPE_BOOLEAN, 0, 0}, /* * As OS said, we don't have a view when we need to set this, so I have to * find another solution before adding them to this property set - MTG @@ -785,6 +787,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->set(IDocumentSettingAccess::EMBED_SYSTEM_FONTS, bTmp); } break; + case HANDLE_TAB_OVER_MARGIN: + { + sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); + mpDoc->set(IDocumentSettingAccess::TAB_OVER_MARGIN, bTmp); + } + break; default: throw UnknownPropertyException(); } @@ -1192,6 +1200,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue.setValue( &bTmp, ::getBooleanCppuType() ); } break; + case HANDLE_TAB_OVER_MARGIN: + { + sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::TAB_OVER_MARGIN ); + rValue.setValue( &bTmp, ::getBooleanCppuType() ); + } + break; default: throw UnknownPropertyException(); } |