sw/inc/IDocumentSettingAccess.hxx | 1 + sw/inc/doc.hxx | 1 + sw/qa/extras/inc/swmodeltestbase.hxx | 7 +++++-- sw/qa/extras/ooxmlimport/data/n793998.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 12 ++++++++++++ sw/source/core/doc/doc.cxx | 5 +++++ sw/source/core/doc/docnew.cxx | 1 + sw/source/core/text/txttab.cxx | 7 +++++-- sw/source/filter/ww8/ww8par.cxx | 1 + sw/source/filter/xml/xmlimp.cxx | 7 +++++++ sw/source/ui/uno/SwXDocumentSettings.cxx | 16 +++++++++++++++- writerfilter/source/filter/ImportFilter.cxx | 1 + 12 files changed, 54 insertions(+), 5 deletions(-)
New commits: commit d7853c1fab14c943b6b2535580f64810b22e225d Author: Miklos Vajna <vmik...@suse.cz> Date: Tue Jan 8 12:56:24 2013 +0100 n#793998 testcase diff --git a/sw/qa/extras/ooxmlimport/data/n793998.docx b/sw/qa/extras/ooxmlimport/data/n793998.docx new file mode 100755 index 0000000..fc96e2e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n793998.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 813b653..28db45e 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -112,6 +112,7 @@ public: void testFineTableDash(); void testN792778(); void testN793262(); + void testN793998(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -176,6 +177,7 @@ void Test::run() {"tableborder-finedash.docx", &Test::testFineTableDash}, {"n792778.docx", &Test::testN792778}, {"n793262.docx", &Test::testN793262}, + {"n793998.docx", &Test::testN793998}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1114,6 +1116,16 @@ void Test::testN793262() CPPUNIT_ASSERT_EQUAL(sal_Int32(76), getProperty<sal_Int32>(xTable->getCellByName("A1"), "TopBorderDistance")); } +void Test::testN793998() +{ + sal_Int32 nTextPortion = parseDump("/root/page/body/txt/Text[1]", "nWidth").toInt32(); // Width of the first (text) portion + sal_Int32 nTabPortion = parseDump("/root/page/body/txt/Text[2]", "nWidth").toInt32(); // Width of the second (tab) portion + sal_Int32 nParagraph = parseDump("/root/page/body/txt/infos/bounds", "width").toInt32(); // Width of the paragraph + sal_Int32 nRightMargin = 3000; + // The problem was that the tab portion didn't ignore the right margin, so text + tab width wasn't larger than body (paragraph - right margin) width. + CPPUNIT_ASSERT(nTextPortion + nTabPortion > nParagraph - nRightMargin); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit bdfc6363d66aa079512cc8008996b633f693fed1 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. diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 2c02236..8214f1a 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 ef40d44..c67f79f 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 dda0b6d..80cfa84 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 cb3bc9c..949cab1 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 4395d55..c6eda0a 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 0db2f7f..7705aae 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1545,6 +1545,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 d085eb8..a86364b 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1144,6 +1144,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(); @@ -1177,6 +1178,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" ) ); @@ -1269,6 +1271,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& ) { @@ -1456,6 +1460,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 ede40fd..828b603 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(); } diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index d58e877..e56cbca 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -192,6 +192,7 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >& xSettings->setPropertyValue("FloattableNomargins", uno::makeAny( sal_True )); xSettings->setPropertyValue( "ClippedPictures", uno::makeAny( sal_True ) ); xSettings->setPropertyValue( "BackgroundParaOverDrawings", uno::makeAny( sal_True ) ); + xSettings->setPropertyValue( "TabOverMargin", uno::makeAny( sal_True ) ); } void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) commit f7623118c415581434937f31f4c56d38a9d02286 Author: Miklos Vajna <vmik...@suse.cz> Date: Tue Jan 8 12:49:51 2013 +0100 SwModelTestBase: clear layout dump cache after testing a document diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 7b4ad3d..128983c 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -60,8 +60,6 @@ public: ~SwModelTestBase() { - if (mpXmlBuffer) - xmlBufferFree(mpXmlBuffer); } virtual void setUp() @@ -259,6 +257,11 @@ protected: { sal_uInt32 nEndTime = osl_getGlobalTimer(); fprintf(stderr, "%" SAL_PRIuUINT32"\n", nEndTime - m_nStartTime); + if (mpXmlBuffer) + { + xmlBufferFree(mpXmlBuffer); + mpXmlBuffer = 0; + } } uno::Reference<lang::XComponent> mxComponent; commit ec376c2934e77fd1b56da892cfe2c1393f4c8156 Author: Miklos Vajna <vmik...@suse.cz> Date: Tue Jan 8 12:22:10 2013 +0100 sw: dump size of tab portions diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 1286f07..4395d55 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -656,7 +656,7 @@ void SwAutoTabDecimalPortion::Paint( const SwTxtPaintInfo & ) const void SwTabPortion::HandlePortion( SwPortionHandler& rPH ) const { - rPH.Text( GetLen(), GetWhichPor() ); + rPH.Text( GetLen(), GetWhichPor(), Height(), Width() ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits