sw/inc/IDocumentSettingAccess.hxx | 1 + sw/inc/doc.hxx | 1 + sw/source/core/doc/doc.cxx | 5 +++++ sw/source/core/doc/docnew.cxx | 1 + sw/source/core/text/txttab.cxx | 5 ++++- sw/source/filter/ww8/ww8par.cxx | 1 + sw/source/filter/xml/xmlimp.cxx | 10 ++++++++++ sw/source/ui/uno/SwXDocumentSettings.cxx | 16 +++++++++++++++- writerfilter/source/filter/ImportFilter.cxx | 1 + 9 files changed, 39 insertions(+), 2 deletions(-)
New commits: commit 5c65238dea9db745c6d05ac34441c35bb9677229 Author: Miklos Vajna <vmik...@suse.cz> Date: Tue Jan 8 11:57:13 2013 +0100 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) Conflicts: sw/inc/IDocumentSettingAccess.hxx sw/inc/doc.hxx sw/source/core/doc/doc.cxx sw/source/core/doc/docnew.cxx sw/source/filter/xml/xmlimp.cxx sw/source/ui/uno/SwXDocumentSettings.cxx writerfilter/source/filter/ImportFilter.cxx Change-Id: Ib07abd5db1daa916b8b4d9530d09d4d0c4af026e diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index ac5770b..3042f8a 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -86,6 +86,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd UNBREAKABLE_NUMBERINGS, BACKGROUND_PARA_OVER_DRAWINGS, CLIPPED_PICTURES, + TAB_OVER_MARGIN, // COMPATIBILITY FLAGS END BROWSE_MODE, diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 1f269bf..caf0eb6 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -592,6 +592,7 @@ private: bool mbUnbreakableNumberings; bool mbBackgroundParaOverDrawings; bool mbClippedPictures; + bool mbTabOverMargin; bool mbLastBrowseMode : 1; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 07eaa49..5f9461b 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -201,6 +201,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings; case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings; case CLIPPED_PICTURES: return mbClippedPictures; + case TAB_OVER_MARGIN: return mbTabOverMargin; case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked! case HTML_MODE: return mbHTMLMode; @@ -352,6 +353,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) mbClippedPictures = 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 4948f24..5cbc424 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -363,6 +363,7 @@ SwDoc::SwDoc() mbFloattableNomargins = false; mbBackgroundParaOverDrawings = false; mbClippedPictures = false; + mbTabOverMargin = false; // // COMPATIBILITY FLAGS END diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 8841e39..798f687 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -494,7 +494,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 2ab64e8..56d0697 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1580,6 +1580,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 fcca6d8..9b1b992 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1156,6 +1156,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC aSet.insert(String("UnbreakableNumberings", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("BackgroundParaOverDrawings", RTL_TEXTENCODING_ASCII_US)); aSet.insert(String("ClippedPictures", RTL_TEXTENCODING_ASCII_US)); + aSet.insert(String("TabOverMargin", RTL_TEXTENCODING_ASCII_US)); sal_Int32 nCount = aConfigProps.getLength(); const PropertyValue* pValues = aConfigProps.getConstArray(); @@ -1189,6 +1190,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bool bUnbreakableNumberings = false; bool bBackgroundParaOverDrawings = false; bool bClippedPictures = false; + bool bTabOverMargin = false; OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) ); @@ -1281,6 +1283,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bBackgroundParaOverDrawings = true; else if( pValues->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ClippedPictures")) ) bClippedPictures = true; + else if ( pValues->Name == "TabOverMargin" ) + bTabOverMargin = true; } catch( Exception& ) { @@ -1467,6 +1471,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC OUString( RTL_CONSTASCII_USTRINGPARAM("ClippedPictures") ), makeAny( false ) ); } + 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 fdbe7b2..383740f 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -129,7 +129,8 @@ enum SwDocumentSettingsPropertyHandles HANDLE_FLOATTABLE_NOMARGINS, HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, HANDLE_CLIPPED_PICTURES, - HANDLE_STYLES_NODEFAULT + HANDLE_STYLES_NODEFAULT, + HANDLE_TAB_OVER_MARGIN, }; MasterPropertySetInfo * lcl_createSettingsInfo() @@ -196,6 +197,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo() { RTL_CONSTASCII_STRINGPARAM("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("ClippedPictures"), HANDLE_CLIPPED_PICTURES, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, 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 @@ -779,6 +781,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->set(IDocumentSettingAccess::STYLES_NODEFAULT, 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(); } @@ -1175,6 +1183,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(); } diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index 47e663f..dc4a187 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -200,6 +200,7 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >& xSettings->setPropertyValue(rtl::OUString::createFromAscii("FloattableNomargins"), uno::makeAny( sal_True )); xSettings->setPropertyValue( rtl::OUString::createFromAscii("BackgroundParaOverDrawings"), uno::makeAny( sal_True ) ); xSettings->setPropertyValue( rtl::OUString::createFromAscii( "ClippedPictures" ), uno::makeAny( sal_True ) ); + xSettings->setPropertyValue( "TabOverMargin", uno::makeAny( sal_True ) ); // Don't load the default style definitions to avoid weird mix xSettings->setPropertyValue( "StylesNoDefault", uno::makeAny( sal_True ) ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits