[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source

2023-08-24 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/layout3.cxx   |2 -
 sw/source/core/inc/tabfrm.hxx |2 -
 sw/source/core/layout/frmtool.cxx |7 +++
 sw/source/core/layout/layact.cxx  |5 --
 sw/source/core/layout/tabfrm.cxx  |   68 --
 5 files changed, 68 insertions(+), 16 deletions(-)

New commits:
commit c303981cfd95ce1c3881366023d5495ae2edce97
Author: Michael Stahl 
AuthorDate: Wed Aug 23 15:50:59 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Aug 24 12:43:25 2023 +0200

tdf#156724 sw: layout: fix tables not splitting due to footnotes differently

Revert commit 610c6f02b11b4b4c555a78b0feb2a1eb35159e39 and
and 61a78a523a6131ff98b5d846368e5626fe58d99c instead do the
opposite: never calc content frames in FormatLayout().

There were a few cases where documents looked worse with the fix, such
as the somewhat pathological tdf120139-1.odt and tdf124474-1.odt, but
typically these went from a bad layout to a worse layout, e.g.
--convert-to pdf tdf120139-1.odt went from 11 minutes to 33 minutes
(dbgutil) with twice as many more half-empty pages.

Worse is that the previous fix appears to prevent tdf#128437 from
working.

It should also be less risky to never calc content frames in
FormatLayout(), because with IsPaintLocked() check that used to be done
led to doing it only for pages which were visible when loading the
document, so any regressions with this new approach would appear on few
pages at the start of the document, instead of many pages at the end.

Note that without the previous commit, this would cause
* CppunitTest_sw_core_layout CPPUNIT_TEST_NAME="testTablePrintAreaLeft"
  to fail
* tdf#137523 SwLayoutWriter3 testTdf137523 to fail,
  *only* on the last text frame

This also appears to fix tdf#125749.

Change-Id: I3d72f8e9d2b89aa3738e554308fd9dce12e92238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155988
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index 28b48e7ec0c9..08020de73489 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -108,7 +108,7 @@ class SW_DLLPUBLIC SwTabFrame final: public SwLayoutFrame, 
public SwFlowFrame
  * created and constructed and inserted directly after this.
  * Join() gets the Follow's content and destroys it.
  */
-bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep );
+bool Split(const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep, 
bool & rIsFootnoteGrowth);
 void Join();
 
 void UpdateAttr_(
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 49d7573dd547..e7ee78a9ae6f 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1431,10 +1431,7 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
 PopFormatLayout();
 }
 }
-else if (!pLay->IsColBodyFrame())
-{   // tdf#156724 unconditionally for frames in tables, so their 
footnotes exist before trying to split
-pLow->OptCalc();
-}
+// else: don't calc content frames any more
 
 if ( IsAgain() )
 return false;
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 4acef7ffe5d1..e4be17237e58 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -646,7 +646,8 @@ inline void TableSplitRecalcLock( SwFlowFrame *pTab ) { 
pTab->LockJoin(); }
 inline void TableSplitRecalcUnlock( SwFlowFrame *pTab ) { pTab->UnlockJoin(); }
 
 static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& 
rFollowLine,
-  SwTwips nRemainingSpaceForLastRow, SwTwips 
nAlreadyFree )
+  SwTwips nRemainingSpaceForLastRow, SwTwips 
nAlreadyFree,
+  bool & rIsFootnoteGrowth)
 {
 bool bRet = true;
 
@@ -655,6 +656,34 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, 
SwRowFrame& rFollowLine,
 SwRectFnSet aRectFnSet(rTab.GetUpper());
 SwTwips nCurLastLineHeight = 
aRectFnSet.GetHeight(rLastLine.getFrameArea());
 
+SwTwips nFootnoteHeight(0);
+if (SwFootnoteBossFrame const*const pBoss = rTab.FindFootnoteBossFrame())
+{
+if (SwFootnoteContFrame const*const pCont = pBoss->FindFootnoteCont())
+{
+for (SwFootnoteFrame const* pFootnote = 
static_cast(pCont->Lower());
+ pFootnote != nullptr;
+ pFootnote = static_cast(pFootnote->GetNext()))
+{
+SwContentFrame const*const pAnchor = pFootnote->GetRef();
+SwTabFrame const* pTab = pAnchor->FindTabFrame();
+if (pTab == )
+{
+while 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source unoidl/source

2019-02-13 Thread Libreoffice Gerrit user
 sw/qa/uitest/writer_tests5/tdf123378.py |   25 
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |   10 +++-
 sw/source/uibase/uno/unotxdoc.cxx   |3 -
 unoidl/source/legacyprovider.cxx|1 
 unoidl/source/sourceprovider-parser-requires.hxx|2 
 unoidl/source/sourceprovider-parser.y   |1 
 unoidl/source/sourceprovider-scanner.l  |1 
 unoidl/source/sourcetreeprovider.cxx|3 -
 unoidl/source/unoidl-read.cxx   |2 
 unoidl/source/unoidl-write.cxx  |1 
 10 files changed, 34 insertions(+), 15 deletions(-)

New commits:
commit 7f6a5b433988e80f7d404c67d6320116ecb28c06
Author: Gabor Kelemen 
AuthorDate: Sat Jan 26 09:54:59 2019 +0100
Commit: Miklos Vajna 
CommitDate: Wed Feb 13 12:11:01 2019 +0100

tdf#42949 Fix IWYU warnings in unoidl/

Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

When rechecking make sure to add
-I/$SRCDIR/workdir/YaccTarget/unoidl/source/
to the IWYU cmd to get correct results

Change-Id: Ie3c97d2152ebba80d7c84607bf82b9bed2790eae
Reviewed-on: https://gerrit.libreoffice.org/67520
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx
index 5dc418196cfd..ac133319a63d 100644
--- a/unoidl/source/legacyprovider.cxx
+++ b/unoidl/source/legacyprovider.cxx
@@ -10,7 +10,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #include 
diff --git a/unoidl/source/sourceprovider-parser-requires.hxx 
b/unoidl/source/sourceprovider-parser-requires.hxx
index 95a6052e0252..74b04d450d2b 100644
--- a/unoidl/source/sourceprovider-parser-requires.hxx
+++ b/unoidl/source/sourceprovider-parser-requires.hxx
@@ -14,10 +14,8 @@
 
 #include 
 
-#include 
 #include 
 #include 
-#include 
 
 #define YYLTYPE int
 
diff --git a/unoidl/source/sourceprovider-parser.y 
b/unoidl/source/sourceprovider-parser.y
index af8d0ec193bd..94573b1ea147 100644
--- a/unoidl/source/sourceprovider-parser.y
+++ b/unoidl/source/sourceprovider-parser.y
@@ -17,6 +17,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/unoidl/source/sourceprovider-scanner.l 
b/unoidl/source/sourceprovider-scanner.l
index a4f636829784..014966a1c60e 100644
--- a/unoidl/source/sourceprovider-scanner.l
+++ b/unoidl/source/sourceprovider-scanner.l
@@ -35,6 +35,7 @@
 #include "rtl/ustring.hxx"
 #include "rtl/textenc.h"
 #include "sal/types.h"
+#include 
 
 #include "sourceprovider-parser-requires.hxx"
 #include "sourceprovider-parser.hxx"
diff --git a/unoidl/source/sourcetreeprovider.cxx 
b/unoidl/source/sourcetreeprovider.cxx
index 31294ba1ac06..0d88c8e0565a 100644
--- a/unoidl/source/sourcetreeprovider.cxx
+++ b/unoidl/source/sourcetreeprovider.cxx
@@ -12,7 +12,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -22,8 +21,6 @@
 #include 
 #include 
 
-#include "sourceprovider-parser-requires.hxx"
-#include 
 #include "sourceprovider-scanner.hxx"
 #include "sourcetreeprovider.hxx"
 
diff --git a/unoidl/source/unoidl-read.cxx b/unoidl/source/unoidl-read.cxx
index 30eb7b4e5994..6414fb376a1c 100644
--- a/unoidl/source/unoidl-read.cxx
+++ b/unoidl/source/unoidl-read.cxx
@@ -10,7 +10,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -18,7 +17,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
diff --git a/unoidl/source/unoidl-write.cxx b/unoidl/source/unoidl-write.cxx
index 1626dbe19ea5..ef3d888b66d6 100644
--- a/unoidl/source/unoidl-write.cxx
+++ b/unoidl/source/unoidl-write.cxx
@@ -11,7 +11,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
commit 8e2d16b337fbd1602af26bd9b40d7e86cee5202e
Author: Patrick Jaap 
AuthorDate: Tue Jan 29 16:08:24 2019 +0100
Commit: Miklos Vajna 
CommitDate: Wed Feb 13 12:09:21 2019 +0100

tdf#123002 Disable off-page positioning for footer/header objects only

We should restrict this to this case since the anchor of objects in the
body may appear on another page when the object is moved around.

In constrast, objects in header and footer should not appear on other pages,
so we still disable the "off-page positioning" for them.

Horizontal off-page positioning should be disabled in any case.

See also
tdf#112443 and tdf#120839

Change-Id: I056c74526f38c302ba49297f9f84ec0e958d2cec
Reviewed-on: https://gerrit.libreoffice.org/67088
Tested-by: Jenkins
Tested-by: Xisco Faulí 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx 
b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index d4d44e4ae199..c6724a34e0b4 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source vcl/inc vcl/source writerfilter/source

2018-03-12 Thread Caolán McNamara
 sw/qa/core/data/rtf/fail/forcepoint-4.rtf | 1779 ++
 sw/source/core/crsr/crstrvl.cxx   |5 
 vcl/inc/regionband.hxx|3 
 vcl/source/gdi/region.cxx |8 
 vcl/source/gdi/regionband.cxx |   27 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 
 6 files changed, 1818 insertions(+), 9 deletions(-)

New commits:
commit 079a17447d869fae97c0b1a6dde5fe6a25247685
Author: Caolán McNamara 
Date:   Mon Mar 12 14:13:23 2018 +

forcepoint #27 check region bands loaded from stream for consistency

Change-Id: I92376b5fb4208c78fa25a94d4dd394256793161c
Reviewed-on: https://gerrit.libreoffice.org/51144
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/inc/regionband.hxx b/vcl/inc/regionband.hxx
index 1fb5db93a410..b227226353d1 100644
--- a/vcl/inc/regionband.hxx
+++ b/vcl/inc/regionband.hxx
@@ -36,6 +36,7 @@ private:
 ImplRegionBand* mpLastCheckedBand;
 
 void implReset();
+SAL_WARN_UNUSED_RESULT bool CheckConsistency() const;
 
 public:
 RegionBand();
@@ -46,7 +47,7 @@ public:
 
 bool operator==( const RegionBand& rRegionBand ) const;
 
-void load(SvStream& rIStrm);
+SAL_WARN_UNUSED_RESULT bool load(SvStream& rIStrm);
 void save(SvStream& rIStrm) const;
 
 bool isSingleRectangle() const;
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index bcc8a0c96e9a..ab711c245c3d 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -1586,7 +1586,7 @@ SvStream& ReadRegion(SvStream& rIStrm, vcl::Region& 
rRegion)
 default:
 {
 RegionBand* pNewRegionBand = new RegionBand();
-pNewRegionBand->load(rIStrm);
+bool bSuccess = pNewRegionBand->load(rIStrm);
 rRegion.mpRegionBand.reset(pNewRegionBand);
 
 if(aCompat.GetVersion() >= 2)
@@ -1603,6 +1603,12 @@ SvStream& ReadRegion(SvStream& rIStrm, vcl::Region& 
rRegion)
 }
 }
 
+if (!bSuccess)
+{
+SAL_WARN("vcl.gdi", "bad region band");
+rRegion.SetNull();
+}
+
 break;
 }
 }
diff --git a/vcl/source/gdi/regionband.cxx b/vcl/source/gdi/regionband.cxx
index c93fc4c73d26..77eb2f4a7782 100644
--- a/vcl/source/gdi/regionband.cxx
+++ b/vcl/source/gdi/regionband.cxx
@@ -190,7 +190,7 @@ bool RegionBand::operator==( const RegionBand& rRegionBand 
) const
 
 enum StreamEntryType { STREAMENTRY_BANDHEADER, STREAMENTRY_SEPARATION, 
STREAMENTRY_END };
 
-void RegionBand::load(SvStream& rIStrm)
+bool RegionBand::load(SvStream& rIStrm)
 {
 // clear this instance data
 implReset();
@@ -203,14 +203,14 @@ void RegionBand::load(SvStream& rIStrm)
 rIStrm.ReadUInt16(nTmp16);
 
 if (STREAMENTRY_END == static_cast(nTmp16))
-return;
+return false;
 
 size_t nRecordsPossible = rIStrm.remainingSize() / (2*sizeof(sal_Int32));
 if (!nRecordsPossible)
 {
 OSL_ENSURE(false, "premature end of region stream" );
 implReset();
-return;
+return false;
 }
 
 do
@@ -259,13 +259,19 @@ void RegionBand::load(SvStream& rIStrm)
 {
 OSL_ENSURE(false, "premature end of region stream" );
 implReset();
-return;
+return false;
 }
 
 // get next header
 rIStrm.ReadUInt16( nTmp16 );
 }
 while (STREAMENTRY_END != static_cast(nTmp16) && 
rIStrm.good());
+if (!CheckConsistency())
+{
+implReset();
+return false;
+}
+return true;
 }
 
 void RegionBand::save(SvStream& rOStrm) const
@@ -1155,6 +1161,19 @@ bool RegionBand::Exclude(const RegionBand& rSource)
 return true;
 }
 
+bool RegionBand::CheckConsistency() const
+{
+// look in the band list (don't test first band again!)
+const ImplRegionBand* pBand = mpFirstBand->mpNextBand;
+while (pBand)
+{
+if (!pBand->mpFirstSep)
+return false;
+pBand = pBand->mpNextBand;
+}
+return true;
+}
+
 tools::Rectangle RegionBand::GetBoundRect() const
 {
 
commit 02cf066ee9b8a833a6f19c41489aadff3561a56b
Author: Caolán McNamara 
Date:   Mon Mar 12 14:29:48 2018 +

tdf#107094 backward heading search doesn't always work

regression from...

commit 84e44386d70e886f9bae633ebe915ea3a52f8dbd
Author: Caolán McNamara 
Date:   Wed Nov 12 10:35:18 2014 +

coverity#982189 Unchecked return value

so put it back the way it was and explicitly ignore the return
instead

Change-Id: I6f5ef42b38236ea5f70ddbccfa25a81f2f3e976c

Change-Id: I0c0084247e8570ace2198fa893db273dab00d2b0
Reviewed-on: 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/inc writerfilter/source

2015-10-19 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/hello.docx|binary
 sw/qa/extras/ooxmlimport/data/tdf94374.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|   30 
 writerfilter/inc/dmapper/DomainMapperFactory.hxx|2 -
 writerfilter/source/dmapper/DomainMapper.cxx|4 +-
 writerfilter/source/dmapper/DomainMapper.hxx|1 
 writerfilter/source/dmapper/domainmapperfactory.cxx |3 --
 writerfilter/source/filter/RtfFilter.cxx|4 --
 writerfilter/source/filter/WriterFilter.cxx |3 --
 9 files changed, 35 insertions(+), 12 deletions(-)

New commits:
commit 8396bffef734a543ee81a742d6d4ac8ed03d046a
Author: Miklos Vajna 
Date:   Mon Oct 19 09:23:42 2015 +0200

writerfilter: dmapper ctor can read TextInsertModeRange directly

Change-Id: If17ae09266134b4bc410eab1a1b2f5139ba93a12

diff --git a/writerfilter/inc/dmapper/DomainMapperFactory.hxx 
b/writerfilter/inc/dmapper/DomainMapperFactory.hxx
index 306870a..afd798a 100644
--- a/writerfilter/inc/dmapper/DomainMapperFactory.hxx
+++ b/writerfilter/inc/dmapper/DomainMapperFactory.hxx
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 namespace utl
@@ -41,7 +40,6 @@ public:
  css::uno::Reference const& xModel,
  bool bRepairStorage,
  SourceDocumentType eDocumentType,
- css::uno::Reference const& 
xInsertTextRange,
  utl::MediaDescriptor& rMediaDesc);
 };
 } // namespace dmapper
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 4132d82..d75e3e4 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -95,12 +95,12 @@ DomainMapper::DomainMapper( const uno::Reference< 
uno::XComponentContext >& xCon
 uno::Reference const& xModel,
 bool bRepairStorage,
 SourceDocumentType eDocumentType,
-uno::Reference const& 
xInsertTextRange,
 utl::MediaDescriptor& rMediaDesc) :
 LoggedProperties("DomainMapper"),
 LoggedTable("DomainMapper"),
 LoggedStream("DomainMapper"),
-m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, 
xInsertTextRange, !rMediaDesc.getUnpackedValueOrDefault("InsertMode", false))),
+m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, 
rMediaDesc.getUnpackedValueOrDefault("TextInsertModeRange", 
uno::Reference()),
+!rMediaDesc.getUnpackedValueOrDefault("InsertMode", false))),
 mbIsSplitPara(false)
 {
 // #i24363# tab stops relative to indent
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx 
b/writerfilter/source/dmapper/DomainMapper.hxx
index e058369..c5a2299 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -80,7 +80,6 @@ public:
  css::uno::Reference const& xModel,
  bool bRepairStorage,
  SourceDocumentType eDocumentType,
- css::uno::Reference const& 
xInsertTextRange,
  utl::MediaDescriptor& rMediaDesc);
 virtual ~DomainMapper();
 
diff --git a/writerfilter/source/dmapper/domainmapperfactory.cxx 
b/writerfilter/source/dmapper/domainmapperfactory.cxx
index 193ae20..52e568c 100644
--- a/writerfilter/source/dmapper/domainmapperfactory.cxx
+++ b/writerfilter/source/dmapper/domainmapperfactory.cxx
@@ -20,7 +20,6 @@ Stream::Pointer_t 
DomainMapperFactory::createMapper(css::uno::Reference const& xModel,
 bool bRepairStorage,
 SourceDocumentType eDocumentType,
-css::uno::Reference const& xInsertTextRange,
 utl::MediaDescriptor& rMediaDesc)
 {
 #ifdef DEBUG_WRITERFILTER
@@ -32,7 +31,7 @@ Stream::Pointer_t 
DomainMapperFactory::createMapper(css::uno::Reference& aDescrip
 utl::MediaDescriptor aMediaDesc(aDescriptor);
 bool bRepairStorage = 
aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false);
 bool bIsNewDoc = !aMediaDesc.getUnpackedValueOrDefault("InsertMode", 
false);
-uno::Reference xInsertTextRange = 
aMediaDesc.getUnpackedValueOrDefault("TextInsertModeRange", 
uno::Reference());
 uno::Reference< io::XInputStream > xInputStream;
 
 aMediaDesc.addInputStream();
@@ -145,8 +144,7 @@ sal_Bool RtfFilter::filter(const uno::Sequence< 
beans::PropertyValue >& aDescrip
uno::Reference());
 
 writerfilter::dmapper::SourceDocumentType eType = 
writerfilter::dmapper::SourceDocumentType::RTF;
-writerfilter::Stream::Pointer_t pStream(
-
writerfilter::dmapper::DomainMapperFactory::createMapper(m_xContext, 
xInputStream, m_xDstDoc, bRepairStorage, eType, xInsertTextRange, aMediaDesc));
+writerfilter::Stream::Pointer_t 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source

2015-08-25 Thread Caolán McNamara
 sw/qa/core/data/ww5/pass/crash-2.doc |binary
 sw/source/filter/ww8/ww8glsy.cxx |   10 --
 sw/source/filter/ww8/ww8par.cxx  |   27 ---
 sw/source/filter/ww8/ww8par.hxx  |8 
 4 files changed, 24 insertions(+), 21 deletions(-)

New commits:
commit 5da016f5e78f7f36136a8179e152aa14aee3d187
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Aug 25 12:22:31 2015 +0100

Revert disable test case pending index assert fix

This reverts commit af9751a760e9007d0450adf2753d8a65be5f536c.

diff --git a/sw/qa/core/data/ww5/pass/crash-2.doc 
b/sw/qa/core/data/ww5/pass/crash-2.doc
new file mode 100644
index 000..23a1897
Binary files /dev/null and b/sw/qa/core/data/ww5/pass/crash-2.doc differ
commit d9edac5d58aa3c4f15cf4022a1faf776d3003e78
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Aug 25 16:36:08 2015 +0100

behave like the native format filter for non-insert mode

just shove the unneeded pam into dead space

Change-Id: Id0a3d550cd9d54394888e6b2d62e21eaded24a7c

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 45f84d4..00318f2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -6153,6 +6153,10 @@ sal_uLong WW8Reader::Read(SwDoc rDoc, const OUString 
rBaseURL, SwPaM rPaM, co
 {
 // Remove Frame and offsets from Frame Template
 Reader::ResetFrameFormats( rDoc );
+
+rPaM.GetBound().nContent.Assign(0, 0);
+rPaM.GetBound(false).nContent.Assign(0, 0);
+
 }
 try
 {
commit 3d992d77d8ae319b31dca808e8c08f439a1bc9c3
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Aug 25 13:30:12 2015 +0100

we only need the PaM for its Point and only to create a uno cursor

so do that in the ctor and drop the arg from a bunch of places

Change-Id: Iaad71e9854b38d8632df057dfe9c96468d1d0098

diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index 7a8d0f4..f125f69 100644
--- a/sw/source/filter/ww8/ww8glsy.cxx
+++ b/sw/source/filter/ww8/ww8glsy.cxx
@@ -210,8 +210,6 @@ bool WW8Glossary::Load( SwTextBlocks rBlocks, bool 
bSaveRelFile )
 if (xDocSh-DoInitNew(0))
 {
 SwDoc *pD =  static_castSwDocShell*((xDocSh))-GetDoc();
-SwWW8ImplReader* pRdr = new 
SwWW8ImplReader(pGlossary-nVersion,
-xStg, rStrm, *pD, rBlocks.GetBaseURL(), true, false);
 
 SwNodeIndex aIdx(
 *pD-GetNodes().GetEndOfContent().StartOfSectionNode(), 1);
@@ -223,11 +221,11 @@ bool WW8Glossary::Load( SwTextBlocks rBlocks, bool 
bSaveRelFile )
 SwPaM aPamo( aIdx );
 
aPamo.GetPoint()-nContent.Assign(aIdx.GetNode().GetContentNode(),
 0);
-pRdr-LoadDoc(aPamo,this);
-
+std::unique_ptrSwWW8ImplReader xRdr(new SwWW8ImplReader(
+pGlossary-nVersion, xStg, rStrm, *pD, 
rBlocks.GetBaseURL(),
+true, false, *aPamo.GetPoint()));
+xRdr-LoadDoc(this);
 bRet = MakeEntries(pD, rBlocks, bSaveRelFile, aStrings, aData);
-
-delete pRdr;
 }
 xDocSh-DoClose();
 rBlocks.EndPutMuchBlockEntries();
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index d7eadb1..45f84d4 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4124,7 +4124,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP 
nTextLen, ManTypes nType)
 }
 
 SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage,
-SvStream* pSt, SwDoc rD, const OUString rBaseURL, bool bNewDoc, bool 
bSkipImages)
+SvStream* pSt, SwDoc rD, const OUString rBaseURL, bool bNewDoc, bool 
bSkipImages, SwPosition rPos)
 : m_pDocShell(rD.GetDocShell())
 , m_pStg(pStorage)
 , m_pStrm(pSt)
@@ -4260,6 +4260,8 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, 
SotStorage* pStorage,
 {
 m_pStrm-SetEndian( SvStreamEndian::LITTLE );
 m_aApos.push_back(false);
+
+mpCrsr = m_rDoc.CreateUnoCrsr(rPos);
 }
 
 void SwWW8ImplReader::DeleteStk(SwFltControlStack* pStck)
@@ -4881,7 +4883,7 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings( const 
OUString sCreatedFrom,
 return bRes;
 }
 
-sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition 
rPos)
+sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
 {
 sal_uLong nErrRet = 0;
 
@@ -4917,7 +4919,6 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, 
const SwPosition rPos)
 pDocShell-SetReadOnlyUI();
 }
 
-mpCrsr = m_rDoc.CreateUnoCrsr(rPos);
 m_pPaM = mpCrsr.get();
 
 m_pCtrlStck = new SwWW8FltControlStack( m_rDoc, m_nFieldFlags, *this );
@@ -5595,7 +5596,7 @@ namespace
 }
 }
 
-sal_uLong 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2015-07-29 Thread Miklos Vajna
 sw/qa/extras/uiwriter/data/tdf89954.odt|binary
 sw/qa/extras/uiwriter/uiwriter.cxx |   22 +
 sw/source/core/txtnode/thints.cxx  |2 -
 writerfilter/source/dmapper/GraphicImport.hxx  |4 +--
 writerfilter/source/dmapper/StyleSheetTable.cxx|1 
 writerfilter/source/dmapper/StyleSheetTable.hxx|5 ++--
 writerfilter/source/dmapper/TextEffectsHandler.hxx |4 +--
 7 files changed, 30 insertions(+), 8 deletions(-)

New commits:
commit e1953f22097d6f895fe27ea21635c37d3cb48f51
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Jul 29 09:15:59 2015 +0200

writerfilter: clean up remaining boost::scoped_ptr usage

Change-Id: I270c91bec75ff96ac77b550e6adef8d03b07f2b5

diff --git a/writerfilter/source/dmapper/GraphicImport.hxx 
b/writerfilter/source/dmapper/GraphicImport.hxx
index 6a10ddb..736a580 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -20,7 +20,7 @@
 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_GRAPHICIMPORT_HXX
 
 #include queue
-#include boost/scoped_ptr.hpp
+#include memory
 
 #include LoggedResources.hxx
 
@@ -64,7 +64,7 @@ enum GraphicImportType
 class GraphicImport : public LoggedProperties, public LoggedTable
 ,public BinaryObj, public LoggedStream
 {
-boost::scoped_ptrGraphicImport_Impl m_pImpl;
+std::unique_ptrGraphicImport_Impl m_pImpl;
 
 css::uno::Referencecss::uno::XComponentContext m_xComponentContext;
 css::uno::Referencecss::lang::XMultiServiceFactory m_xTextFactory;
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.hxx 
b/writerfilter/source/dmapper/TextEffectsHandler.hxx
index 02bd9a9..cce0872 100644
--- a/writerfilter/source/dmapper/TextEffectsHandler.hxx
+++ b/writerfilter/source/dmapper/TextEffectsHandler.hxx
@@ -21,7 +21,7 @@
 
 #include oox/helper/grabbagstack.hxx
 
-#include boost/scoped_ptr.hpp
+#include memory
 #include boost/optional.hpp
 
 namespace writerfilter {
@@ -34,7 +34,7 @@ class TextEffectsHandler : public LoggedProperties
 private:
 boost::optionalPropertyIds maPropertyId;
 OUString maElementName;
-boost::scoped_ptroox::GrabBagStack mpGrabBagStack;
+std::unique_ptroox::GrabBagStack mpGrabBagStack;
 
 void convertElementIdToPropertyId(sal_Int32 aElementId);
 
commit 7b1c5b297746e1fbc7d8b728e888478a260c52e4
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Jul 29 09:10:44 2015 +0200

writerfilter: use std::unique_ptr in StyleSheetTable

Change-Id: I38eebe098c87cceb69b9ff4c48e18d3434ad1557

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 826172b..cdc0e59 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -390,7 +390,6 @@ StyleSheetTable::StyleSheetTable(DomainMapper rDMapper,
 
 StyleSheetTable::~StyleSheetTable()
 {
-delete m_pImpl;
 }
 
 PropertyMapPtr StyleSheetTable::GetDefaultCharProps()
diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx 
b/writerfilter/source/dmapper/StyleSheetTable.hxx
index 44d33ea..ba05630 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.hxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.hxx
@@ -19,6 +19,7 @@
 #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_STYLESHEETTABLE_HXX
 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_STYLESHEETTABLE_HXX
 
+#include memory
 #include TblStylePrHandler.hxx
 
 #include DomainMapper.hxx
@@ -77,7 +78,7 @@ public:
 };
 
 typedef std::shared_ptrStyleSheetEntry StyleSheetEntryPtr;
-typedef ::std::dequeStyleSheetEntryPtr StyleSheetEntryDeque;
+typedef std::dequeStyleSheetEntryPtr StyleSheetEntryDeque;
 typedef std::shared_ptrStyleSheetEntryDeque StyleSheetEntryDequePtr;
 
 class DomainMapper;
@@ -85,7 +86,7 @@ class StyleSheetTable :
 public LoggedProperties,
 public LoggedTable
 {
-StyleSheetTable_Impl   *m_pImpl;
+std::unique_ptrStyleSheetTable_Impl m_pImpl;
 
 public:
 StyleSheetTable(DomainMapper rDMapper, 
css::uno::Referencecss::text::XTextDocument const xTextDocument, bool 
bIsNewDoc);
commit 89d615360e80a13fff6bc69885e5780d8fedf149
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Jul 29 09:08:00 2015 +0200

tdf#89954 sw: let annotation have CH_TXTATR_INWORD placeholder again

Regression from commit 0761f81643a6890457e9ef7d913ab5c88c2593a4 (123792:
complete annotations on text ranges feature, 2013-12-19), the problem
was that while sw wanted CH_TXTATR_INWORD as a placeholder character for
anchor positions that do not count as a word boundary, the commit
changed GetCharOfTextAttr() so that annotations have CH_TXTATR_BREAKWORD
as the placeholder.

Fix the problem by reverting the last hunk of
sw/source/core/txtnode/thints.cxx changes in that commit.

Change-Id: 

[Libreoffice-commits] core.git: 3 commits - sw/qa

2015-06-30 Thread Michael Stahl
 dev/null |binary
 sw/qa/extras/inc/swmodeltestbase.hxx |   12 ++-
 sw/qa/extras/uiwriter/uiwriter.cxx   |  135 +--
 3 files changed, 140 insertions(+), 7 deletions(-)

New commits:
commit 9394362e10de6fe30e673efcdbe56d43579447b1
Author: Michael Stahl mst...@redhat.com
Date:   Tue Jun 30 22:47:20 2015 +0200

sw: remove SwUiWriterTest's empty.odt

Change-Id: I44e2881bcf1d50fbc4d35802d90ea8ee19b39f3a

diff --git a/sw/qa/extras/uiwriter/data/empty.odt 
b/sw/qa/extras/uiwriter/data/empty.odt
deleted file mode 100644
index 311cb06..000
Binary files a/sw/qa/extras/uiwriter/data/empty.odt and /dev/null differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index c65fe61..0339860 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -1399,8 +1399,7 @@ void SwUiWriterTest::testEmbeddedDataSource()
 
 void SwUiWriterTest::testUnoCursorPointer()
 {
-auto xDocComponent(loadFromDesktop(
-getURLFromSrc(DATA_DIRECTORY) + empty.odt,
+auto xDocComponent(loadFromDesktop(private:factory/swriter,
 com.sun.star.text.TextDocument));
 auto pxDocDocument(
 dynamic_castSwXTextDocument *(xDocComponent.get()));
commit 98ddd7a32fd0d5fa080fac368b9dc53a06659285
Author: Michael Stahl mst...@redhat.com
Date:   Tue Jun 30 22:43:22 2015 +0200

sw: fix SwUiWriterTest pointlessly loading an empty.odt ...

... instead of just creating a new document.

Change-Id: Ib336c07f6827775a9c1a4fa0b8fbfe4ae0ff8221

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index e26b6e3..adf21ba 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -572,14 +572,20 @@ protected:
 
 void load(const char* pDir, const char* pName)
 {
+return loadURL(getURLFromSrc(pDir) + OUString::createFromAscii(pName), 
pName);
+}
+
+void loadURL(OUString const rURL, const char* pName)
+{
 if (mxComponent.is())
 mxComponent-dispose();
 // Output name early, so in the case of a hang, the name of the 
hanging input file is visible.
-std::cout  pName  ,;
+if (pName)
+std::cout  pName  ,;
 mnStartTime = osl_getGlobalTimer();
-mxComponent = loadFromDesktop(getURLFromSrc(pDir) + 
OUString::createFromAscii(pName), com.sun.star.text.TextDocument);
+mxComponent = loadFromDesktop(rURL, com.sun.star.text.TextDocument);
 discardDumpedLayout();
-if (mustCalcLayoutOf(pName))
+if (pName  mustCalcLayoutOf(pName))
 calcLayout();
 }
 
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 889eee5..c65fe61 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -169,8 +169,9 @@ private:
 SwDoc* SwUiWriterTest::createDoc(const char* pName)
 {
 if (!pName)
-pName = empty.odt;
-load(DATA_DIRECTORY, pName);
+loadURL(private:factory/swriter, nullptr);
+else
+load(DATA_DIRECTORY, pName);
 
 SwXTextDocument* pTextDoc = dynamic_castSwXTextDocument 
*(mxComponent.get());
 CPPUNIT_ASSERT(pTextDoc);
commit 9060439f98e771d5079fb4434e2152bee053c40d
Author: Varun varun.dh...@studentpartner.com
Date:   Tue Jun 30 03:07:19 2015 +0530

Added Test for tdf#69282 copy page style b/w docs

Change-Id: If5960be7b04db418a1a42bd7b661391f65e79498
Signed-off-by: Michael Stahl mst...@redhat.com

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 9f5a8fc..889eee5 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -35,6 +35,7 @@
 #include unocrsr.hxx
 #include unocrsrhelper.hxx
 #include unotbl.hxx
+#include pagedesc.hxx
 
 #include svx/svdpage.hxx
 #include svx/svdview.hxx
@@ -97,6 +98,8 @@ public:
 void testTdf51741();
 void testdelofTableRedlines();
 void testExportToPicture();
+void testTdf69282();
+void testTdf69282WithMirror();
 void testSearchWithTransliterate();
 void testTdf75137();
 void testTdf83798();
@@ -144,6 +147,8 @@ public:
 CPPUNIT_TEST(testTdf51741);
 CPPUNIT_TEST(testdelofTableRedlines);
 CPPUNIT_TEST(testExportToPicture);
+CPPUNIT_TEST(testTdf69282);
+CPPUNIT_TEST(testTdf69282WithMirror);
 CPPUNIT_TEST(testSearchWithTransliterate);
 CPPUNIT_TEST(testTdf75137);
 CPPUNIT_TEST(testTdf83798);
@@ -1018,6 +1023,128 @@ void SwUiWriterTest::testExportToPicture()
 aTempFile.EnableKillingFile();
 }
 
+void SwUiWriterTest::testTdf69282()
+{
+mxComponent = loadFromDesktop(private:factory/swriter, 
com.sun.star.text.TextDocument);
+SwXTextDocument* pTextDoc = dynamic_castSwXTextDocument 
*(mxComponent.get());
+SwDoc* source = pTextDoc-GetDocShell()-GetDoc();
+

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2015-03-14 Thread Miklos Vajna
 dev/null  |binary
 sw/qa/extras/uiwriter/data/tdf90003.odt   |binary
 sw/qa/extras/uiwriter/uiwriter.cxx|   23 +--
 sw/source/core/text/itrform2.cxx  |7 
 sw/source/uibase/inc/wrtsh.hxx|  110 +++---
 sw/source/uibase/wrtsh/move.cxx   |  108 +++---
 sw/source/uibase/wrtsh/select.cxx |  196 +-
 sw/source/uibase/wrtsh/wrtsh1.cxx |   58 +++
 sw/source/uibase/wrtsh/wrtsh2.cxx |8 -
 sw/source/uibase/wrtsh/wrtsh3.cxx |   18 +-
 sw/source/uibase/wrtsh/wrtundo.cxx|4 
 writerfilter/source/dmapper/SettingsTable.cxx |   26 +--
 12 files changed, 275 insertions(+), 283 deletions(-)

New commits:
commit bcefd5cda926f86db16b1bcf6838431b5b0d61b5
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat Mar 14 15:55:40 2015 +0100

SwWrtShell: rename member variables missing their prefixes

Change-Id: I78ae647cca9167e130592fd11b8dd15c512a2353

diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 2e7c4cd..7880165 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -94,19 +94,19 @@ private:
 
 typedef long (SwWrtShell::*SELECTFUNC)(const Point *, bool bProp );
 
-SELECTFUNC  fnDrag;
-SELECTFUNC  fnSetCrsr;
-SELECTFUNC  fnEndDrag;
-SELECTFUNC  fnKillSel;
+SELECTFUNC  m_fnDrag;
+SELECTFUNC  m_fnSetCrsr;
+SELECTFUNC  m_fnEndDrag;
+SELECTFUNC  m_fnKillSel;
 
 public:
 
 using SwEditShell::Insert;
 
-long SetCursor(const Point* pPt, bool bProp) { return 
(this-*fnSetCrsr)(pPt, bProp); }
-long Drag (const Point* pPt, bool bProp) { return 
(this-*fnDrag)(pPt, bProp); }
-long EndDrag  (const Point* pPt, bool bProp) { return 
(this-*fnEndDrag)(pPt, bProp); }
-long KillSelection(const Point* pPt, bool bProp) { return 
(this-*fnKillSel)(pPt, bProp); }
+long SetCursor(const Point* pPt, bool bProp) { return 
(this-*m_fnSetCrsr)(pPt, bProp); }
+long Drag (const Point* pPt, bool bProp) { return 
(this-*m_fnDrag)(pPt, bProp); }
+long EndDrag  (const Point* pPt, bool bProp) { return 
(this-*m_fnEndDrag)(pPt, bProp); }
+long KillSelection(const Point* pPt, bool bProp) { return 
(this-*m_fnKillSel)(pPt, bProp); }
 
 // reset all selections
 long ResetSelect( const Point *, bool );
@@ -115,45 +115,45 @@ public:
 inline void ResetCursorStack();
 SelectionType   GetSelectionType() const;
 
-boolIsModePushed() const { return 0 != pModeStack; }
+boolIsModePushed() const { return 0 != m_pModeStack; }
 voidPushMode();
 voidPopMode();
 
 voidSttSelect();
 voidEndSelect();
-boolIsInSelect() const { return bInSelect; }
-voidSetInSelect(bool bSel = true) { bInSelect = bSel; }
+boolIsInSelect() const { return m_bInSelect; }
+voidSetInSelect(bool bSel = true) { m_bInSelect = bSel; }
 // is there a text- or frameselection?
 boolHasSelection() const { return SwCrsrShell::HasSelection() ||
 IsMultiSelection() || IsSelFrmMode() 
|| IsObjSelected(); }
 bool Pop( bool bOldCrsr = true );
 
 voidEnterStdMode();
-boolIsStdMode() const { return !bExtMode  !bAddMode  !bBlockMode; }
+boolIsStdMode() const { return !m_bExtMode  !m_bAddMode  
!m_bBlockMode; }
 
 voidEnterExtMode();
 voidLeaveExtMode();
 boolToggleExtMode();
-boolIsExtMode() const { return bExtMode; }
+boolIsExtMode() const { return m_bExtMode; }
 
 voidEnterAddMode();
 voidLeaveAddMode();
 boolToggleAddMode();
-boolIsAddMode() const { return bAddMode; }
+boolIsAddMode() const { return m_bAddMode; }
 
 voidEnterBlockMode();
 voidLeaveBlockMode();
 boolToggleBlockMode();
-boolIsBlockMode() const { return bBlockMode; }
+boolIsBlockMode() const { return m_bBlockMode; }
 
 voidSetInsMode( bool bOn = true );
-voidToggleInsMode() { SetInsMode( !bIns ); }
-boolIsInsMode() const { return bIns; }
+voidToggleInsMode() { SetInsMode( !m_bIns ); }
+boolIsInsMode() const { return m_bIns; }
 voidSetRedlineModeAndCheckInsMode( sal_uInt16 eMode );
 
 voidEnterSelFrmMode(const Point *pStartDrag = 0);
 voidLeaveSelFrmMode();
-boolIsSelFrmMode() const { return bLayoutMode; }
+boolIsSelFrmMode() const { return m_bLayoutMode; }
 // reset selection of frames
 voidUnSelectFrm();
 
@@ -164,9 +164,9 @@ public:
 inline void EndSelTblCells();
 
 // leave per word or per line selection mode. Is usually called in MB-Up.
-boolIsExtSel() const { return bSelWrd || bSelLn; }
+boolIsExtSel() const { return m_bSelWrd || m_bSelLn; }
 
-// 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2015-01-04 Thread Charu Tyagi
 sw/qa/extras/ooxmlimport/data/fdo79738.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   11 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   32 ++
 3 files changed, 43 insertions(+)

New commits:
commit 799e07f02dbca97f4dd9cff5b779392b13b9021c
Author: Charu Tyagi charu.ty...@ericsson.com
Date:   Fri Dec 19 13:56:26 2014 +0530

fdo#79738: Test case for patch that fixes 79738

Reviewed on:
https://gerrit.libreoffice.org/13541

Change-Id: I40ba14503ad9f5458d8326741a4fe7a13653b05a

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a9f0d24..5bec69c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -242,6 +242,17 @@ DECLARE_OOXMLIMPORT_TEST(testFdo81486, fdo81486.docx)
 CPPUNIT_ASSERT_EQUAL(text-getString(),OUString(CustomTitle));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testFdo79738, fdo79738.docx)
+{
+uno::Reference style::XStyleFamiliesSupplier  xStylesSupplier( 
mxComponent, uno::UNO_QUERY_THROW );
+uno::Reference container::XNameAccess  xStyleFamilies = 
xStylesSupplier-getStyleFamilies();
+uno::Referencecontainer::XNameContainer xStyles;
+xStyleFamilies-getByName(ParagraphStyles) = xStyles;
+uno::Referencebeans::XPropertySet xPropertySetHeader( 
xStyles-getByName(Header), uno::UNO_QUERY );
+CPPUNIT_ASSERT_EQUAL(false, 
xPropertySetHeader-getPropertyValue(ParaLineNumberCount).getbool());
+uno::Referencebeans::XPropertySet xPropertySetFooter( 
xStyles-getByName(Footer), uno::UNO_QUERY );
+CPPUNIT_ASSERT_EQUAL(false, 
xPropertySetFooter-getPropertyValue(ParaLineNumberCount).getbool());
+}
 
 DECLARE_OOXMLIMPORT_TEST(testN751077, n751077.docx)
 {
commit e1c45f55cde70d71154fa12b2449b20a256d3a26
Author: Charu Tyagi charu.ty...@ericsson.com
Date:   Fri Dec 19 14:05:49 2014 +0530

fdo#79738: test document for patch that that fixes 79738

Reviewed on:
https://gerrit.libreoffice.org/13542

Change-Id: I8d6289b814a063ba8037d07a7600a44fa77f860d

diff --git a/sw/qa/extras/ooxmlimport/data/fdo79738.docx 
b/sw/qa/extras/ooxmlimport/data/fdo79738.docx
new file mode 100644
index 000..e6873e7
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo79738.docx differ
commit 5b743ccf8b5bb51b4d390e64f2916ac1759419a1
Author: Charu Tyagi charu.ty...@ericsson.com
Date:   Fri Dec 19 11:10:23 2014 +0530

fdo#79738: FILEOPEN: Number lines in footer not compatible with MSO

Reviewed on:
https://gerrit.libreoffice.org/13539

Change-Id: I309f9cfc31420e350acc05be7ff422c8aefad782

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 678b19e..b903c51 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -42,6 +42,7 @@
 #include com/sun/star/text/SetVariableType.hpp
 #include com/sun/star/text/XFootnote.hpp
 #include com/sun/star/text/XLineNumberingProperties.hpp
+#include com/sun/star/style/XStyle.hpp
 #include com/sun/star/text/PageNumberType.hpp
 #include com/sun/star/text/HoriOrientation.hpp
 #include com/sun/star/text/VertOrientation.hpp
@@ -88,6 +89,30 @@ using namespace oox;
 namespace writerfilter {
 namespace dmapper{
 
+//line numbering for header/footer
+void lcl_linenumberingHeaderFooter( PropertyNameSupplier rPropNameSupplier, 
uno::Referencecontainer::XNameContainer xStyles, OUString rname, 
DomainMapper_Impl* dmapper )
+{
+const StyleSheetEntryPtr pEntry = 
dmapper-GetStyleSheetTable()-FindStyleSheetByISTD( rname );
+if (!pEntry)
+return;
+const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_castconst 
StyleSheetPropertyMap*( pEntry-pProperties.get() );
+if ( !pStyleSheetProperties )
+return;
+sal_Int32 nListId = pStyleSheetProperties-GetListId();
+if( xStyles.is() )
+{
+if( xStyles-hasByName( rname ) )
+{
+uno::Reference style::XStyle  xStyle;
+xStyles-getByName( rname ) = xStyle;
+if( !xStyle.is() )
+return;
+uno::Referencebeans::XPropertySet xPropertySet( xStyle, 
uno::UNO_QUERY );
+xPropertySet-setPropertyValue( rPropNameSupplier.GetName( 
PROP_PARA_LINE_NUMBER_COUNT ), uno::makeAny( ( bool )( nListId = 0 ) ) );
+}
+}
+}
+
 // Populate Dropdown Field properties from FFData structure
 void lcl_handleDropdownField( const uno::Reference beans::XPropertySet  
rxFieldProps, FFDataHandler::Pointer_t pFFDataHandler )
 {
@@ -4654,6 +4679,13 @@ void DomainMapper_Impl::SetLineNumbering( sal_Int32 
nLnnMod, sal_uInt32 nLnc, sa
 {}
 }
 m_bLineNumberingSet = true;
+PropertyNameSupplier rPropNameSupplier = 
PropertyNameSupplier::GetPropertyNameSupplier();
+uno::Reference style::XStyleFamiliesSupplier  xStylesSupplier( 
GetTextDocument(), 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-12-11 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx  |5 +++
 sw/source/filter/ww8/docxexport.cxx|   13 +
 writerfilter/source/dmapper/SettingsTable.cxx  |   24 +
 writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx |6 
 4 files changed, 42 insertions(+), 6 deletions(-)

New commits:
commit 5a410df4ff5edd9ea2fbe5469084bb0e8b57bd1c
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Dec 11 19:18:06 2014 +0100

DOCX export: handle w:autoHyphenation/

Change-Id: Ie4bb2b3bf7d2df58c30a54ded68f7b932c2111ed

diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 923a82f..d2a4c7f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -462,6 +462,11 @@ DECLARE_OOXMLEXPORT_TEST(testfdo78599,fdo78599.docx)
 return;
 //docx file after RT is getting corrupted.
 assertXPath ( pXmlDoc, 
/w:document/w:body/w:p[1]/w:hyperlink/w:r[6]/w:fldChar, fldCharType, end 
);
+
+// Check for automatic hyphenation
+if (xmlDocPtr pSettingsXml = parseExport(word/settings.xml))
+// This failed as w:settings had no w:autoHyphenation child.
+assertXPath(pSettingsXml, /w:settings/w:autoHyphenation);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testfdo78886, fdo78886.docx)
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 6cb7d80..48ebe66 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -43,6 +43,7 @@
 #include IMark.hxx
 #include IDocumentSettingAccess.hxx
 #include IDocumentLayoutAccess.hxx
+#include IDocumentStylePoolAccess.hxx
 #include docsh.hxx
 #include ndtxt.hxx
 #include wrtww8.hxx
@@ -58,6 +59,7 @@
 #include editeng/editobj.hxx
 #include editeng/outlobj.hxx
 #include editeng/brushitem.hxx
+#include editeng/hyphenzoneitem.hxx
 
 #include docary.hxx
 #include numrule.hxx
@@ -849,6 +851,17 @@ void DocxExport::WriteSettings()
 pFS-singleElementNS( XML_w, XML_defaultTabStop, FSNS( XML_w, XML_val 
),
 OString::number( m_aSettings.defaultTabStop).getStr(), FSEND );
 
+// Automatic hyphenation: it's a global setting in Word, it's a paragraph 
setting in Writer.
+// Use the setting from the default style.
+SwTxtFmtColl* pColl = 
pDoc-getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, 
/*bRegardLanguage=*/false);
+const SfxPoolItem* pItem;
+if (pColl  SfxItemState::SET == 
pColl-GetItemState(RES_PARATR_HYPHENZONE, false, pItem))
+{
+pFS-singleElementNS(XML_w, XML_autoHyphenation,
+ FSNS(XML_w, XML_val), 
OString::boolean(static_castconst SvxHyphenZoneItem*(pItem)-IsHyphen()),
+ FSEND);
+}
+
 // Even and Odd Headers
 if( m_aSettings.evenAndOddHeaders )
 pFS-singleElementNS( XML_w, XML_evenAndOddHeaders, FSEND );
commit d93d09c5065cf4342402b6f4e1216406d3cf9b24
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Dec 11 18:10:28 2014 +0100

DOCX import: handle w:autoHyphenation/

It's the OOXML equivalent of the fAutoHyphen DOP flag from [MS-DOC].

Change-Id: Iae66dcd0d350ce4ebee3c3493ee07eff0d9a5e1d

diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index dd2cef5..76dff4c 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -21,6 +21,10 @@
 #include rtl/ustring.hxx
 #include resourcemodel/ResourceModelHelper.hxx
 #include com/sun/star/beans/XPropertySet.hpp
+#include com/sun/star/beans/XPropertyState.hpp
+#include com/sun/star/container/XNameContainer.hpp
+#include com/sun/star/style/XStyle.hpp
+#include com/sun/star/style/XStyleFamiliesSupplier.hpp
 #include SettingsTable.hxx
 #include ooxml/resourceids.hxx
 #include ConversionHelper.hxx
@@ -75,6 +79,7 @@ struct SettingsTable_Impl
 boolembedSystemFonts;
 boolm_bDoNotUseHTMLParagraphAutoSpacing;
 boolm_bNoColumnBalance;
+boolm_bAutoHyphenation;
 boolm_bSplitPgBreakAndParaMark;
 boolm_bMirrorMargin;
 uno::Sequencebeans::PropertyValue m_pThemeFontLangProps;
@@ -106,6 +111,7 @@ struct SettingsTable_Impl
 , embedSystemFonts(false)
 , m_bDoNotUseHTMLParagraphAutoSpacing(false)
 , m_bNoColumnBalance(false)
+, m_bAutoHyphenation(false)
 , m_bSplitPgBreakAndParaMark(false)
 , m_bMirrorMargin(false)
 , m_pThemeFontLangProps(3)
@@ -281,6 +287,9 @@ void SettingsTable::lcl_sprm(Sprm rSprm)
 case NS_ooxml::LN_CT_Compat_noColumnBalance:
 m_pImpl-m_bNoColumnBalance = nIntValue;
 break;
+case NS_ooxml::LN_CT_Settings_autoHyphenation:
+m_pImpl-m_bAutoHyphenation = nIntValue;
+break;
 default:
 {
 #ifdef 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-11-22 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/num-override-start.rtf |   29 +++
 sw/qa/extras/rtfexport/rtfexport.cxx   |7 +
 sw/source/filter/ww8/docxtablestyleexport.cxx  |   86 ++---
 writerfilter/source/dmapper/NumberingManager.cxx   |   12 --
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 
 5 files changed, 82 insertions(+), 54 deletions(-)

New commits:
commit 74249cb6f4f52b7c10ebaa92f943920f6f94aaf4
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat Nov 22 12:34:06 2014 +0100

RTF import: fix handling of multiple \lfolevel control words

Change-Id: I242853d491c2ef83f192486fa6fe5a3407700047

diff --git a/sw/qa/extras/rtfexport/data/num-override-start.rtf 
b/sw/qa/extras/rtfexport/data/num-override-start.rtf
new file mode 100644
index 000..aa1a2d4
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/num-override-start.rtf
@@ -0,0 +1,29 @@
+{\rtf1
+{\*\listtable
+{\list\listtemplateid-1627985480
+{\listlevel\levelnfc0
+\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \s15\fi-360\li720\lin720 }
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0
+\levelstartat1\levellegal\levelspace0\levelindent0
+{\leveltext\'03\'00.\'01;}
+{\levelnumbers\'01\'03;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li360\lin360 }
+{\listname ;}
+\listid94861222}
+}
+{\*\listoverridetable
+{\listoverride\listid94861222\listoverridecount2
+{\lfolevel\listoverridestartat\levelstartat1}
+{\lfolevel\listoverridestartat\levelstartat3}
+\ls1}
+}
+\pard\plain \ltrpar\s16\ql 
\fi-360\li360\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls1\ilvl1\adjustright\rin0\lin360\itap0\pararsid16599941
 \rtlch\fcs1 \ab\af0\afs24\alang1025 \ltrch\fcs0
+\b\fs28\lang3082\langfe3082\cgrid\langnp3082\langfenp3082
+{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 
\fs20\lang2057\langfe3082\langnp2057\insrsid16599941 This should be 1.3}
+{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
+\fs20\lang2057\langfe3082\langnp2057\insrsid14181417\charrsid16599941
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 12fbfd1..c4118c6 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -836,6 +836,13 @@ DECLARE_RTFEXPORT_TEST(testTableRtl, table-rtl.rtf)
 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, 
getPropertysal_Int16(xTable, WritingMode));
 }
 
+DECLARE_RTFEXPORT_TEST(testNumOverrideStart, num-override-start.rtf)
+{
+// The numbering on the second level was 3.1, not 1.3.
+uno::Referencecontainer::XIndexAccess xRules = getProperty 
uno::Referencecontainer::XIndexAccess 
(getStyles(NumberingStyles)-getByName(WWNum1), NumberingRules);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(1), 
comphelper::SequenceAsHashMap(xRules-getByIndex(0))[StartWith].getsal_Int16());
+CPPUNIT_ASSERT_EQUAL(sal_Int16(3), 
comphelper::SequenceAsHashMap(xRules-getByIndex(1))[StartWith].getsal_Int16());
+}
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 70cc3da..246cb4f 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -5901,7 +5901,7 @@ int RTFDocumentImpl::popState()
 aState.aTableAttributes.set(NS_ooxml::LN_CT_NumLvl_ilvl, 
pInnerValue);
 
 RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, 
aState.aTableSprms));
-m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, 
pValue);
+m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, 
pValue, OVERWRITE_NO_APPEND);
 }
 break;
 // list override table
commit f2f171a4dbec9e3adac7ff66c1417ced84cd0d8e
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat Nov 22 12:19:35 2014 +0100

Use comphelper::SequenceAsVector

Change-Id: I0d2c312f903a2a326961430caa772a4841f4fa87

diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 2412f8c..0a1c52f 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -263,7 +263,7 @@ uno::Sequence beans::PropertyValue  
ListLevel::GetLevelProperties( )
 };
 
 PropertyNameSupplier aPropNameSupplier = 
PropertyNameSupplier::GetPropertyNameSupplier();
-PropertyValueVector_t aNumberingProperties;
+comphelper::SequenceAsVectorbeans::PropertyValue aNumberingProperties;
 
 if( m_nIStartAt = 0)
 aNumberingProperties.push_back( MAKE_PROPVAL(PROP_START_WITH, 
(sal_Int16)m_nIStartAt) );
@@ -343,15 +343,7 @@ uno::Sequence beans::PropertyValue  
ListLevel::GetLevelProperties( )
 beans::PropertyValue( 
aPropNameSupplier.GetName(PROP_BULLET_FONT_NAME), 0, aPropFont-second, 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source

2014-11-04 Thread Miklos Vajna
 sw/qa/extras/inc/swmodeltestbase.hxx  |3 +++
 sw/qa/extras/ww8export/data/bnc636128.doc |binary
 sw/qa/extras/ww8export/ww8export.cxx  |   12 ++--
 sw/source/filter/ww8/wrtww8.cxx   |   10 ++
 sw/source/filter/ww8/ww8par.hxx   |4 +++-
 sw/source/filter/ww8/ww8par3.cxx  |5 +++--
 6 files changed, 29 insertions(+), 5 deletions(-)

New commits:
commit 2ad1f195b875f2c1052c8ffab79602b9f6871ccb
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Nov 4 15:36:02 2014 +0100

bnc#636128 DOC export: handle FFData.cch

Change-Id: Ia1a3a4ef5e61d8ed2a3bde689f3d2101525efc46

diff --git a/sw/qa/extras/ww8export/data/bnc636128.doc 
b/sw/qa/extras/ww8export/data/bnc636128.doc
new file mode 100644
index 000..5f92c3e
Binary files /dev/null and b/sw/qa/extras/ww8export/data/bnc636128.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index e973029..c1e6ca6 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -16,6 +16,7 @@
 #include com/sun/star/table/ShadowFormat.hpp
 #include com/sun/star/table/TableBorder2.hpp
 #include com/sun/star/text/GraphicCrop.hpp
+#include com/sun/star/text/XFormField.hpp
 
 class Test : public SwModelTestBase
 {
@@ -378,6 +379,15 @@ DECLARE_WW8EXPORT_TEST(testCellBgColor, 
cell-bg-color.odt)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0xCC), 
getPropertysal_Int32(xTable-getCellByName(A1), BackColor));
 }
 
+DECLARE_WW8EXPORT_TEST(testBnc636128, bnc636128.doc)
+{
+// Import / export of FFData.cch was missing.
+uno::Referencetext::XFormField xFormField = getProperty 
uno::Referencetext::XFormField (getRun(getParagraph(1), 2), Bookmark);
+uno::Referencecontainer::XNameContainer xParameters = 
xFormField-getParameters();
+// This resulted in a container.NoSuchElementException.
+CPPUNIT_ASSERT_EQUAL(OUString(5), 
xParameters-getByName(MaxLength).getOUString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 58718c2..97629ae 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3783,6 +3783,16 @@ void WW8Export::WriteFormData( const 
::sw::mark::IFieldmark rFieldmark )
 ffres = 0;
 }
 aFldHeader.bits |= ( (ffres2)  0x7C );
+if (type == 0) // iTypeText
+{
+sw::mark::IFieldmark::parameter_map_t::const_iterator pParameter = 
rFieldmark.GetParameters()-find(MaxLength);
+if (pParameter != rFieldmark.GetParameters()-end())
+{
+OUString aLength;
+pParameter-second = aLength;
+aFldHeader.cch = aLength.toUInt32();
+}
+}
 
 std::vector OUString  aListItems;
 if (type==2)
commit dfa26e6d489a2c5bd79652450a9f27343008d37f
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Nov 4 12:37:45 2014 +0100

bnc#636128 DOC import: handle FFData.cch

Change-Id: I8020ce561a72f10b8f0f517d50407a802049bd48

diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 6e0349b..953ee5e 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -662,7 +662,7 @@ public:
 WW8FormulaControl(const OUString rN, SwWW8ImplReader rR)
 : rRdr(rR), fUnknown(0), fDropdownIndex(0),
 fToolTip(0), fNoMark(0), fUseSize(0), fNumbersOnly(0), fDateOnly(0),
-fUnused(0), nSize(0), hpsCheckBox(20), nChecked(0), sName( rN )
+fUnused(0), nSize(0), hpsCheckBox(20), nChecked(0), mnMaxLen(0), 
sName( rN )
 {
 }
 sal_uInt8 fUnknown:2;
@@ -678,6 +678,8 @@ public:
 sal_uInt16 hpsCheckBox;
 sal_uInt16 nChecked;
 
+/// FFData.cch in the spec: maximum length, in characters, of the value of 
the textbox.
+sal_uInt16 mnMaxLen;
 OUString sTitle;
 OUString sDefault;
 OUString sFormatting;
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 046e146..5e3bbe9 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -165,6 +165,8 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* 
pF, OUString rStr )
 maFieldStack.back().SetBookmarkType(ODF_FORMTEXT);
 maFieldStack.back().getParameters()[Description] = 
uno::makeAny(OUString(aFormula.sToolTip));
 maFieldStack.back().getParameters()[Name] = 
uno::makeAny(OUString(aFormula.sTitle));
+if (aFormula.mnMaxLen)
+maFieldStack.back().getParameters()[MaxLength] = 
uno::makeAny(OUString::number(aFormula.mnMaxLen));
 }
 return FLD_TEXT;
 }
@@ -2144,8 +2146,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType 
nWhich,
 
 sal_uInt8 iRes = (bits1  0x7C)  2;
 
-sal_uInt16 cch = 0;
-pDataStream-ReadUInt16( cch );
+pDataStream-ReadUInt16( mnMaxLen );
 
 sal_uInt16 hps 

[Libreoffice-commits] core.git: 3 commits - sw/qa vcl/quartz

2014-10-30 Thread Norbert Thiebaud
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |2 +
 vcl/quartz/CTRunData.cxx |6 +++
 vcl/quartz/ctlayout.cxx  |   52 ++-
 3 files changed, 26 insertions(+), 34 deletions(-)

New commits:
commit f5296655650e75fee259acf1959c15eb2cea3a1e
Author: Norbert Thiebaud nthieb...@gmail.com
Date:   Thu Oct 30 13:10:46 2014 -0500

disable specific oox_export unit for macosx

the magic number in this test does not seems to agree with Mac Retina
Display (Assumed because the non Retina tinderbox do not complain)

Change-Id: I247215b59995e4ffc01720da4988e7eaa8ac78ca

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 3d76287..1ca3bce 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -445,7 +445,9 @@ DECLARE_OOXMLEXPORT_TEST(testCropPixel, crop-pixel.docx)
 {
 // This is 17667 in the original document, was 504666 (so the image
 // become invisible), now is around 19072.
+#ifndef MACOSX
 CPPUNIT_ASSERT(getXPath(pXmlDoc, //a:srcRect, l).toInt32()  
2);
+#endif
 }
 }
 
commit 1ea6dd2111a0ecf7aface1af0ffb0c17bd6d79fe
Author: Norbert Thiebaud nthieb...@gmail.com
Date:   Thu Oct 30 13:08:46 2014 -0500

address LTR issue with coretext rendering

There was a snaffu with the handling of DXArray
concerning the special case of the 'first' character
and how that translate when the glyph order is not
the same than the character order

Change-Id: Ie9273ff22fa2d22ca0df2b583768ffb2b2a59930

diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index a0bcd24..3a42ebc 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -141,7 +141,7 @@ bool CTLayout::LayoutText( ImplLayoutArgs rArgs )
 // CFAttributedStringCreate copies the attribues parameter
 mpAttrString = CFAttributedStringCreate( NULL, aCFText, 
mpTextStyle-GetStyleDict() );
 mpCTLine = CTLineCreateWithAttributedString( mpAttrString );
-SAL_INFO( vcl.ct, CTLineCreateWithAttributedString(\  
GetOUString(aCFText)  \) =   mpCTLine );
+SAL_INFO( vcl.ct, CTLineCreateWithAttributedString(\  
GetOUString(aCFText)  \) =p   mpCTLine );
 CFRelease( aCFText);
 
 mnTrailingSpaceCount = 0;
@@ -176,48 +176,32 @@ void CTLayout::ApplyDXArray(ImplLayoutArgs rArgs)
 delete[] iter-m_pAdjPositions;
 iter-m_pAdjPositions = new CGPoint[iter-m_nGlyphs];
 
+SAL_INFO( vcl.ct, Apply DXArray Run status: 
(void*)(uintptr_t)status);
+
 if(!(status  kCTRunStatusNonMonotonic))
 {
-if(mnLayoutFlags  SAL_LAYOUT_VERTICAL)
+/* simple 1 to 1 */
+SAL_INFO( vcl.ct, nb glyph in vrun:  iter-m_nGlyphs);
+for(int i = 0 ; i  iter-m_nGlyphs; i++)
 {
-/* simple 1 to 1 */
-for(int i = 0 ; i  iter-m_nGlyphs; i++)
+SAL_INFO( vcl.ct, StringIndices[  i   ] =   
iter-m_pStringIndices[i]);
+int j = iter-m_pStringIndices[i];
+if(j == 0)
 {
-if(iter-m_pStringIndices[i] == 0)
-{
-iter-m_pAdjPositions[i].x = 0;
-SAL_INFO( vcl.ct, Apply DXArray[ i  ]: 0.0 
pos:   iter-m_pPositions[i].x);
-}
-else
-{
-iter-m_pAdjPositions[i].x = 
rArgs.mpDXArray[iter-m_pStringIndices[i-1]];
-SAL_INFO( vcl.ct, Apply to i DXArray[ 
iter-m_pStringIndices[i-1]  ]:  
-  rArgs.mpDXArray[iter-m_pStringIndices[i-1]] 
  pos:(   iter-m_pPositions[i].x  ,   iter-m_pPositions[i].y);
-}
-iter-m_pAdjPositions[i].y = iter-m_pPositions[i].y;
+iter-m_pAdjPositions[i].x = 0;
+SAL_INFO( vcl.ct, m_pAdjPostion[  i  ] = 0.0);
 }
-}
-else
-{
-/* simple 1 to 1 */
-for(int i = 0 ; i  iter-m_nGlyphs; i++)
+else
 {
-if(iter-m_pStringIndices[i] == 0)
-{
-iter-m_pAdjPositions[i].x = 0;
-SAL_INFO( vcl.ct, Apply DXArray[ i  ]: 0.0 
pos:   iter-m_pPositions[i].x);
-}
-else
-{
-iter-m_pAdjPositions[i].x = 
rArgs.mpDXArray[iter-m_pStringIndices[i-1]];
-SAL_INFO( vcl.ct, Apply to i DXArray[ 
iter-m_pStringIndices[i-1]  ]:   
rArgs.mpDXArray[iter-m_pStringIndices[i-1]]   pos:   
iter-m_pPositions[i].x);
-}
-iter-m_pAdjPositions[i].y = iter-m_pPositions[i].y;
+iter-m_pAdjPositions[i].x = rArgs.mpDXArray[j - 1];
+ 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-10-26 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo82076.rtf   |   13 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   11 +++
 sw/source/filter/ww8/docxexport.cxx|2 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   19 ++-
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 ++-
 writerfilter/source/rtftok/rtfsdrimport.cxx|   12 +++-
 6 files changed, 52 insertions(+), 8 deletions(-)

New commits:
commit 8c6d3cd45e2183a19f91e9a30c1fdc699de393f8
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Oct 26 14:42:19 2014 +0100

Avoid boost::optionalbool

Change-Id: Idaacaf80098e59df47183741402c8664ba5ea631

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index f15a675..f2081b4 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -42,6 +42,8 @@
 #include oox/drawingml/shapepropertymap.hxx
 #include oox/helper/propertyset.hxx
 
+#include boost/logic/tribool.hpp
+
 using namespace com::sun::star;
 
 namespace writerfilter
@@ -147,7 +149,7 @@ void 
RTFSdrImport::applyProperty(uno::Referencedrawing::XShape const xShape,
 uno::Referencebeans::XPropertySet xPropertySet(xShape, uno::UNO_QUERY);
 sal_Int16 nHoriOrient = 0;
 sal_Int16 nVertOrient = 0;
-boost::optionalbool obFitShapeToText;
+boost::logic::tribool obFitShapeToText(boost::logic::indeterminate);
 bool bFilled = true;
 
 if (aKey == posh)
@@ -191,7 +193,7 @@ void 
RTFSdrImport::applyProperty(uno::Referencedrawing::XShape const xShape,
 }
 }
 else if (aKey == fFitShapeToText)
-obFitShapeToText.reset(aValue.toInt32() == 1);
+obFitShapeToText = aValue.toInt32() == 1;
 else if (aKey == fFilled)
 bFilled = aValue.toInt32() == 1;
 else if (aKey == rotation)
@@ -208,10 +210,10 @@ void 
RTFSdrImport::applyProperty(uno::Referencedrawing::XShape const xShape,
 xPropertySet-setPropertyValue(HoriOrient, 
uno::makeAny(nHoriOrient));
 if (nVertOrient != 0  xPropertySet.is())
 xPropertySet-setPropertyValue(VertOrient, 
uno::makeAny(nVertOrient));
-if (obFitShapeToText  xPropertySet.is())
+if (!boost::logic::indeterminate(obFitShapeToText)  xPropertySet.is())
 {
-xPropertySet-setPropertyValue(SizeType, 
uno::makeAny(*obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX));
-xPropertySet-setPropertyValue(FrameIsAutomaticHeight, 
uno::makeAny(*obFitShapeToText));
+xPropertySet-setPropertyValue(SizeType, 
uno::makeAny(obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX));
+xPropertySet-setPropertyValue(FrameIsAutomaticHeight, 
uno::makeAny(static_castbool(obFitShapeToText)));
 }
 if (!bFilled  xPropertySet.is())
 {
commit cc926007e2471b9d7396a9724cae026e27e52ed2
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Oct 26 14:32:37 2014 +0100

Let's have both switchHeaderFooter() calls in 
DocxExport::WriteHeaderFooter()

Change-Id: I051a2a74e0da44b8f13a21e052c35581159402f1

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index d15e4d2..67540eb 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -266,7 +266,6 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 
nHeadFootFlags,
 
 // Turn OFF flag for 'Writing Headers \ Footers'
 m_pAttrOutput-SetWritingHeaderFooter( false );
-m_pAttrOutput-switchHeaderFooter(false, -1);
 #if OSL_DEBUG_LEVEL  1
 fprintf( stderr, DocxExport::WriteHeadersFooters() - nBreakCode 
introduced, but ignored\n );
 #endif
@@ -720,6 +719,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt rFmt, bool 
bHeader, const char*
 m_pAttrOutput-switchHeaderFooter(true, m_nHeadersFootersInSection++);
 // do the work
 WriteHeaderFooterText( rFmt, bHeader );
+m_pAttrOutput-switchHeaderFooter(false, -1);
 m_pAttrOutput-EndParaSdtBlock();
 
 //When the stream changes the cache which is maintained for the graphics 
in case of alternate content is not cleared.
commit 956c3ff3d43e1b181f7c91518edee1c7c4dc2a0a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Oct 26 12:53:05 2014 +0100

fdo#82076 RTF import: handle footnote in table cell

Change-Id: I69def7936c320e93db5d4504922d52346caaf9cf

diff --git a/sw/qa/extras/rtfimport/data/fdo82076.rtf 
b/sw/qa/extras/rtfimport/data/fdo82076.rtf
new file mode 100644
index 000..20b33e9
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo82076.rtf
@@ -0,0 +1,13 @@
+{\rtf1
+\pard\plain
+Before
+\par
+\trowd \cellx4000\cellx8000
+A1\cell
+B1
+{\chftn
+{\footnote Footnote}
+}
+\cell\row
+\pard After\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 6ecd7a3..90ae2ef 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1996,6 +1996,17 @@ 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-10-15 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/fdo82860.odt  |binary
 sw/qa/extras/rtfexport/rtfexport.cxx  |   10 +
 sw/source/filter/ww8/rtfattributeoutput.cxx   |  122 +-
 sw/source/filter/ww8/rtfattributeoutput.hxx   |3 
 sw/source/filter/ww8/rtfexport.cxx|   25 
 sw/source/filter/ww8/rtfexport.hxx|8 +
 sw/source/filter/ww8/rtfsdrexport.cxx |   31 +
 sw/source/filter/ww8/rtfsdrexport.hxx |8 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   30 +++--
 9 files changed, 175 insertions(+), 62 deletions(-)

New commits:
commit 5a5d55a8a0f82406a8001015a723596f21d3562c
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Oct 15 13:00:24 2014 +0200

fdo#82860 RTF import: fix handling of SHAPE fields

No need to use fieldmarks for these.

Change-Id: I8d2c797f2b00be88e445dab0dd69cb1a9556c02c

diff --git a/sw/qa/extras/rtfexport/data/fdo82860.odt 
b/sw/qa/extras/rtfexport/data/fdo82860.odt
new file mode 100644
index 000..f680410
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/fdo82860.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 5c74c53..2ffbb38 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -709,6 +709,16 @@ DECLARE_RTFEXPORT_TEST(testNumberingFont, 
numbering-font.rtf)
 CPPUNIT_ASSERT_EQUAL(OUString(Verdana), getPropertyOUString(xStyle, 
CharFontName));
 }
 
+DECLARE_RTFEXPORT_TEST(testFdo82860, fdo82860.odt)
+{
+// The problem was that:
+// 1) The import tried to use fieldmarks for SHAPE fields
+// 2) The exporter did not handle shape with textbox text.
+uno::Referencetext::XTextRange xTextRange(getShape(1), uno::UNO_QUERY);
+uno::Referencetext::XText xText = xTextRange-getText();
+CPPUNIT_ASSERT_EQUAL(OUString(hello), getParagraphOfText(1, 
xText)-getString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8bdf7f7..adee004 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4001,20 +4001,26 @@ void DomainMapper_Impl::CloseFieldCommand()
  * To handle unsupported fields used fieldmark API.
  */
 OUString aCode( pContext-GetCommand().trim() );
-xFieldInterface = 
m_xTextFactory-createInstance(com.sun.star.text.Fieldmark);
-const uno::Referencetext::XTextContent 
xTextContent(xFieldInterface, uno::UNO_QUERY_THROW);
-uno::Reference text::XTextAppend   xTextAppend;
-xTextAppend = m_aTextAppendStack.top().xTextAppend;
-uno::Reference text::XTextCursor  xCrsr = 
xTextAppend-createTextCursorByRange(pContext-GetStartRange());
-if (xTextContent.is())
+// Don't waste resources on wrapping shapes inside a fieldmark.
+if (aCode != SHAPE)
 {
-xTextAppend-insertTextContent(xCrsr,xTextContent, 
sal_True);
+xFieldInterface = 
m_xTextFactory-createInstance(com.sun.star.text.Fieldmark);
+const uno::Referencetext::XTextContent 
xTextContent(xFieldInterface, uno::UNO_QUERY_THROW);
+uno::Reference text::XTextAppend   xTextAppend;
+xTextAppend = m_aTextAppendStack.top().xTextAppend;
+uno::Reference text::XTextCursor  xCrsr = 
xTextAppend-createTextCursorByRange(pContext-GetStartRange());
+if (xTextContent.is())
+{
+xTextAppend-insertTextContent(xCrsr,xTextContent, 
sal_True);
+}
+const uno::Referenceuno::XInterface 
xContent(xTextContent);
+uno::Reference text::XFormField xFormField(xContent, 
uno::UNO_QUERY);
+xFormField-setFieldType(aCode);
+m_bStartGenericField = true;
+pContext-SetFormField( xFormField );
 }
-const uno::Referenceuno::XInterface xContent(xTextContent);
-uno::Reference text::XFormField xFormField(xContent, 
uno::UNO_QUERY);
-xFormField-setFieldType(aCode);
-m_bStartGenericField = true;
-pContext-SetFormField( xFormField );
+else
+m_bParaHadField = false;
 }
 //set the text field if there is any
 pContext-SetTextField( uno::Reference text::XTextField ( 
xFieldInterface, uno::UNO_QUERY ) );
commit ecc5cbc69e4c2df4ddbe46bbc2f973cc60a10772
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Oct 15 12:35:47 2014 +0200

fdo#82860 RTF export: if 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-08-22 Thread Miklos Vajna
 sw/qa/core/data/ooxml/pass/liststyle-gridbefore.docx |binary
 sw/source/core/unocore/unoparagraph.cxx  |2 +-
 writerfilter/source/dmapper/StyleSheetTable.cxx  |3 ++-
 writerfilter/source/ooxml/modelpreprocess.py |4 
 4 files changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 7c02c7b0216f642074b690cce889f1a02a2ef6b0
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Aug 22 13:51:54 2014 +0200

DOCX import: list styles don't support automatic updates

The problem was the following: setPropertyValue(IsAutoUpdate) on the
style failed - a number of styles was not imported in
StyleSheetTable::ApplyStyleSheets() due to the exception, then when we
tried to use one of the not imported styles, we also got an exception in
DomainMapper_Impl::finishParagraph(), which resulted in not calling
DomainMapperTableManager::handle(), so multiple cells of the same table
wanted the same range for cell contents, and that resulted in a crash.

Regression from cf33af732ed0d3d553bb74636e3b14c55d44c153 (handle
w:gridBefore by faking cells (fdo#38414), 2014-04-23), but that commit
just made the previously hidden problem visible.

Change-Id: I788cb6b4a2c7b7efbfa48297c658bb26450bf583

diff --git a/sw/qa/core/data/ooxml/pass/liststyle-gridbefore.docx 
b/sw/qa/core/data/ooxml/pass/liststyle-gridbefore.docx
new file mode 100644
index 000..60dae2a
Binary files /dev/null and 
b/sw/qa/core/data/ooxml/pass/liststyle-gridbefore.docx differ
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 50e9b7e..1c39a8a 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1203,7 +1203,8 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr 
rFontTable )
 xPropertySet-setPropertyValue(StyleInteropGrabBag, 
uno::makeAny(aGrabBag));
 }
 
-if (pEntry-bAutoRedefine)
+// List styles don't support automatic update.
+if (pEntry-bAutoRedefine  !bListStyle)
 xPropertySet-setPropertyValue(IsAutoUpdate, 
uno::makeAny(sal_True));
 }
 else if(pEntry-nStyleTypeCode == STYLE_TYPE_TABLE)
commit 2a029e5f4ec7992422a02c575581a8b321c3f578
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Aug 22 10:55:06 2014 +0200

SwXParagraph::Impl::GetTxtNode: fix indenetation

Change-Id: Iac9e2883067b6cf4fdc259110642002b4ef6e48c

diff --git a/sw/source/core/unocore/unoparagraph.cxx 
b/sw/source/core/unocore/unoparagraph.cxx
index c6c3e20..d83a19a 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -134,7 +134,7 @@ public:
 {
 }
 
-  SwTxtNode * GetTxtNode()   {
+SwTxtNode* GetTxtNode() {
 return static_castSwTxtNode*(GetRegisteredInNonConst());
 }
 
commit 8e9c34036220d9099386e83adb9a38ae008e1044
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Aug 22 10:11:12 2014 +0200

writerfilter: unused namespacealias attribute

Change-Id: I12f59c6d06323d3d9ebcd55ee5fe7e43597a11b4

diff --git a/writerfilter/source/ooxml/modelpreprocess.py 
b/writerfilter/source/ooxml/modelpreprocess.py
index 246fae3..6b2e874 100644
--- a/writerfilter/source/ooxml/modelpreprocess.py
+++ b/writerfilter/source/ooxml/modelpreprocess.py
@@ -71,10 +71,6 @@ def check(model):
 def preprocess(model):
 for i in model.getElementsByTagName(namespace):
 ns = i.getElementsByTagName(grammar)[0].getAttribute(ns)
-if ns in list(ooxUrlAliases.keys()):
-i.setAttribute(namespacealias, ooxUrlAliases[ns])
-else:
-i.setAttribute(namespacealias, )
 if ns.startswith(http://schemas.openxmlformats.org/;):
 i.setAttribute(prefix, 
ns.replace('http://schemas.openxmlformats.org/', '').replace('/', 
'_').replace('-', '_'))
 else:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source

2014-08-14 Thread Michael Stahl
 sw/qa/python/var_fields.py   |   20 ++--
 sw/source/core/doc/DocumentFieldsManager.cxx |1 +
 sw/source/core/doc/docnew.cxx|1 +
 3 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 19efa546ab88ea4b3943bb05405752dee7e57623
Author: Michael Stahl mst...@redhat.com
Date:   Thu Aug 14 14:15:03 2014 +0200

sw: assert that UnlockExpFlds() isn't called when it's not locked

Change-Id: Ibe2394978b776dd4a91a253856040fc45f81c7e9

diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index b9b3607..870685e 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1207,6 +1207,7 @@ void DocumentFieldsManager::LockExpFlds()
 
 void DocumentFieldsManager::UnlockExpFlds()
 {
+assert(mnLockExpFld != 0);
 if( mnLockExpFld )
 --mnLockExpFld;
 }
commit 85fde3735afb306b4c3aba72a9c99d19c71546fa
Author: Michael Stahl mst...@redhat.com
Date:   Thu Aug 14 13:37:41 2014 +0200

sw: initialize SwDoc::mbInReading

This was causing intermittent failure at least in sw_python test.
(regression from 5494954b269267f6ee3bdd5ac73e7513fa69978f)

Change-Id: I8452536cfbb7bc5bd07e6405bc255e31a5007185

diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 1e129bf..0b2c0d1 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -260,6 +260,7 @@ SwDoc::SwDoc()
 mReferenceCount(0),
 mbGlossDoc(false),
 mbDtor(false),
+mbInReading(false),
 mbInXMLImport(false),
 mbUpdateTOX(false),
 mbInLoadAsynchron(false),
commit 29f0b74a74c80edf89868b3eb586c266472454a2
Author: Michael Stahl mst...@redhat.com
Date:   Thu Aug 14 12:51:55 2014 +0200

sw: use less confusing variable names in python test

Change-Id: Ie07fe4761a634c3ae55e82e1ed70c9424dc33213

diff --git a/sw/qa/python/var_fields.py b/sw/qa/python/var_fields.py
index 3222f17..b6b3ff1 100644
--- a/sw/qa/python/var_fields.py
+++ b/sw/qa/python/var_fields.py
@@ -74,35 +74,35 @@ class TestVarFields(unittest.TestCase):
 xBodyText.insertControlCharacter(xCursor, PARAGRAPH_BREAK, False )
 xBodyText.insertString(xCursor, new paragraph, False)
 # 13. Access fields to refresh the document
-xEnumerationAccess = xDoc.getTextFields()
+xTextFields = xDoc.getTextFields()
 # 14. refresh document to update the fields
-xEnumerationAccess.refresh()
+xTextFields.refresh()
 # 15. retrieve the field
-xFieldEnum = xEnumerationAccess.createEnumeration()
+xFieldEnum = xTextFields.createEnumeration()
 # Note: we have only one field here, that why nextElement() is just 
fine here
-xPropSet = xFieldEnum.nextElement()
+xField = xFieldEnum.nextElement()
 # check
-readContent = xPropSet.getPropertyValue(Content)
+readContent = xField.getPropertyValue(Content)
 self.assertEqual(0, readContent)
-readContent = xPropSet.getPropertyValue(Value)
+readContent = xField.getPropertyValue(Value)
 self.assertEqual(0.0, readContent)
 # 16. change the value of the field from 0 to 1 and check
 self.__class__._uno.checkProperties(
-xPropSet,
+xField,
 {Value: 1.0,
  Content: 1
  },
 self
 )
 # 17. refresh document to update the fields again
-xEnumerationAccess.refresh()
+xTextFields.refresh()
 # 18. store document
 url = os.path.join(os.environ[TestUserDir], VarFields.odt)
 xDoc.storeToURL(url, tuple(list(range(0
 # 19. retrieve the section
-xPropSet = xDoc.getTextSections().getByIndex(0)
+xSection = xDoc.getTextSections().getByIndex(0)
 # 20. retrieve the condition property of that section
-readContent = xPropSet.getPropertyValue(Condition)
+readContent = xSection.getPropertyValue(Condition)
 # 21. check
 # expected:
 #self.assertEqual(foo EQ 1, readContent)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-08-12 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/picture-wrap-polygon.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx |   12 ++
 sw/source/filter/ww8/docxsdrexport.cxx  |   29 +++
 sw/source/filter/ww8/writerhelper.cxx   |   30 
 sw/source/filter/ww8/writerhelper.hxx   |3 +
 sw/source/filter/ww8/wrtw8esh.cxx   |   27 --
 writerfilter/source/ooxml/model.xml |1 
 7 files changed, 75 insertions(+), 27 deletions(-)

New commits:
commit b818256d1c0f467d1064a0ebc1b17d079e74f38a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Aug 12 16:48:27 2014 +0200

DOCX export: handle wrap polygon around pictures

Change-Id: I83d9d42cd48ba4dcd86c6506c7dbd6493bb4d204

diff --git a/sw/qa/extras/ooxmlexport/data/picture-wrap-polygon.docx 
b/sw/qa/extras/ooxmlexport/data/picture-wrap-polygon.docx
new file mode 100644
index 000..f858a05
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/picture-wrap-polygon.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index fc4c1c2..7dfa7ad 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -18,6 +18,7 @@
 #include com/sun/star/drawing/Hatch.hpp
 #include com/sun/star/drawing/LineJoint.hpp
 #include com/sun/star/drawing/LineStyle.hpp
+#include com/sun/star/drawing/PointSequenceSequence.hpp
 #include com/sun/star/drawing/TextVerticalAdjust.hpp
 #include com/sun/star/style/LineSpacing.hpp
 #include com/sun/star/style/LineSpacingMode.hpp
@@ -1792,6 +1793,17 @@ DECLARE_OOXMLEXPORT_TEST(testWrapTightThrough, 
wrap-tight-through.docx)
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testPictureWrapPolygon, picture-wrap-polygon.docx)
+{
+// The problem was that the wrap polygon was ignored during export.
+drawing::PointSequenceSequence aSeqSeq = 
getPropertydrawing::PointSequenceSequence(getShape(1), ContourPolyPolygon);
+// This was 0: the polygon list was empty.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeqSeq.getLength());
+
+drawing::PointSequence aSeq = aSeqSeq[0];
+CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength());
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 7265745..2c1f7bc 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -51,6 +51,7 @@
 
 
 #include IDocumentDrawModelAccess.hxx
+#include writerhelper.hxx
 
 using namespace com::sun::star;
 using namespace oox;
@@ -682,6 +683,34 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* 
pFrmFmt, const Size rS
 }
 }
 
+// Or if we have a contour.
+if (!nWrapToken  pFrmFmt-GetSurround().IsContour())
+{
+if (const SwNoTxtNode* pNd = 
sw::util::GetNoTxtNodeFromSwFrmFmt(*pFrmFmt))
+{
+const PolyPolygon* pPolyPoly = pNd-HasContour();
+if (pPolyPoly  pPolyPoly-Count())
+{
+nWrapToken = XML_wrapTight;
+m_pImpl-m_pSerializer-startElementNS(XML_wp, nWrapToken,
+   XML_wrapText, 
bothSides, FSEND);
+
+m_pImpl-m_pSerializer-startElementNS(XML_wp, XML_wrapPolygon,
+   XML_edited, 0,
+   FSEND);
+Polygon aPoly = 
sw::util::CorrectWordWrapPolygonForExport(*pPolyPoly, pNd);
+for (sal_uInt16 i = 0; i  aPoly.GetSize(); ++i)
+m_pImpl-m_pSerializer-singleElementNS(XML_wp, (i == 0 ? 
XML_start : XML_lineTo),
+XML_x, 
OString::number(aPoly[i].X()),
+XML_y, 
OString::number(aPoly[i].Y()),
+FSEND);
+m_pImpl-m_pSerializer-endElementNS(XML_wp, XML_wrapPolygon);
+
+m_pImpl-m_pSerializer-endElementNS(XML_wp, nWrapToken);
+}
+}
+}
+
 // No? Then just approximate based on what we have.
 if (isAnchor  !nWrapToken)
 {
commit 959a843f48be63071c64ba9e20c9389ebc390e81
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Tue Aug 12 11:40:13 2014 +0200

DOC export: factor out wrap polygon handling to to sw::util

So that it'll be possible to reuse it in the DOCX exporter.

Change-Id: Ib7371c92c4fd93d7c6f3271ca81311bac8f1a1a7

diff --git a/sw/source/filter/ww8/writerhelper.cxx 
b/sw/source/filter/ww8/writerhelper.cxx
index 015b076..85891c3 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -660,6 +660,36 @@ namespace sw
 }
 }
 
+Polygon 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2014-08-10 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo82106.rtf |4 
 sw/qa/extras/rtfimport/rtfimport.cxx |6 
 writerfilter/source/dmapper/DomainMapper.cxx |   82 ++---
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|7 
 writerfilter/source/dmapper/PageBordersHandler.cxx   |   10 
 writerfilter/source/dmapper/PropertyMap.cxx  |4 
 writerfilter/source/dmapper/SettingsTable.cxx|8 
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx  |8 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx|   14 
 writerfilter/source/ooxml/model.xml  |  234 ++-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |   66 ++--
 writerfilter/source/rtftok/rtffly.hxx|   28 -
 13 files changed, 226 insertions(+), 247 deletions(-)

New commits:
commit 656ab07b2924dd2703f31f460c8586c375c7878a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sun Aug 10 20:57:27 2014 +0200

Sync oox - writerfilter alias for wordprocessingml

The motivation is that once all the namespace aliases in
writerfilter/source/ooxml/model.xml match the ones in
oox/source/token/namespaces.txt, then the writerfilter copies could be
dropped.

Change-Id: I1f9abb8bb457189997f28c99b0f6b00660252c14

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index bd2c226..78d7ba0 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -408,19 +408,19 @@ void DomainMapper::lcl_attribute(Id nName, Value  val)
 else //NS_ooxml::LN_CT_Spacing_lineRule:
 {
 // exactly, atLeast, auto
-if( sal::static_int_castId(nIntValue) == 
NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_auto)
+if( sal::static_int_castId(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_LineSpacingRule_auto)
 {
 m_pImpl-appendGrabBag(m_pImpl-m_aSubInteropGrabBag, 
lineRule, auto);
 aSpacing.Mode = style::LineSpacingMode::PROP;
 //reinterpret the already set value
 aSpacing.Height = sal_Int16( aSpacing.Height * 100 /  
ConversionHelper::convertTwipToMM100( SINGLE_LINE_SPACING ));
 }
-else if( sal::static_int_castId(nIntValue) == 
NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_atLeast)
+else if( sal::static_int_castId(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast)
 {
 m_pImpl-appendGrabBag(m_pImpl-m_aSubInteropGrabBag, 
lineRule, atLeast);
 aSpacing.Mode = style::LineSpacingMode::MINIMUM;
 }
-else // 
NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_exact
+else // NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact
 {
 m_pImpl-appendGrabBag(m_pImpl-m_aSubInteropGrabBag, 
lineRule, exact);
 aSpacing.Mode = style::LineSpacingMode::FIX;
@@ -583,7 +583,7 @@ void DomainMapper::lcl_attribute(Id nName, Value  val)
 {
 // 49 is just the old value that should be removed, once the
 // root cause in SwTabFrm::MakeAll() is fixed.
-if (m_pImpl-GetSettingsTable()-GetView() == 
NS_ooxml::LN_Value_wordprocessingml_ST_View_web)
+if (m_pImpl-GetSettingsTable()-GetView() == 
NS_ooxml::LN_Value_doc_ST_View_web)
 default_spacing = 49;
 else
 default_spacing = 280;
@@ -605,7 +605,7 @@ void DomainMapper::lcl_attribute(Id nName, Value  val)
 
 if 
(!m_pImpl-GetSettingsTable()-GetDoNotUseHTMLParagraphAutoSpacing())
 {
-if (m_pImpl-GetSettingsTable()-GetView() == 
NS_ooxml::LN_Value_wordprocessingml_ST_View_web)
+if (m_pImpl-GetSettingsTable()-GetView() == 
NS_ooxml::LN_Value_doc_ST_View_web)
 default_spacing = 49;
 else
 default_spacing = 280;
@@ -684,10 +684,10 @@ void DomainMapper::lcl_attribute(Id nName, Value  val)
 case NS_ooxml::LN_CT_FramePr_hAnchor:
 switch(nIntValue)
 {
-case  
NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text:   //relative to column
+case  NS_ooxml::LN_Value_doc_ST_HAnchor_text:   
//relative to column
 nIntValue = text::RelOrientation::FRAME; break;
-case  
NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin: nIntValue = 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-08-07 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/para-shading.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   14 
 sw/source/filter/ww8/docxattributeoutput.cxx|   59 +-
 writerfilter/source/ooxml/model.xml |  492 
 4 files changed, 286 insertions(+), 279 deletions(-)

New commits:
commit 6e31cbb4eaea3c6600248ba59a22853acc1d6606
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Aug 7 13:46:37 2014 +0200

DOCX export: avoid empty attributes in paragraph shading

Change-Id: I4bdf3f2d7f2aee3ce735a52185e736a8861d85e4

diff --git a/sw/qa/extras/ooxmlexport/data/para-shading.docx 
b/sw/qa/extras/ooxmlexport/data/para-shading.docx
new file mode 100644
index 000..9c2af1a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/para-shading.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b242714..6cd31bc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3474,6 +3474,20 @@ DECLARE_OOXMLEXPORT_TEST(testFdo80902, fdo80902.docx)
 assertXPath(pXmlDoc, /w:document/w:body/w:sectPr/w:docGrid, type, 
lines);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testParaShading, para-shading.docx)
+{
+// Make sure the themeColor attribute is not written when it would be 
empty.
+if (xmlDocPtr pXmlDoc = parseExport(word/document.xml))
+{
+xmlXPathObjectPtr pXPath = getXPathNode(pXmlDoc, 
/w:document/w:body/w:p/w:pPr/w:shd);
+xmlNodeSetPtr pXmlNodes = pXPath-nodesetval;
+CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes));
+xmlNodePtr pXmlNode = pXmlNodes-nodeTab[0];
+// The attribute existed, so xmlGetProp() returned non-NULL.
+CPPUNIT_ASSERT_EQUAL(static_castxmlChar*(0), xmlGetProp(pXmlNode, 
BAD_CAST(themeColor)));
+}
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFirstHeaderFooter, first-header-footer.docx)
 {
 // Test import and export of a section's headerf/footerf properties.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2ba2b4b..cfd3ef4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7710,42 +7710,35 @@ void DocxAttributeOutput::ParaGrabBag(const 
SfxGrabBagItem rItem)
 {
 uno::Sequencebeans::PropertyValue aGrabBagSeq;
 i-second = aGrabBagSeq;
-OUString sVal, sShdFill, sShdColor,
-sThemeColor, sThemeTint, sThemeShade,
-sThemeFill, sThemeFillTint, sThemeFillShade;
+
 for (sal_Int32 j=0; j  aGrabBagSeq.getLength(); ++j)
 {
+OString sVal = 
OUStringToOString(aGrabBagSeq[j].Value.getOUString(), RTL_TEXTENCODING_UTF8);
+
+if (sVal.isEmpty())
+continue;
+
 if (aGrabBagSeq[j].Name == val)
-aGrabBagSeq[j].Value = sVal;
+AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, XML_val), 
sVal.getStr());
 else if (aGrabBagSeq[j].Name == color)
-aGrabBagSeq[j].Value = sShdColor;
+AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, 
XML_color), sVal.getStr());
 else if (aGrabBagSeq[j].Name == themeColor)
-aGrabBagSeq[j].Value = sThemeColor;
+AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, 
XML_themeColor), sVal.getStr());
 else if (aGrabBagSeq[j].Name == themeTint)
-aGrabBagSeq[j].Value = sThemeTint;
+AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, 
XML_themeTint), sVal.getStr());
 else if (aGrabBagSeq[j].Name == themeShade)
-aGrabBagSeq[j].Value = sThemeShade;
+AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, 
XML_themeShade), sVal.getStr());
 else if (aGrabBagSeq[j].Name == fill)
-aGrabBagSeq[j].Value = sShdFill;
+AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, 
XML_fill), sVal.getStr());
 else if (aGrabBagSeq[j].Name == themeFill)
-aGrabBagSeq[j].Value = sThemeFill;
+AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, 
XML_themeFill), sVal.getStr());
 else if (aGrabBagSeq[j].Name == themeFillTint)
-aGrabBagSeq[j].Value = sThemeFillTint;
+AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, 
XML_themeFillTint), sVal.getStr());
 else if (aGrabBagSeq[j].Name == themeFillShade)
-aGrabBagSeq[j].Value = sThemeFillShade;
+AddToAttrList(m_pBackgroundAttrList, FSNS(XML_w, 
XML_themeFillShade), sVal.getStr());
 else if (aGrabBagSeq[j].Name == originalColor)
 aGrabBagSeq[j].Value = 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source

2014-08-06 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   19 +
 sw/source/filter/ww8/docxattributeoutput.cxx  |   33 +++
 sw/source/filter/ww8/docxtablestyleexport.cxx |   36 ++
 sw/source/filter/ww8/docxtablestyleexport.hxx |3 ++
 4 files changed, 90 insertions(+), 1 deletion(-)

New commits:
commit 994cca6b4d090abf7b262ab8b16a46528bef6c21
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Aug 6 16:56:54 2014 +0200

DOCX export: handle w:cnfStyle row property

Change-Id: Ice1cf2ce078b130130c44952ec2be0f8642f21a8

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d595af3..b242714 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1980,6 +1980,25 @@ DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, 
table-theme-preservation.d
 // check that one cell attribute present in the original document has been 
preserved
 assertXPath(pXmlDocument, 
/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/*, 1);
 
+// Check that w:cnfStyle row, cell and paragraph property is preserved.
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:trPr/w:cnfStyle, val, 
1000);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:trPr/w:cnfStyle, firstRow, 
1);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:trPr/w:cnfStyle, lastRow, 
0);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:trPr/w:cnfStyle, 
firstColumn, 0);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:trPr/w:cnfStyle, 
lastColumn, 0);
+
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle, val, 
0010);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle, 
oddVBand, 0);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle, 
evenVBand, 0);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle, 
oddHBand, 0);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle, 
evenHBand, 0);
+
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle, 
val, 1000);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle, 
firstRowFirstColumn, 0);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle, 
firstRowLastColumn, 0);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle, 
lastRowFirstColumn, 0);
+assertXPath(pXmlDocument, //w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle, 
lastRowLastColumn, 0);
+
 }
 
 DECLARE_OOXMLEXPORT_TEST(testcantSplit, 2_table_doc.docx)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3db0385..92b7b1e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2921,6 +2921,20 @@ void DocxAttributeOutput::StartTableRow( 
ww8::WW8TableNodeInfoInner::Pointer_t p
 TableHeight( pTableTextNodeInfoInner );
 TableCanSplit( pTableTextNodeInfoInner );
 
+const SwTableBox *pTableBox = pTableTextNodeInfoInner-getTableBox();
+const SwTableLine* pTableLine = pTableBox-GetUpper();
+if (const SfxGrabBagItem* pItem = 
sw::util::HasItemSfxGrabBagItem(pTableLine-GetFrmFmt()-GetAttrSet(), 
RES_FRMATR_GRABBAG))
+{
+const std::mapOUString, uno::Any rGrabBag = pItem-GetGrabBag();
+std::mapOUString, uno::Any::const_iterator it = 
rGrabBag.find(RowCnfStyle);
+if (it != rGrabBag.cend())
+{
+uno::Sequencebeans::PropertyValue aAttributes = it-second.get 
uno::Sequencebeans::PropertyValue ();
+m_pTableStyleExport-CnfStyle(aAttributes);
+}
+}
+
+
 m_pSerializer-endElementNS( XML_w, XML_trPr );
 }
 
commit dbaff6d0b62426ef76acb0a08140eab1371381be
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Aug 6 16:43:50 2014 +0200

DOCX export: handle w:cnfStyle cell property

Change-Id: I7ff2411aed76aa74c8c0d111962773e7af12a7df

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index c199240..3db0385 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2783,6 +2783,18 @@ void DocxAttributeOutput::TableCellProperties( 
ww8::WW8TableNodeInfoInner::Point
 FSEND );
 }
 
+if (const SfxGrabBagItem* pItem = 
sw::util::HasItemSfxGrabBagItem(pTblBox-GetFrmFmt()-GetAttrSet(), 
RES_FRMATR_GRABBAG))
+{
+const std::mapOUString, uno::Any rGrabBag = pItem-GetGrabBag();
+std::mapOUString, uno::Any::const_iterator it = 
rGrabBag.find(CellCnfStyle);
+if (it != rGrabBag.cend())
+{
+uno::Sequencebeans::PropertyValue aAttributes = it-second.get 
uno::Sequencebeans::PropertyValue ();
+m_pTableStyleExport-CnfStyle(aAttributes);
+}
+}
+
+
 const SvxBoxItem rBox = pTblBox-GetFrmFmt( )-GetBox( );

[Libreoffice-commits] core.git: 3 commits - sw/qa vcl/source writerfilter/source

2014-08-02 Thread Michael Stahl
 sw/qa/extras/rtfimport/data/fdo81944.rtf  |   15 +
 sw/qa/extras/rtfimport/rtfimport.cxx  |   13 
 vcl/source/gdi/sallayout.cxx  |9 +--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx|   66 +-
 writerfilter/source/rtftok/rtfdocumentimpl.hxx|3 -
 6 files changed, 66 insertions(+), 46 deletions(-)

New commits:
commit f8e8e476aa0a5576234dbb4daac9dc299e044e61
Author: Michael Stahl mst...@redhat.com
Date:   Sat Aug 2 18:55:55 2014 +0200

fdo#81944: writerfilter: RTF import: don't drop fonts in stylesheet

The font definitions in the style sheet meet an untimely death in
StyleSheetTable::lcl_sprm(), which special-cases LN_EG_RPrBase_rFonts,
routing it into TblStylePrHandler.

Avoid this by sending style entries to the domain mapper in the same way
as the OOXML tokenizer, i.e., with paragraph and run properties nested
below CT_Style_pPr/rPr.

This reveals that the CT_Style_basedOn was wrongly handled as paragraph
property.

Change-Id: Ic724ba48fe36bf782b1b430bdafdb1df480d5ad3

diff --git a/sw/qa/extras/rtfimport/data/fdo81944.rtf 
b/sw/qa/extras/rtfimport/data/fdo81944.rtf
new file mode 100644
index 000..780e9bd
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo81944.rtf
@@ -0,0 +1,15 @@
+{\rtf1
+
+{\fonttbl
+{\f38\fbidi \fswiss\fcharset0\fprq2 Segoe UI;}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2 Times New Roman;}
+}
+
+{\stylesheet
+{\qc \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 
\f38\fs18\lang1033\langfe1033 Normal;}
+}
+
+\pard
+
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index cc510ce..e9cf28d 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1219,6 +1219,19 @@ DECLARE_RTFIMPORT_TEST(testPageBackground, 
page-background.rtf)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), 
getPropertysal_Int32(xPageStyle, BackColor));
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo81944, fdo81944.rtf)
+{
+// font properties in style were not imported
+uno::Referencebeans::XPropertySet xPropertySet(
+getStyles(ParagraphStyles)-getByName(Standard), uno::UNO_QUERY);
+uno::Referencestyle::XStyle xStyle(xPropertySet, uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(Segoe UI), getPropertyOUString(xStyle, 
CharFontName));
+CPPUNIT_ASSERT_EQUAL(9.0f, getPropertyfloat(xStyle, CharHeight));
+// not sure if this should be set on Asian or Complex or both?
+CPPUNIT_ASSERT_EQUAL(OUString(Times New Roman), 
getPropertyOUString(xStyle, CharFontNameComplex));
+CPPUNIT_ASSERT_EQUAL(11.0f, getPropertyfloat(xStyle, 
CharHeightComplex));
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo62044, fdo62044.rtf)
 {
 // The problem was that RTF import during copypaste did not ignore 
existing paragraph styles.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 685a98c..1c736f0 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4690,15 +4690,17 @@ uno::Referencecontainer::XIndexAccess 
DomainMapper_Impl::GetCurrentNumberingRu
 
 // So we are in a paragraph style and it has numbering. Look up the 
relevant numbering rules.
 OUString aListName = ListDef::GetStyleName(nListId);
-uno::Reference style::XStyleFamiliesSupplier  
xStylesSupplier(GetTextDocument(), uno::UNO_QUERY);
+uno::Reference style::XStyleFamiliesSupplier  
xStylesSupplier(GetTextDocument(), uno::UNO_QUERY_THROW);
 uno::Reference container::XNameAccess  xStyleFamilies = 
xStylesSupplier-getStyleFamilies();
 uno::Referencecontainer::XNameAccess xNumberingStyles;
 xStyleFamilies-getByName(NumberingStyles) = xNumberingStyles;
 uno::Referencebeans::XPropertySet 
xStyle(xNumberingStyles-getByName(aListName), uno::UNO_QUERY);
 xRet.set(xStyle-getPropertyValue(NumberingRules), uno::UNO_QUERY);
 }
-catch( const uno::Exception )
+catch (const uno::Exception e)
 {
+SAL_WARN(writerfilter.dmapper,
+GetCurrentNumberingRules: exception caught:   e.Message);
 }
 return xRet;
 }
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e234a72..f2c0ae4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1152,7 +1152,7 @@ void RTFDocumentImpl::text(OUString rString)
 
m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue);
 
 writerfilter::ReferenceProperties::Pointer_t const pProp(
-new RTFReferenceProperties(mergeAttributes(), 
mergeSprms())
+   createStyleProperties()
 );
   

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-07-18 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |4 
 sw/source/filter/ww8/docxattributeoutput.cxx |9 -
 writerfilter/source/dmapper/SdtHelper.cxx|   21 ++---
 3 files changed, 22 insertions(+), 12 deletions(-)

New commits:
commit e400b3af070d2ec592d78ce64ba10bc5f091ce6a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jul 18 16:46:43 2014 +0200

DOCX export: handle w:alias for the date SDT

Change-Id: I97d4331a5e49815cc03e8579b50a076b37530f96

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index e7934b2..87fdbd6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3360,8 +3360,12 @@ DECLARE_OOXMLEXPORT_TEST(testSdtAlias, sdt-alias.docx)
 DECLARE_OOXMLEXPORT_TEST(testSdtDateCharformat, sdt-date-charformat.docx)
 {
 if (xmlDocPtr pXmlDoc = parseExport())
+{
 // character formatting (bold) was missing, this was 0
 assertXPath(pXmlDoc, 
/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:rPr/w:b, 1);
+// alias was also missing.
+assertXPath(pXmlDoc, /w:document/w:body/w:p/w:sdt/w:sdtPr/w:alias, 
1);
+}
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFooterBodyDistance, footer-body-distance.docx)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 92e4a96..dcdb99a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4216,7 +4216,7 @@ void DocxAttributeOutput::WritePostponedFormControl(const 
SdrObject* pObject)
 // gather component properties
 
 Date aOriginalDate(Date::EMPTY);
-OUString sOriginalContent, sDateFormat;
+OUString sOriginalContent, sDateFormat, sAlias;
 OUString sLocale(en-US);
 uno::Sequencebeans::PropertyValue aGrabBag;
 uno::Referencebeans::XPropertySet 
xShapePropertySet(pFormObj-getUnoShape(), uno::UNO_QUERY);
@@ -4241,6 +4241,8 @@ void DocxAttributeOutput::WritePostponedFormControl(const 
SdrObject* pObject)
 }
 else if (aGrabBag[i].Name == CharFormat)
 aGrabBag[i].Value = aCharFormat;
+else if (aGrabBag[i].Name == ooxml:CT_SdtPr_alias)
+aGrabBag[i].Value = sAlias;
 }
 }
 uno::Referencebeans::XPropertySet 
xPropertySet(xControlModel, uno::UNO_QUERY);
@@ -4274,6 +4276,11 @@ void 
DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject)
 m_pSerializer-startElementNS(XML_w, XML_sdt, FSEND);
 m_pSerializer-startElementNS(XML_w, XML_sdtPr, FSEND);
 
+if (!sAlias.isEmpty())
+m_pSerializer-singleElementNS(XML_w, XML_alias,
+   FSNS(XML_w, XML_val), 
OUStringToOString(sAlias, RTL_TEXTENCODING_UTF8),
+   FSEND);
+
 if (bHasDate)
 m_pSerializer-startElementNS(XML_w, XML_date,
   FSNS( XML_w, XML_fullDate ), 
sDate.getStr(),
commit 085ab61bfd63d7610f2ccc52aa2483d795c9bc1a
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jul 18 16:41:09 2014 +0200

DOCX import: handle w:alias for the date SDT

Change-Id: I4a58fd9fc1db4e0fd3f9e2142fc208cec9f99f9d

diff --git a/writerfilter/source/dmapper/SdtHelper.cxx 
b/writerfilter/source/dmapper/SdtHelper.cxx
index 18c3c06..2b1a111 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -128,6 +128,8 @@ void SdtHelper::createDateControl(OUString rContentText, 
beans::PropertyValue a
 aGrabBag[DateFormat] = sDateFormat;
 aGrabBag[Locale] = m_sLocale.makeStringAndClear();
 aGrabBag[CharFormat] = aCharFormat.Value;
+// merge in properties like ooxml:CT_SdtPr_alias and friends.
+aGrabBag.update(comphelper::SequenceAsHashMap(m_aGrabBag));
 
 std::vectorOUString aItems;
 createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), 
rContentText, aItems), xControlModel, aGrabBag.getAsConstPropertyValueList());
commit 7916ca62209ee32c46c264b8cbf0a28b1c23a2a8
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jul 18 16:38:45 2014 +0200

Use comphelper::SequenceAsHashMap

Change-Id: I398881187001393a84e407157041d3a7d254b708

diff --git a/writerfilter/source/dmapper/SdtHelper.cxx 
b/writerfilter/source/dmapper/SdtHelper.cxx
index aeb129d..18c3c06 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -12,6 +12,7 @@
 #include com/sun/star/drawing/XControlShape.hpp
 #include com/sun/star/text/VertOrientation.hpp
 
+#include comphelper/sequenceashashmap.hxx
 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2014-07-18 Thread Michael Stahl
 sw/qa/extras/rtfimport/data/fdo78502.rtf   |   11 +++
 sw/qa/extras/rtfimport/rtfimport.cxx   |6 ++
 writerfilter/source/rtftok/rtfcontrolwords.hxx |1 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   23 +++
 4 files changed, 37 insertions(+), 4 deletions(-)

New commits:
commit ab18e62bd7a0a05970323509a2ce22a94c70b7bf
Author: Michael Stahl mst...@redhat.com
Date:   Fri Jul 18 23:43:40 2014 +0200

writerfilter: RTF import: ignore \listname destination differently

This adds a skeleton for \listname but not immediately obvious what it
should do...

Change-Id: Icd8dd3b5d597f1c4038044ec2eba8b63718e0d3d

diff --git a/writerfilter/source/rtftok/rtfcontrolwords.hxx 
b/writerfilter/source/rtftok/rtfcontrolwords.hxx
index f89e4cf..b55c2f2 100644
--- a/writerfilter/source/rtftok/rtfcontrolwords.hxx
+++ b/writerfilter/source/rtftok/rtfcontrolwords.hxx
@@ -33,6 +33,7 @@ enum RTFDestinationState
 DESTINATION_LISTTABLE,
 DESTINATION_LISTPICTURE,
 DESTINATION_LISTENTRY,
+DESTINATION_LISTNAME,
 DESTINATION_LISTOVERRIDETABLE,
 DESTINATION_LISTOVERRIDEENTRY,
 DESTINATION_LISTLEVEL,
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d8e12d0..5946642 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1097,6 +1097,7 @@ void RTFDocumentImpl::text(OUString rString)
 case DESTINATION_FONTENTRY:
 case DESTINATION_STYLESHEET:
 case DESTINATION_STYLEENTRY:
+case DESTINATION_LISTNAME:
 case DESTINATION_REVISIONTABLE:
 case DESTINATION_REVISIONENTRY:
 {
@@ -1156,6 +1157,10 @@ void RTFDocumentImpl::text(OUString rString)
 else
 SAL_INFO(writerfilter, no RTF style type defined, 
ignoring);
 break;
+case DESTINATION_LISTNAME:
+// TODO: what can be done with a list name?
+m_aStates.top().aDestinationText.makeStringAndClear();
+break;
 case DESTINATION_REVISIONTABLE:
 case DESTINATION_REVISIONENTRY:
 m_aAuthors[m_aAuthors.size()] = 
m_aStates.top().aDestinationText.makeStringAndClear();
@@ -1494,6 +1499,9 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword 
nKeyword)
 case RTF_LIST:
 m_aStates.top().nDestinationState = DESTINATION_LISTENTRY;
 break;
+case RTF_LISTNAME:
+m_aStates.top().nDestinationState = DESTINATION_LISTNAME;
+break;
 case RTF_LFOLEVEL:
 m_aStates.top().nDestinationState = DESTINATION_LFOLEVEL;
 m_aStates.top().aTableSprms.clear();
@@ -5563,6 +5571,8 @@ int RTFDocumentImpl::popState()
 m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, 
pValue);
 }
 break;
+case DESTINATION_LISTNAME:
+break;
 case DESTINATION_LISTLEVEL:
 {
 RTFValue::Pointer_t pInnerValue(new 
RTFValue(m_aStates.top().nListLevelNum++));
commit e93f0852477b44df986807860c821319a921b199
Author: Michael Stahl mst...@redhat.com
Date:   Fri Jul 18 23:40:40 2014 +0200

fdo#78502: writerfilter: RTF import: handle \u keyword inside levelnumbers

The ; terminates an entry and shall not be inserted as text,
even if some over-engineered producer encodes it as {\uc1 \u59 ?}.

Also, remove the special-casing of the \leveltext destination, since the
bugdoc does contain \uc inside it and it's not obvious why that should
be ignored.

Change-Id: I1e19c9df39597cb1b22bbda97853c829d7812e29

diff --git a/sw/qa/extras/rtfimport/data/fdo78502.rtf 
b/sw/qa/extras/rtfimport/data/fdo78502.rtf
new file mode 100644
index 000..37749e8
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo78502.rtf
@@ -0,0 +1,11 @@
+{\rtf \ansi \ansicpg0 \deff0
+{\fonttbl {\f0 \froman \fcharset0 \fprq2 Times New Roman{\*\falt Times New 
Roman};}{\f1 \fnil \fcharset134 \fprq0 {\uc1 \u23435 ?}{\uc1 \u20307 ?}{\*\falt 
{\uc1 \u23435 ?}{\uc1 \u20307 ?}};}{\f2 \froman \fcharset0 \fprq0 
Symbol{\*\falt Symbol};}}
+{\*\listtable
+{\list \listtemplateid300746803 \listhybrid
+{\listlevel \levelnfc23 \levelnfcn23 \leveljc0 \leveljcn0 \levelstartat1 
\levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0 
{\leveltext {\uc1 \u1 ?}{\uc1 \u61623 ?}{\uc1 \u59 ?}}{\levelnumbers {\uc1 \u59 
?}}\fs20 \dbch \af1 \hich \af2 \loch \f2 \li720 \lin720 \fi-360 \jclisttab 
\tx720 }
+{\listlevel \levelnfc23 \levelnfcn23 \leveljc0 \leveljcn0 \levelstartat1 
\levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0 
{\leveltext {\uc1 \u1 ?}{\uc1 \u61623 ?}{\uc1 \u59 ?}}{\levelnumbers {\uc1 \u59 
?}}\fs20 \dbch \af1 \hich \af2 \loch \f2 \li1440 \lin1440 \fi-360 \jclisttab 
\tx1440 }
+{\listlevel \levelnfc23 \levelnfcn23 \leveljc0 \leveljcn0 \levelstartat1 
\levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-07-16 Thread Miklos Vajna
 sw/qa/extras/README |   19 ++
 sw/qa/extras/ooxmlexport/data/fdo79817.docx |binary
 sw/qa/extras/ooxmlexport/data/sdt-citation-run.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   35 +---
 sw/source/filter/ww8/docxattributeoutput.cxx|2 +
 writerfilter/source/dmapper/DomainMapper.cxx|   12 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |   15 ++--
 writerfilter/source/dmapper/DomainMapper_Impl.hxx   |3 +
 8 files changed, 61 insertions(+), 25 deletions(-)

New commits:
commit 033f59dad00d449fec8b8eccf8674ee59d8e
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Jul 16 11:27:33 2014 +0200

sw/qa/extras/README: document how to run a single test

This was already documented in the code, but first it got copypasted
several times, then now it's hidden in a header, so not so easy to
find.

Change-Id: I6c6814a14bb6208d9f31ee66f0c0f9b843ee7157

diff --git a/sw/qa/extras/README b/sw/qa/extras/README
index fbc6aac..1959f68 100644
--- a/sw/qa/extras/README
+++ b/sw/qa/extras/README
@@ -128,6 +128,25 @@ uno::Referencebeans::XPropertySet 
xStyle(getStyles(PageStyles)-getByName(DE
 CPPUNIT_ASSERT_EQUAL(true, getPropertybool(xStyle, IsLandscape));
 
 
+== CppUnit tips
+
+=== sal_Bool
+
+In case an UNO method returns sal_Bool, and the assert fails, CppUnit won't be
+able to print a usable error message, as it will think that the value is a
+printable character. Best to use `bool` for the expected value and cast the
+actual value to `bool` as well before comparing.
+
+=== Running only a single test
+
+If you want to run only a single test to allow quick development iteration,
+then you need to do two things:
+
+- change the `#if 1` in `inc/swmodeltestbase.hxx` to `#if 0` to define the test
+  macro with the `_ONLY` suffix
+- change the used macro for the test you want to run, i.e.
+  `DECLARE_OOXMLEXPORT_TEST` - `DECLARE_OOXMLEXPORT_TEST_ONLY`
+
 == UNO, in more details, various tips:
 
 === writing code based xray inspection:
commit b2bc4ea8ddae6b01f344469d988e21fed3143c42
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed Jul 16 10:46:38 2014 +0200

DOCX import: handle SDT around citation field

There were two problems here:

1) Citation field was around a run, but was exported as around the
paragraph.

2) The SDT properties were discarded, as they were inserted into a
character context that was thrown away. To fix this, add a (character
properties) context to the field state, so when it's inserted, it can
have the requested properties.

Change-Id: Ic36deff616060f049147874633c6c7264ae8ecf2

diff --git a/sw/qa/extras/ooxmlexport/data/sdt-citation-run.docx 
b/sw/qa/extras/ooxmlexport/data/sdt-citation-run.docx
new file mode 100644
index 000..cd97f93
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/sdt-citation-run.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 646bf57..0e69a54 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2903,7 +2903,7 @@ DECLARE_OOXMLEXPORT_TEST(test_FieldType, 99_Fields.docx)
 // Checking for three field types (BIBLIOGRAPHY, BIDIOUTLINE, CITATION) in 
sequence
 assertXPath(pXmlDoc, 
/w:document[1]/w:body[1]/w:p[2]/w:r[2]/w:instrText[1],1);
 assertXPath(pXmlDoc, 
/w:document[1]/w:body[1]/w:p[5]/w:r[2]/w:instrText[1],1);
-assertXPath(pXmlDoc, 
/w:document[1]/w:body[1]/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText[1],1);
+assertXPath(pXmlDoc, 
/w:document[1]/w:body[1]/w:p/w:sdt/w:sdtContent/w:r[2]/w:instrText[1],1);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testComboBoxControl, combobox-control.docx)
@@ -3002,8 +3002,8 @@ DECLARE_OOXMLEXPORT_TEST(testCitation,FDO74775.docx)
 xmlDocPtr pXmlDoc = parseExport();
 if (!pXmlDoc)
 return;
-assertXPathContent(pXmlDoc, 
/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[3]/w:instrText,  CITATION 
Kra06 \\l 1033 );
-assertXPathContent(pXmlDoc, 
/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[5]/w:t, (Kramer  Chen, 
2006));
+assertXPathContent(pXmlDoc, 
/w:document/w:body/w:p[1]/w:sdt/w:sdtContent/w:r[2]/w:instrText,  CITATION 
Kra06 \\l 1033 );
+assertXPathContent(pXmlDoc, 
/w:document/w:body/w:p[1]/w:sdt/w:sdtContent/w:r[4]/w:t, (Kramer  Chen, 
2006));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo76016, fdo76016.docx)
@@ -3101,11 +3101,11 @@ DECLARE_OOXMLEXPORT_TEST(testSimpleSdts, 
simple-sdts.docx)
 if (!pXmlDoc)
return;
 
-assertXPath(pXmlDoc, /w:document/w:body/w:p/w:sdt/w:sdtPr/w:text, 1);
-assertXPath(pXmlDoc, /w:document/w:body/w:p/w:sdt/w:sdtPr/w:id, 1);
+assertXPath(pXmlDoc, /w:document/w:body/w:p[1]/w:sdt/w:sdtPr/w:text, 1);
+assertXPath(pXmlDoc, /w:document/w:body/w:p[2]/w:sdt/w:sdtPr/w:id, 1);
 assertXPath(pXmlDoc, 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source

2014-06-06 Thread Jacobo Aragunde Pérez
 sw/qa/extras/ooxmlexport/data/theme-preservation.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   10 +--
 sw/source/filter/ww8/docxattributeoutput.cxx  |   58 +-
 sw/source/filter/ww8/docxattributeoutput.hxx  |1 
 4 files changed, 52 insertions(+), 17 deletions(-)

New commits:
commit 1534c3363336003c4f84cfec1bf988fef6663f8a
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Fri Jun 6 13:43:06 2014 +0200

fdo#79558: Do not overwrite w:shd value

When a w:shd has some pattern with two colors, LO blends both to
render the paragraph background. We must compare that blended color
with the paragraph color on export to know if the user has edited it
or not. We were using the w:fill attribute to compare, but that was
incorrect.

Modified an existing unit test to check this behaviour. The unit test
had to be retouched because Word remove some redundant information
from the original .docx file when I saved it again with some
background changes.

Change-Id: Ia2f1ddc4afd2637e1d87b6eccd441c26853045c4

diff --git a/sw/qa/extras/ooxmlexport/data/theme-preservation.docx 
b/sw/qa/extras/ooxmlexport/data/theme-preservation.docx
index 1c94b47..2de4374 100644
Binary files a/sw/qa/extras/ooxmlexport/data/theme-preservation.docx and 
b/sw/qa/extras/ooxmlexport/data/theme-preservation.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4c6dcda..596c292 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1930,9 +1930,7 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, 
theme-preservation.docx)
 // check theme font color value has been preserved
 assertXPath(pXmlDocument, 
/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color, themeColor, accent3);
 OUString sThemeShade = getXPath(pXmlDocument, 
/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color, themeShade);
-CPPUNIT_ASSERT_EQUAL(sThemeShade.toInt32(16), sal_Int32(0xbf));
-assertXPath(pXmlDocument, 
/w:document/w:body/w:p[7]/w:r[1]/w:rPr/w:color, themeColor, accent1);
-assertXPath(pXmlDocument, 
/w:document/w:body/w:p[7]/w:r[1]/w:rPr/w:color, themeTint, 99);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0xbf), sThemeShade.toInt32(16));
 
 // check the themeFontLang values in settings file
 xmlDocPtr pXmlSettings = parseExport(word/settings.xml);
@@ -1956,8 +1954,12 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, 
theme-preservation.docx)
 CPPUNIT_ASSERT_EQUAL(OUString(Trebuchet MS),
  getPropertyOUString(getParagraph(5, Major theme 
font), CharFontName));
 
-// check the paragraph background theme color has been preserved
+// check the paragraph background pattern has been preserved including 
theme colors
+assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, val, 
thinHorzStripe);
 assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, 
themeFill, text2);
+assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, 
themeFillTint, 33);
+assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, 
themeColor, accent1);
+assertXPath(pXmlDocument, /w:document/w:body/w:p[6]/w:pPr/w:shd, 
themeShade, 80);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, 
table-theme-preservation.docx)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index f357a6f..d3cfad8 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6867,14 +6867,13 @@ void DocxAttributeOutput::FormatBackground( const 
SvxBrushItem rBrush )
 }
 else if ( !m_rExport.bOutPageDescs )
 {
-if( !m_pBackgroundAttrList )
-m_pBackgroundAttrList = m_pSerializer-createAttrList();
-
 // compare fill color with the original fill color
 OString sOriginalFill = rtl::OUStringToOString(
-m_pBackgroundAttrList-getOptionalValue( FSNS( XML_w, XML_fill 
) ), RTL_TEXTENCODING_UTF8 );
-if( sOriginalFill.isEmpty() )
+m_sOriginalBackgroundColor, RTL_TEXTENCODING_UTF8 );
+
+if( !m_pBackgroundAttrList )
 {
+m_pBackgroundAttrList = m_pSerializer-createAttrList();
 m_pBackgroundAttrList-add( FSNS( XML_w, XML_fill ), 
sColor.getStr() );
 m_pBackgroundAttrList-add( FSNS( XML_w, XML_val ), clear );
 }
@@ -6886,6 +6885,7 @@ void DocxAttributeOutput::FormatBackground( const 
SvxBrushItem rBrush )
 m_pBackgroundAttrList-add( FSNS( XML_w, XML_fill ), 
sColor.getStr() );
 m_pBackgroundAttrList-add( FSNS( XML_w, XML_val ), clear );
 }
+m_sOriginalBackgroundColor = ;
 }
 }
 
@@ -7272,7 +7272,7 @@ void DocxAttributeOutput::ParaGrabBag(const 
SfxGrabBagItem rItem)
 {
 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2014-05-24 Thread Miklos Vajna
 sw/qa/extras/rtfimport/rtfimport.cxx |3 ++-
 sw/source/core/doc/docbm.cxx |2 ++
 writerfilter/source/ooxml/efforts.sh |   20 
 3 files changed, 4 insertions(+), 21 deletions(-)

New commits:
commit 17fa344d034df1a1179b4e5961ec3001402a6df1
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat May 24 22:00:05 2014 +0200

coverity#1158081 Unchecked dynamic_cast

Change-Id: Ia67656ac35d50c1f70045ff8e9084bcc54b0d9a8

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 901ac71..21de483 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -573,6 +573,8 @@ namespace sw { namespace mark
 ++ppMark)
 {
 ::sw::mark::MarkBase* pMark = dynamic_cast ::sw::mark::MarkBase* 
(ppMark-get());
+if (!pMark)
+continue;
 // is on position ??
 bool bChangedPos = false;
 if(pMark-GetMarkPos().nNode.GetNode() == pOldNode)
commit 8617afc0a88789722202cd0f30678eaee6c95580
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat May 24 21:55:34 2014 +0200

writerfilter: unused efforts.sh

Change-Id: Ide86e29584faeff1d4b8a7d6d8a9a59acc725bd4

diff --git a/writerfilter/source/ooxml/efforts.sh 
b/writerfilter/source/ooxml/efforts.sh
deleted file mode 100755
index e2c58e2..000
--- a/writerfilter/source/ooxml/efforts.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-#   Licensed to the Apache Software Foundation (ASF) under one or more
-#   contributor license agreements. See the NOTICE file distributed
-#   with this work for additional information regarding copyright
-#   ownership. The ASF licenses this file to you under the Apache
-#   License, Version 2.0 (the License); you may not use this file
-#   except in compliance with the License. You may obtain a copy of
-#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-./status.sh | xmllint --format - | xsltproc todo.xsl - | xsltproc effort.xsl -
commit 1c14618eaf7c2cc15f060733d6f88a5d4ed132f9
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Sat May 24 21:53:19 2014 +0200

CppunitTest_sw_rtfimport: the point here was only that this was nearly zero

If the old width was that small, then something larger should be also
fine. (Seen 564 instead of 423.)

Change-Id: Ife0fd4a55738268cdc1691b90e28b51adba829ef

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index e96f037..0284736 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -821,7 +821,8 @@ DECLARE_RTFIMPORT_TEST(testFdo52989, fdo52989.rtf)
 {
 // Same as n#192129, but for JPEG files.
 uno::Referencedrawing::XShape xShape(getShape(1), uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(423), xShape-getSize().Width);
+// This was 2, should be 423.
+CPPUNIT_ASSERT(xShape-getSize().Width = 423);
 }
 
 DECLARE_RTFIMPORT_TEST(testFdo48442, fdo48442.rtf)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2014-03-26 Thread Luboš Luňák
 dev/null |binary
 sw/qa/extras/ooxmlimport/data/negative_table_cell_twips.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   24 +++
 writerfilter/source/dmapper/CellMarginHandler.cxx|2 
 writerfilter/source/dmapper/ConversionHelper.cxx |   10 +++-
 writerfilter/source/dmapper/ConversionHelper.hxx |1 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   24 +--
 writerfilter/source/dmapper/TablePropertiesHandler.cxx   |4 -
 8 files changed, 32 insertions(+), 33 deletions(-)

New commits:
commit 0d1abac3a3131a9419cedb4385edf6ab8ccb58de
Author: Luboš Luňák l.lu...@collabora.com
Date:   Wed Mar 26 17:31:03 2014 +0100

test for ignoring negative cell margin values

Change-Id: I7e56762a7097dd7369f9d8d71b499888ee5c081d

diff --git a/sw/qa/extras/ooxmlimport/data/negative_table_cell_twips.docx 
b/sw/qa/extras/ooxmlimport/data/negative_table_cell_twips.docx
new file mode 100644
index 000..3ae73db
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/negative_table_cell_twips.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index b86d26d..da5472d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1981,6 +1981,14 @@ DECLARE_OOXMLIMPORT_TEST(testLargeTwips, 
large-twips.docx )
 CPPUNIT_ASSERT( width.toInt32()  0 );
 }
 
+DECLARE_OOXMLIMPORT_TEST(testNegativeCellMarginTwips, 
negative-cell-margin-twips.docx )
+{
+// Sligtly related to cp#143, the twips value was negative, which 
wrapped around somewhere,
+// while MSO seems to ignore that as well.
+OUString width = parseDump( 
/root/page/body/tab/row[1]/cell[1]/txt/infos/bounds, width );
+CPPUNIT_ASSERT( width.toInt32()  0 );
+}
+
 DECLARE_OOXMLIMPORT_TEST(testFdo38414, fdo38414.docx )
 {
 // The cells in the last (4th) column were merged properly and so the 
result didn't have the same height.
commit 1e47614cdb84b018a22a334dad0cdd9f0f53892c
Author: Luboš Luňák l.lu...@collabora.com
Date:   Wed Mar 26 17:28:51 2014 +0100

apparently some table .docx properties shouldn't be  0

Somewhat related to 10b4da63e3143108ba75891e9e98fdaa2f7953ab , a similar
doc has negative value inside w:tblCellMar, which MSO seems to ignore
(altering the value has no visible effect), so ignore it as well.

Change-Id: I846e9b55fea0d4e66f03ce615584516360b8b7dd

diff --git a/writerfilter/source/dmapper/CellMarginHandler.cxx 
b/writerfilter/source/dmapper/CellMarginHandler.cxx
index 380a8d9..6bbb525 100644
--- a/writerfilter/source/dmapper/CellMarginHandler.cxx
+++ b/writerfilter/source/dmapper/CellMarginHandler.cxx
@@ -57,7 +57,7 @@ void CellMarginHandler::lcl_attribute(Id rName, Value  rVal)
 {
 case NS_ooxml::LN_CT_TblWidth_w:
 m_nWidth = nIntValue;
-m_nValue = ConversionHelper::convertTwipToMM100( nIntValue );
+m_nValue = ConversionHelper::convertTwipToMM100Unsigned( nIntValue 
);
 break;
 case NS_ooxml::LN_CT_TblWidth_type:
 OSL_ENSURE( NS_ooxml::LN_Value_ST_TblWidth_dxa == 
sal::static_int_castId(nIntValue), cell margins work for absolute values, 
only);
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx 
b/writerfilter/source/dmapper/ConversionHelper.cxx
index cba58b7..9de86ee 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -226,18 +226,24 @@ OUString ConvertMSFormatStringToSO(
 
 }
 
+#define TWIP_TO_MM100(TWIP) ((TWIP) = 0 ? (((TWIP)*127L+36L)/72L) : 
(((TWIP)*127L-36L)/72L))
 
 sal_Int32 convertTwipToMM100(sal_Int32 _t)
 {
+return TWIP_TO_MM100( _t );
+}
+
+sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t)
+{
+if( _t  0 )
+return 0;
 // It appears that MSO handles large twip values specially, probably 
legacy 16bit handling,
 // anything that's bigger than 32767 appears to be simply ignored.
 if( _t = 0x8000 )
 return 0;
-#define TWIP_TO_MM100(TWIP) ((TWIP) = 0 ? (((TWIP)*127L+36L)/72L) : 
(((TWIP)*127L-36L)/72L))
 return TWIP_TO_MM100( _t );
 }
 
-
 sal_Int32 convertEMUToMM100(sal_Int32 _t)
 {
 return _t / 360;
diff --git a/writerfilter/source/dmapper/ConversionHelper.hxx 
b/writerfilter/source/dmapper/ConversionHelper.hxx
index 5b3b4fd..247da5c 100644
--- a/writerfilter/source/dmapper/ConversionHelper.hxx
+++ b/writerfilter/source/dmapper/ConversionHelper.hxx
@@ -44,6 +44,7 @@ namespace ConversionHelper{
 OUString ConvertMSFormatStringToSO(
 const OUString rFormat, ::com::sun::star::lang::Locale rLocale, 
bool bHijri);
 sal_Int32 convertTwipToMM100(sal_Int32 _t);
+sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t);
 // probably the most useless unit in the world - English Metric Units 
(EMU) 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source vcl/source

2014-03-24 Thread Jan Holesovsky
 sw/qa/extras/inc/swmodeltestbase.hxx   |   10 
 sw/source/filter/ww8/docxsdrexport.cxx |9 +++
 vcl/source/gdi/outdev2.cxx |   12 +-
 vcl/source/window/window.cxx   |   39 +++--
 4 files changed, 29 insertions(+), 41 deletions(-)

New commits:
commit f7c802b46d1c7cafe4c8e0cbec2ce46854862812
Author: Jan Holesovsky ke...@collabora.com
Date:   Mon Mar 24 09:49:01 2014 +0100

No need for a template here.

Change-Id: Id56f5c394a4973b9d9464d79a2e94cda38f192de

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 1083477..c80cce0 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -50,10 +50,9 @@ using namespace oox;
 namespace
 {
 
-templateclass T
-T lclGetProperty(uno::Referencedrawing::XShape rShape, const OUString 
rPropName)
+uno::Sequencebeans::PropertyValue 
lclGetProperty(uno::Referencedrawing::XShape rShape, const OUString 
rPropName)
 {
-T aResult;
+uno::Sequencebeans::PropertyValue aResult;
 uno::Referencebeans::XPropertySet xPropertySet(rShape, uno::UNO_QUERY);
 uno::Referencebeans::XPropertySetInfo xPropSetInfo;
 
@@ -73,7 +72,7 @@ OUString lclGetAnchorIdFromGrabBag(const SdrObject* pObj)
 OUString aResult;
 uno::Referencedrawing::XShape 
xShape(const_castSdrObject*(pObj)-getUnoShape(), uno::UNO_QUERY);
 uno::Sequence beans::PropertyValue  propList =
-lclGetProperty uno::Sequencebeans::PropertyValue (xShape, 
FrameInteropGrabBag);
+lclGetProperty(xShape, FrameInteropGrabBag);
 for (sal_Int32 nProp = 0; nProp  propList.getLength(); ++nProp)
 {
 OUString aPropName = propList[nProp].Name;
@@ -609,7 +608,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* 
pSdrObject, const SwFrmFmt*
 
 bool bLockedCanvas = false;
 uno::Sequence beans::PropertyValue  propList =
-lclGetProperty uno::Sequencebeans::PropertyValue (xShape, 
InteropGrabBag);
+lclGetProperty(xShape, InteropGrabBag);
 for (sal_Int32 nProp=0; nProp  propList.getLength(); ++nProp)
 {
 OUString propName = propList[nProp].Name;
commit ece15872c8e049a11773083edd80f55fb08b8bf4
Author: Jan Holesovsky ke...@collabora.com
Date:   Mon Mar 24 09:43:39 2014 +0100

Simplify.

Change-Id: If20ed2636c9b3cfbfcfe058fe027bd0cc9f8f277

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index a204ca0..f460800 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -615,15 +615,7 @@ protected:
  */
 void assertXPathContent(xmlDocPtr pXmlDoc, const OString rXPath, const 
OUString rContent)
 {
-xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
-
-CPPUNIT_ASSERT_MESSAGE(OString(XPath ' + rXPath + ' not 
found).getStr(),
-xmlXPathNodeSetGetLength(pXmlNodes)  0);
-
-xmlNodePtr pXmlNode = pXmlNodes-nodeTab[0];
-
-CPPUNIT_ASSERT_EQUAL_MESSAGE(XPath contents of child does not match, 
rContent,
-OUString::createFromAscii((const 
char*)((pXmlNode-children[0]).content)));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(XPath contents of child does not match, 
rContent, getXPathContent(pXmlDoc, rXPath));
 }
 
 /**
commit 4365d3c120ec3952e051d31fa94ec25633737fda
Author: Jan Holesovsky ke...@collabora.com
Date:   Mon Mar 24 09:28:27 2014 +0100

Decrease indentation by returning early.

Change-Id: I9ab5b4dbd28c720c9d7cdd8a1642462643abe94c

diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index d20cd78..51ee483 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -377,12 +377,12 @@ void OutputDevice::CopyArea( const Point rDestPt,
 
 void OutputDevice::CopyAreaFinal( SalTwoRect aPosAry, sal_uInt32 /*nFlags*/)
 {
-if ( aPosAry.mnSrcWidth  aPosAry.mnSrcHeight  aPosAry.mnDestWidth  
aPosAry.mnDestHeight )
-{
-aPosAry.mnDestWidth  = aPosAry.mnSrcWidth;
-aPosAry.mnDestHeight = aPosAry.mnSrcHeight;
-mpGraphics-CopyBits( aPosAry, NULL, this, NULL );
-}
+if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || 
aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0)
+return;
+
+aPosAry.mnDestWidth  = aPosAry.mnSrcWidth;
+aPosAry.mnDestHeight = aPosAry.mnSrcHeight;
+mpGraphics-CopyBits(aPosAry, NULL, this, NULL);
 }
 
 void OutputDevice::ImplDrawFrameDev( const Point rPt, const Point rDevPt, 
const Size rDevSize,
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 857cd1cf..1e6a339 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -422,31 +422,28 @@ bool Window::ImplInitGraphics() const
 
 void Window::CopyAreaFinal( SalTwoRect aPosAry, sal_uInt32 nFlags )
 {
+if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || 
aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source

2014-03-18 Thread Luboš Luňák
 sw/qa/extras/inc/swmodeltestbase.hxx|   10 +-
 sw/qa/extras/ooxmlimport/data/fdo38414.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|7 +++
 sw/source/core/table/swnewtable.cxx |   16 +---
 4 files changed, 25 insertions(+), 8 deletions(-)

New commits:
commit 075fc0c0a34875adf2833e5933b4982b9443a373
Author: Luboš Luňák l.lu...@centrum.cz
Date:   Tue Mar 18 19:29:29 2014 +0100

testcase for fdo#38414

Change-Id: I9467ae2ba5155175d5be8218248edada136a5ca1

diff --git a/sw/qa/extras/ooxmlimport/data/fdo38414.docx 
b/sw/qa/extras/ooxmlimport/data/fdo38414.docx
new file mode 100644
index 000..135cd32
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo38414.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e47a208..87571c8 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1997,6 +1997,13 @@ DECLARE_OOXMLIMPORT_TEST(testLargeTwips, 
large-twips.docx )
 CPPUNIT_ASSERT( width.toInt32()  0 );
 }
 
+DECLARE_OOXMLIMPORT_TEST(testFdo38414, fdo38414.docx )
+{
+// The cells in the last (4th) column were merged properly and so the 
result didn't have the same height.
+OUString height3 = 
parseDump(/root/page/body/tab/row[1]/cell[3]/infos/bounds, height );
+OUString height4 = 
parseDump(/root/page/body/tab/row[1]/cell[4]/infos/bounds, height );
+CPPUNIT_ASSERT_EQUAL( height3, height4 );
+}
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit e1036f0faedcb58897628dcfa8ccbda42b20403c
Author: Luboš Luňák l.lu...@centrum.cz
Date:   Tue Mar 18 19:17:43 2014 +0100

add messages to utility test functions

So that e.g. parseDump() in case of an incorrect xpath does not just
plain give an equality assertion failure, which on its own is confusing.

Change-Id: Ib9fc2b4f6720b5c472773afbe8dc18cd8961465c

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index e079810..1fb6c48 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -274,7 +274,7 @@ protected:
 xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
 xmlXPathObjectPtr pXmlXpathObj = 
xmlXPathEvalExpression(BAD_CAST(aXPath.getStr()), pXmlXpathCtx);
 xmlNodeSetPtr pXmlNodes = pXmlXpathObj-nodesetval;
-CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(parsing dump failed, 1, 
xmlXPathNodeSetGetLength(pXmlNodes));
 xmlNodePtr pXmlNode = pXmlNodes-nodeTab[0];
 OUString aRet;
 if (aAttribute.getLength())
@@ -352,7 +352,7 @@ protected:
 uno::Referencetext::XTextRange const xParagraph(
 getParagraphOrTable(number), uno::UNO_QUERY_THROW);
 if( !content.isEmpty())
-CPPUNIT_ASSERT_EQUAL( content, xParagraph-getString());
+CPPUNIT_ASSERT_EQUAL_MESSAGE( paragraph does not have expected 
content, content, xParagraph-getString());
 return xParagraph;
 }
 
@@ -360,7 +360,7 @@ protected:
 {
 uno::Referencetext::XTextRange const 
xParagraph(getParagraphOrTable(number, xText), uno::UNO_QUERY_THROW);
 if (!content.isEmpty())
-CPPUNIT_ASSERT_EQUAL(content, xParagraph-getString());
+CPPUNIT_ASSERT_EQUAL_MESSAGE( paragraph does not contain expected 
content, content, xParagraph-getString());
 return xParagraph;
 }
 
@@ -373,7 +373,7 @@ protected:
 xRunEnum-nextElement();
 uno::Referencetext::XTextRange xRun(xRunEnum-nextElement(), 
uno::UNO_QUERY);
 if( !content.isEmpty())
-CPPUNIT_ASSERT_EQUAL( content, xRun-getString());
+CPPUNIT_ASSERT_EQUAL_MESSAGE( run does not contain expected 
content, content, xRun-getString());
 return xRun;
 }
 
@@ -399,7 +399,7 @@ protected:
 {
 uno::Referencetext::XText const xCellText(xCell,
 uno::UNO_QUERY_THROW);
-CPPUNIT_ASSERT_EQUAL(rContent, xCellText-getString());
+CPPUNIT_ASSERT_EQUAL_MESSAGE(cell does not contain expected 
content, rContent, xCellText-getString());
 }
 return xCell;
 }
