instsetoo_native/util/openoffice.lst | 24 ++-- oox/source/drawingml/chart/axisconverter.cxx | 4 solenv/inc/minor.mk | 4 sw/CppunitTest_sw_subsequent_odfimport.mk | 5 + sw/inc/crsrsh.hxx | 4 sw/inc/viewsh.hxx | 2 sw/qa/extras/odfimport/data/fdo37606.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 74 +++++++++++++++ sw/qa/extras/ooxmlimport/data/bnc779620.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 ++ sw/source/core/crsr/crsrsh.cxx | 31 ++++++ sw/source/core/edit/eddel.cxx | 4 sw/source/core/edit/edglss.cxx | 12 ++ sw/source/core/layout/trvlfrm.cxx | 5 + sw/source/core/view/vnew.cxx | 2 sw/source/ui/inc/swdtflvr.hxx | 2 sw/source/ui/wrtsh/select.cxx | 9 + writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 25 ++--- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 18 +++ writerfilter/source/dmapper/PropertyMap.cxx | 15 +++ 20 files changed, 213 insertions(+), 37 deletions(-)
New commits: commit fdb5c84a814e294881f16d9003c1bb17c50a95ac Author: Andras Timar <[email protected]> Date: Thu Oct 3 23:28:51 2013 -0700 Bump for 4.0-17 Change-Id: I725c090eee8094e85a64c18816af2ace8aaa010b diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst index 267cf38..a1028ae 100644 --- a/instsetoo_native/util/openoffice.lst +++ b/instsetoo_native/util/openoffice.lst @@ -33,7 +33,7 @@ Globals CREATE_MSP_INSTALLSET 0 UPDATE_DATABASE_LISTNAME finals_instsetoo.txt PACKAGEMAP package_names.txt,package_names_ext.txt - WINDOWSPATCHLEVEL 16 + WINDOWSPATCHLEVEL 17 OOOVENDOR The Document Foundation OOODOWNLOADNAME 1 BUILDIDCWS {buildidcws} @@ -50,13 +50,13 @@ LibreOffice { PRODUCTNAME LibreOffice PRODUCTVERSION 4.0 - PRODUCTEXTENSION -16 + PRODUCTEXTENSION -17 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 4.0 USERDIRPRODUCTVERSION 4 ABOUTBOXPRODUCTVERSION 4.0 - ABOUTBOXPRODUCTVERSIONSUFFIX :build-316 + ABOUTBOXPRODUCTVERSIONSUFFIX :build-317 BASEPRODUCTVERSION 4.0 PCPFILENAME libreoffice.pcp UPDATEURL http://update.libreoffice.org/check.php @@ -100,14 +100,14 @@ LibreOffice_Dev { PRODUCTNAME LOdev PRODUCTVERSION 4.0 - PRODUCTEXTENSION -16 + PRODUCTEXTENSION -17 UNIXBASISROOTNAME lodev4.0 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 4.0 USERDIRPRODUCTVERSION 4 ABOUTBOXPRODUCTVERSION 4.0 - ABOUTBOXPRODUCTVERSIONSUFFIX :build-316 + ABOUTBOXPRODUCTVERSIONSUFFIX :build-317 BASEPRODUCTVERSION 4.0 DEVELOPMENTPRODUCT 1 BASISPACKAGEPREFIX lodevbasis @@ -161,7 +161,7 @@ URE PRODUCTVERSION 4.0 PACKAGEVERSION 4.0 PACKAGEREVISION 1 - PRODUCTEXTENSION -16 + PRODUCTEXTENSION -17 BRANDPACKAGEVERSION 4.0 LICENSENAME LGPL NOVERSIONINDIRNAME 1 @@ -192,7 +192,7 @@ LibreOffice_SDK { PRODUCTNAME LibreOffice PRODUCTVERSION 4.0 - PRODUCTEXTENSION -16 + PRODUCTEXTENSION -17 POSTVERSIONEXTENSION SDK POSTVERSIONEXTENSIONUNIX sdk BRANDPACKAGEVERSION 4.0 @@ -231,7 +231,7 @@ LibreOffice_Dev_SDK { PRODUCTNAME LOdev PRODUCTVERSION 4.0 - PRODUCTEXTENSION -16 + PRODUCTEXTENSION -17 UNIXBASISROOTNAME lodev4.0 POSTVERSIONEXTENSION SDK POSTVERSIONEXTENSIONUNIX sdk @@ -276,7 +276,7 @@ LibreOffice_Test { PRODUCTNAME LibreOffice PRODUCTVERSION 4.0 - PRODUCTEXTENSION -16 + PRODUCTEXTENSION -17 POSTVERSIONEXTENSION TEST POSTVERSIONEXTENSIONUNIX test BRANDPACKAGEVERSION 4.0 @@ -315,7 +315,7 @@ LibreOffice_Dev_Test { PRODUCTNAME LOdev PRODUCTVERSION 4.0 - PRODUCTEXTENSION -16 + PRODUCTEXTENSION -17 UNIXBASISROOTNAME lodev4.0 POSTVERSIONEXTENSION TEST POSTVERSIONEXTENSIONUNIX test @@ -359,13 +359,13 @@ OxygenOffice { PRODUCTNAME OxygenOffice PRODUCTVERSION 4.0 - PRODUCTEXTENSION -16 + PRODUCTEXTENSION -17 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 4.0 USERDIRPRODUCTVERSION 4 ABOUTBOXPRODUCTVERSION 4.0 - ABOUTBOXPRODUCTVERSIONSUFFIX :build-316 + ABOUTBOXPRODUCTVERSIONSUFFIX :build-317 BASEPRODUCTVERSION 4.0 PCPFILENAME openoffice.pcp UPDATEURL http://update.libreoffice.org/check.php diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index 1cb6a96..d7bd97a 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,6 +1,6 @@ RSCVERSION=400 -RSCREVISION=400m1(Build:316) -BUILD=316 +RSCREVISION=400m1(Build:317) +BUILD=317 LAST_MINOR=m0 SOURCEVERSION=OOO400 commit ad425ac87b5295cc3db3323bda93949d2f1b96e0 Author: Miklos Vajna <[email protected]> Date: Tue Oct 1 16:57:56 2013 +0200 bnc#779620 DOCX import: try harder to convert floating tables to text frames Since 78d1f1c2835b9fae0f91ed771fc1d594c7817502, we convert floating tables to text frames only in case it's possible that there will be wrapping, to give better results for multi-page tables, which are multi-page, and technically floating ones, but that has no effect on the layout. The problem was that we try to do this decision too early, effectively the page width and margins were counted from the default letter size, instead of the actual values, which did not arrive at the time of the decision. Fix this by moving this logic at the section end. Change-Id: Ic1fbceb54c8ec223ed01836fafe6220bb3b2410a (cherry picked from commit bbef85c157169efa958ea1014d91d467cb243e6f) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx writerfilter/source/dmapper/DomainMapper_Impl.hxx diff --git a/sw/qa/extras/ooxmlimport/data/bnc779620.docx b/sw/qa/extras/ooxmlimport/data/bnc779620.docx new file mode 100644 index 0000000..23c126d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/bnc779620.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 648baba..33c0ece 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -138,6 +138,7 @@ public: void testFdo68607(); void testVmlTextVerticalAdjust(); void testGroupshapeSdt(); + void testBnc779620(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -224,6 +225,7 @@ void Test::run() {"fdo68607.docx", &Test::testFdo68607}, {"vml-text-vertical-adjust.docx", &Test::testVmlTextVerticalAdjust}, {"groupshape-sdt.docx", &Test::testGroupshapeSdt}, + {"bnc779620.docx", &Test::testBnc779620}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -1398,6 +1400,14 @@ void Test::testGroupshapeSdt() CPPUNIT_ASSERT_EQUAL(sal_Int32(20), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xShape->getText()), 1), "CharKerning")); } +void Test::testBnc779620() +{ + // The problem was that the floating table was imported as a non-floating one. + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 571ef77..1facd2a 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -765,19 +765,7 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) uno::Reference<text::XTextRange> xStart; uno::Reference<text::XTextRange> xEnd; - bool bNoFly = false; - if (SectionPropertyMap* pSectionContext = m_rDMapper_Impl.GetSectionContext()) - { - sal_Int32 nTextAreaWidth = pSectionContext->GetPageWidth() - pSectionContext->GetLeftMargin() - pSectionContext->GetRightMargin(); - sal_Int32 nTableWidth = 0; - m_aTableProperties->getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth ); - // If the table is wider than the text area, then don't create a fly - // for the table: no wrapping will be performed anyway, but multi-page - // tables will be broken. - bNoFly = nTableWidth >= nTextAreaWidth; - } - - bool bFloating = aFrameProperties.hasElements() && !bNoFly; + bool bFloating = aFrameProperties.hasElements(); // Additional checks: if we can do this. if (bFloating && (*m_pTableSeq)[0].getLength() > 0 && (*m_pTableSeq)[0][0].getLength() > 0) { @@ -864,7 +852,16 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) // A non-zero left margin would move the table out of the frame, move the frame itself instead. xTableProperties->setPropertyValue("LeftMargin", uno::makeAny(sal_Int32(0))); - uno::Reference< text::XTextContent > xFrame = m_xText->convertToTextFrame(xStart, xEnd, aFrameProperties); + // In case the document ends with a table, we're called after + // SectionPropertyMap::CloseSectionGroup(), so we'll have no idea + // about the text area width, nor can fix this by delaying the text + // frame conversion: just do it here. + sal_Int32 nTableWidth = 0; + m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, nTableWidth); + if (m_rDMapper_Impl.GetSectionContext()) + m_rDMapper_Impl.m_aPendingFloatingTables.push_back(FloatingTableInfo(xStart, xEnd, aFrameProperties, nTableWidth)); + else + m_xText->convertToTextFrame(xStart, xEnd, aFrameProperties); } } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index ccca0dc..fe5ac78 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -281,6 +281,22 @@ struct LineNumberSettings }; +/// Contains information about a table that will be potentially converted to a floating one at the section end. +struct FloatingTableInfo +{ + uno::Reference<text::XTextRange> m_xStart; + uno::Reference<text::XTextRange> m_xEnd; + uno::Sequence<beans::PropertyValue> m_aFrameProperties; + sal_Int32 m_nTableWidth; + + FloatingTableInfo(uno::Reference<text::XTextRange> xStart, uno::Reference<text::XTextRange> xEnd, uno::Sequence<beans::PropertyValue> aFrameProperties, sal_Int32 nTableWidth) + : m_xStart(xStart), + m_xEnd(xEnd), + m_aFrameProperties(aFrameProperties), + m_nTableWidth(nTableWidth) + { + } +}; class DomainMapper; class WRITERFILTER_DLLPRIVATE DomainMapper_Impl @@ -692,6 +708,8 @@ public: * PFInTable SPRM or not). */ sal_Int32 m_nTableDepth; + /// Pending floating tables: they may be converted to text frames at the section end. + std::vector<FloatingTableInfo> m_aPendingFloatingTables; }; } //namespace dmapper } //namespace writerfilter diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 62c6272..38f6c61 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -845,6 +845,21 @@ void SectionPropertyMap::HandleMarginsHeaderFooter(DomainMapper_Impl& rDM_Impl) void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) { + // Text area width is known at the end of a section: decide if tables should be converted or not. + std::vector<FloatingTableInfo>& rPendingFloatingTables = rDM_Impl.m_aPendingFloatingTables; + sal_Int32 nTextAreaWidth = GetPageWidth() - GetLeftMargin() - GetRightMargin(); + uno::Reference<text::XTextAppendAndConvert> xBodyText( rDM_Impl.GetBodyText(), uno::UNO_QUERY ); + for (size_t i = 0; i < rPendingFloatingTables.size(); ++i) + { + FloatingTableInfo& rInfo = rPendingFloatingTables[i]; + // If the table is wider than the text area, then don't create a fly + // for the table: no wrapping will be performed anyway, but multi-page + // tables will be broken. + if (rInfo.m_nTableWidth < nTextAreaWidth) + xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties); + } + rPendingFloatingTables.clear(); + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); if( m_nLnnMod ) { commit 5b19cf63f9e791070314a4e27970f212b4e333e6 Author: Muthu Subramanian <[email protected]> Date: Wed Sep 11 21:41:43 2013 +0530 n#834720: Labels wrongly interpreted as dates. If the numFormat is available we should probably use that. diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index ba01c52..7feb6c9 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -307,10 +307,8 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo { bool bPercent = false; if( mrModel.maNumberFormat.maFormatCode.indexOf('%') >= 0) - { - mrModel.maNumberFormat.mbSourceLinked = false; bPercent = true; - } + mrModel.maNumberFormat.mbSourceLinked = false; getFormatter().convertNumberFormat( aAxisProp, mrModel.maNumberFormat, bPercent ); } commit 0dd07c6febe133e28199c89d1ebd3e75f93858be Author: Andras Timar <[email protected]> Date: Sun Sep 22 07:32:08 2013 -0700 Bump for 4.0-16 Change-Id: Ia7d8e427295b813268b74a8cfb4b8a1e686aa3d8 diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst index 9f948d5..267cf38 100644 --- a/instsetoo_native/util/openoffice.lst +++ b/instsetoo_native/util/openoffice.lst @@ -33,7 +33,7 @@ Globals CREATE_MSP_INSTALLSET 0 UPDATE_DATABASE_LISTNAME finals_instsetoo.txt PACKAGEMAP package_names.txt,package_names_ext.txt - WINDOWSPATCHLEVEL 15 + WINDOWSPATCHLEVEL 16 OOOVENDOR The Document Foundation OOODOWNLOADNAME 1 BUILDIDCWS {buildidcws} @@ -50,13 +50,13 @@ LibreOffice { PRODUCTNAME LibreOffice PRODUCTVERSION 4.0 - PRODUCTEXTENSION -15 + PRODUCTEXTENSION -16 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 4.0 USERDIRPRODUCTVERSION 4 ABOUTBOXPRODUCTVERSION 4.0 - ABOUTBOXPRODUCTVERSIONSUFFIX :build-315 + ABOUTBOXPRODUCTVERSIONSUFFIX :build-316 BASEPRODUCTVERSION 4.0 PCPFILENAME libreoffice.pcp UPDATEURL http://update.libreoffice.org/check.php @@ -100,14 +100,14 @@ LibreOffice_Dev { PRODUCTNAME LOdev PRODUCTVERSION 4.0 - PRODUCTEXTENSION -15 + PRODUCTEXTENSION -16 UNIXBASISROOTNAME lodev4.0 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 4.0 USERDIRPRODUCTVERSION 4 ABOUTBOXPRODUCTVERSION 4.0 - ABOUTBOXPRODUCTVERSIONSUFFIX :build-315 + ABOUTBOXPRODUCTVERSIONSUFFIX :build-316 BASEPRODUCTVERSION 4.0 DEVELOPMENTPRODUCT 1 BASISPACKAGEPREFIX lodevbasis @@ -161,7 +161,7 @@ URE PRODUCTVERSION 4.0 PACKAGEVERSION 4.0 PACKAGEREVISION 1 - PRODUCTEXTENSION -15 + PRODUCTEXTENSION -16 BRANDPACKAGEVERSION 4.0 LICENSENAME LGPL NOVERSIONINDIRNAME 1 @@ -192,7 +192,7 @@ LibreOffice_SDK { PRODUCTNAME LibreOffice PRODUCTVERSION 4.0 - PRODUCTEXTENSION -15 + PRODUCTEXTENSION -16 POSTVERSIONEXTENSION SDK POSTVERSIONEXTENSIONUNIX sdk BRANDPACKAGEVERSION 4.0 @@ -231,7 +231,7 @@ LibreOffice_Dev_SDK { PRODUCTNAME LOdev PRODUCTVERSION 4.0 - PRODUCTEXTENSION -15 + PRODUCTEXTENSION -16 UNIXBASISROOTNAME lodev4.0 POSTVERSIONEXTENSION SDK POSTVERSIONEXTENSIONUNIX sdk @@ -276,7 +276,7 @@ LibreOffice_Test { PRODUCTNAME LibreOffice PRODUCTVERSION 4.0 - PRODUCTEXTENSION -15 + PRODUCTEXTENSION -16 POSTVERSIONEXTENSION TEST POSTVERSIONEXTENSIONUNIX test BRANDPACKAGEVERSION 4.0 @@ -315,7 +315,7 @@ LibreOffice_Dev_Test { PRODUCTNAME LOdev PRODUCTVERSION 4.0 - PRODUCTEXTENSION -15 + PRODUCTEXTENSION -16 UNIXBASISROOTNAME lodev4.0 POSTVERSIONEXTENSION TEST POSTVERSIONEXTENSIONUNIX test @@ -359,13 +359,13 @@ OxygenOffice { PRODUCTNAME OxygenOffice PRODUCTVERSION 4.0 - PRODUCTEXTENSION -15 + PRODUCTEXTENSION -16 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 4.0 USERDIRPRODUCTVERSION 4 ABOUTBOXPRODUCTVERSION 4.0 - ABOUTBOXPRODUCTVERSIONSUFFIX :build-315 + ABOUTBOXPRODUCTVERSIONSUFFIX :build-316 BASEPRODUCTVERSION 4.0 PCPFILENAME openoffice.pcp UPDATEURL http://update.libreoffice.org/check.php diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index 0f38c76..1cb6a96 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,6 +1,6 @@ RSCVERSION=400 -RSCREVISION=400m1(Build:315) -BUILD=315 +RSCREVISION=400m1(Build:316) +BUILD=316 LAST_MINOR=m0 SOURCEVERSION=OOO400 commit 8d2f01088a9449d7137b51cb01a8a0a866ca1841 Author: Miklos Vajna <[email protected]> Date: Mon Sep 16 12:12:42 2013 +0200 bnc#825891 fdo#37606 SwWrtShell::SelAll(): fix for doc starting with table SwWrtShell::SelAll() can now detect if the body text starts with a table, and if so, it explicitly selects the whole document, not just the first cell of the starting table. Also, SwCrsrShell::EndAction() now checks for this "select all and doc starts with table" situation, and if that's the case, it activates a special select all mode, so layout can act accordingly. (cherry picked from commit 3b11e66ab89c201591d8be8f1ab1af1aba11a821) Conflicts: sw/source/core/crsr/crsrsh.cxx sw/source/core/layout/trvlfrm.cxx fdo#37606 SwWrtShell: fix select all when doc starts with table and cursor ... ... is outside that table (cherry picked from commit 4b6445dba6bb5b2aed3edb4878ecb327446286e9) fdo#37606 SwEditShell::DeleteSel(): handle document starting with a table If the whole document is selected and the document starts with a table, then we used to delete the contents of the document, except the starting table, which was just cleared. Change this and do what is expected: remove the table as well, so the document will have a single empty paragraph only. (cherry picked from commit 0fb4adcff534e3841cf6df0e2363fb0797af7022) Conflicts: sw/source/core/edit/eddel.cxx fdo#37606 SwEditShell: fix copying when doc starts with a table ... ... and the whole document was selected The problem is that the cursor starts at the first cell of the starting table, but when copying, we want to copy the preceding startnode and tablenode as well. (cherry picked from commit 49505336a629a75f4fb48bbe0c532b402e857ed4) fdo#37606 testcase (cherry picked from commit f5fa78d75abac3dbe0f9edf9e9106f63ca5dca53) Conflicts: sw/qa/extras/odfimport/odfimport.cxx Change-Id: I60d34906a90a5143163e516f618648cf7178430e Conflicts: sw/CppunitTest_sw_odfimport.mk sw/inc/viewsh.hxx sw/qa/extras/odfimport/odfimport.cxx sw/source/core/crsr/crsrsh.cxx sw/source/core/view/vnew.cxx diff --git a/sw/CppunitTest_sw_subsequent_odfimport.mk b/sw/CppunitTest_sw_subsequent_odfimport.mk index f7ad4eb..23b5a8f 100644 --- a/sw/CppunitTest_sw_subsequent_odfimport.mk +++ b/sw/CppunitTest_sw_subsequent_odfimport.mk @@ -38,6 +38,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_odfimport, \ cppu \ cppuhelper \ sal \ + svt \ sw \ test \ unotest \ @@ -53,6 +54,7 @@ $(eval $(call gb_CppunitTest_use_externals,sw_subsequent_odfimport,\ $(eval $(call gb_CppunitTest_set_include,sw_subsequent_odfimport,\ -I$(SRCDIR)/sw/inc \ -I$(SRCDIR)/sw/source/core/inc \ + -I$(SRCDIR)/sw/source/ui/inc \ -I$(SRCDIR)/sw/qa/extras/inc \ $$(INCLUDE) \ )) @@ -87,6 +89,9 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_odfimport,\ unotools/util/utl \ unoxml/source/service/unoxml \ uui/util/uui \ + $(if $(filter-out MACOSX WNT,$(OS)), \ + vcl/vcl.unx \ + ) \ $(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \ )) diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 5a061db..f8dfdd2 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -324,6 +324,10 @@ public: // if ExtendedSelect() is called afterwards, the whole nodes array is selected // only for usage in special cases allowed! void ExtendedSelectAll(); + /// If ExtendedSelectAll() was called and selection didn't change since then. + bool ExtendedSelectedAll(); + /// If document body starts with a table. + bool StartsWithTable(); SwPaM* GetCrsr( sal_Bool bMakeTblCrsr = sal_True ) const; inline SwCursor* GetSwCrsr( sal_Bool bMakeTblCrsr = sal_True ) const; diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 3ddfbe4..749023f 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -193,6 +193,7 @@ protected: sal_uInt16 nStartAction; // != 0 if at least one ::com::sun::star::chaos::Action is active. sal_uInt16 nLockPaint; // != 0 if Paint is locked. + bool mbSelectAll; ///< Special select all mode: whole document selected, even if doc starts with table. public: TYPEINFO(); @@ -564,6 +565,7 @@ public: bool IsHeaderFooterEdit() const { return bHeaderFooterEdit; } bool IsShowHeaderFooterSeparator( FrameControlType eControl ) { return (eControl == Header)? bShowHeaderSeparator: bShowFooterSeparator; } virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow ) { if ( eControl == Header ) bShowHeaderSeparator = bShow; else bShowFooterSeparator = bShow; } + bool IsSelectAll() { return mbSelectAll; } }; //---- class CurrShell manages global ShellPointer ------------------- diff --git a/sw/qa/extras/odfimport/data/fdo37606.odt b/sw/qa/extras/odfimport/data/fdo37606.odt new file mode 100644 index 0000000..462984f Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo37606.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 8d86bd5..456eb50 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -30,6 +30,12 @@ #include <com/sun/star/text/XTextTable.hpp> #include <swmodeltestbase.hxx> +#include <wrtsh.hxx> +#include <ndtxt.hxx> +#include <swdtflvr.hxx> +#include <view.hxx> +#include <edtwin.hxx> + typedef std::map<OUString, com::sun::star::uno::Sequence< com::sun::star::table::BorderLine> > AllBordersMap; typedef std::pair<OUString, com::sun::star::uno::Sequence< com::sun::star::table::BorderLine> > StringSequencePair; @@ -40,6 +46,8 @@ public: void testHideAllSections(); void testOdtBorders(); void testFdo56272(); + void testFdo37606(); + void testFdo37606Copy(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -58,9 +66,13 @@ void Test::run() {"fdo53210.odt", &Test::testHideAllSections}, {"borders_ooo33.odt", &Test::testOdtBorders}, {"fdo56272.odt", &Test::testFdo56272}, + {"fdo37606.odt", &Test::testFdo37606}, + {"fdo37606.odt", &Test::testFdo37606Copy}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { + if (mxComponent.is()) + mxComponent->dispose(); MethodEntry<Test>& rEntry = aMethods[i]; mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/odfimport/data/") + OUString::createFromAscii(rEntry.pName)); (this->*rEntry.pMethod)(); @@ -281,6 +293,68 @@ void Test::testFdo56272() CPPUNIT_ASSERT_EQUAL(sal_Int32(422), xShape->getPosition().Y); // Was -2371 } +void Test::testFdo37606() +{ + SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + SwWrtShell* pWrtShell = pTxtDoc->GetDocShell()->GetWrtShell(); + SwShellCrsr* pShellCrsr = pWrtShell->getShellCrsr(false); + + { + pWrtShell->SelAll(); + SwTxtNode& rStart = dynamic_cast<SwTxtNode&>(pShellCrsr->Start()->nNode.GetNode()); + CPPUNIT_ASSERT_EQUAL(String("A1"), rStart.GetTxt()); + + SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode()); + // This was "A1", i.e. Ctrl-A only selected the A1 cell of the table, not the whole document. + CPPUNIT_ASSERT_EQUAL(String("Hello."), rEnd.GetTxt()); + } + + { + pWrtShell->SttEndDoc(false); // Go to the end of the doc. + pWrtShell->SelAll(); // And now that we're outside of the table, try Ctrl-A again. + SwTxtNode& rStart = dynamic_cast<SwTxtNode&>(pShellCrsr->Start()->nNode.GetNode()); + // This was "Hello", i.e. Ctrl-A did not select the starting table. + CPPUNIT_ASSERT_EQUAL(String("A1"), rStart.GetTxt()); + + SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode()); + CPPUNIT_ASSERT_EQUAL(String("Hello."), rEnd.GetTxt()); + } + + { + pWrtShell->Delete(); // Delete the selection + // And make sure the table got deleted as well. + SwNodes& rNodes = pWrtShell->GetDoc()->GetNodes(); + SwNodeIndex nNode(rNodes.GetEndOfExtras()); + SwCntntNode* pCntntNode = rNodes.GoNext(&nNode); + // First content node was in a table -> table wasn't deleted. + CPPUNIT_ASSERT(!pCntntNode->FindTableNode()); + } +} + +void Test::testFdo37606Copy() +{ + SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + SwWrtShell* pWrtShell = pTxtDoc->GetDocShell()->GetWrtShell(); + // Ctrl-A + pWrtShell->SelAll(); + + // Ctrl-C + SwTransferable* pTransferable = new SwTransferable(*pWrtShell); + uno::Reference<datatransfer::XTransferable> xTransferable(pTransferable); + pTransferable->Copy(); + + pWrtShell->SttEndDoc(false); // Go to the end of the doc. + + // Ctrl-V + TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromSystemClipboard(&pWrtShell->GetView().GetEditWin())); + SwTransferable::Paste( *pWrtShell, aDataHelper ); + + // Previously copy&paste failed to copy the table in case it was the document-starting one. + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index ac00ff7..75dec38 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -58,6 +58,7 @@ #include <numrule.hxx> #include <IGrammarContact.hxx> +#include <comphelper/flagguard.hxx> #include <globals.hrc> #include <comcore.hrc> @@ -238,6 +239,7 @@ void SwCrsrShell::StartAction() void SwCrsrShell::EndAction( const sal_Bool bIdleEnd ) { sal_Bool bVis = bSVCrsrVis; + comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll()); // Idle-formatting? if( bIdleEnd && Imp()->GetRegion() ) @@ -545,6 +547,32 @@ void SwCrsrShell::ExtendedSelectAll() pPos->nContent.Assign( pCNd, pCNd ? pCNd->Len() : 0 ); } +bool SwCrsrShell::ExtendedSelectedAll() +{ + SwNodes& rNodes = GetDoc()->GetNodes(); + SwNodeIndex nNode = rNodes.GetEndOfPostIts(); + SwCntntNode* pStart = rNodes.GoNext(&nNode); + + nNode = rNodes.GetEndOfContent(); + SwCntntNode* pEnd = rNodes.GoPrevious(&nNode); + + if (!pStart || !pEnd) + return false; + + SwPosition aStart(*pStart, 0); + SwPosition aEnd(*pEnd, pEnd->Len()); + SwShellCrsr* pShellCrsr = getShellCrsr(false); + return aStart == *pShellCrsr->Start() && aEnd == *pShellCrsr->End(); +} + +bool SwCrsrShell::StartsWithTable() +{ + SwNodes& rNodes = GetDoc()->GetNodes(); + SwNodeIndex nNode(rNodes.GetEndOfExtras()); + SwCntntNode* pCntntNode = rNodes.GoNext(&nNode); + return pCntntNode->FindTableNode(); +} + sal_Bool SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage ) { sal_Bool bRet = sal_False; @@ -1130,6 +1158,7 @@ sal_Bool SwCrsrShell::GoPrevCrsr() void SwCrsrShell::Paint( const Rectangle &rRect) { + comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll()); SET_CURR_SHELL( this ); // always switch off all cursors when painting @@ -1311,7 +1340,7 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd ) pDoc->IsIdxInTbl( pTstCrsr->GetPoint()->nNode ) && ( pTblCrsr || pTstCrsr->GetNode( sal_True )->StartOfSectionNode() != - pTstCrsr->GetNode( sal_False )->StartOfSectionNode() ) ) + pTstCrsr->GetNode( sal_False )->StartOfSectionNode() ) && !mbSelectAll) { SwShellCrsr* pITmpCrsr = getShellCrsr( true ); Point aTmpPt( pITmpCrsr->GetPtPos() ); diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index ca20b2d..1f98618 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -39,6 +39,7 @@ void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo ) { + bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(); // nur bei Selektion if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark()) return; @@ -49,9 +50,10 @@ void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo ) // 1. Point und Mark stehen in einer Box, Selection normal loeschen // 2. Point und Mark stehen in unterschiedlichen Boxen, alle // selektierten Boxen suchen in den Inhalt loeschen + // 3. Point and Mark are at the document start and end, Point is in a table: delete selection as usual if( rPam.GetNode()->FindTableNode() && rPam.GetNode()->StartOfSectionNode() != - rPam.GetNode(sal_False)->StartOfSectionNode() ) + rPam.GetNode(sal_False)->StartOfSectionNode() && !bSelectAll ) { // in Tabellen das Undo gruppieren if( pUndo && !*pUndo ) diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 9125987..8828b97e 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -226,6 +226,7 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd ) bool bColSel = _GetCrsr()->IsColumnSelection(); if( bColSel && pInsDoc->IsClipBoard() ) pInsDoc->SetColumnSelection( true ); + bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(); { FOREACHPAM_START(this) @@ -244,7 +245,16 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd ) } else { - bRet = GetDoc()->CopyRange( *PCURCRSR, aPos, false ) || bRet; + // Make a copy, so that in case we need to adjust the selection + // for the purpose of copying, our shell cursor is not touched. + // (Otherwise we would have to restore it.) + SwPaM aPaM(*PCURCRSR); + if (bSelectAll) + // Selection starts at the first para of the first cell, + // but we want to copy the table and the start node before + // the first cell as well. + aPaM.Start()->nNode = aPaM.Start()->nNode.GetNode().FindTableNode()->GetIndex(); + bRet = GetDoc()->CopyRange( aPaM, aPos, false ) || bRet; } FOREACHPAM_END() diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 6e60864..538ea61 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -2581,6 +2581,9 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode ) bool const bBody = pStartFrm->IsInDocBody(); const SwTableBox* pCellBox = pStartFrm->GetUpper()->IsCellFrm() ? ((SwCellFrm*)pStartFrm->GetUpper())->GetTabBox() : 0; + if (pSh->IsSelectAll()) + pCellBox = 0; + const SwCntntFrm *pCntnt = pStartFrm->GetNextCntntFrm(); SwRect aPrvRect; @@ -2602,6 +2605,8 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode ) // same cell frame (or its follow cell) const SwTableBox* pTmpCellBox = pCntnt->GetUpper()->IsCellFrm() ? ((SwCellFrm*)pCntnt->GetUpper())->GetTabBox() : 0; + if (pSh->IsSelectAll()) + pTmpCellBox = 0; if ( bBody == pCntnt->IsInDocBody() && ( !pCellBox || pCellBox == pTmpCellBox ) ) { diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 56b4882..1fb8478 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -196,6 +196,7 @@ ViewShell::ViewShell( SwDoc& rDocument, Window *pWindow, pDoc( &rDocument ), nStartAction( 0 ), nLockPaint( 0 ), + mbSelectAll(false), mpPrePostOutDev(0), // #i72754# maPrePostMapMode() { @@ -279,6 +280,7 @@ ViewShell::ViewShell( ViewShell& rShell, Window *pWindow, pDoc( rShell.GetDoc() ), nStartAction( 0 ), nLockPaint( 0 ), + mbSelectAll(false), mpPrePostOutDev(0), // #i72754# maPrePostMapMode() { diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx index 9a87ec6..8466691 100644 --- a/sw/source/ui/inc/swdtflvr.hxx +++ b/sw/source/ui/inc/swdtflvr.hxx @@ -54,7 +54,7 @@ namespace nsTransferBufferType #define DATA_FLAVOR ::com::sun::star::datatransfer::DataFlavor -class SwTransferable : public TransferableHelper +class SW_DLLPUBLIC SwTransferable : public TransferableHelper { friend class SwView_Impl; SfxObjectShellLock aDocShellRef; diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx index d089a8c..c57c13c 100644 --- a/sw/source/ui/wrtsh/select.cxx +++ b/sw/source/ui/wrtsh/select.cxx @@ -159,6 +159,11 @@ long SwWrtShell::SelAll() } SttSelect(); GoEnd(sal_True, &bMoveTable); + + bool bStartsWithTable = StartsWithTable(); + if (bStartsWithTable) + ExtendedSelectAll(); + if( pStartPos ) { pTmpCrsr = getShellCrsr( false ); @@ -169,9 +174,9 @@ long SwWrtShell::SelAll() // if the last selection was behind the first section or // if the last selection was already the first section // In this both cases we select to the end of document - if( *pTmpCrsr->GetPoint() < *pEndPos || + if( ( *pTmpCrsr->GetPoint() < *pEndPos || ( *pStartPos == *pTmpCrsr->GetMark() && - *pEndPos == *pTmpCrsr->GetPoint() ) ) + *pEndPos == *pTmpCrsr->GetPoint() ) ) && !bStartsWithTable) SwCrsrShell::SttEndDoc(sal_False); } delete pStartPos; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