commit 9970d5d9878bf8b40361606cfad6b25a2b6cc83d
Author: Luboš Luňák l.lu...@centrum.cz
Date:   Tue Mar 18 18:57:05 2014 +0100

workaround for rounding errors when handling merged cells (fdo#38414)

Change-Id: I4d36e4b86c77a7356a8c221cbfc5735e925392ba

diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index 26a445a..0186a22 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -198,10 +198,20 @@ static SwTableBox* lcl_LeftBorder2Box( long nLeft, const 
SwTableLine* pLine )
 {
 SwTableBox* pBox = pLine-GetTabBoxes()[nCurrBox];
 OSL_ENSURE( pBox, Missing table box );

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2014-02-25 Thread Michael Stahl
 sw/qa/extras/rtfimport/data/rhbz1065629.rtf|   20 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   32 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |  439 -
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |   93 -
 writerfilter/source/rtftok/rtfsdrimport.cxx|3 
 writerfilter/source/rtftok/rtftokenizer.cxx|6 
 6 files changed, 419 insertions(+), 174 deletions(-)

New commits:
commit c8f83ce1dbf5544f6aaa91775db6820a69c3c061
Author: Michael Stahl mst...@redhat.com
Date:   Tue Feb 25 12:50:46 2014 +0100

rhbz#1065629: RTF import: re-implement nested tables

The previous fix for this bug only fixed a symptom, this a fix for the
real problem; with the real problem fixed the nCellEnds is unnecessary.

Given that top-level table properties may be put either before or after the
table cells, the only way that works to import tables is to buffer a whole
top-level table row, but currently the buffer is replayed already at the
end of a nested table row.

Fortunately the RTF spec guarantees that \nesttableprops must occur
after the nested table cells of the nested row, so it should be
sufficient to remember the cell properties for the current nested table
row only, in addition to the cell properties for the top-level table row.

With this change, skipping a \nesttableprops destination when there is
a table style turns out to mangle ooo98040-1.rtf badly, so stop doing
that workaround.

RTFDocumentImpl::popState() was copying various buffers up the state
stack which is a clear indication that these shouldn't be members of
RTFParserState in the first place, move them to RTFDocumentImpl.

Change-Id: Ic2d8f7b3e00844b224d61605b405ca651239e5f7

diff --git a/sw/qa/extras/rtfimport/data/rhbz1065629.rtf 
b/sw/qa/extras/rtfimport/data/rhbz1065629.rtf
index b22ec50..7f37594 100644
--- a/sw/qa/extras/rtfimport/data/rhbz1065629.rtf
+++ b/sw/qa/extras/rtfimport/data/rhbz1065629.rtf
@@ -6,6 +6,26 @@
 \f3\ftech\fcharset2 Symbol;
 \f4\fswiss\fcharset0 Helvetica;
 }
+{\colortbl
+;
+\red127\green255\blue212;
+\red0\green0\blue0;
+\red0\green0\blue255;
+\red255\green0\blue255;
+\red190\green190\blue190;
+\red0\green255\blue0;
+\red50\green205\blue50;
+\red176\green48\blue96;
+\red0\green0\blue128;
+\red85\green107\blue47;
+\red160\green32\blue240;
+\red255\green0\blue0;
+\red192\green192\blue192;
+\red0\green128\blue128;
+\red255\green255\blue255;
+\red255\green255\blue0;
+\red204\green0\blue0;
+}
 {\info
 {\*\userprops
 {\propname creator}\proptype30
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index cecd97d..3015f23 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1383,6 +1383,38 @@ DECLARE_RTFIMPORT_TEST(testNestedTable, 
rhbz1065629.rtf)
 xPara.set(xParaEnum-nextElement(), uno::UNO_QUERY);
 xPara.set(xParaEnum-nextElement(), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(OUString(Nom: John Doe), xPara-getString());
+
+// outer table: background color, borders for B1/B2 cell
+xTable.set(xTables-getByIndex(2), uno::UNO_QUERY);
+xCell.set(xTable-getCellByName(A1), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xCell.is());
+table::BorderLine2 fullPtSolid(
+1, 0, 35, 0, table::BorderLineStyle::SOLID, 35);
+CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
+getPropertytable::BorderLine2(xCell, LeftBorder));
+CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
+getPropertytable::BorderLine2(xCell, RightBorder));
+CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
+getPropertytable::BorderLine2(xCell, TopBorder));
+CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
+getPropertytable::BorderLine2(xCell, BottomBorder));
+CPPUNIT_ASSERT_EQUAL(0xCC, getPropertysal_Int32(xCell, BackColor));
+xCell.set(xTable-getCellByName(A2), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xCell.is());
+table::BorderLine2 halfPtSolid(
+/*0*/1, 0, 18, 0, table::BorderLineStyle::SOLID, 18);
+CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid,
+getPropertytable::BorderLine2(xCell, LeftBorder));
+CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(0x),
+getPropertysal_Int32(xCell, BackColor));
+xCell.set(xTable-getCellByName(B2), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xCell.is());
+CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid,
+getPropertytable::BorderLine2(xCell, LeftBorder));
+CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid,
+getPropertytable::BorderLine2(xCell, RightBorder));
+CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(0x),
+getPropertysal_Int32(xCell, BackColor));
 }
 
 DECLARE_RTFIMPORT_TEST(testCp116, hello.rtf)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 626c834..621e3a5 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2013-12-17 Thread Jacobo Aragunde Pérez
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |5 +
 sw/source/filter/ww8/docxattributeoutput.cxx |   86 +++
 sw/source/filter/ww8/docxattributeoutput.hxx |2 
 writerfilter/source/dmapper/DomainMapper.cxx |   21 ++
 writerfilter/source/dmapper/PropertyIds.cxx  |3 
 writerfilter/source/dmapper/PropertyIds.hxx  |3 
 6 files changed, 95 insertions(+), 25 deletions(-)

New commits:
commit 25dc9aaf693ba1e4aac75659f0762f5169c10f28
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Tue Dec 17 14:12:57 2013 +0100

ooxml: preserve font theme color shade property

Change-Id: I40fa3f172f98b319a97a855231b854651be2d784

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 9cbaaf6..e8279c0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2062,6 +2062,8 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, 
theme-preservation.docx)
 
 // check theme font color value has been preserved
 assertXPath(pXmlDocument, 
/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color, themeColor, accent3);
+OUString sThemeShade = getXPath(pXmlDocument, 
/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color, themeShade);
+CPPUNIT_ASSERT_EQUAL(sThemeShade.toInt32(16), 0xbf);
 
 // check the themeFontLang values in settings file
 xmlDocPtr pXmlSettings = parseExport(word/settings.xml);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7d32238..ff041dc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6216,6 +6216,15 @@ void DocxAttributeOutput::CharGrabBag( const 
SfxGrabBagItem rItem )
 m_pColorAttrList-add( FSNS( XML_w, XML_themeColor ),
OUStringToOString( str, 
RTL_TEXTENCODING_UTF8 ) );
 }
+else if ( i-first == CharThemeColorShade )
+{
+i-second = str;
+if( !m_pColorAttrList )
+m_pColorAttrList = m_pSerializer-createAttrList();
+
+m_pColorAttrList-add( FSNS( XML_w, XML_themeShade ),
+   OUStringToOString( str, 
RTL_TEXTENCODING_UTF8 ) );
+}
 else if( i-first == CharThemeFontNameCs   ||
 i-first == CharThemeFontNameAscii ||
 i-first == CharThemeFontNameEastAsia ||
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 357faa3..1ee9e2d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3110,6 +3110,8 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext, SprmType
 
m_pImpl-GetTopContext()-Insert(PROP_CHAR_THEME_ORIGINAL_COLOR, aIter-Value, 
true, CHAR_GRAB_BAG);
 else if (aIter-Name == themeColor)
 m_pImpl-GetTopContext()-Insert(PROP_CHAR_THEME_COLOR, 
aIter-Value, true, CHAR_GRAB_BAG);
+else if (aIter-Name == themeShade)
+
m_pImpl-GetTopContext()-Insert(PROP_CHAR_THEME_COLOR_SHADE, aIter-Value, 
true, CHAR_GRAB_BAG);
 }
 if (m_pImpl-m_aInteropGrabBagName == TempColorPropsGrabBag)
 {
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index a38b19c..8916ff8 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -357,6 +357,7 @@ const OUString PropertyNameSupplier::GetName( PropertyIds 
eId ) const
 case PROP_CHAR_THEME_FONT_NAME_EAST_ASIA:   sName = 
CharThemeFontNameEastAsia; break;
 case PROP_CHAR_THEME_COLOR  :   sName = 
CharThemeColor; break;
 case PROP_CHAR_THEME_ORIGINAL_COLOR :   sName = 
CharThemeOriginalColor; break;
+case PROP_CHAR_THEME_COLOR_SHADE:   sName = 
CharThemeColorShade; break;
 }
 ::std::pairPropertyNameMap_t::iterator,bool aInsertIt =
 m_pImpl-aNameMap.insert( PropertyNameMap_t::value_type( eId, 
sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx 
b/writerfilter/source/dmapper/PropertyIds.hxx
index e804686..8f1fa11 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -328,6 +328,7 @@ enum PropertyIds
 ,PROP_CHAR_THEME_FONT_NAME_EAST_ASIA
 ,PROP_CHAR_THEME_COLOR
 ,PROP_CHAR_THEME_ORIGINAL_COLOR
+,PROP_CHAR_THEME_COLOR_SHADE
 };
 struct PropertyNameSupplier_Impl;
 class PropertyNameSupplier
commit 3d126bcf1febe68919eab42c5cd2cd0d7db2f66b
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Tue Dec 17 13:19:16 2013 +0100

ooxml: preserve font theme color property

The property is called w:themeColor and it belongs to the 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source

2013-11-20 Thread Jan Holesovsky
 sw/qa/extras/ooxmlexport/data/bnc837302.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   32 ++
 sw/source/core/doc/docredln.cxx   |3 --
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   14 +
 4 files changed, 47 insertions(+), 2 deletions(-)

New commits:
commit 919d4a2c5977bb6066e5baf6bb960a21cd385911
Author: Jan Holesovsky ke...@collabora.com
Date:   Wed Nov 20 13:39:18 2013 +0100

Related bnc#837302: Don't introduce a redlined delete and the end of doc.

Change-Id: I5c3903a40b69867684707d33acbc92b1f80a93ec

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 13245c3..da830d6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1170,6 +1170,17 @@ DECLARE_OOXMLEXPORT_TEST(testBnc837302, bnc837302.docx)
 getRun(xParagraph, 3, AAA);
 // interestingly the 'Insert' is set on the _previous_ run
 CPPUNIT_ASSERT_EQUAL(OUString(Insert), 
getPropertyOUString(getRun(xParagraph, 2), RedlineType));
+
+// make sure we don't introduce a redlined delete in the 2nd paragraph
+xParagraph = getParagraph(2);
+OUString aProperty;
+try
+{
+// throws when not present
+aProperty = getPropertyOUString(getRun(xParagraph, 1), 
RedlineType);
+}
+catch (const beans::UnknownPropertyException) {}
+CPPUNIT_ASSERT_EQUAL(OUString(), aProperty);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo68418, fdo68418.docx)
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index cc2486b..d88ca49 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -300,7 +300,21 @@ void DomainMapper_Impl::RemoveLastParagraph( )
 // If this is a text on a shape, possibly the text has the trailing
 // newline removed already.
 if (xCursor-getString() == \n)
+{
+uno::Referencebeans::XPropertySet 
xDocProps(GetTextDocument(), uno::UNO_QUERY);
+const OUString aRecordChanges(RecordChanges);
+uno::Any 
aPreviousValue(xDocProps-getPropertyValue(aRecordChanges));
+
+// disable redlining for this operation, otherwise we might
+// end up with an unwanted recorded deletion
+xDocProps-setPropertyValue(aRecordChanges, 
uno::Any(sal_False));
+
+// delete
 xCursor-setString(OUString());
+
+// restore again
+xDocProps-setPropertyValue(aRecordChanges, aPreviousValue);
+}
 }
 }
 catch( const uno::Exception )
commit 6e0aa783f4112791de336007343e064abc46324e
Author: Jan Holesovsky ke...@collabora.com
Date:   Wed Nov 20 11:45:39 2013 +0100

bnc#837302: Allow insertion of redlines with an empty author.

No idea why that was not allowed (since the initial import in 2000), we need
it for interoperability.

Change-Id: I475fa63f9a4a3219a2b898b6f7d81e0603d32c18

diff --git a/sw/qa/extras/ooxmlexport/data/bnc837302.docx 
b/sw/qa/extras/ooxmlexport/data/bnc837302.docx
new file mode 100644
index 000..9d0c0af
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/bnc837302.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index f20cecd..13245c3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1161,6 +1161,17 @@ DECLARE_OOXMLEXPORT_TEST(testBnc834035, bnc834035.odt)
 assertXPath(pXmlDoc, /w:document/w:body/w:p[10]/w:hyperlink, anchor, 
_Toc363553908);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testBnc837302, bnc837302.docx)
+{
+// The problem was that text with empty author was not inserted as a 
redline
+uno::Referencetext::XTextRange xParagraph = getParagraph(1);
+
+// previously 'AAA' was not an own run
+getRun(xParagraph, 3, AAA);
+// interestingly the 'Insert' is set on the _previous_ run
+CPPUNIT_ASSERT_EQUAL(OUString(Insert), 
getPropertyOUString(getRun(xParagraph, 2), RedlineType));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFdo68418, fdo68418.docx)
 {
 // The problem was that in 'MSWordExportBase::SectionProperties' function 
in 'wrt8sty.cxx'
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 04bd747..ee4db26 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -290,8 +290,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool 
bCallDelete )
 bool bMerged = false;
 _CHECK_REDLINE( this )
 
-if( IsRedlineOn()  !IsShowOriginal( meRedlineMode ) 
-!pNewRedl-GetAuthorString().isEmpty() )
+if (IsRedlineOn()  !IsShowOriginal(meRedlineMode))
 {
 pNewRedl-InvalidateRange();
 
commit ae3cfef7ea13f49f442862aba5264fc8839dd863
Author: 

[Libreoffice-commits] core.git: 3 commits - sw/qa

2013-10-24 Thread Ptyl Dragon
 sw/qa/tiledrendering/tiledrendering.cxx |7 +--
 sw/qa/tiledrendering/tiledrendering.ui  |2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 9fd0abe9abfe37cb1591e1db794e0c921d95b172
Author: Ptyl Dragon p...@cloudon.com
Date:   Wed Oct 23 11:55:16 2013 +0200

added links to the image in tiled rendering

Change-Id: Ic9d972fd67123e3ab04f023806f7f96c89a883a7

diff --git a/sw/qa/tiledrendering/tiledrendering.cxx 
b/sw/qa/tiledrendering/tiledrendering.cxx
index bfd20c3..6af94ec 100644
--- a/sw/qa/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/tiledrendering/tiledrendering.cxx
@@ -21,37 +21,68 @@
 #include vcl/vclmain.hxx
 #include vcl/field.hxx
 #include vcl/button.hxx
+#include vcl/fixed.hxx
+#include sfx2/filedlghelper.hxx
+#include com/sun/star/ui/dialogs/TemplateDescription.hpp
+#include com/sun/star/ui/dialogs/XFilePicker.hpp
+#include com/sun/star/uno/XInterface.hpp
+#include com/sun/star/frame/XComponentLoader.hpp
+#include com/sun/star/frame/Desktop.hpp
+#include com/sun/star/lang/XComponent.hpp
+#include com/sun/star/beans/XPropertySet.hpp
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::sfx2;
 
-class UIPreviewApp : public Application
+class TiledRenderingApp : public Application
 {
+private:
+uno::Referenceuno::XComponentContext xContext;
+uno::Referencelang::XMultiComponentFactory xFactory;
+uno::Referencelang::XMultiServiceFactory xSFactory;
+uno::Referenceuno::XInterface xDesktop;
+uno::Referenceframe::XComponentLoader xLoader;
+uno::Referencelang::XComponent xComponent;
 public:
 virtual void Init();
 virtual int Main();
+void Open(OUString  aFileUrl);
 };
 
-using namespace com::sun::star;
 
 class TiledRenderingDialog: public ModalDialog{
+private:
+TiledRenderingApp * app;
 public:
-TiledRenderingDialog() : ModalDialog(DIALOG_NO_PARENT, TiledRendering, 
qa/sw/ui/tiledrendering.ui)
+TiledRenderingDialog(TiledRenderingApp * app) :
+ModalDialog(DIALOG_NO_PARENT, TiledRendering, 
qa/sw/ui/tiledrendering.ui),
+app(app)
 {
 PushButton * renderButton;
 get(renderButton,buttonRenderTile);
 renderButton-SetClickHdl( LINK( this, TiledRenderingDialog, 
RenderHdl));
+
+PushButton * chooseDocumentButton;
+get(chooseDocumentButton,buttonChooseDocument);
+chooseDocumentButton-SetClickHdl( LINK( this, TiledRenderingDialog, 
ChooseDocumentHdl));
+
 SetStyle(GetStyle()|WB_CLOSEABLE);
 }
+
 virtual ~TiledRenderingDialog()
 {
 }
 
 DECL_LINK ( RenderHdl, Button * );
+DECL_LINK ( ChooseDocumentHdl, Button * );
 
-sal_Int32 extractInt(const char * name)
+sal_Int32 ExtractInt(const char * name)
 {
 NumericField * pField;
 get(pField,name);
 OUString aString(pField-GetText());
-std::cerr  param   name   returned   aString /n;
 return aString.toInt32();
 }
 
@@ -59,67 +90,79 @@ public:
 
 IMPL_LINK ( TiledRenderingDialog,  RenderHdl, Button *, EMPTYARG )
 {
-extractInt(spinContextWidth);
-extractInt(spinContextHeight);
-extractInt(spinTilePosX);
-extractInt(spinTilePosY);
-extractInt(spinTileWidth);
-extractInt(spinTileHeight);
+ExtractInt(spinContextWidth);
+ExtractInt(spinContextHeight);
+ExtractInt(spinTilePosX);
+ExtractInt(spinTilePosY);
+ExtractInt(spinTileWidth);
+ExtractInt(spinTileHeight);
+FixedImage * pImage;
+get(pImage,imageTile);
+return 1;
+}
+
+IMPL_LINK ( TiledRenderingDialog,  ChooseDocumentHdl, Button *, EMPTYARG )
+{
+FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+uno::Reference  XFilePicker  xFP = aDlgHelper.GetFilePicker();
+if( aDlgHelper.Execute() == ERRCODE_NONE )
+{
+OUString aFileUrl =xFP-getFiles().getConstArray()[0];
+app-Open(aFileUrl);
+}
 return 1;
 }
 
-void UIPreviewApp::Init()
+void TiledRenderingApp::Open(OUString  aFileUrl){
+static const OUString TARGET(_default);
+static const Sequencebeans::PropertyValue PROPS (0);
+if(xComponent.get())
+{
+xComponent-dispose();
+xComponent.clear();
+}
+xComponent.set(xLoader-loadComponentFromURL(aFileUrl,TARGET,0,PROPS));
+}
+
+void TiledRenderingApp::Init()
 {
-uno::Referenceuno::XComponentContext xContext =
-cppu::defaultBootstrap_InitialComponentContext();
-uno::Referencelang::XMultiComponentFactory xFactory =
-xContext-getServiceManager();
-uno::Referencelang::XMultiServiceFactory xSFactory =
-uno::Referencelang::XMultiServiceFactory (xFactory, 
uno::UNO_QUERY_THROW);
+xContext.set(cppu::defaultBootstrap_InitialComponentContext());
+xFactory.set(xContext-getServiceManager());
+xSFactory.set(uno::Referencelang::XMultiServiceFactory (xFactory, 
uno::UNO_QUERY_THROW));
 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2013-08-15 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/table-floating-margins.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   16 +-
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx  |   37 --
 writerfilter/source/dmapper/DomainMapperTableHandler.hxx  |2 
 writerfilter/source/dmapper/TablePositionHandler.cxx  |   33 
 writerfilter/source/dmapper/TablePositionHandler.hxx  |6 +-
 writerfilter/source/ooxml/model.xml   |   12 +++-
 7 files changed, 71 insertions(+), 35 deletions(-)

New commits:
commit 66b4bfe302e248fc1503c5c74b83f4fb5fee4026
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Aug 15 17:06:57 2013 +0200

DOCX import: handle custom left cell margin for float table position

Change-Id: I5bc51b739c663d3e123c9d7fb4c2a70f01f8c841

diff --git a/sw/qa/extras/ooxmlimport/data/table-floating-margins.docx 
b/sw/qa/extras/ooxmlimport/data/table-floating-margins.docx
new file mode 100755
index 000..81f6f6c
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/table-floating-margins.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index bf7db73..3f62931 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -129,6 +129,7 @@ public:
 void testGroupshapeRotation();
 void testBnc780044Spacing();
 void testTableFloating();
+void testTableFloatingMargins();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -223,6 +224,7 @@ void Test::run()
 {groupshape-rotation.docx, Test::testGroupshapeRotation},
 {bnc780044_spacing.docx, Test::testBnc780044Spacing},
 {table-floating.docx, Test::testTableFloating},
+{table-floating-margins.docx, Test::testTableFloatingMargins},
 };
 header();
 for (unsigned int i = 0; i  SAL_N_ELEMENTS(aMethods); ++i)
@@ -1569,6 +1571,18 @@ void Test::testTableFloating()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(250), getPropertysal_Int32(xFrame, 
RightMargin));
 }
 
+void Test::testTableFloatingMargins()
+{
+// In case the table had custom left cell margin, the horizontal position 
was still incorrect (too small, -199).
+uno::Referencetext::XTextFramesSupplier xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xIndexAccess(xTextFramesSupplier-getTextFrames(), uno::UNO_QUERY);
+uno::Referencebeans::XPropertySet xFrame(xIndexAccess-getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(-499), getPropertysal_Int32(xFrame, 
HoriOrientPosition));
+// These were 0 as well, due to lack of import.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1000), getPropertysal_Int32(xFrame, 
TopMargin));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), getPropertysal_Int32(xFrame, 
BottomMargin));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 72d7c74..3d99fa2 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -38,6 +38,8 @@ namespace dmapper {
 using namespace ::com::sun::star;
 using namespace ::std;
 
+#define DEF_BORDER_DIST 190  //0,19cm
+
 #ifdef DEBUG_DMAPPER_TABLE_HANDLER
 static void  lcl_printProperties( PropertyMapPtr pProps )
 {
@@ -306,6 +308,22 @@ bool lcl_extractTableBorderProperty(PropertyMapPtr 
pTableProperties, const Prope
 
 }
 
+void lcl_DecrementHoriOrientPosition(uno::Sequencebeans::PropertyValue 
rFrameProperties, sal_Int32 nAmount)
+{
+// Shifts the frame left by the given value.
+for (sal_Int32 i = 0; i  rFrameProperties.getLength(); ++i)
+{
+beans::PropertyValue rPropertyValue = rFrameProperties[i];
+if (rPropertyValue.Name == HoriOrientPosition)
+{
+sal_Int32 nValue = rPropertyValue.Value.getsal_Int32();
+nValue -= nAmount;
+rPropertyValue.Value = nValue;
+return;
+}
+}
+}
+
 TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo  rInfo, 
uno::Sequencebeans::PropertyValue rFrameProperties)
 {
 // will receive the table style if any
@@ -401,8 +419,10 @@ TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo
 
 m_aTableProperties-Insert( PROP_TABLE_BORDER_DISTANCES, uno::makeAny( 
aDistances ) );
 
+if (rFrameProperties.hasElements())
+lcl_DecrementHoriOrientPosition(rFrameProperties, 
rInfo.nLeftBorderDistance);
+
 // Set table above/bottom spacing to 0.
-// TODO: handle 'Around' text wrapping mode
 m_aTableProperties-Insert( PROP_TOP_MARGIN, uno::makeAny( sal_Int32( 
0 ) ) );
 m_aTableProperties-Insert( PROP_BOTTOM_MARGIN, uno::makeAny( 
sal_Int32( 0 ) ) );
 
@@ -430,20 +450,7 @@ 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2013-08-09 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo53556.rtf|   49 
 sw/qa/extras/rtfimport/rtfimport.cxx|   16 +
 writerfilter/source/rtftok/rtfsdrimport.cxx |   36 ++--
 writerfilter/source/rtftok/rtfsdrimport.hxx |2 +
 4 files changed, 92 insertions(+), 11 deletions(-)

New commits:
commit aa6959ba2c4ef1b718d8249fd47faaf677b16111
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Aug 9 16:00:04 2013 +0200

fdo#53556 testcase

Change-Id: If58376aec31ab00cab19221beed73e8275a834d2

diff --git a/sw/qa/extras/rtfimport/data/fdo53556.rtf 
b/sw/qa/extras/rtfimport/data/fdo53556.rtf
new file mode 100644
index 000..aafa11c
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo53556.rtf
@@ -0,0 +1,49 @@
+{\rtf1\ansi\deff0\viewkind1\paperw12240\paperh15840\marglsxn0\margrsxn0\margtsxn0\margbsxn0
+{\shp\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz3\shpleft1000\shpright12000\shptop1000\shpbottom1800
+{\sp
+{\sn fFilled}
+{\sv 0}
+}
+{\shpinst
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+{\shptxt
+{\pard\cb1 \qc\sl367 \f0\fs32\b\cf2 ARL STATISTICS 2011-2012\line 
WORKSHEET\plain\par}
+}
+}
+}
+{\shp\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz18\shpleft1000\shpright4700\shptop900\shpbottom15040
+{\sp
+{\sn fFilled}
+{\sv 0}
+}
+{\shpinst
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+}
+}
+{\shp\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz2\shpleft1000\shpright12000\shptop2480\shpbottom3320
+{\sp
+{\sn fFilled}
+{\sv 0}
+}
+{\shpinst
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+{\shptxt
+{\pard\cb1 \ql\sl252 \f0\fs22\cf2 This worksheet is designed to help you plan 
your submission for the 2011-2012 ARL Statistics. The figures on this worksheet 
should be similar to those in the Summary page of your web form, except in 
cases where data are unavailable. If an exact figure is unavailable, use NA/UA. 
If the appropriate answer is zero or none, use 0.\plain\par}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 5c7eb69..c258d7c 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -11,6 +11,7 @@
 #include com/sun/star/document/XImporter.hpp
 #include com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp
 #include com/sun/star/drawing/EnhancedCustomShapeSegment.hpp
+#include com/sun/star/drawing/FillStyle.hpp
 #include com/sun/star/drawing/LineStyle.hpp
 #include com/sun/star/drawing/XDrawPageSupplier.hpp
 #include com/sun/star/graphic/GraphicType.hpp
@@ -160,6 +161,7 @@ public:
 void testFdo67365();
 void testFdo67498();
 void testFdo47440();
+void testFdo53556();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -305,6 +307,7 @@ void Test::run()
 {fdo67365.rtf, Test::testFdo67365},
 {fdo67498.rtf, Test::testFdo67498},
 {fdo47440.rtf, Test::testFdo47440},
+{fdo53556.rtf, Test::testFdo53556},
 };
 header();
 for (unsigned int i = 0; i  SAL_N_ELEMENTS(aMethods); ++i)
@@ -1489,6 +1492,19 @@ void Test::testFdo47440()
 CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, 
getPropertysal_Int16(xDraws-getByIndex(0), VertOrientRelation));
 }
 
+void Test::testFdo53556()
+{
+uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY);
+// This was drawing::FillStyle_SOLID, which resulted in being 
non-transparent, hiding text which would be visible.
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, 
getPropertydrawing::FillStyle(xDraws-getByIndex(2), FillStyle));
+
+// This was a com.sun.star.drawing.CustomShape, which resulted in lack of 
word wrapping in the bugdoc.
+uno::Referencebeans::XPropertySet 
xShapeProperties(xDraws-getByIndex(0), uno::UNO_QUERY);
+uno::Referencedrawing::XShapeDescriptor 
xShapeDescriptor(xShapeProperties, uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(FrameShape), 
xShapeDescriptor-getShapeType());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 9f1f7199736e2ae07b34849ba66f61a1ef5782e8
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Aug 9 15:03:08 2013 +0200

fdo#53556 RTF import: fix handling of default shapeType

It was a customshape, but Word seems to handle the shape as a rectangle
when shapeType is missing. This makes the text in the textboxes of the
bugdoc wrap properly.

Change-Id: I56e044f42ead348bbb79addc36fa13c82a7ffc29

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index caa5896..147675e 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -231,6 +231,13 @@ void RTFSdrImport::resolve(RTFShape rShape, bool bClose)
 oox::vml::FillModel aFillModel; // Gradient.
 oox::vml::ShadowModel 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2013-07-01 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo47802.rtf   |   46 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   10 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   25 +
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |4 +-
 writerfilter/source/rtftok/rtfvalue.cxx|   32 -
 writerfilter/source/rtftok/rtfvalue.hxx|7 +++
 6 files changed, 113 insertions(+), 11 deletions(-)

New commits:
commit d892671c118158490b08d24eea7398330a23599b
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Jul 1 11:37:30 2013 +0200

fdo#47802 testcase

Change-Id: Ib3e399efb0d1116473bc5ff0e1b858b2cfa4aec8

diff --git a/sw/qa/extras/rtfimport/data/fdo47802.rtf 
b/sw/qa/extras/rtfimport/data/fdo47802.rtf
new file mode 100644
index 000..cbbf94f
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo47802.rtf
@@ -0,0 +1,46 @@
+{\rtf1
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440
+\ltrrow\trowd \cellx4680\cellx9468\pard\plain \ltrpar\ql 
\li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\yts15
 \rtlch\fcs1 
+\af31507\afs22\alang1025 \ltrch\fcs0 
\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid5924912 
+{\shp
+{\*\shpinst\shpleft705\shptop-130\shpright1920\shpbottom335\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\sp
+{\sn fFlipH}
+{\sv 0}
+}
+{\sp
+{\sn fFlipV}
+{\sv 0}
+}
+{\sp
+{\sn lTxid}
+{\sv 65536}
+}
+{\sp
+{\sn dhgt}
+{\sv 251658240}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 1}
+}
+{\shptxt \ltrpar \pard\plain \ltrpar\ql 
\li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
 \rtlch\fcs1 
+\af31507\afs22\alang1025 \ltrch\fcs0 
\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 
\lang1038\langfe1033\langnp1038\insrsid5924912 C}
+{\par }
+}
+}
+}
+}
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid5924912 A\cell B\cell 
+}
+\pard\plain \ltrpar\ql 
\li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0
 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 
\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 
+{\row }
+\pard \ltrpar\ql 
\li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
 
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 61de96e..6b628c3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -149,6 +149,7 @@ public:
 void testN823655();
 void testFdo66040();
 void testN823675();
+void testFdo47802();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -283,6 +284,7 @@ void Test::run()
 {n823655.rtf, Test::testN823655},
 {fdo66040.rtf, Test::testFdo66040},
 {n823675.rtf, Test::testN823675},
+{fdo47802.rtf, Test::testFdo47802},
 };
 header();
 for (unsigned int i = 0; i  SAL_N_ELEMENTS(aMethods); ++i)
@@ -1377,6 +1379,14 @@ void Test::testN823675()
 CPPUNIT_ASSERT_EQUAL(OUString(Symbol), aFont.Name);
 }
 
+void Test::testFdo47802()
+{
+uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY);
+// Shape inside table was ignored.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws-getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 818d80eb0cee65d1bcc4fdb74b32a7c42cc1336e
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Jun 28 16:47:49 2013 +0200

RTF import: support shapes inside tables

This is a better fix for fdo#47802, now that shape import is no longer
buffered.

Change-Id: Idce6d11e6774d1fe7fc04b6a52d5b77a3879381e

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 31cc365..96bfce6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1197,6 +1197,10 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t rBuffer)
 Mapper().endCharacterGroup();
 else if (aPair.first == BUFFER_PAR)
 parBreak();
+else if (aPair.first == BUFFER_STARTSHAPE)
+m_pSdrImport-resolve(aPair.second-getShape(), false);
+else if (aPair.first == BUFFER_ENDSHAPE)
+m_pSdrImport-close();
 else
 SAL_WARN(writerfilter, should not happen);
 }
@@ -1313,11 +1317,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword 
nKeyword)
 m_aStates.top().nDestinationState = DESTINATION_SHAPE;
 break;
 case RTF_SHPINST:
-// 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2013-06-05 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/n820509.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |   19 +++
 writerfilter/source/dmapper/DomainMapper.cxx   |   10 ++
 writerfilter/source/dmapper/ModelEventListener.cxx |   10 --
 writerfilter/source/dmapper/ModelEventListener.hxx |4 +++-
 writerfilter/source/dmapper/SdtHelper.cxx  |6 ++
 writerfilter/source/dmapper/SdtHelper.hxx  |4 
 7 files changed, 46 insertions(+), 7 deletions(-)

New commits:
commit a9e0ec2b87a99c93b77a210a916b4df44ece454a
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Jun 5 11:44:10 2013 +0200

bnc#820509 testcase

Change-Id: Iee9909e9c42014ab10ceaa2f8f8e554c25e89157

diff --git a/sw/qa/extras/ooxmlimport/data/n820509.docx 
b/sw/qa/extras/ooxmlimport/data/n820509.docx
new file mode 100755
index 000..a6da1e1
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n820509.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 601f154..b30ebd6 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -32,6 +32,7 @@
 #include com/sun/star/style/ParagraphAdjust.hpp
 #include com/sun/star/table/ShadowFormat.hpp
 #include com/sun/star/view/XSelectionSupplier.hpp
+#include com/sun/star/view/XFormLayerAccess.hpp
 #include com/sun/star/table/BorderLine2.hpp
 #include com/sun/star/table/TableBorder2.hpp
 #include com/sun/star/text/SizeType.hpp
@@ -116,6 +117,7 @@ public:
 void testWatermark();
 void testPageBorderShadow();
 void testN816593();
+void testN820509();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -200,6 +202,7 @@ void Test::run()
 {watermark.docx, Test::testWatermark},
 {page-border-shadow.docx, Test::testPageBorderShadow},
 {n816593.docx, Test::testN816593},
+{n820509.docx, Test::testN820509},
 };
 header();
 for (unsigned int i = 0; i  SAL_N_ELEMENTS(aMethods); ++i)
@@ -1432,6 +1435,22 @@ void Test::testN816593()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables-getCount());
 }
 
+void Test::testN820509()
+{
+// Design mode was enabled.
+uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY);
+uno::Referenceview::XFormLayerAccess 
xFormLayerAccess(xModel-getCurrentController(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(false, bool(xFormLayerAccess-isFormDesignMode()));
+
+// M.d. date format was unhandled.
+uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY);
+uno::Referencedrawing::XControlShape 
xControlShape(xDraws-getByIndex(0), uno::UNO_QUERY);
+uno::Referencebeans::XPropertySet 
xPropertySet(xControlShape-getControl(), uno::UNO_QUERY);
+uno::Referencelang::XServiceInfo xServiceInfo(xPropertySet, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getPropertysal_Int16(xPropertySet, 
DateFormat));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 58197c3692df0d0fccb5bc7abddaf6d9667565f6
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Jun 5 11:22:33 2013 +0200

bnc#820509 DOCX import: handle M.d. date format in w:sdt

Change-Id: Iae233c24a9580ffc8ea4680276161a543171f63c

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index b0bdc58..2e571d9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3343,8 +3343,9 @@ void DomainMapper::sprmWithProps( Sprm rSprm, 
PropertyMapPtr rContext, SprmType
 break;
 case NS_ooxml::LN_CT_SdtDate_dateFormat:
 {
-if (sStringValue == M/d/)
-// See com/sun/star/awt/UnoControlDateFieldModel.idl, DateFormat; 
sadly there are no constants for this.
+// See com/sun/star/awt/UnoControlDateFieldModel.idl, DateFormat; 
sadly there are no constants for this.
+if (sStringValue == M/d/ || sStringValue == M.d.)
+// Approximate with MM.dd.yyy
 m_pImpl-m_pSdtHelper-getDateFormat().reset(8);
 else
 {
commit 3d6a7cf3eb7aa966601cbc019d1ad5faf21f
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Jun 5 10:29:25 2013 +0200

bnc#820509 DOCX import: try harder to disable form design mode

Previously this only worked if we had indexes in the document as well,
but actually these are independent.

Change-Id: I28afa60d2606230c901948d4c1da8f5a7c50a9f7

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f611bda..b0bdc58 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -143,11 +143,12 @@ DomainMapper::~DomainMapper()
 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2013-04-10 Thread Miklos Vajna
 sw/qa/extras/rtfimport/rtfimport.cxx   |   15 ---
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |5 +
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 ++
 writerfilter/source/rtftok/rtfsdrimport.cxx|   25 -
 4 files changed, 35 insertions(+), 12 deletions(-)

New commits:
commit 92e74798a753b5eb595a5964cc8efe70e3a6e56b
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Apr 10 13:07:54 2013 +0200

RTF import of new-style frames: fix txflTextFlow shape property

Change-Id: If6febeaea00b384ea36d470264c04dfb4c7afd24

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index f856099..15f54f4 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -136,6 +136,7 @@ void RTFSdrImport::resolve(RTFShape rShape)
 uno::Any aLineColor = uno::makeAny(COL_BLACK);
 // Default line width is 0.75 pt (26 mm100) in Word, 0 in Writer.
 uno::Any aLineWidth = uno::makeAny(sal_Int32(26));
+text::WritingMode eWritingMode = text::WritingMode_LR_TB;
 
 for (std::vector std::pairOUString, OUString ::iterator i = 
rShape.aProperties.begin();
 i != rShape.aProperties.end(); ++i)
@@ -206,10 +207,7 @@ void RTFSdrImport::resolve(RTFShape rShape)
 else if (i-first == txflTextFlow  xPropertySet.is())
 {
 if (i-second.toInt32() == 1)
-{
-aAny = text::WritingMode_TB_RL;
-xPropertySet-setPropertyValue(TextWritingMode, aAny);
-}
+eWritingMode = text::WritingMode_TB_RL;
 }
 else if (i-first == fLine  xPropertySet.is())
 resolveFLine(xPropertySet, i-second.toInt32());
@@ -373,6 +371,11 @@ void RTFSdrImport::resolve(RTFShape rShape)
 xPropertySet-setPropertyValue(LineWidth, aLineWidth);
 if (rShape.oZ)
 resolveDhgt(xPropertySet, *rShape.oZ);
+if (bTextFrame)
+// Writer textframes implement text::WritingMode2, which is a 
different data type.
+xPropertySet-setPropertyValue(WritingMode, 
uno::makeAny(sal_Int16(eWritingMode)));
+else
+xPropertySet-setPropertyValue(TextWritingMode, 
uno::makeAny(eWritingMode));
 }
 
 if (nType == ESCHER_ShpInst_PictureFrame) // picture frame
commit 9a8306a18998b42b387eb83128c82abbcfdd87a3
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Apr 10 12:22:03 2013 +0200

RTF import of new-style frames: fix name

Change-Id: Ifa8e79fb9c4b9ad5a0bf64466cefad91b6bbeb0c

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 3cb4038..f856099 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -26,6 +26,7 @@
  * instead of those above.
  */
 
+#include com/sun/star/container/XNamed.hpp
 #include com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp
 #include com/sun/star/drawing/XDrawPageSupplier.hpp
 #include com/sun/star/drawing/LineStyle.hpp
@@ -171,7 +172,15 @@ void RTFSdrImport::resolve(RTFShape rShape)
 xPropertySet-setPropertyValue(FillColor, aAny);
 }
 else if ( i-first == wzName )
-xPropertySet-setPropertyValue(Name, uno::makeAny(i-second));
+{
+if (bTextFrame)
+{
+uno::Referencecontainer::XNamed xNamed(xShape, 
uno::UNO_QUERY);
+xNamed-setName(i-second);
+}
+else
+xPropertySet-setPropertyValue(Name, 
uno::makeAny(i-second));
+}
 else if ( i-first == wzDescription )
 xPropertySet-setPropertyValue(Description, 
uno::makeAny(i-second));
 else if ( i-first == pib )
commit 91a151085a9e8e77e30c0e21740f211fd5eedd95
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Apr 10 11:55:22 2013 +0200

restore disabled rtfimport tests

There were two problems here:

- Writer textframes don't have an AnchorPosition property, use
  compareRegionStarts() instead
- turns out DOC/DOCX import doesn't create Write textframes when the
  shape has no text, doing so in the RTF import fixes the other two
  testcase as well.

Change-Id: Ib2b4a0b7f8317d300fd532daea22568e33eceb53

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index dc776d9..89c96f4 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -46,6 +46,7 @@
 #include com/sun/star/text/XTextGraphicObjectsSupplier.hpp
 #include com/sun/star/text/XTextFieldsSupplier.hpp
 #include com/sun/star/text/XTextFramesSupplier.hpp
+#include com/sun/star/text/XTextRangeCompare.hpp
 #include com/sun/star/text/XTextTablesSupplier.hpp
 #include com/sun/star/text/XTextTable.hpp
 #include com/sun/star/text/XTextViewCursorSupplier.hpp
@@ -401,10 +402,14 @@ void 

[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source

2013-04-05 Thread Miklos Vajna
 dev/null |binary
 sw/qa/extras/ooxmlexport/data/i120928.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   22 +
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   23 --
 sw/source/filter/ww8/docxattributeoutput.cxx |   43 ++-
 sw/source/filter/ww8/docxattributeoutput.hxx |3 +
 sw/source/filter/ww8/docxexport.cxx  |   25 +++
 sw/source/filter/ww8/docxexport.hxx  |3 +
 sw/source/filter/ww8/wrtww8.cxx  |6 +--
 sw/source/filter/ww8/wrtww8.hxx  |   11 +++---
 10 files changed, 103 insertions(+), 33 deletions(-)

New commits:
commit 0644a20605965b36fcc983e4c1158820fd858726
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Apr 5 15:12:30 2013 +0200

Get rid of copypaste by moving code from WW8Export to MSWordExportBase

Change-Id: I1a36fb3d20d1e67484668b7ba8feb1c96505af59

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 42cb103..e7bec6f 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -528,66 +528,6 @@ void DocxExport::WritePostitFields()
 }
 }
 
-int DocxExport::CollectGrfsOfBullets()
-{
-m_vecBulletPic.clear();
-
-if ( pDoc )
-{
-int nCountRule = pDoc-GetNumRuleTbl().size();
-for (int n = 0; n  nCountRule; ++n)
-{
-const SwNumRule rRule = *( pDoc-GetNumRuleTbl().at(n) );
-sal_uInt16 nLevels = rRule.IsContinusNum() ? 1 : 9;
-for (sal_uInt16 nLvl = 0; nLvl  nLevels; ++nLvl)
-{
-const SwNumFmt rFmt = rRule.Get(nLvl);
-if (SVX_NUM_BITMAP != rFmt.GetNumberingType())
-{
-continue;
-}
-const Graphic *pGraf = rFmt.GetBrush()? 
rFmt.GetBrush()-GetGraphic():0;
-if ( pGraf )
-{
-bool bHas = false;
-for (unsigned i = 0; i  m_vecBulletPic.size(); ++i)
-{
-if (m_vecBulletPic[i]-GetChecksum() == 
pGraf-GetChecksum())
-{
-bHas = true;
-break;
-}
-}
-if (!bHas)
-{
-m_vecBulletPic.push_back(pGraf);
-}
-}
-}
-}
-}
-
-return m_vecBulletPic.size();
-}
-
-int DocxExport::GetGrfIndex(const SvxBrushItem rBrush)
-{
-int nIndex = -1;
-if ( rBrush.GetGraphic() )
-{
-for (unsigned i = 0; i  m_vecBulletPic.size(); ++i)
-{
-if (m_vecBulletPic[i]-GetChecksum() == 
rBrush.GetGraphic()-GetChecksum())
-{
-nIndex = i;
-break;
-}
-}
-}
-
-return nIndex;
-}
-
 void DocxExport::BulletDefinitions()
 {
 for (size_t i = 0; i  m_vecBulletPic.size(); ++i)
diff --git a/sw/source/filter/ww8/docxexport.hxx 
b/sw/source/filter/ww8/docxexport.hxx
index 797dd94..ac5637d 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -85,8 +85,6 @@ class DocxExport : public MSWordExportBase
 
 DocxSettingsData settings;
 
-std::vectorconst Graphic* m_vecBulletPic;
-
 public:
 
 DocxExportFilter GetFilter() { return *m_pFilter; };
@@ -148,9 +146,6 @@ public:
 
 void WriteOutliner(const OutlinerParaObject rOutliner, sal_uInt8 nTyp);
 
-int CollectGrfsOfBullets();
-int GetGrfIndex(const SvxBrushItem rBrush);
-
 protected:
 /// Format-dependant part of the actual export.
 virtual void ExportDocument_Impl();
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index a666980..86e3f57 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1406,7 +1406,7 @@ void WW8Export::AppendBookmark( const rtl::OUString 
rName, bool bSkip )
 }
 
 // #i120928 collect all the graphics of bullets applied to paragraphs
-int WW8Export::CollectGrfsOfBullets() const
+int MSWordExportBase::CollectGrfsOfBullets()
 {
 m_vecBulletPic.clear();
 
@@ -1505,8 +1505,8 @@ void WW8Export::OutGrfBullets(const sw::Frame  rFrame)
 Set_UInt8( pArr, nAttrMagicIdx++ );
 pChpPlc-AppendFkpEntry( Strm().Tell(), static_cast short (pArr - aArr), 
aArr );
 }
-//Achieve the index position
-int WW8Export::GetGrfIndex(const SvxBrushItem rBrush)
+
+int MSWordExportBase::GetGrfIndex(const SvxBrushItem rBrush)
 {
 int nIndex = -1;
 if ( rBrush.GetGraphic() )
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index aae74df..8628545 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -747,6 +747,8 @@ public:
 
 const SfxPoolItem* HasItem( sal_uInt16 nWhich ) const;
 
+/// Returns the index of 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2013-04-03 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo51916.rtf   |  319 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |7 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   21 +
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 
 4 files changed, 345 insertions(+), 5 deletions(-)

New commits:
commit 008275d56f9ac5248f0e94f606671b4c1993ca20
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Apr 3 17:36:26 2013 +0200

fdo#51916 out of bounds substring access

Change-Id: I7db46ef17b8aed443faa7eb0c13b6ba109242cc1

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0714b15..d10a5a0 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3940,11 +3940,14 @@ int RTFDocumentImpl::popState()
 // extract default text
 nLength = aStr.toChar();
 aStr = aStr.copy(1);
-OString aDefaultText = aStr.copy(0, nLength);
 RTFValue::Pointer_t pNValue(new 
RTFValue(OStringToOUString(aName, aState.nCurrentEncoding)));
 m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue);
-RTFValue::Pointer_t pDValue(new 
RTFValue(OStringToOUString(aDefaultText, aState.nCurrentEncoding)));
-m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, 
pDValue);
+if (nLength  0)
+{
+OString aDefaultText = aStr.copy(0, nLength);
+RTFValue::Pointer_t pDValue(new 
RTFValue(OStringToOUString(aDefaultText, aState.nCurrentEncoding)));
+m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, 
pDValue);
+}
 
 m_bFormField = false;
 }
commit 7006ef460bb68d27a74381fab7b8826b786b31c6
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Apr 3 17:28:42 2013 +0200

fdo#51916 testcase

Change-Id: I27ffbab64cfb6763235d4dfd7fb47aa98235274d

diff --git a/sw/qa/extras/rtfimport/data/fdo51916.rtf 
b/sw/qa/extras/rtfimport/data/fdo51916.rtf
new file mode 100644
index 000..b2359c3
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo51916.rtf
@@ -0,0 +1,319 @@
+{\rtf1
+{\fonttbl
+{\f0\fbidi \froman\fcharset238\fprq2
+{\*\panose 02020603050405020304}
+Times New Roman;}
+{\f34\fbidi \froman\fcharset238\fprq2
+{\*\panose 02040503050406030204}
+Cambria Math;}
+{\f37\fbidi \fswiss\fcharset238\fprq2
+{\*\panose 020f0502020204030204}
+Calibri
+{\*\falt Century Gothic}
+;}
+{\f38\fbidi \fswiss\fcharset238\fprq2
+{\*\panose 020b0604030504040204}
+Tahoma;}
+{\flomajor\f31500\fbidi \froman\fcharset238\fprq2
+{\*\panose 02020603050405020304}
+Times New Roman;}
+{\fdbmajor\f31501\fbidi \froman\fcharset238\fprq2
+{\*\panose 02020603050405020304}
+Times New Roman;}
+{\fhimajor\f31502\fbidi \froman\fcharset238\fprq2
+{\*\panose 02040503050406030204}
+Cambria;}
+{\fbimajor\f31503\fbidi \froman\fcharset238\fprq2
+{\*\panose 02020603050405020304}
+Times New Roman;}
+{\flominor\f31504\fbidi \froman\fcharset238\fprq2
+{\*\panose 02020603050405020304}
+Times New Roman;}
+{\fdbminor\f31505\fbidi \froman\fcharset238\fprq2
+{\*\panose 02020603050405020304}
+Times New Roman;}
+{\fhiminor\f31506\fbidi \fswiss\fcharset238\fprq2
+{\*\panose 020f0502020204030204}
+Calibri
+{\*\falt Century Gothic}
+;}
+{\fbiminor\f31507\fbidi \froman\fcharset238\fprq2
+{\*\panose 02020603050405020304}
+Times New Roman;}
+{\f297\fbidi \froman\fcharset0\fprq2 Times New Roman;}
+{\f296\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\f298\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
+{\f299\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
+{\f300\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
+{\f301\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
+{\f302\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
+{\f303\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
+{\f637\fbidi \froman\fcharset0\fprq2 Cambria Math;}
+{\f636\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}
+{\f638\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}
+{\f639\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}
+{\f642\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}
+{\f643\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
+{\f667\fbidi \fswiss\fcharset0\fprq2 Calibri
+{\*\falt Century Gothic}
+;}
+{\f666\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr
+{\*\falt Century Gothic}
+;}
+{\f668\fbidi \fswiss\fcharset161\fprq2 Calibri Greek
+{\*\falt Century Gothic}
+;}
+{\f669\fbidi \fswiss\fcharset162\fprq2 Calibri Tur
+{\*\falt Century Gothic}
+;}
+{\f672\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic
+{\*\falt Century Gothic}
+;}
+{\f673\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese)
+{\*\falt Century Gothic}
+;}
+{\f677\fbidi \fswiss\fcharset0\fprq2 Tahoma;}
+{\f676\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;}
+{\f679\fbidi 

[Libreoffice-commits] core.git: 3 commits - sw/qa writerfilter/source

2013-03-01 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/fdo59638.rtf   |   35 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   25 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   35 -
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |1 
 4 files changed, 90 insertions(+), 6 deletions(-)

New commits:
commit 58c30a3545a5725d704eabd79071db02f1f2cb23
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Mar 1 17:38:03 2013 +0100

fdo#59638 handle RTF_F inside RTF_LISTLEVEL

Word typically uses the Symbol font to describe bullet characters
instead of using a sane Unicode value, the previous can only be handled
if we parse the custom font set for the list.

Change-Id: I1491f07c40953949e381a035c1596c207cdc4c35

diff --git a/sw/qa/extras/rtfimport/data/fdo59638.rtf 
b/sw/qa/extras/rtfimport/data/fdo59638.rtf
new file mode 100644
index 000..e2572bf
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo59638.rtf
@@ -0,0 +1,35 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0
+{\fonttbl
+{\f0\fbidi \froman\fcharset238\fprq2
+Times New Roman;}
+{\f2\fbidi \fmodern\fcharset238\fprq1
+Courier New;}
+{\f3\fbidi \froman\fcharset2\fprq2
+Symbol;}
+}
+{\*\listtable
+{\list\listtemplateid-178490\listsimple
+{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat0\levelspace0\levelindent0
+{\leveltext\'01*;}
+{\levelnumbers;}
+\hres0\chhres0 }
+{\listname ;}
+\listid-2}
+}
+{\*\listoverridetable
+{\listoverride\listid-2\listoverridecount1
+{\lfolevel\listoverrideformat
+{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat0\levelold\levelspace0
+\levelindent0
+{\leveltext\'01\u-3913 ?;}
+{\levelnumbers;}
+\f3\fbias0 }
+}
+\ls1}
+}
+\pard\plain \ltrpar\ql \fi-360\li720\ri0\nowidctlpar\wrapdefault
+\faauto\ls1\rin0\lin720\itap0\pararsid7241016 \rtlch\fcs1 
\af31507\afs22\alang1025 \ltrch\fcs0 
\fs22\lang1031\langfe1031\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1031\langfenp1031
 
+{\rtlch\fcs1 \af37 \ltrch\fcs0 
+\f37\insrsid15285686 \hich\af37\dbch\af31505\loch\f37 3
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index f923762..e577f42 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -143,6 +143,7 @@ public:
 void testFdo59419();
 void testFdo58076_2();
 void testFdo59953();
+void testFdo59638();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -258,6 +259,7 @@ void Test::run()
 {fdo59419.rtf, Test::testFdo59419},
 {fdo58076-2.rtf, Test::testFdo58076_2},
 {fdo59953.rtf, Test::testFdo59953},
+{fdo59638.rtf, Test::testFdo59638},
 };
 header();
 for (unsigned int i = 0; i  SAL_N_ELEMENTS(aMethods); ++i)
@@ -1120,6 +1122,29 @@ void Test::testFdo59953()
 CPPUNIT_ASSERT_EQUAL(sal_Int16(7650), getProperty 
uno::Sequencetext::TableColumnSeparator (xTableRows-getByIndex(0), 
TableColumnSeparators)[0].Position);
 }
 
+void Test::testFdo59638()
+{
+// The problem was that w:lvlOverride inside w:num was ignores by dmapper.
+
+uno::Referencebeans::XPropertySet 
xPropertySet(getStyles(NumberingStyles)-getByName(WWNum1), uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xLevels(xPropertySet-getPropertyValue(NumberingRules), uno::UNO_QUERY);
+uno::Sequencebeans::PropertyValue aProps;
+xLevels-getByIndex(0) = aProps; // 1st level
+
+for (int i = 0; i  aProps.getLength(); ++i)
+{
+const beans::PropertyValue rProp = aProps[i];
+
+if (rProp.Name == BulletChar)
+{
+// Was '*', should be 'o'.
+CPPUNIT_ASSERT_EQUAL(OUString(\xEF\x82\xB7, 3, 
RTL_TEXTENCODING_UTF8), rProp.Value.getOUString());
+return;
+}
+}
+CPPUNIT_FAIL(no BulletChar property);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 6ef8009..077ce50 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2721,6 +2721,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 m_aFontIndexes.push_back(nParam);
 m_nCurrentFontIndex = getFontIndex(nParam);
 }
+else if (m_aStates.top().nDestinationState == 
DESTINATION_LISTLEVEL)
+{
+RTFSprms aFontSprms;
+aFontSprms.set(NS_sprm::LN_CRgFtc0, RTFValue::Pointer_t(new 
RTFValue(getFontIndex(nParam;
+RTFSprms aRunPropsSprms;
+aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, 
RTFValue::Pointer_t(new RTFValue(RTFSprms(),