core.git: sw/inc sw/qa sw/source writerfilter/source

2024-04-09 Thread Michael Stahl (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 
 sw/qa/core/text/data/A011-charheight.rtf  |   27 ++
 sw/qa/core/text/itrform2.cxx  |   18 +
 sw/qa/extras/ooxmlexport/data/fdo74110.docx   |binary
 sw/source/core/doc/DocumentSettingManager.cxx |   11 ++
 sw/source/core/inc/DocumentSettingManager.hxx |1 
 sw/source/core/text/itrform2.cxx  |   13 +---
 sw/source/filter/ww8/ww8par.cxx   |1 
 sw/source/filter/xml/xmlimp.cxx   |   10 +
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 +
 writerfilter/source/filter/WriterFilter.cxx   |1 
 11 files changed, 98 insertions(+), 3 deletions(-)

New commits:
commit 2b47fae7e3e23ee7c733708500cb0482ad7f8af1
Author: Michael Stahl 
AuthorDate: Mon Apr 8 15:26:00 2024 +0200
Commit: Michael Stahl 
CommitDate: Tue Apr 9 14:10:19 2024 +0200

tdf#88214 sw: text formatting: adapt empty line at end of para to Word

For an empty line at the end of an empty paragraph, Writer already uses
any existing text attribute in the paragraph, see for example
testEmptyTrailingSpans.

For an empty line at the end of a non-empty paragraph, Writer text
formatting uses only paragraph attributes, ignoring any text attributes,
whereas the UI will display the attributes from the text attributes
(such as font height) if you move the cursor there.

Word uses text attributes also in this case, so adapt the inconsistent
Writer behaviour: text formatting now uses text attributes too.

Apparently this can be achieved by calling SeekAndChgBefore() instead of
SeekAndChg().

Add another compat flag "ApplyTextAttrToEmptyLineAtEndOfParagraph" to
preserve the formatting of existing ODF documents.

Adapt test document fdo74110.docx, it has a line break with "Angsana
New" font.

Change-Id: I0863d3077e419404194b47110e4ad2bdda3d11c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165887
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 74b123dc462e..0dd9467bdf13 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -98,6 +98,7 @@ enum class DocumentSettingId
 ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK,
 // tdf#119908 new paragraph justification
 JUSTIFY_LINES_WITH_SHRINKING,
+APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/core/text/data/A011-charheight.rtf 
b/sw/qa/core/text/data/A011-charheight.rtf
new file mode 100644
index ..4b56ecdd6a15
--- /dev/null
+++ b/sw/qa/core/text/data/A011-charheight.rtf
@@ -0,0 +1,27 @@
+{ 
tf1deflang1025nsinsicpg1252\uc1deff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang3079\deflangfe3079
   hemelang3079hemelangfe0 hemelangcs0
+{onttbl{0bidi romancharset0prq2Times New Roman{\*alt Arial};}
+}
+{\*\defchp 0s22\lang3079\langfe1033\langfenp1033 }
+{\*\defpap \ql \li0 i0\sa200\sl276\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 }
+
oqfpromote
+{\stylesheet
+{\ql \li0 i0\sa200\sl276\slmult1\widctlpar\wrapdefaultspalphaspnum
aautodjustright in0\lin0\itap0  tlchcs1 f0fs22lang1025 \ltrchcs0
+0s23\lang3079\langfe1033+{\s15\ql \li0 i0\widctlpar  qc  x4536   qr  
x9072\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlchcs1 
f0fs22lang1025 \ltrchcs0 0s23\lang3079\langfe1033+\sbasedon0 \snext15 
\slink16 \sunhideused header;}
+{\*+}
+\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1134\gutter0\ltrsect
+\deftab708\widowctrltnbjenddoc\hyphhotz425   rackmoves0  
rackformatting1\donotembedsysfont1 elyonvml0\donotembedlingdata0\grfdocevents0
alidatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1
oxlattoyenxpshrtn
oultrlspc\dntblnsbdb
ospaceforul
ormshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1417\dgvorigin1417\dghshow1\dgvshow1
+\jexpandiewkind1iewscale100\pgbrdrhead\pgbrdrfoot\splytwnine
tnlytwnine\htmautsp
olnhtadjtbl\useltbalnlntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
obrkwrptbl\snaptogridincellllowfieldendsel\wrppunct
+sianbrkrule
ewtblstyruls
ogrowautofit\usenormstyforlist
oindnmbrtselnbrelev
ocxsptable\indrlsweleven
oafcnsttblfelev\utinl\hwelev\spltpgpar
otcvasp
otbrkcnstfrctbl
otvatxbx\krnprsnet+{\*\wgrffmtfilter 2450}
ofeaturethrottle1\ilfomacatclnup0
+
+\ltrpar \pard\plain \ltrpar\s15\qc \li0 i0\widctlpar
+   qc  x4536   qr  x9072\wrapdefaultspalphaspnum
aautodjustright in0\lin0\itap0 tlchcs1 f0fs22lang1025 \ltrchcs0 0
s23\lang3079\langfe1033+s16 \line \line \line
+\par \line
+\par }
+}
diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index 

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

2023-10-17 Thread László Németh (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |2 ++
 sw/qa/core/text/frmform.cxx   |5 +
 sw/qa/extras/ooxmlexport/data/tdf130088.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   11 +++
 sw/source/core/doc/DocumentSettingManager.cxx |   11 +++
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/core/text/guess.cxx |8 
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +
 9 files changed, 61 insertions(+)

New commits:
commit 7d08767b890e723cd502b1c61d250924f695eb98
Author: László Németh 
AuthorDate: Mon Oct 16 19:39:30 2023 +0200
Commit: László Németh 
CommitDate: Tue Oct 17 10:37:23 2023 +0200

tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt.

Writer typeset DOCX files with more lines/pages, because of
new default paragraph justification algorithm of MSO 2013 and
newer, which resulted in losing text layout interoperability
for new DOCX documents.

Add new compatibility option "JustifyLinesWithShrinking" to
store also the new type of justification in OpenDocument files.

First analysis of the unknown justification algorithm shows
up to 2% shrinking of plain justified line. Apply this value
to break the lines in the same (or very similar) positions
during importing a DOCX file with compatibilityMode >= 15
(created in MSO 2013 or newer), to avoid typesetting more lines
and pages.

Note: shrinking will be added by the next commits, fixing
the temporary exceeding lines.

Change-Id: I9a00db888e9af3f6723e4c502158e8e56a00ef02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158063
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 8e5e3a587997..b8077ea9ad56 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -94,6 +94,8 @@ enum class DocumentSettingId
 HYPHENATE_URLS, ///< tdf#152952
 DO_NOT_BREAK_WRAPPED_TABLES,
 ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK,
+// tdf#119908 new paragraph justification
+JUSTIFY_LINES_WITH_SHRINKING,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/core/text/frmform.cxx b/sw/qa/core/text/frmform.cxx
index ee791f325729..b321fca51cee 100644
--- a/sw/qa/core/text/frmform.cxx
+++ b/sw/qa/core/text/frmform.cxx
@@ -63,6 +63,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableNegativeVertOffset)
 CPPUNIT_ASSERT_LESS(pPara2->getFrameArea().Top(), rFlyRect.Bottom());
 }
 
+// FIXME: because breaking the lines at the right place, this test
+// became obsolete: proposed fix is to modify compatibilityMode to "14"
+// in the DOCX test file to use the old justification algorithm
+#if 0
 CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidManipOfst)
 {
 // Given a document with a 6-page floating table and some anchor text:
@@ -81,6 +85,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidManipOfst)
 // anchors of non-last split fly frames should contain no text.
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
pAnchor->GetOffset().get());
 }
+#endif
 
 CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidLastManipOfst)
 {
diff --git a/sw/qa/extras/ooxmlexport/data/tdf130088.docx 
b/sw/qa/extras/ooxmlexport/data/tdf130088.docx
new file mode 100644
index ..8d5a7a604b5e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf130088.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index dd0c1a75e48f..704166e695a5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1397,6 +1397,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf146346, "tdf146346.docx")
 }
 #endif
 
+DECLARE_OOXMLEXPORT_TEST(testTdf130088, "tdf130088.docx")
+{
+// This was 2 (justification without shrinking resulted more lines)
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+// check compatibility option in ODT export/import, too
+saveAndReload("writer8");
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, 
"cont-sect-break-header-footer.docx")
 {
 // Load a document with a continuous section break on page 2.
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 53bd26fa9d08..86aa3ede7e81 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -255,6 +255,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 return mbDoNotBreakWrappedTables;
 case DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK:
 return mbAllowTextAfterFloatingTableBreak;
+case 

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

2023-07-04 Thread Mike Kaganski (via logerrit)
 sw/inc/autostyle_helper.hxx   |   31 
+++
 sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |   17 +
 sw/source/core/unocore/unoobj.cxx |   52 
+
 sw/source/core/unocore/unostyle.cxx   |   67 
--
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx  |   99 
++
 6 files changed, 213 insertions(+), 53 deletions(-)

New commits:
commit b036e563e699595fa7625888f11ab0c76f1abd66
Author: Mike Kaganski 
AuthorDate: Tue Jul 4 08:14:02 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Jul 4 20:10:33 2023 +0200

tdf#141969: use paragraph autostyle to mimic Word's table style

Word's table styles may define paragraph and character properties. They are
handled in DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle.

When setting such a character property using setPropertyValue, it may apply
to the text runs inside the paragraph, overriding values from character
style and direct formatting, which must be kept.

To fix that, this change creates a *paragraph* autostyle first, containing
the properties; and then applies only this autostyle to the paragraph; the
autostyle can't apply to runs, so the properties apply at paragraph level.

Sadly, it is impossible to create a useful autostyle in writerfilter using
UNO, because of the same problem that caused tdf#155945. UNO properties
may define only parts of complex SfxPoolItem; setting them without having
already applied values of such SfxPoolItem's would create wrong values for
properties that weren't set by the UNO properties, but happen to share the
same SfxPoolItem. To workaround that in writerfilter, a map of UNO names
to sets of UNO names defining the complex property would be required, and
then maintained.

Instead, introduce a hidded 'ParaAutoStyleDef' property of SwXTextCursor,
taking the same PropertyValue sequence as in XAutoStyleFamily::insertStyle.
Implement it similarly to SwUnoCursorHelper::SetPropertyValues: first,
build a WhichRangesContainer for specific WIDs needed for the properties;
then obtain the actual values for these WIDs from the paragraph; and then
set properties from the PropertyValue sequence.

To create the autostyle properly, the code from 
SwXAutoStyleFamily::insertStyle
is reused.

There are more "proper" ways to fix this in part or as a whole, e.g.:

* Split all complex SfxPoolItem's to simple ones, as done for one of them
  in commit db115bec9254417ef7a3faf687478fe5424ab378 (tdf#78510 sw,cui:
  split SvxLRSpaceItem for SwTextNode, SwTextFormatColl, 2023-02-24);

* Rewrite writerfilter in sw;

* Implement the missing proper table styles with paragraph and character
  properties, having the same precedence.

But I don't feel crazy enough for any of these :D

Change-Id: I07142cb23e8ec51f0e8ac8609f367ba247d94438
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153947
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/autostyle_helper.hxx b/sw/inc/autostyle_helper.hxx
new file mode 100644
index ..9336085db02e
--- /dev/null
+++ b/sw/inc/autostyle_helper.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#pragma once
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "istyleaccess.hxx"
+#include "swatrset.hxx"
+
+class SwDoc;
+
+std::shared_ptr
+PropValuesToAutoStyleItemSet(SwDoc& rDoc, IStyleAccess::SwAutoStyleFamily 
eFamily,
+ const 
css::uno::Sequence& Values,
+ SfxItemSet& rSet);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git 
a/sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx 
b/sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx
new file mode 100644
index ..6cbb8fb72e9d
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 20b190d59af6..a0a4d8051686 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1177,6 +1177,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156078)
 CPPUNIT_ASSERT(numberPixelsFound);
 }
 

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

2023-06-24 Thread Mike Kaganski (via logerrit)
 sw/inc/unoprnms.hxx  |2 
 sw/qa/core/layout/data/floattable-2cols.docx |binary
 sw/qa/core/layout/data/floattable-compat14-body.docx |binary
 sw/qa/core/layout/data/floattable-compat14-nosplit.docx  |binary
 sw/qa/core/layout/data/floattable-compat14.docx  |binary
 sw/qa/core/layout/data/floattable-footer-2rows.docx  |binary
 sw/qa/core/layout/data/floattable-footer.docx|binary
 sw/qa/core/layout/data/floattable-widow.docx |binary
 sw/qa/extras/layout/data/tdf116256.docx  |binary
 sw/qa/extras/layout/data/tdf136613.docx  |binary
 sw/qa/extras/layout/layout2.cxx  |   13 
 sw/qa/extras/ooxmlexport/data/lastEmptyLineWithDirectFormatting.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport19.cxx   |   11 
 sw/qa/extras/rtfexport/rtfexport6.cxx|4 
 sw/qa/extras/rtfimport/rtfimport.cxx |7 
 sw/source/core/doc/DocumentContentOperationsManager.cxx  |7 
 sw/source/core/doc/docfmt.cxx|6 
 sw/source/core/unocore/unoobj.cxx|9 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|  169 
++
 xmloff/source/text/txtparai.cxx  |   30 -
 20 files changed, 155 insertions(+), 103 deletions(-)

New commits:
commit fc1b9ab2913bc8c2d8414b6d8de3ceed3910c5d8
Author: Mike Kaganski 
AuthorDate: Fri Jun 23 09:31:01 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Jun 24 10:18:47 2023 +0200

tdf#133560: re-anchor objects, to use paragraph's dispose for bEndOfDocument

1. During import, XParagraphAppend::finishParagraph(Insert) are called,
   which are implemented using SwXText::Impl::finishOrAppendParagraph,
   and the latter calls

m_pDoc->getIDocumentContentOperations().AppendTextNode( 
*aPam.GetPoint() );
// remove attributes from the previous paragraph
m_pDoc->ResetAttrs(aPam);

   so that there is always another (empty) paragraph after the finalized
   one;

2. During import, lcl_AddRange is called to create anchored text content;
   the start and end of it may reference the very end of the document
   (using xTextAppend->getEnd()) - i.e., that last (maybe empty, maybe
   extra) paragraph.

3. In many places, and in particular, in DomainMapper_Impl destructor,
   DomainMapper_Impl::RemoveLastParagraph is called; and the latter uses
   one of the two techniques to remove that last paragraph:

3.1. It either obtains the paragraph's lang::XComponent interface, and
 calls its dispose (SwXParagraph::dispose), which eventually calls
 DocumentContentOperationsManager::DelFullPara;

3.2. Or it uses cursor to select 1 ch back, and replace the resulting
 selection with nothing.

3.1 has an advantage of keeping the formatting of the remaining (second-
to-last) paragraph, but DocumentContentOperationsManager::DelFullPara,
among other things, removes all anchored objects, thus this mode is not
used for the end-of-document case (e.g., see commit message of commit
e521930ea1c855c236efb67793e540d07c201d35 "fdo#58327: writerfilter:
RemoveLastParagraph is tricky:", 2013-01-10);

3.2 keeps the anchored objects, but needs workarounds to keep bookmarks,
and destroys the remaining paragraph character formatting.

Let me try to use #3.1 also in the end-of-document case, by introducing
code to move anchored objects to previous paragraph before calling
XComponent::dispose. Indeed, it may happen that more processing could be
needed, if more properties would happen to be bound to the very last
extra paragraph.

This change adds a call to DocumentRedlineManager::CompressRedlines in
DocumentContentOperationsManager::DelFullPara, because previously, this
was called during #3.2 inside setString. testTdf150086 failed without
this change.

testTdf131386 and testTdf152872 were changed to the now-correct import of
last paragraph properties (previously both of them relied on the hidden
property not present there, while it is there in Word).

In DomainMapper_Impl::RemoveLastParagraph, the check of the content of
selection made by moving backward one character was generalized to be run
before both cases, because RTF sometimes has only one paragraph after a
table (see e.g. testTdf148515), which now could be removed in the absence
of the check.

testTdf104390 was changed to not check the number of runs, because now
the paragraph keeps the trailing "paragraph mark 

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

2023-06-08 Thread Justin Luth (via logerrit)
 dev/null  |binary
 sw/inc/IDocumentSettingAccess.hxx |3 ---
 sw/qa/extras/layout/layout2.cxx   |8 
 sw/source/core/doc/DocumentSettingManager.cxx |6 --
 sw/source/core/inc/DocumentSettingManager.hxx |1 -
 sw/source/core/text/portxt.cxx|5 +
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   16 
 writerfilter/source/filter/WriterFilter.cxx   |1 -
 8 files changed, 1 insertion(+), 39 deletions(-)

New commits:
commit 278b6d21d36a0ff401fdd9ed6f964cd0dca862bf
Author: Justin Luth 
AuthorDate: Thu Jun 8 20:24:28 2023 -0400
Commit: Justin Luth 
CommitDate: Fri Jun 9 06:07:18 2023 +0200

tdf#152046 Revert "tdf#100680 sw DOCX compatibility: fix wrap of as_char 
flys"

This reverts 7.4 commit 41b012767feb8552b60a68c7be18d80c403304bf,

The premiss of the commit is that as-char flies needed to be handled 
differently,
and yet at the spot where it was implemented, we have no idea whether we
are even dealing with an as-char fly!!!

As this bug report report shows, it affects paragraphy that don't
have any fly whatsoever, let alone an as-char fly.

Change-Id: I2fedb2d610093933081e861a16a25de2f2716258
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152778
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index f8d9bfa2ab59..f14ffb543b30 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -120,9 +120,6 @@ enum class DocumentSettingId
 // footnoteContainer default position is the page end instead of the 
column end
 // only if "evenly distributed" is set, and "collected at the end" is not 
set
 FOOTNOTE_IN_COLUMN_TO_PAGEEND,
-// AsChar anchored flys wrapped differently in ooxml than normally so in 
case of
-// docx enable this flag. For details see ticket tdf#100680.
-WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML,
 // Should we display follow by symbol for numbered paragraph if numbering 
exists, but "None"?
 NO_NUMBERING_SHOW_FOLLOWBY,
 // drop cap punctuation: smaller dashes, bullet, asterisks, quotation 
marks etc.
diff --git a/sw/qa/extras/layout/data/tdf100680.docx 
b/sw/qa/extras/layout/data/tdf100680.docx
deleted file mode 100644
index c949540be388..
Binary files a/sw/qa/extras/layout/data/tdf100680.docx and /dev/null differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index b4b004951bf0..9daa260c21c4 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -137,14 +137,6 @@ void SwLayoutWriter2::CheckRedlineCharAttributesHidden()
 "portion", "foobaz");
 }
 
-CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf100680_as_char_wrap)
-{
-createSwDoc("tdf100680.docx");
-auto pDump = parseLayoutDump();
-assertXPath(pDump, "/root/page/header/txt/SwParaPortion/SwLineLayout[3]");
-// If the third line missing that assert will fire, as was before the fix.
-}
-
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf148897)
 {
 createSwDoc("tdf148897.odt");
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 7eb4f9de5f20..5610f2a1f801 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -106,7 +106,6 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbFootnoteInColumnToPageEnd(false),
 mnImagePreferredDPI(0),
 mbAutoFirstLineIndentDisregardLineSpace(true),
-mbWrapAsCharFlysLikeInOOXML(false),
 mbNoNumberingShowFollowBy(false),
 mbDropCapPunctuation(true),
 mbUseVariableWidthNBSP(false)
@@ -254,7 +253,6 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::HYPHENATE_URLS: return mbHyphenateURLs;
 case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES:
 return mbDoNotBreakWrappedTables;
-case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: return 
mbWrapAsCharFlysLikeInOOXML;
 case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return 
mbNoNumberingShowFollowBy;
 case DocumentSettingId::DROP_CAP_PUNCTUATION: return 
mbDropCapPunctuation;
 case DocumentSettingId::USE_VARIABLE_WIDTH_NBSP: return 
mbUseVariableWidthNBSP;
@@ -444,10 +442,6 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 mbDoNotBreakWrappedTables = value;
 break;
 
-case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML:
-mbWrapAsCharFlysLikeInOOXML = value;
-break;
-
 case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY:
 mbNoNumberingShowFollowBy = value;
 break;
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx 

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

2023-01-13 Thread Michael Stahl (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 
 sw/qa/extras/layout/data/Hyphenated-link.fodt |  258 ++
 sw/qa/extras/layout/data/Hyphenated-link.rtf  |   41 
 sw/qa/extras/layout/layout2.cxx   |   26 ++
 sw/source/core/doc/DocumentSettingManager.cxx |9 
 sw/source/core/inc/DocumentSettingManager.hxx |1 
 sw/source/core/text/guess.cxx |   30 +++
 sw/source/filter/ww8/ww8par.cxx   |1 
 sw/source/filter/xml/xmlimp.cxx   |   10 +
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 +
 writerfilter/source/filter/WriterFilter.cxx   |1 
 11 files changed, 396 insertions(+)

New commits:
commit de2b1a3a22a0a3bf5dfdd44c57c09e1fd0ba39d2
Author: Michael Stahl 
AuthorDate: Thu Jan 12 14:24:11 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Jan 13 15:51:02 2023 +

tdf#152952 sw: don't hyphenate URLs by default

New compatibility flag HyphenateURLs, disabled by default for Word
interop and enabled for old ODT documents.

Change-Id: I1496819599deb5ed0fd736698d269ab9a22167fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145415
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 1f81ead70645..e891a2b8c058 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -92,6 +92,7 @@ enum class DocumentSettingId
 EMPTY_DB_FIELD_HIDES_PARA,
 // tdf#129448: Auto first-line indent should not be effected by line space
 AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE,
+HYPHENATE_URLS, ///< tdf#152952
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/extras/layout/data/Hyphenated-link.fodt 
b/sw/qa/extras/layout/data/Hyphenated-link.fodt
new file mode 100644
index ..0371cf4406f1
--- /dev/null
+++ b/sw/qa/extras/layout/data/Hyphenated-link.fodt
@@ -0,0 +1,258 @@
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ Gabor Kelemen 
LO2023-01-09T23:24:002023-01-09T23:25:003PT3SLibreOfficeDev/7.4.5.0.0$Linux_X86_64
 
LibreOffice_project/f2d3658697f22090ee138cebda4d10c3ede21230Gábor Kelemen2010
+ 
+  
+   0
+   0
+   0
+   0
+   true
+   false
+  
+  
+   false
+   false
+   false
+   true
+   true
+   true
+   true
+   true
+   false
+   0
+   false
+   false
+   false
+   true
+   false
+   false
+   true
+   true
+   false
+   false
+   false
+   true
+   true
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   false
+   true
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   0
+   1
+   true
+   true
+   
+   high-resolution
+   true
+   
+   
+   false
+   false
+   true
+   false
+   true
+   true
+   true
+   false
+   true
+   
+   true
+   1180787
+   
+   true
+ 

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

2022-10-13 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentContentOperations.hxx   |3 --
 sw/inc/strings.hrc  |2 +
 sw/qa/core/doc/doc.cxx  |   24 ++--
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   16 ++
 sw/source/core/doc/docbm.cxx|4 ++
 sw/source/core/doc/docdesc.cxx  |4 +-
 sw/source/core/doc/docfmt.cxx   |2 -
 sw/source/core/inc/DocumentContentOperationsManager.hxx |2 -
 sw/source/core/unocore/unotext.cxx  |   22 ++
 writerfilter/source/dmapper/PropertyMap.cxx |   11 ---
 10 files changed, 33 insertions(+), 57 deletions(-)

New commits:
commit 41403fbff8140ad0ca7cf8f81d37cddcfbd19197
Author: Miklos Vajna 
AuthorDate: Thu Oct 13 13:53:33 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 13 15:16:04 2022 +0200

sw: improve duplicated bookmarks in copied header/footer text

Bookmarks in copied text were renamed in a way that made it hard to
differentiate between the original bookmark and the copy, e.g. "Bookmark
1" was renamed to "Bookmark 11".

Bookmarks are supposed to have a unique name, so renaming makes sense,
and it's probably better to do that compared to what commit
3ec224dcb15e0e663ba85077b8ea0e632f8f03f8 (DOCX import: avoid duplicated
bookmarks in copied header/footer text, 2022-09-08) did to just omit
them during copy. That solved the duplicated bookmarks, but if one had
bookmarks around images to find them, now it doesn't work to find all
such images.

Fix the problem by going back to copying bookmarks, but copy "Bookmark
1" as "Bookmark 1 Copy 1" (and "Bookmark 1 Copy 2", etc), so API users
can identify the original and the copied bookmarks.

A similar problem is there for images as well, but that's not yet
addressed here.

Change-Id: Ic0689b05f790a99ff06523ff4836b1dd412af896
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141293
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/inc/IDocumentContentOperations.hxx 
b/sw/inc/IDocumentContentOperations.hxx
index 60d45d47a0a3..5a95d0ba95b8 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -75,12 +75,11 @@ enum class SwCopyFlags
 CopyAll = (1<<0), ///< copy break attributes even when source is 
single node
 CheckPosInFly   = (1<<1), ///< check if target position is in fly anchored 
at source range
 IsMoveToFly = (1<<2), ///< MakeFlyAndMove
-SkipBookmarks   = (1<<3), ///< skip bookmarks, but not other kind of marks
 // TODO: mbCopyIsMove? mbIsRedlineMove?
 };
 namespace o3tl
 {
-template<> struct typed_flags : is_typed_flags {};
+template<> struct typed_flags : is_typed_flags {};
 }
 
 enum class SwDeleteFlags
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 4f2dd39ff86b..e1859f1432d0 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1446,6 +1446,8 @@
 // in order to change %PRODUCTNAME at runtime is expensive, so limit doing 
that as much as possible.
 #define STR_A11Y_DESC_AUTO  
NC_("insertcaption|extended_tip|auto", "Opens the Caption dialog. It has the 
same information as the dialog you get by menu %PRODUCTNAME Writer - 
AutoCaption in the Options dialog box.")
 
+#define STR_MARK_COPY NC_("STR_MARK_COPY", "%1 Copy ")
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx 
b/sw/qa/core/doc/data/copy-bookmarks.docx
similarity index 100%
rename from sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx
rename to sw/qa/core/doc/data/copy-bookmarks.docx
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 8c882e906373..98548befa9ee 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -256,19 +256,27 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testContentControlDelete)
 CPPUNIT_ASSERT_EQUAL(OUString("\x0001test\x0001"), pTextNode->GetText());
 }
 
-CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyFlagSkipBookmarks)
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyBookmarks)
 {
 // Given a document with a bookmark in a header that is linked later:
-SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "copy-flag-skip-bookmarks.docx");
-
-// When checking the # of bookmarks in the resulting doc model:
-sal_Int32 nActual = pDoc->getIDocumentMarkAccess()->getAllMarksCount();
-
-// Then make sure we have a single bookmark, with no duplications:
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "copy-bookmarks.docx");
+
+// When checking the # of non-copy bookmarks in the resulting doc model:
+sal_Int32 nActual = 0;
+for (auto it = pDoc->getIDocumentMarkAccess()->getBookmarksBegin();
+ it != pDoc->getIDocumentMarkAccess()->getBookmarksEnd(); ++it)
+{
+if 

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

2022-09-19 Thread Miklos Vajna (via logerrit)
 sw/inc/txatbase.hxx   |2 
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |   43 ---
 sw/source/filter/ww8/attributeoutputbase.hxx  |8 --
 sw/source/filter/ww8/docxattributeoutput.cxx  |   86 +++---
 sw/source/filter/ww8/docxattributeoutput.hxx  |   11 --
 sw/source/filter/ww8/docxexport.cxx   |2 
 sw/source/filter/ww8/rtfattributeoutput.cxx   |3 
 sw/source/filter/ww8/rtfattributeoutput.hxx   |3 
 sw/source/filter/ww8/wrtw8nds.cxx |   29 +--
 sw/source/filter/ww8/ww8atr.cxx   |4 -
 sw/source/filter/ww8/ww8attributeoutput.hxx   |2 
 writerfilter/source/dmapper/DomainMapper.cxx  |   15 +--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 ++
 writerfilter/source/dmapper/SdtHelper.hxx |4 -
 14 files changed, 93 insertions(+), 127 deletions(-)

New commits:
commit de90c192cb8f1f03a4028493d8bfe9a127a76b2a
Author: Miklos Vajna 
AuthorDate: Mon Sep 19 10:01:36 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon Sep 19 11:31:05 2022 +0200

sw content controls, plain text: enable DOCX filter with data binding

- writerfilter/ had explicit code to not map plain text SDT to Writer 
content
  controls if it has data bindings specified, lift this limitation and set 
the
  value of content control from data binding, like Word does and Writer did 
it
  for input fields since b5c616d10bff3213840d4893d13b4493de71fa56 
(tdf#104823:
  support for sdt plain text fields, 2021-11-24)

- call DocxExport::AddSdtData() on the export side to do the opposite on 
export

- give up on the idea to export content controls to DOCX by finding the text
  attribute in SwWW8AttrIter::OutAttrWithRange(): this needs buffering in 
both
  directions (need to start the SDT before the start of the run, need to 
end it
  after the end of the run), and solving this using marks and merges at a
  fast-serializer level looks like hacks on top of hacks. To be more 
specific,
  CppunitTest_sw_ooxmlexport7's testSdtAndShapeOverlapping seems to be very 
hard
  to fix with this design

- instead, give not only the start position but also the length of the run 
to
  DocxAttributeOutput::EndRun(), which has random access to the doc model 
and can
  look up if there is a content control start or end that needs writing at 
the
  current position of the XML output, without any buffering, which also
  means less code

- adapt CppunitTest_sw_ooxmlfieldexport's testSdtBeforeField, which didn't 
like
  the empty run at the start of content controls, which seems to be harmless
  otherwise

- fix CppunitTest_sw_ooxmlfieldexport 
CPPUNIT_TEST_NAME=testSdtDateDuplicate by
  disabling the "set content control value from data binding" logic for date
  pickers because that logic in writerfilter/ sets the value as-is and it 
has to
  consider the requested date format before this can be enabled

As a side effect, this gives PDF export for plain text SDTs, even if they 
have
data binding set. CppunitTest_sw_ooxmlfieldexport's testTdf104823 is now
updated to ensure that we import such SDTs as Writer content controls.

Change-Id: I749a845b5a25454c51066b8ded892682f523b6b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140134
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
index 183e254f8817..00e2f9b51470 100644
--- a/sw/inc/txatbase.hxx
+++ b/sw/inc/txatbase.hxx
@@ -132,7 +132,7 @@ public:
 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
-class SAL_DLLPUBLIC_RTTI SwTextAttrEnd : public virtual SwTextAttr
+class SW_DLLPUBLIC SwTextAttrEnd : public virtual SwTextAttr
 {
 protected:
 sal_Int32 m_nEnd;
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 073918d31c48..f5db919b4c7e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -596,7 +596,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtBeforeField)
 loadAndReload("sdt-before-field.docx");
 xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 // Make sure the field doesn't sneak inside the SDT: the SDT should 
contain only a single run (there were 6 ones).
-assertXPath(pXmlDoc, "//w:sdt/w:sdtContent/w:r", 1);
+assertXPath(pXmlDoc, "//w:p/w:sdt/w:sdtContent/w:r/w:t", 1);
+assertXPath(pXmlDoc, "//w:p/w:r/w:fldChar", 3);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testfdo81946)
@@ -901,36 +902,26 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf104823)
 OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"tdf104823.docx";
 loadURL(aURL, nullptr);
 
-css::uno::Reference xTextFieldsSupplier(
-mxComponent, css::uno::UNO_QUERY_THROW);
-auto 

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

2022-09-08 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentContentOperations.hxx   |3 +-
 sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx   |binary
 sw/qa/core/doc/doc.cxx  |   16 +++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   16 ---
 sw/source/core/doc/docdesc.cxx  |4 +-
 sw/source/core/doc/docfmt.cxx   |2 -
 sw/source/core/inc/DocumentContentOperationsManager.hxx |2 -
 sw/source/core/unocore/unotext.cxx  |   22 +---
 writerfilter/source/dmapper/PropertyMap.cxx |   11 
 9 files changed, 64 insertions(+), 12 deletions(-)

New commits:
commit 3ec224dcb15e0e663ba85077b8ea0e632f8f03f8
Author: Miklos Vajna 
AuthorDate: Thu Sep 8 16:41:46 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Sep 8 17:46:05 2022 +0200

DOCX import: avoid duplicated bookmarks in copied header/footer text

In case a DOCX document has 2 sections and the 2nd section has a linked
header, writerfilter/ copies the header text from the 1st page style to
the 2nd page style. This leads to duplicated bookmarks in the doc model,
which causes an unexpected increase in bookmark count on export.

This went wrong with 8885bdf2f564bb7b56181c50baf39ff99d551ec9
(tdf#128106 sw: copy bookmarks at start if whole node is copied,
2021-08-27), previously at least bookmarks at the start of the header
were not duplicated, though that was also inconsistent, since other
bookmarks were still duplicated. Interestingly the DOC import doesn't
have this problem, because it first copies header text and only later
imports the bookmarks.

Fix the problem by introducing a new SwCopyFlags::SkipBookmarks flag,
add UNO API to set this from writerfilter/ code and skip copying
bookmarks (but not other marks) in sw::CopyBookmarks() accordingly.
Copying other marks is still needed, because e.g. fieldmarks have a mark
and a field, and it would be inconsistent to copy the field, but not the
mark.

Note that the text is still duplicated in header/footer, linked
header/footer is a missing feature on the Writer side.

Change-Id: I40e18f231ef2c0d91ae9582621684ef5b6284904
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139697
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/inc/IDocumentContentOperations.hxx 
b/sw/inc/IDocumentContentOperations.hxx
index 5a95d0ba95b8..60d45d47a0a3 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -75,11 +75,12 @@ enum class SwCopyFlags
 CopyAll = (1<<0), ///< copy break attributes even when source is 
single node
 CheckPosInFly   = (1<<1), ///< check if target position is in fly anchored 
at source range
 IsMoveToFly = (1<<2), ///< MakeFlyAndMove
+SkipBookmarks   = (1<<3), ///< skip bookmarks, but not other kind of marks
 // TODO: mbCopyIsMove? mbIsRedlineMove?
 };
 namespace o3tl
 {
-template<> struct typed_flags : is_typed_flags {};
+template<> struct typed_flags : is_typed_flags {};
 }
 
 enum class SwDeleteFlags
diff --git a/sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx 
b/sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx
new file mode 100644
index ..3fb27b430a17
Binary files /dev/null and b/sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx 
differ
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 87bfd2697621..2ee2ee342bd3 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -255,6 +255,22 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testContentControlDelete)
 CPPUNIT_ASSERT_EQUAL(OUString("\x0001test\x0001"), pTextNode->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyFlagSkipBookmarks)
+{
+// Given a document with a bookmark in a header that is linked later:
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "copy-flag-skip-bookmarks.docx");
+
+// When checking the # of bookmarks in the resulting doc model:
+sal_Int32 nActual = pDoc->getIDocumentMarkAccess()->getAllMarksCount();
+
+// Then make sure we have a single bookmark, with no duplications:
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 2
+// i.e. the 2nd header had a duplicated bookmark.
+CPPUNIT_ASSERT_EQUAL(static_cast(1), nActual);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index c642cde1c8c7..62c362eba181 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -232,7 +232,7 @@ namespace
 namespace sw
 {
 // TODO: use SaveBookmark (from DelBookmarks)
-void CopyBookmarks(const SwPaM& rPam, 

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

2022-08-17 Thread László Németh (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |5 +
 sw/qa/extras/layout/data/tdf150200.docx   |binary
 sw/qa/extras/layout/data/tdf150200.odt|binary
 sw/qa/extras/layout/data/tdf150438.docx   |binary
 sw/qa/extras/layout/data/tdf150438.odt|binary
 sw/qa/extras/layout/layout2.cxx   |   88 ++
 sw/source/core/doc/DocumentSettingManager.cxx |   10 ++
 sw/source/core/inc/DocumentSettingManager.hxx |1 
 sw/source/core/text/txtdrop.cxx   |   14 
 sw/source/filter/xml/xmlimp.cxx   |   12 +++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   30 ++--
 writerfilter/source/filter/WriterFilter.cxx   |1 
 12 files changed, 152 insertions(+), 9 deletions(-)

New commits:
commit a18a74d6762e56a20093ca51cfd12925697c2524
Author: László Németh 
AuthorDate: Tue Aug 16 11:00:54 2022 +0200
Commit: László Németh 
CommitDate: Wed Aug 17 18:07:24 2022 +0200

tdf#150200 tdf#150438 sw, DOCX: fix drop cap dash, quotation etc.

In drop cap layout, set smaller size for all glyphs positioned
over the baseline, e.g. dashes (dash, en-dash, em-dash, figure dash),
bullet, asterisks and quotation marks by extending the bounding box
of the glyph to the baseline, like MSO does.

Add "DropCapPunctuation", a new default compatibility option for this.
Only old ODT files loads the old layout (which was partially broken:
e.g. dashes were too long, often missing from the drop cap area or
the drop cap was disabled). New ODT and imported DOCX documents
use the new default layout for better typesetting and interoperability.

Change-Id: I3aba0727fd15f6edb9245e31f523e12f407d189e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138356
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 548419576168..1f81ead70645 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -123,7 +123,10 @@ enum class DocumentSettingId
 // docx enable this flag. For details see ticket tdf#100680.
 WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML,
 // Should we display follow by symbol for numbered paragraph if numbering 
exists, but "None"?
-NO_NUMBERING_SHOW_FOLLOWBY
+NO_NUMBERING_SHOW_FOLLOWBY,
+// drop cap punctuation: smaller dashes, bullet, asterisks, quotation 
marks etc.
+// by extending the rounding box of the glyph to the baseline
+DROP_CAP_PUNCTUATION
 };
 
 /** Provides access to settings of a document
diff --git a/sw/qa/extras/layout/data/tdf150200.docx 
b/sw/qa/extras/layout/data/tdf150200.docx
new file mode 100644
index ..8f3a57d764b9
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf150200.docx differ
diff --git a/sw/qa/extras/layout/data/tdf150200.odt 
b/sw/qa/extras/layout/data/tdf150200.odt
new file mode 100644
index ..224d5c4c4b3e
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf150200.odt differ
diff --git a/sw/qa/extras/layout/data/tdf150438.docx 
b/sw/qa/extras/layout/data/tdf150438.docx
new file mode 100644
index ..87aa1c5f6de2
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf150438.docx differ
diff --git a/sw/qa/extras/layout/data/tdf150438.odt 
b/sw/qa/extras/layout/data/tdf150438.odt
new file mode 100644
index ..5634ab91adb4
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf150438.odt differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 09e113fc4ed0..eafb21646cdf 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -2009,6 +2009,94 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf118672)
 "setetur");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150200)
+{
+createSwDoc(DATA_DIRECTORY, "tdf150200.odt");
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// dash
+OUString sFirstLine = 
parseDump("/root/page/body/txt[1]/LineBreak[1]/@Line");
+CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"-(dash)"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(93), sFirstLine.getLength());
+// en-dash
+sFirstLine = parseDump("/root/page/body/txt[2]/LineBreak[1]/@Line");
+CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"–(en-dash)"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(88), sFirstLine.getLength());
+// em-dash
+sFirstLine = parseDump("/root/page/body/txt[3]/LineBreak[1]/@Line");
+CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"—(em-dash)"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(77), sFirstLine.getLength());
+// figure dash
+sFirstLine = parseDump("/root/page/body/txt[4]/LineBreak[1]/@Line");
+CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"‒(figure dash)"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(87), sFirstLine.getLength());
+}
+
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150200_DOCX)
+{
+createSwDoc(DATA_DIRECTORY, 

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

2022-08-02 Thread Vasily Melenchuk (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |4 +++-
 sw/qa/extras/ooxmlexport/data/tdf148360.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx|   15 +++
 sw/source/core/doc/DocumentSettingManager.cxx |9 +++--
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/core/text/txtfld.cxx|3 ++-
 sw/source/core/txtnode/ndtxt.cxx  |   18 --
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 +-
 writerfilter/source/dmapper/DomainMapper.cxx  |2 +-
 9 files changed, 58 insertions(+), 12 deletions(-)

New commits:
commit a7d9837a8aa6d1233f4c21e4db5d32428a3ffc58
Author: Vasily Melenchuk 
AuthorDate: Thu May 26 12:05:58 2022 +0300
Commit: Thorsten Behrens 
CommitDate: Tue Aug 2 15:59:35 2022 +0200

tdf#148360: sw: do not ignore list label followed by

...even if numbering is empty.

Since this is a core change to avoid impact on other formats
(mostly ODT) it is implemented as a new document setting.

Change-Id: I35e1cec97eb40f9f3411e3ba74cb553bd8afac59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134989
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index eee38ef7678e..548419576168 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -121,7 +121,9 @@ enum class DocumentSettingId
 FOOTNOTE_IN_COLUMN_TO_PAGEEND,
 // AsChar anchored flys wrapped differently in ooxml than normally so in 
case of
 // docx enable this flag. For details see ticket tdf#100680.
-WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML
+WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML,
+// Should we display follow by symbol for numbered paragraph if numbering 
exists, but "None"?
+NO_NUMBERING_SHOW_FOLLOWBY
 };
 
 /** Provides access to settings of a document
diff --git a/sw/qa/extras/ooxmlexport/data/tdf148360.docx 
b/sw/qa/extras/ooxmlexport/data/tdf148360.docx
new file mode 100644
index ..8f09f685d26f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148360.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index ee5b0dd19b14..bb9d30fc97d0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -1054,6 +1054,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149313, "tdf149313.docx")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(8000), getXPath(pXmlDoc, 
"/root/page[2]/infos/bounds", "width").toInt32());
 }
 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_OOXMLEXPORT_TEST(testTdf148360, "tdf148360.docx")
+{
+const auto& pLayout = parseLayoutDump();
+
+// Ensure first element is a tab
+assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"PortionType::TabLeft");
+// and only then goes content
+assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[2]", "nType", 
"PortionType::Text");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf135923, "tdf135923-min.docx")
 {
 uno::Reference xShape(getShape(1), uno::UNO_QUERY);
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 851aec5b9e10..5f2a57099938 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -106,8 +106,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbFootnoteInColumnToPageEnd(false),
 mnImagePreferredDPI(0),
 mbAutoFirstLineIndentDisregardLineSpace(true),
-mbWrapAsCharFlysLikeInOOXML(false)
-
+mbWrapAsCharFlysLikeInOOXML(false),
+mbNoNumberingShowFollowBy(false)
 // COMPATIBILITY FLAGS END
 {
 // COMPATIBILITY FLAGS START
@@ -246,6 +246,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
 return mbAutoFirstLineIndentDisregardLineSpace;
 case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: return 
mbWrapAsCharFlysLikeInOOXML;
+case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return 
mbNoNumberingShowFollowBy;
 default:
 OSL_FAIL("Invalid setting id");
 }
@@ -428,6 +429,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 mbWrapAsCharFlysLikeInOOXML = value;
 break;
 
+case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY:
+mbNoNumberingShowFollowBy = value;
+break;
+
 // COMPATIBILITY FLAGS END
 
 case DocumentSettingId::BROWSE_MODE: //can be used temporary 
(load/save) when no SwViewShell is available
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx 
b/sw/source/core/inc/DocumentSettingManager.hxx
index b6656a934676..f37696df1a3e 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ 

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

2022-07-11 Thread Attila Bakos (NISZ) (via logerrit)
 sw/inc/textboxhelper.hxx  |   40 ++
 sw/qa/extras/layout/layout.cxx|5 
 sw/qa/extras/ooxmlexport/data/tdf149546.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|6 
 sw/source/core/doc/docfly.cxx |7 
 sw/source/core/doc/textboxhelper.cxx  |  309 ++
 sw/source/core/edit/edundo.cxx|9 
 sw/source/core/layout/atrfrm.cxx  |9 
 sw/source/core/text/porfly.cxx|7 
 sw/source/core/undo/undobj1.cxx   |   12 
 sw/source/core/unocore/unodraw.cxx|   22 +
 sw/source/core/unocore/unotext.cxx|   23 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   27 +
 13 files changed, 348 insertions(+), 128 deletions(-)

New commits:
commit 1d3d2a995239c3c71432006cb795324c56a0412a
Author: Attila Bakos (NISZ) 
AuthorDate: Mon Jun 20 17:27:53 2022 +0200
Commit: László Németh 
CommitDate: Mon Jul 11 14:09:09 2022 +0200

tdf#148687 tdf#149173 tdf#149546 sw: fix crash with textboxes

Regression from 2110597ac730fa07dbbdd603fda82b182ed27c9e
"tdf#147485 sw: fix group shape crash using std::shared_ptr".

Details:

1) Using reference instead of copy assignment in SwTextBoxHelper.

2) Cleanup: Unused parts of SwTextBoxHelper were removed.

3) Fixing destruction of textboxes, in case when first the shape
is removed, with clearing all textboxes from the doc and the shape
before the pointer is released. All of this only have to be done if
the call is not coming from the swdoc dtor, unless there will be
double freeing.

4) Missing style conversion was fixed in writerfilter.

5) Don't import sections in textboxes, unless the hack of dummy
paragraph before tables in sections will be applied and the paragraph
with anchored objects inside will be removed with the objects;

6) ConvertTextRangeToTextFrame also fixed, so embed frames in
frames are imported from now. (Also textboxes in frames, this
can be useful when there is a floating table having group
textbox with nested complex content inside, or floating table
in floating table, etc...) Note: Follow up commit will enable
group textbox import in frames and tables.

7) Import of group textboxes with complex content in header/footer
was impossible, from now this is also supported both from DOCX and
ODT (test included).

8) Guard class for blocking unwanted recursive textbox sync
has been introduced, and maybe some speedup with group
textbox import has been achieved.

9) The anchor sync method got a new function which avoids
unnecessary sync when the anchor is the same.

10) Sync of As_char textboxes during layout calculation caused
crash so that has a workaround from now, for DOCX import anchor
change and Undo. That syncs starts before the layout calculation
so sync not needed later.

11) A memory leak was found in Undo, which has been fixed.

Note: layout test "testTdf147485Forcepoint" has to be limited
to Windows and Mac builds, because font substitution
causes crash on the Unix based systems.

Change-Id: I69d5d79cc120e3a70ba9285be32ec36a434b2a04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136192
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 112b312a0dab..ebf329342d8e 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -179,6 +179,9 @@ public:
 /// vector filled with the textboxes.
 static std::vector CollectTextBoxes(const SdrObject* 
pGroupObject,
 SwFrameFormat* 
pFormat);
+
+// Compares the anchor of the first and second given formats, and decides 
whether sync needed.
+static bool isAnchorSyncNeeded(const SwFrameFormat* pFirst, const 
SwFrameFormat* pSecond);
 };
 
 /// Textboxes are basically textframe + shape pairs. This means one shape has 
one frame.
@@ -187,6 +190,8 @@ public:
 /// it can have multiple textboxes.
 class SwTextBoxNode
 {
+friend class SwTextBoxLockGuard;
+
 // One TextBox-entry
 struct SwTextBoxElement
 {
@@ -194,8 +199,6 @@ class SwTextBoxNode
 SwFrameFormat* m_pTextBoxFormat;
 // The Draw object where the textbox belongs to
 SdrObject* m_pDrawObject;
-// This is for indicating if the textbox is in special case: for 
example during undo.
-bool m_bIsActive;
 };
 
 // This vector stores the textboxes what belongs to this node
@@ -204,8 +207,12 @@ class SwTextBoxNode
 // (and the textboxes)
 SwFrameFormat* m_pOwnerShapeFormat;
 
+// Prevents oscillating during recursive clone calling.
 mutable bool m_bIsCloningInProgress;
 
+// Protection 

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

2022-04-28 Thread Attila Bakos (NISZ) (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |3 +++
 sw/qa/extras/layout/data/tdf100680.docx   |binary
 sw/qa/extras/layout/layout2.cxx   |8 
 sw/source/core/doc/DocumentSettingManager.cxx |8 +++-
 sw/source/core/inc/DocumentSettingManager.hxx |2 ++
 sw/source/core/text/portxt.cxx|7 +--
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   16 
 writerfilter/source/filter/WriterFilter.cxx   |1 +
 8 files changed, 42 insertions(+), 3 deletions(-)

New commits:
commit 41b012767feb8552b60a68c7be18d80c403304bf
Author: Attila Bakos (NISZ) 
AuthorDate: Tue Apr 5 13:37:55 2022 +0200
Commit: László Németh 
CommitDate: Thu Apr 28 11:47:42 2022 +0200

tdf#100680 sw DOCX compatibility: fix wrap of as_char flys

New DOCX compatibility flag "WordLikeWrapForAsCharFlys"
has been introduced which true in case of importing DOCX
documents. It modifies the wrapping of long words
with as_char anchored flys anchored into the same line,
resulting e.g. correct import of poor man's header lines
drawn by using underline characters under an image.

Note: this example was imported as a broken header line:
half of it was there after the left aligned image in the
same line, and after the line break, only the other half
under the image.

Change-Id: I9474900ef778bcf5ddc9d95f39d536d67015f3b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132571
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 7de8674c4d0f..4e434f20a3ee 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -119,6 +119,9 @@ enum class DocumentSettingId
 // footnoteContainer default position is the page end instead of the 
column end
 // only if "evenly distributed" is set, and "collected at the end" is not 
set
 FOOTNOTE_IN_COLUMN_TO_PAGEEND,
+// AsChar anchored flys wrapped differently in ooxlm than normally so in 
case of
+// docx enable this flag. For details see ticket tdf#100680.
+WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML
 };
 
 /** Provides access to settings of a document
diff --git a/sw/qa/extras/layout/data/tdf100680.docx 
b/sw/qa/extras/layout/data/tdf100680.docx
new file mode 100644
index ..c949540be388
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf100680.docx differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 02b40c21b5ef..faf978d65f1e 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -93,6 +93,14 @@ void SwLayoutWriter2::CheckRedlineCharAttributesHidden()
 assertXPath(pXmlDoc, "/root/page[1]/body/txt[11]/Text[1]", "Portion", 
"foobaz");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf100680_as_char_wrap)
+{
+createSwDoc(DATA_DIRECTORY, "tdf100680.docx");
+auto pDump = parseLayoutDump();
+assertXPath(pDump, "/root/page/header/txt/SwParaPortion/SwLineLayout[3]");
+// If the third line missing that assert will fire, as was before the fix.
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineCharAttributes)
 {
 createSwDoc(DATA_DIRECTORY, "redline_charatr.fodt");
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 3e03097fb41f..851aec5b9e10 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -105,7 +105,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbGutterAtTop(false),
 mbFootnoteInColumnToPageEnd(false),
 mnImagePreferredDPI(0),
-mbAutoFirstLineIndentDisregardLineSpace(true)
+mbAutoFirstLineIndentDisregardLineSpace(true),
+mbWrapAsCharFlysLikeInOOXML(false)
 
 // COMPATIBILITY FLAGS END
 {
@@ -244,6 +245,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND: return 
mbFootnoteInColumnToPageEnd;
 case DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
 return mbAutoFirstLineIndentDisregardLineSpace;
+case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: return 
mbWrapAsCharFlysLikeInOOXML;
 default:
 OSL_FAIL("Invalid setting id");
 }
@@ -422,6 +424,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 mbAutoFirstLineIndentDisregardLineSpace = value;
 break;
 
+case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML:
+mbWrapAsCharFlysLikeInOOXML = value;
+break;
+
 // COMPATIBILITY FLAGS END
 
 case DocumentSettingId::BROWSE_MODE: //can be used temporary 
(load/save) when no SwViewShell is available
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx 

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

2022-03-31 Thread Sarper Akdemir (via logerrit)
 sw/inc/unoprnms.hxx  |1 
 sw/qa/extras/ooxmlexport/data/tdf148273_sectionBulletFormatLeak.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   17 
++
 sw/source/core/unocore/unoobj.cxx|9 
+
 writerfilter/source/dmapper/DomainMapper.cxx |2 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|8 

 6 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit e072e4149ffd4c07be1b6ded38e560f9cb635515
Author: Sarper Akdemir 
AuthorDate: Wed Mar 30 17:02:30 2022 +0300
Commit: Miklos Vajna 
CommitDate: Thu Mar 31 15:32:07 2022 +0200

tdf#148273 docx import: fix section break format leak to bullets

Fixes RES_PARATR_LIST_AUTOFMT leaking into the next section.

Achieves this by resetting list related attributes on the cursor's
text node in DomainMapper_Impl::RemoveLastParagraph() after the
deletion of the paragraph.

Change-Id: Ib4d09c5f190b8b8fd3bdc119ddd57d91f353de2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132324
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index db77b87481c3..579e1752508a 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -502,6 +502,7 @@
 #define UNO_NAME_SEPARATOR_LINE_IS_ON "SeparatorLineIsOn"
 #define UNO_NAME_IS_SKIP_HIDDEN_TEXT "IsSkipHiddenText"
 #define UNO_NAME_IS_SKIP_PROTECTED_TEXT "IsSkipProtectedText"
+#define UNO_NAME_RESET_PARAGRAPH_LIST_ATTRIBUTES "ResetParagraphListAttributes"
 #define UNO_NAME_DOCUMENT_INDEX_MARKS "DocumentIndexMarks"
 #define UNO_NAME_FOOTNOTE_IS_COLLECT_AT_TEXT_END "FootnoteIsCollectAtTextEnd"
 #define UNO_NAME_FOOTNOTE_IS_RESTART_NUMBERING "FootnoteIsRestartNumbering"
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf148273_sectionBulletFormatLeak.docx 
b/sw/qa/extras/ooxmlexport/data/tdf148273_sectionBulletFormatLeak.docx
new file mode 100644
index ..1ebb1e8b419c
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf148273_sectionBulletFormatLeak.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 53e80df5a301..69591c638fcc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -456,6 +457,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135923, 
"tdf135923-min.docx")
 CPPUNIT_ASSERT_EQUAL(COL_BLACK, getProperty(getRun(xParagraph, 2), 
"CharColor"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf148273_sectionBulletFormatLeak, 
"tdf148273_sectionBulletFormatLeak.docx")
+{
+// get a paragraph with bullet point after section break
+uno::Reference xParagraph = getParagraph(4);
+uno::Reference xProps(xParagraph, uno::UNO_QUERY);
+
+// Make sure that the bullet has no ListAutoFormat inherited from
+// the empty paragraph before the section break
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 0
+// - Actual  : 1
+// i.e. empty paragraph formats from the first section leaked to the 
bullet's formatting
+uno::Any aValue = xProps->getPropertyValue("ListAutoFormat");
+CPPUNIT_ASSERT_EQUAL(false, aValue.hasValue());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unoobj.cxx 
b/sw/source/core/unocore/unoobj.cxx
index 72376372fe2f..067daf3d25f4 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2118,6 +2118,15 @@ SwXTextCursor::setPropertyValue(
 }
 rUnoCursor.SetSkipOverProtectSections(bSet);
 }
+else if (rPropertyName == UNO_NAME_RESET_PARAGRAPH_LIST_ATTRIBUTES)
+{
+SwTextNode* pTextNode= GetPaM()->GetNode().GetTextNode();
+
+if(pTextNode)
+{
+pTextNode->ResetAttr(RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END);
+}
+}
 else
 {
 SwUnoCursorHelper::SetPropertyValue(rUnoCursor,
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f261538a0f19..22f2be927f8d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3789,10 +3789,10 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 
static_cast(xContext.get())->SetListId(-1);;
 xContext->Erase(PROP_NUMBERING_LEVEL);
 }
-m_pImpl->SetParaSectpr(false);
 finishParagraph(bRemove, bNoNumbering);
 if (bRemove)
 m_pImpl->RemoveLastParagraph();
+m_pImpl->SetParaSectpr(false);
 }
 else
 {
diff --git 

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

2021-11-29 Thread Attila Szűcs (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx  
|3 +
 
sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt
 |binary
 
sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt
 |binary
 sw/qa/extras/layout/layout.cxx 
|   24 ++
 sw/source/core/doc/DocumentSettingManager.cxx  
|   15 +-
 sw/source/core/inc/DocumentSettingManager.hxx  
|1 
 sw/source/core/layout/findfrm.cxx  
|6 ++
 sw/source/filter/ww8/ww8par.cxx
|2 
 sw/source/uibase/app/docshini.cxx  
|1 
 sw/source/uibase/uno/SwXDocumentSettings.cxx   
|   18 +++
 writerfilter/source/dmapper/DomainMapper.cxx   
|1 
 11 files changed, 68 insertions(+), 3 deletions(-)

New commits:
commit 41cc1d2c0c0c3bfa5ba341311f68df05375859fb
Author: Attila Szűcs 
AuthorDate: Thu Nov 18 11:02:01 2021 +0100
Commit: László Németh 
CommitDate: Mon Nov 29 09:34:07 2021 +0100

tdf#54465 tdf#139336 sw: add compat. flag for footnote in column

Add compatibility option FOOTNOTE_IN_COLUMN_TO_PAGEEND to keep layout
of old ODT files, where multicolumn sections have footnotes in columns,
growing sections to the full page.

Note: Multicolumn page styles or not evenly distributed multicolumn
sections, or footnotes not collected at the end of the sections still
use footnotes in columns, so they don't need this compatibility option.

Follow-up to commit 4c31b4ef2083087a822c3ae648fd09acc67d2f88
"tdf#139336 sw: fix extra pages of multicolumn sections with footnotes".

Co-authored-by: Tibor Nagy (NISZ)

Change-Id: I7d6a1f804b555dc5372767014b8fb5e3fa57ba9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125442
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 310f6a773c3d..d20130dbd3e5 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -114,6 +114,9 @@ enum class DocumentSettingId
 HEADER_SPACING_BELOW_LAST_PARA,
 FRAME_AUTOWIDTH_WITH_MORE_PARA,
 GUTTER_AT_TOP,
+// footnoteContainer default position is the page end instead of the 
column end
+// only if "evenly distributed" is set, and "collected at the end" is not 
set
+FOOTNOTE_IN_COLUMN_TO_PAGEEND,
 };
 
 /** Provides access to settings of a document
diff --git 
a/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt
 
b/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt
new file mode 100644
index ..28a19263053a
Binary files /dev/null and 
b/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt
 differ
diff --git 
a/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt
 
b/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt
new file mode 100644
index ..426e684937b3
Binary files /dev/null and 
b/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt
 differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 9050a00a86cf..3ef61970f5ae 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3733,6 +3733,30 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testTdf139336_ColumnsWithFootnoteDoNotOccup
 assertXPath(pXmlDoc, "/root/page", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testTdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage)
+{
+// Old odt files should keep their original layout, as it was before 
Tdf139336 fix.
+// The new odt file is only 1 page long, while the old odt file (with the 
same content)
+// was more then 1 page long.
+// Note: Somewhy this test miscalculates the layout of the old odt file.
+// It will be 4 pages long, while opened in Writer it is 5 pages long.
+SwDoc* pDoc
+= createSwDoc(DATA_DIRECTORY, 
"tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt");
+CPPUNIT_ASSERT(pDoc);
+Scheduler::ProcessEventsToIdle();
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/root/page");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+CPPUNIT_ASSERT_GREATER(1, xmlXPathNodeSetGetLength(pXmlNodes));
+xmlXPathFreeObject(pXmlObj);
+
+discardDumpedLayout();
+pDoc = createSwDoc(DATA_DIRECTORY, 
"tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt");
+CPPUNIT_ASSERT(pDoc);
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, 

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

2021-10-04 Thread László Németh (via logerrit)
 sw/inc/tox.hxx|   19 -
 sw/inc/unomap.hxx |1 
 sw/inc/unoprnms.hxx   |1 
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |6 ++
 sw/source/core/tox/tox.cxx|7 ---
 sw/source/core/unocore/unoidx.cxx |   25 ---
 sw/source/core/unocore/unomap.cxx |1 
 sw/source/filter/ww8/wrtw8nds.cxx |   17 +++-
 sw/source/filter/ww8/ww8atr.cxx   |   20 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   46 +-
 writerfilter/source/dmapper/PropertyIds.cxx   |1 
 writerfilter/source/dmapper/PropertyIds.hxx   |1 
 12 files changed, 69 insertions(+), 76 deletions(-)

New commits:
commit 05f92eb1359c399c43d3bcbe8942034408fa23eb
Author: László Németh 
AuthorDate: Fri Oct 1 17:42:48 2021 +0200
Commit: László Németh 
CommitDate: Mon Oct 4 08:22:23 2021 +0200

tdf#77051 DOCX: fix user index and index entry support

defined by field code \f.

E.g. INDEX \f "user-index" inserts only the entries
defined by XE "entry" \f "user-index" field codes.

Revert commit a7bc9c1e4977bd3430df69287fa0a8377a686c58
"fdo#77051: Preservation of Index field flag '\f'", which
added an undocumented UNO property only for round-trip
support of INDEX, but not for XE index entries, so the
DOCX export still resulted a broken index with lost
entries, not only the import was broken because of the
missing functionality in com.sun.star.text.DocumentIndex.

Now the import uses com.sun.star.text.UserIndex and
com.sun.star.text.UserIndexMark index and index entry
fields, which support the requested user index not
only during the DOCX and OpenDocument round-trip, but
its run-time functionality, the multiple user-defined
indices.

Note: for manual testing, update the user index (the
first index) of the left original unit test document
IndexFieldFlagF.docx: the updated index is not empty,
as before, but contains the user index entries.

Change-Id: Ia6139bba88907051fd050cfd40809f5544b9a89e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122930
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index e16882e87afa..77f7e6cd5e5b 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -99,7 +99,6 @@ class SW_DLLPUBLIC SwTOXMark final
 
 sal_uInt16  m_nLevel;
 OUStringm_aBookmarkName;
-OUStringm_aEntryTypeName; // stored specific entry type name for INDEX 
field \f
 boolm_bAutoGenerated; // generated using a concordance file
 boolm_bMainEntry; // main entry emphasized by character style
 
@@ -136,8 +135,6 @@ public:
 inline sal_uInt16   GetLevel() const;
 inline void SetBookmarkName( const OUString& bName);
 inline const OUString&  GetBookmarkName() const;
-inline void SetEntryTypeName( const OUString& sName);
-inline const OUString&  GetEntryTypeName() const;
 
 // for alphabetical index only
 inline void SetPrimaryKey(const OUString& rStr );
@@ -381,7 +378,6 @@ enum class SwTOXElement : sal_uInt16
 Bookmark  = 0x0400,
 Newline   = 0x0800,
 ParagraphOutlineLevel = 0x1000,
-IndexEntryType= 0x2000,
 };
 namespace o3tl {
 template<> struct typed_flags : is_typed_flags {};
@@ -432,7 +428,6 @@ class SW_DLLPUBLIC SwTOXBase : public SwClient
 OUStringm_aName;  // unique name
 OUStringm_aTitle; // title
 OUStringm_aBookmarkName;  //Bookmark Name
-OUStringm_aEntryTypeName;   // Type name
 
 OUStringm_sMainEntryCharStyle; // name of the character style applied 
to main index entries
 
@@ -507,10 +502,6 @@ public:
 const OUString& GetMainEntryCharStyle() const {return 
m_sMainEntryCharStyle;}
 voidSetMainEntryCharStyle(const OUString& rSet)  
{m_sMainEntryCharStyle = rSet;}
 
-// for record the Index field expression of MS Word
-const OUString& GetEntryTypeName() const;
-void  SetEntryTypeName(const OUString& sName);
-
 // content index only
 inline void SetLevel(sal_uInt16);   // 
consider outline level
 inline sal_uInt16   GetLevel() const;
@@ -582,9 +573,6 @@ inline const OUString& SwTOXMark::GetAlternativeText() const
 inline const OUString& SwTOXMark::GetBookmarkName() const
 {   return m_aBookmarkName;}
 
-inline const OUString& SwTOXMark::GetEntryTypeName() const
-{   return m_aEntryTypeName;}
-
 inline const SwTOXType* SwTOXMark::GetTOXType() const
 { return m_pType; }
 
@@ -601,10 +589,6 @@ inline void SwTOXMark::SetBookmarkName(const OUString& 
bName)
 m_aBookmarkName = bName;
 }
 

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

2021-08-25 Thread Attila Szűcs (via logerrit)
 sw/inc/unotextbodyhf.hxx |
2 
 sw/inc/unotextrange.hxx  |
3 
 sw/qa/extras/ooxmlexport/data/tdf143384_tableInFoot_negativeMargins.docx 
|binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |
7 +
 sw/source/core/unocore/unoframe.cxx  |
8 +
 sw/source/core/unocore/unoobj2.cxx   |   
15 ++
 sw/source/core/unocore/unotext.cxx   |   
56 +++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|
8 +
 writerfilter/source/dmapper/PropertyIds.cxx  |
1 
 writerfilter/source/dmapper/PropertyIds.hxx  |
1 
 10 files changed, 83 insertions(+), 18 deletions(-)

New commits:
commit c1ad429d925855c1baacbdeca1ef42f4486eb9c2
Author: Attila Szűcs 
AuthorDate: Tue Jul 27 11:45:58 2021 +0200
Commit: László Németh 
CommitDate: Wed Aug 25 13:45:23 2021 +0200

tdf#143384 DOCX import: fix SAXException at header with table

Regression from commit d656191ec308d4280b93c7169372e543a255d108
"tdf#119952 DOCX import: fix negative page margins".

Add SwXHeadFootText::CreateTextCursor(bool bIgnoreTables = false)
(modeled after SwXBodyText::CreateTextCursor) to create text cursor
for copying the header/footer also started with table during
fly frame creation in convertoToTextFrame().

Note: add hidden property PROP_CURSOR_NOT_IGNORE_TABLES_IN_HF
to use the new feature in domainmapper (followed
commit af4e5ee0f93c1ff442d08caed5c875f2b2c1fd43
"tdf#97128 DOCX import: fix frame direction").

Co-authored-by: Tibor Nagy (NISZ)

Change-Id: I96e2cf2dddcecd146c53c12d7fdb44fc4d90fa0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119549
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/unotextbodyhf.hxx b/sw/inc/unotextbodyhf.hxx
index fbccc982ef04..99887c6beb5c 100644
--- a/sw/inc/unotextbodyhf.hxx
+++ b/sw/inc/unotextbodyhf.hxx
@@ -115,6 +115,8 @@ public:
 static css::uno::Reference< css::text::XText >
 CreateXHeadFootText(SwFrameFormat & rHeadFootFormat, const bool 
bIsHeader);
 
+css::uno::Reference CreateTextCursor(const bool 
bIgnoreTables = false);
+
 // XInterface
 virtual css::uno::Any SAL_CALL queryInterface(
 const css::uno::Type& rType) override;
diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx
index f3ed06fb4a06..4d8ed2df2c06 100644
--- a/sw/inc/unotextrange.hxx
+++ b/sw/inc/unotextrange.hxx
@@ -57,7 +57,8 @@ namespace sw {
 
 enum class TextRangeMode {
 RequireTextNode,
-AllowNonTextNode
+AllowNonTextNode,
+AllowTableNode
 };
 
 void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget);
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf143384_tableInFoot_negativeMargins.docx 
b/sw/qa/extras/ooxmlexport/data/tdf143384_tableInFoot_negativeMargins.docx
new file mode 100644
index ..918c1029fb4a
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf143384_tableInFoot_negativeMargins.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index de3eea4c0659..08e0cbd9f8f7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -1618,6 +1618,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf119952_negativeMargins, 
"tdf119952_negativeMargi
 CPPUNIT_ASSERT_EQUAL(OUString("        "), 
parseDump("/root/page[3]/header/txt/anchored/fly"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf143384_tableInFoot_negativeMargins, 
"tdf143384_tableInFoot_negativeMargins.docx")
+{
+// There should be no crash during loading of the document
+// so, let's check just how much pages we have
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index 74d366d9961d..8b9250671d78 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1418,7 +1418,13 @@ void SwXFrame::setPropertyValue(const OUString& 
rPropertyName, const ::uno::Any&
 const ::SfxItemPropertyMapEntry* pEntry = 
m_pPropSet->getPropertyMap().getByName(rPropertyName);
 
 if (!pEntry)
-throw beans::UnknownPropertyException( "Unknown property: " + 
rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+{
+// Hack to skip the dummy CursorNotIgnoreTables property
+if (rPropertyName == "CursorNotIgnoreTables")
+return;
+else
+throw beans::UnknownPropertyException("Unknown property: " + 
rPropertyName, static_cast  (this));
+}
 
  

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

2021-06-08 Thread Justin Luth (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 
 sw/qa/extras/ooxmlexport/data/tdf142404_tabOverSpacingC15.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx|   18 
 sw/source/core/doc/DocumentSettingManager.cxx |   12 +
 sw/source/core/inc/DocumentSettingManager.hxx |1 
 sw/source/core/text/inftxt.cxx|   10 
 sw/source/core/text/itrcrsr.cxx   |4 +
 sw/source/core/text/txttab.cxx|   22 +++---
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   13 +
 writerfilter/source/filter/WriterFilter.cxx   |5 ++
 10 files changed, 78 insertions(+), 8 deletions(-)

New commits:
commit a2d8a737f41cbb0ed8a51a99b1c233b25e433d1c
Author: Justin Luth 
AuthorDate: Thu Jun 3 13:38:33 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jun 8 15:23:29 2021 +0200

tdf#142404 DOCX c15: add compat flag TabOverSpacing

DOCX in 2013 (compatibilityMode 15) no longer supports
TabOverMargin (i.e. the text margin),
but it does a similar kind of thing if the tab goes
into the spacing-after of a paragraph.
So add a compat flag to handle this in-between
kind of situation.

I grepped -i "tab_*over_*margin" to see if I was missing
anything. Decimal/Center proved to be only tabOverMargin.
IsInSect shouldn't matter since it fits inside the printing range.
The other places where I didn't insert TabOverSpacing
didn't seem relevant based on a code read.

Tab-after-tab still doesn't work great, but what we have is
already a massive house of cards that will just collapse if changed.
No real provision for handling tabs-over-paragraph-end.
-auto-tabs are created instead of "beyond nMyRight" tab,
 unless it is the first tab defined.
-doesn't allow auto-tabs to fill the remaining space.

But on the other hand, MS Word's implementation of tabs
follows some kind of incomprehensible bizarre logic,
so just ignore the tabs completely, please.

Change-Id: I3723107b29ec3e287ea8661544711c13eee3ca48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116667
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 059694ff1ceb..310f6a773c3d 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -82,6 +82,7 @@ enum class DocumentSettingId
 CLIPPED_PICTURES,
 BACKGROUND_PARA_OVER_DRAWINGS,
 TAB_OVER_MARGIN,
+TAB_OVER_SPACING,
 // MS Word still wraps text around objects with less space than LO would.
 SURROUND_TEXT_WRAP_SMALL,
 PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
diff --git a/sw/qa/extras/ooxmlexport/data/tdf142404_tabOverSpacingC15.odt 
b/sw/qa/extras/ooxmlexport/data/tdf142404_tabOverSpacingC15.odt
new file mode 100644
index ..9760fd253988
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf142404_tabOverSpacingC15.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 045102438c90..a2217f3ab845 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -226,6 +226,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf142404_tabOverMarginC15, 
"tdf142404_tabOverMargi
 CPPUNIT_ASSERT_EQUAL_MESSAGE("too big for one page", 2, getPages());
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf142404_tabOverSpacingC15, 
"tdf142404_tabOverSpacingC15.odt")
+{
+// Although TabOverMargin no longer applies to compatibilityMode 15 DOCX 
files,
+// it still applies to a tab over the paragraph end (inside text 
boundaries).
+// The original 3-page ODT saved as DOCX would fit on one page in MS Word 
2010, but 3 in Word 2013.
+CPPUNIT_ASSERT_EQUAL_MESSAGE("too big for two pages", 3, getPages());
+// The tab goes over the paragraph margin
+CPPUNIT_ASSERT_EQUAL(OUString("A left tab positioned at"), 
parseDump("//page[1]/body/txt[2]/Text[1]", "Portion"));
+sal_Int32 nTextLen = parseDump("//page[1]/body/txt[2]/Text[1]", 
"nWidth").toInt32();
+CPPUNIT_ASSERT_EQUAL(OUString("*"), 
parseDump("//page[1]/body/txt[2]/Text[2]", "Portion"));
+sal_Int32 nTabLen = parseDump("//page[1]/body/txt[2]/Text[2]", 
"nWidth").toInt32();
+CPPUNIT_ASSERT_MESSAGE("Large left tab", nTextLen < nTabLen);
+// Not 1 line high (Word 2010 DOCX), or 3 lines high (LO DOCX) or 5 lines 
high (ODT), but 4 lines high
+sal_Int32 nHeight = parseDump("//page[1]/body/txt[2]/infos/bounds", 
"height").toInt32();
+CPPUNIT_ASSERT_MESSAGE("4 lines high", 1100 < nHeight);
+CPPUNIT_ASSERT_MESSAGE("4 lines high", nHeight < 1300);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf139580, "tdf139580.odt")
 {
 // Without the fix in 

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

2021-03-31 Thread Attila Bakos (NISZ) (via logerrit)
 sw/inc/pagedesc.hxx   |6 +
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx|5 -
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|3 
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |6 -
 sw/qa/extras/uiwriter/uiwriter.cxx|4 
 sw/qa/uitest/data/TestHiddenHeadersFooters.docx   |binary
 sw/qa/uitest/writer_tests7/tdf141158.py   |   47 ++
 sw/source/core/doc/docdesc.cxx|   30 +-
 sw/source/core/doc/docfmt.cxx |   11 ++
 sw/source/core/layout/pagedesc.cxx|   96 --
 sw/source/core/unocore/unostyle.cxx   |   32 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   24 +
 12 files changed, 247 insertions(+), 17 deletions(-)

New commits:
commit b802ab694a8a7357d4657f3e11b571144fa7c7bf
Author: Attila Bakos (NISZ) 
AuthorDate: Fri Mar 12 14:33:08 2021 +0100
Commit: László Németh 
CommitDate: Wed Mar 31 14:44:27 2021 +0200

tdf#141158 DOCX: import discarded headers/footers

Before the inactive DOCX headers/footers lost during
import time. Now it can be restored by disabling
the options “Same content on left and right pages” and
“Same content on first page” on the Header and the
Footer panes of the Page style. This is for improving
the interoperability with other Office programs, e.g.
supporting DOCX text document templates better.

Follow-up of commit f5dc6b11d2218d94c9effe7a1ab418d0133da5e3
(tdf#140117 sw UI: keep headers/footers when inactive).

To start the py-UItest run:

$ make UITest_writer_tests7 
UITEST_TEST_NAME="tdf141158.TestTdf141158.test_tdf141158"

Note: In spite of this patch implements the
left/first/first_left page header/footer stash
at import time, the left one works correctly at now.
This is because the first pages have different
page styles so changing the right page style will
restore the hidden header/footer content.
For this problem further improvements are planned,
exactly in the filter part. Number of unit tests
had to be modified, because before these headers
and footers were dropped.

Co-developed-with: Daniel Arato (NISZ)

Change-Id: I3dd452a648bc465710698707c083734dc762ed94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112580
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 0d29eb0ca6e3..4178361349d6 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -223,6 +223,12 @@ public:
 /// Used to restore hidden header/footer formats.
 const SwFrameFormat* GetStashedFrameFormat(bool bHeader, bool bLeft, bool 
bFirst) const;
 
+/// Checks if the pagedescriptor has a stashed format according to the 
parameters or not.
+bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst);
+
+/// Gives the feature of removing the stashed format by hand if it is 
neccessarry.
+void RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst);
+
 /// Same as WriteUseOn(), but the >= HeaderShare part of the bitfield is 
not modified.
 inline void  SetUseOn( UseOnPage eNew );
 inline UseOnPage GetUseOn() const;
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index c33f99cb4322..ba6a6a6a98e2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -688,7 +688,9 @@ DECLARE_OOXMLEXPORT_TEST(testBnc875718, "bnc875718.docx")
 // is not SwXBodyText but rather SwXHeadFootText
 uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
 uno::Reference 
xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
-for( int i = 0;
+// The sample bugdoc has 3 footer.xml and has a textframe in each. The 
first one is hidden
+// and it has no text in its anchored text range: it is anchored to body 
text. Ignoring...
+for( int i = 1;
  i < xIndexAccess->getCount();
  ++i )
 {
@@ -700,6 +702,7 @@ DECLARE_OOXMLEXPORT_TEST(testBnc875718, "bnc875718.docx")
 // Also check that the footer contents are not in the body text.
 uno::Reference textDocument(mxComponent, 
uno::UNO_QUERY);
 uno::Reference text = textDocument->getText();
+CPPUNIT_ASSERT(text); //Do not crash on empty content
 CPPUNIT_ASSERT_EQUAL( OUString( "Text" ), text->getString());
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index cd3ca2f39e46..951a4d8650f2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -670,7 +670,8 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf130167_spilloverHeaderShape, "testTdf130167_spil
 uno::Reference xNameAccess(
 xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY);
 

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

2020-09-24 Thread Michael Stahl (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 +
 sw/qa/extras/layout/layout.cxx|7 +++
 sw/source/core/doc/DocumentSettingManager.cxx |   11 +++
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/core/layout/calcmove.cxx|   16 +---
 sw/source/core/layout/flowfrm.cxx |   12 ++--
 sw/source/core/layout/frmtool.cxx |2 +-
 sw/source/filter/ww8/ww8par.cxx   |1 +
 sw/source/filter/xml/xmlimp.cxx   |7 +++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   13 +
 writerfilter/source/filter/WriterFilter.cxx   |1 +
 11 files changed, 62 insertions(+), 10 deletions(-)

New commits:
commit 38aa699f265c17548769aaa4f20e1ae35d18f202
Author: Michael Stahl 
AuthorDate: Wed Sep 23 15:14:08 2020 +0200
Commit: Michael Stahl 
CommitDate: Thu Sep 24 20:56:27 2020 +0200

tdf#134782 sw: split AddParaSpacingToTableCells flag in 2

commit 3cccdabf19a99fd3f657985c1822436d7679df2b "extend
AddParaSpacingToTableCells with line spacing" changed how the
ADD_PARA_SPACING_TO_TABLE_CELLS compat flag works, to improve interop
with Word.

This commit splits out the change as a separate new compat flag
ADD_PARA_LINE_SPACING_TO_TABLE_CELLS ("AddParaLineSpacingToTableCells"),
to preserve compatibility with ODT documents that were produced
by LO < 6.4 (via SwXMLImport::SetConfigurationSettings()).

New documents and WW8/RTF/DOCX import have both flags enabled.

The combination false/true is invalid, and treated as equivalent
to false/false.

Change-Id: Ida20df8fe4a8192a714f91da95345f9726fd7d98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103317
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 2ae267d08fe0..c7dd852d3d23 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -47,6 +47,7 @@ enum class DocumentSettingId
 USE_HIRES_VIRTUAL_DEVICE,
 OLD_LINE_SPACING,
 ADD_PARA_SPACING_TO_TABLE_CELLS,
+ADD_PARA_LINE_SPACING_TO_TABLE_CELLS,
 USE_FORMER_OBJECT_POS,
 USE_FORMER_TEXT_WRAPPING,
 CONSIDER_WRAP_ON_OBJECT_POSITION,
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index ce0a43f8c213..194fea99d3b1 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1196,10 +1196,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testTableOverlapFooterFly)
 assertXPath(pLayout, 
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/Text", "Portion",
 "Abc def ghi jkl mno pqr stu vwx yz.");
 // height was: 1517
-assertXPath(
-pLayout, 
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/infos/bounds", "height",
-// "253"); // FIXME: this is correct but 
3cccdabf19a99fd3f657985c1822436d7679df2b breaks it
-"379");
+// tdf#134782 height was: 379
+assertXPath(pLayout, 
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/infos/bounds", "height",
+"253");
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277)
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index c1355c6b6319..febce5528ea7 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -117,6 +117,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbAddExternalLeading= !aOptions.GetDefault( 
SvtCompatibilityEntry::Index::NoExtLeading );
 mbOldLineSpacing= aOptions.GetDefault( 
SvtCompatibilityEntry::Index::UseLineSpacing );
 mbAddParaSpacingToTableCells= aOptions.GetDefault( 
SvtCompatibilityEntry::Index::AddTableSpacing );
+mbAddParaLineSpacingToTableCells= aOptions.GetDefault( 
SvtCompatibilityEntry::Index::AddTableSpacing ); // FIXME? separate UI?
 mbUseFormerObjectPos= aOptions.GetDefault( 
SvtCompatibilityEntry::Index::UseObjectPositioning );
 mbUseFormerTextWrapping = aOptions.GetDefault( 
SvtCompatibilityEntry::Index::UseOurTextWrapping );
 mbConsiderWrapOnObjPos  = aOptions.GetDefault( 
SvtCompatibilityEntry::Index::ConsiderWrappingStyle );
@@ -136,6 +137,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbAddExternalLeading= true;
 mbOldLineSpacing= false;
 mbAddParaSpacingToTableCells= false;
+mbAddParaLineSpacingToTableCells= false;
 mbUseFormerObjectPos= false;
 mbUseFormerTextWrapping = false;
 mbConsiderWrapOnObjPos  = false;
@@ -172,6 +174,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case 

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

2020-07-15 Thread Attila Szűcs (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 +
 sw/qa/extras/layout/data/tdf124423.docx   |binary
 sw/qa/extras/layout/data/tdf124423.odt|binary
 sw/qa/extras/layout/layout.cxx|   19 +++
 sw/source/core/doc/DocumentSettingManager.cxx |   13 -
 sw/source/core/inc/DocumentSettingManager.hxx |2 +-
 sw/source/core/layout/fly.cxx |7 +++
 sw/source/filter/ww8/ww8par.cxx   |2 ++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |1 +
 10 files changed, 61 insertions(+), 2 deletions(-)

New commits:
commit c78221a5ad98939f3fb9ca6af4a2d2d2a63ff6ee
Author: Attila Szűcs 
AuthorDate: Mon Jun 29 15:55:28 2020 +0200
Commit: László Németh 
CommitDate: Wed Jul 15 11:55:32 2020 +0200

tdf#124423 sw: fix AutoSize width frames of DOCX

Add layout compatibility option FRAME_AUTOWIDTH_WITH_MORE_PARA
to keep paragraph area width of AutoSize width frames with
more than one paragraph.

Co-authored-by: Tibor Nagy (NISZ)

Change-Id: Iab8926b6219ac92ef1ab7488bdef1d3f2b47c396
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97425
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 737e1f8d5902..8ff48ff467a7 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -107,6 +107,7 @@ enum class DocumentSettingId
 PROTECT_BOOKMARKS,
 PROTECT_FIELDS,
 HEADER_SPACING_BELOW_LAST_PARA,
+FRAME_AUTOWIDTH_WITH_MORE_PARA,
 };
 
  /** Provides access to settings of a document
diff --git a/sw/qa/extras/layout/data/tdf124423.docx 
b/sw/qa/extras/layout/data/tdf124423.docx
new file mode 100644
index ..d48cc60b2923
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf124423.docx differ
diff --git a/sw/qa/extras/layout/data/tdf124423.odt 
b/sw/qa/extras/layout/data/tdf124423.odt
new file mode 100644
index ..2202c93c5c46
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf124423.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index aec3faac5665..e9d850bdcf2d 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -4182,6 +4182,25 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134548)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124423)
+{
+createDoc("tdf124423.docx");
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+sal_Int32 nFly1Width = getXPath(pXmlDoc, "(//fly)[1]/infos/prtBounds", 
"width").toInt32();
+sal_Int32 nFly2Width = getXPath(pXmlDoc, "(//fly)[2]/infos/prtBounds", 
"width").toInt32();
+sal_Int32 nPageWidth = getXPath(pXmlDoc, "//page/infos/prtBounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(nPageWidth, nFly2Width);
+CPPUNIT_ASSERT_LESS(nPageWidth / 2, nFly1Width);
+
+createDoc("tdf124423.odt");
+pXmlDoc = parseLayoutDump();
+nFly1Width = getXPath(pXmlDoc, "(//fly)[1]/infos/prtBounds", 
"width").toInt32();
+nFly2Width = getXPath(pXmlDoc, "(//fly)[2]/infos/prtBounds", 
"width").toInt32();
+nPageWidth = getXPath(pXmlDoc, "//page/infos/prtBounds", 
"width").toInt32();
+CPPUNIT_ASSERT_LESS(nPageWidth / 2, nFly2Width);
+CPPUNIT_ASSERT_LESS(nPageWidth / 2, nFly1Width);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 1f2f4aef7e85..5873f299493d 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -97,7 +97,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbDisableOffPagePositioning ( false ),
 mbProtectBookmarks(false),
 mbProtectFields(false),
-mbHeaderSpacingBelowLastPara(false)
+mbHeaderSpacingBelowLastPara(false),
+mbFrameAutowidthWithMorePara(false)
 
 // COMPATIBILITY FLAGS END
 {
@@ -226,6 +227,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::PROTECT_BOOKMARKS: return mbProtectBookmarks;
 case DocumentSettingId::PROTECT_FIELDS: return mbProtectFields;
 case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA: return 
mbHeaderSpacingBelowLastPara;
+case DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA: return 
mbFrameAutowidthWithMorePara;
 default:
 OSL_FAIL("Invalid setting id");
 }
@@ -474,6 +476,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA:
 mbHeaderSpacingBelowLastPara = value;
 break;
+case DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA:
+mbFrameAutowidthWithMorePara = value;
+  

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

2020-06-24 Thread Vasily Melenchuk (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx  |3 ++-
 sw/qa/extras/ooxmlexport/data/128197_compat14.docx |binary
 sw/qa/extras/ooxmlexport/data/128197_compat15.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |   15 +++
 sw/source/core/doc/DocumentSettingManager.cxx  |   12 
 sw/source/core/inc/DocumentSettingManager.hxx  |1 +
 sw/source/core/text/itrform2.cxx   |   10 ++
 sw/source/uibase/uno/SwXDocumentSettings.cxx   |   13 +
 writerfilter/source/dmapper/SettingsTable.cxx  |8 
 9 files changed, 61 insertions(+), 1 deletion(-)

New commits:
commit ee7b6c773eb22268fefee4bfcc10110b0bbbd8cf
Author: Vasily Melenchuk 
AuthorDate: Thu Jun 11 09:45:03 2020 +0300
Commit: Thorsten Behrens 
CommitDate: Wed Jun 24 13:10:27 2020 +0200

tdf#128197: sw: different line height for DOCX with compat=14

Lines containing just a shape inline without any other text are
treated in DOCX with compatibility option 15 and 14 in a different
way: while compat=15 is layouting line exatly as LO does, in
compat=14 mode minimal line height takes into account just shape
height and not current font.

Change-Id: Id2bdab941a0bbaa9080567d736435d9e0babd490
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96080
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 00176843b32f..737e1f8d5902 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -63,7 +63,8 @@ enum class DocumentSettingId
 
 // tdf#104349 tdf#104668
 MS_WORD_COMP_TRAILING_BLANKS,
-
+// tdf#128197 MS Word in some modes can have line height based on shape 
height, not on font
+MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY,
 UNIX_FORCE_ZERO_EXT_LEADING,
 TABS_RELATIVE_TO_INDENT,
 PROTECT_FORM,
diff --git a/sw/qa/extras/ooxmlexport/data/128197_compat14.docx 
b/sw/qa/extras/ooxmlexport/data/128197_compat14.docx
new file mode 100644
index ..507e28396019
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/128197_compat14.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/data/128197_compat15.docx 
b/sw/qa/extras/ooxmlexport/data/128197_compat15.docx
new file mode 100644
index ..d618b117cfec
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/128197_compat15.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 781dfa872081..167c05111a51 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -74,6 +74,21 @@ DECLARE_OOXMLIMPORT_TEST(Tdf130907, "tdf130907.docx")
 sal_Int16(style::ParagraphAdjust::ParagraphAdjust_RIGHT), nHOri3);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf128197)
+{
+load(mpTestDocumentPath, "128197_compat14.docx");
+xmlDocUniquePtr pLayout14 = parseLayoutDump();
+sal_Int32 nHeight14 = getXPath(pLayout14, 
"//page[1]/body/txt[1]/infos/bounds", "height").toInt32();
+
+load(mpTestDocumentPath, "128197_compat15.docx");
+xmlDocUniquePtr pLayout15 = parseLayoutDump();
+sal_Int32 nHeight15 = getXPath(pLayout15, 
"//page[1]/body/txt[1]/infos/bounds", "height").toInt32();
+
+// In compat mode=14 second line has size of the shape thus entire 
paragraph height is smaller
+// So nHeight14 < nHeight15
+CPPUNIT_ASSERT_LESS(nHeight15, nHeight14);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf123622, "tdf123622.docx")
 {
 uno::Reference 
XPropsRight(getShape(1),uno::UNO_QUERY);
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 30be92c69122..c5a262f28596 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -78,6 +78,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbTabRelativeToIndent(true),
 mbProtectForm(false), // i#78591#
 mbMsWordCompTrailingBlanks(false), // tdf#104349 tdf#104668
+mbMsWordCompMinLineHeightByFly(false),
 mbInvertBorderSpacing (false),
 mbCollapseEmptyCellPara(true),
 mbTabAtLeftIndentForParagraphsInList(false), //#i89181#
@@ -185,6 +186,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::PROTECT_FORM: return mbProtectForm;
 // tdf#104349 tdf#104668
 case DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS: return 
mbMsWordCompTrailingBlanks;
+case DocumentSettingId::MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY: return 
mbMsWordCompMinLineHeightByFly;
 // #i89181#
 case DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return 
mbTabAtLeftIndentForParagraphsInList;
 case DocumentSettingId::INVERT_BORDER_SPACING: return 
mbInvertBorderSpacing;
@@ -331,6 +333,10 @@ void 

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

2020-06-15 Thread Samuel Mehrbrodt (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 +
 sw/qa/core/layout/data/tdf128195.docx |binary
 sw/qa/core/layout/layout.cxx  |   11 +++
 sw/source/core/doc/DocumentSettingManager.cxx |   13 -
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/core/layout/flowfrm.cxx |5 -
 sw/source/filter/ww8/ww8par.cxx   |3 +++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   19 +++
 writerfilter/source/dmapper/DomainMapper.cxx  |2 ++
 9 files changed, 53 insertions(+), 2 deletions(-)

New commits:
commit 9b5805d1ef2b9e9c4e8f389c069807bf4489ea95
Author: Samuel Mehrbrodt 
AuthorDate: Wed May 20 08:41:46 2020 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jun 15 14:42:59 2020 +0200

tdf#128195 Keep spacing below last paragraph in header (docx)

Add a layout compat option to keep the spacing below the last paragraph
in the header in doc/docx files

Change-Id: I259511183a8252e04d9951357dbdd4f4832523ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94577
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 5c7d3fe54253..00176843b32f 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -105,6 +105,7 @@ enum class DocumentSettingId
 CONTINUOUS_ENDNOTES,
 PROTECT_BOOKMARKS,
 PROTECT_FIELDS,
+HEADER_SPACING_BELOW_LAST_PARA,
 };
 
  /** Provides access to settings of a document
diff --git a/sw/qa/core/layout/data/tdf128195.docx 
b/sw/qa/core/layout/data/tdf128195.docx
new file mode 100644
index ..16180654ce8d
Binary files /dev/null and b/sw/qa/core/layout/data/tdf128195.docx differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 8a3a3b5369e6..cfc13640c471 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -39,6 +39,17 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlap)
 CPPUNIT_ASSERT_GREATEREQUAL(nFlyBottom, nTableTop);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf128195)
+{
+// Load a document that has two paragraphs in the header.
+// The second paragraph should have its bottom spacing applied.
+load(DATA_DIRECTORY, "tdf128195.docx");
+sal_Int32 nTxtHeight = parseDump("//header/txt[2]/infos/bounds", 
"height").toInt32();
+sal_Int32 nTxtBottom = parseDump("//header/txt[2]/infos/bounds", 
"bottom").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2269), nTxtHeight);
+CPPUNIT_ASSERT_EQUAL(static_cast(3529), nTxtBottom);
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBorderCollapseCompat)
 {
 // Load a document with a border conflict: top cell has a dotted bottom 
border, bottom cell has
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 279e4850b944..797e9024abb2 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -95,7 +95,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbLastBrowseMode( false ),
 mbDisableOffPagePositioning ( false ),
 mbProtectBookmarks(false),
-mbProtectFields(false)
+mbProtectFields(false),
+mbHeaderSpacingBelowLastPara(false)
 
 // COMPATIBILITY FLAGS END
 {
@@ -222,6 +223,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::CONTINUOUS_ENDNOTES: return 
mbContinuousEndnotes;
 case DocumentSettingId::PROTECT_BOOKMARKS: return mbProtectBookmarks;
 case DocumentSettingId::PROTECT_FIELDS: return mbProtectFields;
+case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA: return 
mbHeaderSpacingBelowLastPara;
 default:
 OSL_FAIL("Invalid setting id");
 }
@@ -463,6 +465,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 case DocumentSettingId::PROTECT_FIELDS:
 mbProtectFields = value;
 break;
+case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA:
+mbHeaderSpacingBelowLastPara = value;
+break;
 default:
 OSL_FAIL("Invalid setting id");
 }
@@ -633,6 +638,7 @@ void 
sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti
 mbContinuousEndnotes = rSource.mbContinuousEndnotes;
 // No mbProtectBookmarks: this is false by default everywhere
 // No mbProtectFields: this is false by default everywhere
+mbHeaderSpacingBelowLastPara = rSource.mbHeaderSpacingBelowLastPara;
 }
 
 sal_uInt32 sw::DocumentSettingManager::Getn32DummyCompatibilityOptions1() const
@@ -923,6 +929,11 @@ void 
sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const
 
BAD_CAST(OString::boolean(mbContinuousEndnotes).getStr()));
 

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

2020-05-08 Thread Vasily Melenchuk (via logerrit)
 sw/inc/unosett.hxx |2 
 sw/qa/extras/ooxmlexport/data/tdf94628.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |   24 
 sw/source/core/unocore/unosett.cxx |  895 +
 sw/source/uibase/config/StoredChapterNumbering.cxx |2 
 writerfilter/source/dmapper/NumberingManager.cxx   |   28 
 6 files changed, 424 insertions(+), 527 deletions(-)

New commits:
commit cad788328ec6ef4b3071cf9002dfac12347562da
Author: Vasily Melenchuk 
AuthorDate: Thu May 7 21:28:12 2020 +0300
Commit: Thorsten Behrens 
CommitDate: Sat May 9 00:16:51 2020 +0200

tdf#94628: sw: allow setting for bullet for outline paragraphs

Paragraphs in outline (having style "Header XXX") can also be
a part of list and have custom bullets.

Simplified code of SwXNumberingRules::SetPropertiesToNumFormat():
do not check for properties special for outline/chapters and removed
redundant data shuffle with local maps.

Change-Id: I1fa7f8f5359acee1d5aa62d9700641490bb91b6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93672
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx
index dc36615d7d4b..ef9e37726682 100644
--- a/sw/inc/unosett.hxx
+++ b/sw/inc/unosett.hxx
@@ -217,7 +217,7 @@ public:
 OUString *const pBulletFontName,
 OUString *const pHeadingStyleName,
 OUString *const pParagraphStyleName,
-SwDoc *const pDoc, SwDocShell *const pDocShell,
+SwDoc *const pDoc,
 css::uno::Sequence const& rProperties);
 
 };
diff --git a/sw/qa/extras/ooxmlexport/data/tdf94628.docx 
b/sw/qa/extras/ooxmlexport/data/tdf94628.docx
new file mode 100644
index ..aa1d226841fd
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf94628.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index a8a55bd56e6c..ee99b05b0764 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -931,6 +931,30 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf122563, 
"tdf122563.docx")
 "width:255.75pt;height:63.75pt");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf94628, "tdf94628.docx")
+{
+uno::Reference xPropertySet(
+getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
+uno::Reference xLevels(
+xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+uno::Sequence 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")
+{
+// Check for 'BLACK UPPER RIGHT TRIANGLE' (U+25E5) as a bullet
+CPPUNIT_ASSERT_EQUAL(OUString(u"\u25E5"), 
rProp.Value.get());
+return;
+}
+}
+
+// Shouldn't reach here
+CPPUNIT_FAIL("Did not find bullet with level 0");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf122594, "tdf122594.docx")
 {
 // test import/export of ActiveTable (visible sheet) of embedded XLSX OLE 
objects
diff --git a/sw/source/core/unocore/unosett.cxx 
b/sw/source/core/unocore/unosett.cxx
index 2257a49faf1e..ebffc9ae2852 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1468,18 +1468,6 @@ uno::Sequence 
SwXNumberingRules::GetPropertiesForNumFormat
 return ::comphelper::containerToSequence(aPropertyValues);
 }
 
-static PropertyValue const* lcl_FindProperty(
-const char* cName, std::vector const& 
rPropertyValues)
-{
-const OUString sCmp = OUString::createFromAscii(cName);
-for(const PropertyValue* pTemp : rPropertyValues)
-{
-if (sCmp == pTemp->Name)
-return pTemp;
-}
-return nullptr;
-}
-
 void SwXNumberingRules::SetNumberingRuleByIndex(
 SwNumRule& rNumRule,
 const uno::Sequence& rProperties, sal_Int32 
nIndex)
@@ -1495,7 +1483,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
 SetPropertiesToNumFormat(aFormat, m_sNewCharStyleNames[nIndex],
 _sNewBulletFontNames[nIndex],
 , ,
-m_pDoc, m_pDocShell, rProperties);
+m_pDoc, rProperties);
 
 
 if (m_pDoc && !sParagraphStyleName.isEmpty())
@@ -1541,547 +1529,436 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
 OUString & rCharStyleName, OUString *const pBulletFontName,
 OUString *const pHeadingStyleName,
 OUString *const pParagraphStyleName,
-SwDoc *const pDoc, SwDocShell *const pDocShell,
+SwDoc *const pDoc,
 const uno::Sequence& rProperties)
 {
-// the order of the names is important!
-static const char* aNumPropertyNames[] =
-{
-UNO_NAME_ADJUST,// 0
-UNO_NAME_PARENT_NUMBERING,  // 1
-

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

2020-03-24 Thread Caolán McNamara (via logerrit)
 sw/inc/doc.hxx  |3 +++
 sw/inc/unomap.hxx   |1 +
 sw/qa/core/data/ww6/pass/ofz21168-1.doc |binary
 sw/source/core/doc/docnew.cxx   |1 +
 sw/source/core/undo/undobj.cxx  |4 ++--
 sw/source/core/unocore/unomap.cxx   |1 +
 sw/source/filter/basflt/shellio.cxx |7 +++
 sw/source/uibase/uno/unotxdoc.cxx   |   12 
 writerfilter/source/filter/RtfFilter.cxx|   14 ++
 writerfilter/source/filter/WriterFilter.cxx |5 +
 10 files changed, 46 insertions(+), 2 deletions(-)

New commits:
commit c4dab726caaa73be9f9c731312080143b0a0b89d
Author: Caolán McNamara 
AuthorDate: Thu Mar 12 12:43:10 2020 +
Commit: Caolán McNamara 
CommitDate: Tue Mar 24 20:32:16 2020 +0100

ofz#21168 sw,writerfilter: limit writerfilter hack to writerfilter

The problem is that at the end of WW8 import, a delete redline is
inserted that ends up calling DeleteAndJoin from inside
AppendRedline(). A fly is anchored AT_CHAR at (node 46, offset 0)
and the deletion goes from (node 46, offset 0) to
(node 48, offset 13) hence the special case check in
IsDestroyFrameAnchoredAtChar() for the IsInReading() prevents it
from being deleted, and then its anchor is still registered at the
node 46 when it gets deleted.

So try to restrict the WriterfilterHack to writerfilter, so it won't
affect WW8 import.

Unfortunately this is far less obvious than expected, because import can
happen for creating a new file, in which case it's all done via UNO in
writerfilter, or when inserting into an existing file, in which case
SwReader::Read() is used.

The SwDocShell's pMedium can't be used becuse in insert file case it
will be the loaded file, not the inserted file.

There isn't any obvious alternative to adding a silly UNO property for
the writerfilter to use.

Change-Id: Ia7fdc9bb1925202f6692ebee6e4b6b1fe50e5345
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90384
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 6566cc56416e..f4cd14a1911e 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -303,6 +303,7 @@ private:
 bool mbInWriting : 1; //< TRUE: Document is in the process of being 
written.
 bool mbInMailMerge   : 1;//< TRUE: Document is in the process 
of being written by mail merge.
 bool mbInXMLImport   : 1;//< TRUE: During xml import, 
attribute portion building is not necessary.
+bool mbInWriterfilterImport  : 1;//< TRUE: writerfilter import 
(DOCX,RTF)
 bool mbUpdateTOX : 1;//< TRUE: After loading document, 
update TOX.
 bool mbInLoadAsynchron   : 1;//< TRUE: Document is in the process 
of being loaded asynchronously.
 bool mbIsAutoFormatRedline   : 1;//< TRUE: Redlines are recorded by 
Autoformat.
@@ -967,6 +968,8 @@ public:
 
 bool IsInXMLImport() const { return mbInXMLImport; }
 void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
+bool IsInWriterfilterImport() const { return mbInWriterfilterImport; }
+void SetInWriterfilterImport(bool const b) { mbInWriterfilterImport = b; }
 
 // Manage types of tables/indices
 sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 36f8766e0e03..caee6bc5c209 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -245,6 +245,7 @@ struct SfxItemPropertyMapEntry;
 #define WID_DOC_LOCK_UPDATES1016
 #define WID_DOC_HAS_VALID_SIGNATURES1017
 #define WID_DOC_INTEROP_GRAB_BAG1018
+#define WID_DOC_WRITERFILTER1019
 #define WID_DOC_BUILDID 1024
 #define WID_DOC_ISTEMPLATEID1025
 #define WID_DOC_DEFAULT_PAGE_MODE   1069
diff --git a/sw/qa/core/data/ww6/pass/ofz21168-1.doc 
b/sw/qa/core/data/ww6/pass/ofz21168-1.doc
new file mode 100644
index ..3bafb1d36bf7
Binary files /dev/null and b/sw/qa/core/data/ww6/pass/ofz21168-1.doc differ
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index db01f3f00912..e4f38b44bbb0 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -245,6 +245,7 @@ SwDoc::SwDoc()
 mbInWriting(false),
 mbInMailMerge(false),
 mbInXMLImport(false),
+mbInWriterfilterImport(false),
 mbUpdateTOX(false),
 mbInLoadAsynchron(false),
 mbIsAutoFormatRedline(false),
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 125154579980..1a3c85d921ee 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1558,7 +1558,7 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & 
rAnchorPos,
 }
 
 if ((nDelContentType & 

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

2019-09-20 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtwrapinfluenceonobjpos.hxx|5 
 sw/qa/extras/ooxmlexport/data/tdf124600b.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |9 
 sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx   |   10 -
 sw/source/core/doc/textboxhelper.cxx   |8 
 sw/source/core/inc/tocntntanchoredobjectposition.hxx   |4 
 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx |   92 
+++---
 sw/source/filter/ww8/docxsdrexport.cxx |4 
 writerfilter/source/dmapper/GraphicImport.cxx  |9 
 9 files changed, 110 insertions(+), 31 deletions(-)

New commits:
commit f8c7a2284b88c149addc8a30abb0cad8a10dad77
Author: Miklos Vajna 
AuthorDate: Fri Sep 20 11:55:21 2019 +0200
Commit: Miklos Vajna 
CommitDate: Fri Sep 20 12:42:17 2019 +0200

Related: tdf#124600 sw anchored object allow overlap: add DOCX filter

Which also made it necessary to support allow-overlap=no for not only
shapes, but for shapes-with-text in the layout.

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

diff --git a/sw/inc/fmtwrapinfluenceonobjpos.hxx 
b/sw/inc/fmtwrapinfluenceonobjpos.hxx
index 8e56be1ed653..897e825b14ff 100644
--- a/sw/inc/fmtwrapinfluenceonobjpos.hxx
+++ b/sw/inc/fmtwrapinfluenceonobjpos.hxx
@@ -21,6 +21,7 @@
 
 #include "hintids.hxx"
 #include "format.hxx"
+#include "swtypes.hxx"
 #include 
 #include 
 
@@ -30,6 +31,8 @@ private:
 sal_Int16 mnWrapInfluenceOnPosition;
 /// Allow objects to overlap, permitted by default.
 bool mbAllowOverlap = true;
+/// Vertical offset added during positioning to avoid an overlap.
+SwTwips mnOverlapVertOffset = 0;
 
 public:
 
@@ -59,6 +62,8 @@ public:
 
 void SetAllowOverlap(bool bAllowOverlap);
 bool GetAllowOverlap() const;
+void SetOverlapVertOffset(SwTwips nOverlapVertOffset);
+SwTwips GetOverlapVertOffset() const;
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
diff --git a/sw/qa/extras/ooxmlexport/data/tdf124600b.docx 
b/sw/qa/extras/ooxmlexport/data/tdf124600b.docx
new file mode 100644
index ..aa25ada91baf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124600b.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index dd059cdb6af9..ad5aec4e6d39 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -279,6 +279,15 @@ DECLARE_OOXMLEXPORT_TEST(tdf123912_protectedForm, 
"tdf123912_protectedForm.odt")
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Section1 is protected", false, 
getProperty(xSect, "IsProtected"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(tdf124600b, "tdf124600b.docx")
+{
+//  was lost on roundtrip, we always wrote "1" 
on export.
+bool bAllowOverlap1 = getProperty(getShape(1), "AllowOverlap");
+CPPUNIT_ASSERT(!bAllowOverlap1);
+bool bAllowOverlap2 = getProperty(getShape(2), "AllowOverlap");
+CPPUNIT_ASSERT(!bAllowOverlap2);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testDateControl, "empty-date-control.odt")
 {
 // Check that we exported the empty date control correctly
diff --git a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx 
b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
index a593416407c3..4182bb90a95a 100644
--- a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
+++ b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
@@ -43,7 +43,8 @@ bool SwFormatWrapInfluenceOnObjPos::operator==( const 
SfxPoolItem& rAttr ) const
 const SwFormatWrapInfluenceOnObjPos& rAttribute
 = static_cast(rAttr);
 return (mnWrapInfluenceOnPosition == rAttribute.GetWrapInfluenceOnObjPos()
-&& mbAllowOverlap == rAttribute.mbAllowOverlap);
+&& mbAllowOverlap == rAttribute.mbAllowOverlap
+&& mnOverlapVertOffset == rAttribute.mnOverlapVertOffset);
 }
 
 SfxPoolItem* SwFormatWrapInfluenceOnObjPos::Clone( SfxItemPool * ) const
@@ -154,6 +155,13 @@ bool SwFormatWrapInfluenceOnObjPos::GetAllowOverlap() const
 return mbAllowOverlap;
 }
 
+void SwFormatWrapInfluenceOnObjPos::SetOverlapVertOffset(SwTwips 
nOverlapVertOffset)
+{
+mnOverlapVertOffset = nOverlapVertOffset;
+}
+
+SwTwips SwFormatWrapInfluenceOnObjPos::GetOverlapVertOffset() const { return 
mnOverlapVertOffset; }
+
 void SwFormatWrapInfluenceOnObjPos::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
 xmlTextWriterStartElement(pWriter, 
BAD_CAST("SwFormatWrapInfluenceOnObjPos"));
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 83672434b79d..89072dffae14 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -563,6 +563,14 @@ void 

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

2019-08-01 Thread Andrea Gelmini (via logerrit)
 sw/inc/IDocumentDrawModelAccess.hxx   |2 +-
 sw/inc/SwNumberTree.hxx   |2 +-
 sw/inc/fesh.hxx   |2 +-
 sw/inc/frmfmt.hxx |2 +-
 sw/inc/ndarr.hxx  |2 +-
 sw/inc/node.hxx   |2 +-
 sw/inc/swunohelper.hxx|2 +-
 sw/qa/extras/rtfexport/rtfexport5.cxx |2 +-
 sw/qa/python/xtextrange.py|2 +-
 sw/qa/uitest/classification/classification.py |2 +-
 sw/qa/uitest/options/tdf78133.py  |4 ++--
 sw/qa/uitest/writer_tests/tdf53460.py |2 +-
 sw/qa/uitest/writer_tests4/tdf51352.py|4 ++--
 sw/source/core/text/itrcrsr.cxx   |2 +-
 sw/source/ui/dbui/createaddresslistdialog.cxx |2 +-
 sw/source/ui/index/swuiidxmrk.cxx |2 +-
 sw/source/ui/misc/bookmark.cxx|2 +-
 sw/source/ui/misc/outline.cxx |2 +-
 sw/source/ui/vba/vbaapplication.cxx   |2 +-
 sw/source/ui/vba/vbaborders.cxx   |4 ++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 ++--
 21 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit 8fe5161a9e36d8285c489da7167d7cca27cb0f1d
Author: Andrea Gelmini 
AuthorDate: Thu Aug 1 21:05:39 2019 +0200
Commit: Andrea Gelmini 
CommitDate: Thu Aug 1 22:21:44 2019 +0200

Fix typos

Change-Id: I2238961a7b124652e90e948e27a6ca9d98dc54ac
Reviewed-on: https://gerrit.libreoffice.org/76826
Tested-by: Jenkins
Reviewed-by: Andrea Gelmini 

diff --git a/sw/inc/IDocumentDrawModelAccess.hxx 
b/sw/inc/IDocumentDrawModelAccess.hxx
index b81d65d945d8..b631317a02e8 100644
--- a/sw/inc/IDocumentDrawModelAccess.hxx
+++ b/sw/inc/IDocumentDrawModelAccess.hxx
@@ -60,7 +60,7 @@ public:
 
 /** method to determine, if the corresponding invisible layer ID for a 
visible one.
 
-Note: If given layer ID is a invisible one, method returns given layer 
ID.
+Note: If given layer ID is an invisible one, method returns given 
layer ID.
 Note: If given layer ID is unknown, method returns given layer ID.
 
 @param _nVisibleLayerId
diff --git a/sw/inc/SwNumberTree.hxx b/sw/inc/SwNumberTree.hxx
index 2472f160f95d..4d2409616842 100644
--- a/sw/inc/SwNumberTree.hxx
+++ b/sw/inc/SwNumberTree.hxx
@@ -293,7 +293,7 @@ public:
 /** Invalidation and notification of complete numbering tree
 
 #i64010#
-Usage: on  state change its needed to invalidate the
+Usage: on  state change it's needed to invalidate the
complete numbering tree due to wide influence of this change.
 */
 void InvalidateAndNotifyTree()
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 4d619d4d65f0..25bf062c1e82 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -266,7 +266,7 @@ public:
 /// Is selected frame within another frame?
 const SwFrameFormat* IsFlyInFly();
 
-/** If an object as been given, exactly this object is selected
+/** If an object has been given, exactly this object is selected
  (instead of searching over position). */
 bool SelectObj( const Point& rSelPt, sal_uInt8 nFlag = 0, SdrObject *pObj 
= nullptr );
 void DelSelectedObj();
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 5c3c9dc55213..4bfd5268d251 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -226,7 +226,7 @@ public:
 Method determines, if background of fly frame is transparent.
 
 @return true, if background color is transparent, but not "no fill"
-or a existing background graphic is transparent.
+or an existing background graphic is transparent.
 */
 virtual bool IsBackgroundTransparent() const override;
 
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 6153af0ad012..2f2958c977bc 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -151,7 +151,7 @@ public:
 
 /// A still empty section.
 SwNode& GetEndOfPostIts() const { return *m_pEndOfPostIts; }
-/// Section fpr all footnotes.
+/// Section for all footnotes.
 SwNode& GetEndOfInserts() const { return *m_pEndOfInserts; }
 /// Section for all Flys/Header/Footers.
 SwNode& GetEndOfAutotext() const{ return *m_pEndOfAutotext; }
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index d1e0f36fcae7..e3e469c5ff9d 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -262,7 +262,7 @@ public:
 
 /// Is node in the visible area of the Shell?
 bool IsInVisibleArea( SwViewShell const * pSh ) const;
-/// Is node in an protected area?
+/// Is node in a protected area?
 bool IsInProtectSect() const;
 /**  Is node in something that is protected (range, frame,
 table cells ... including anchor in case of frames or footnotes)? */
diff --git 

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

2019-07-12 Thread Tamás Zolnai (via logerrit)
 sw/inc/IDocumentMarkAccess.hxx |2 
 sw/inc/IMark.hxx   |   19 +
 sw/inc/swabstdlg.hxx   |4 
 sw/qa/extras/globalfilter/data/date_form_field.odt |binary
 sw/qa/extras/globalfilter/globalfilter.cxx |   55 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |4 
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx  |   37 ++
 sw/qa/extras/uiwriter/uiwriter2.cxx|5 
 sw/source/core/crsr/DateFormFieldButton.cxx|   66 -
 sw/source/core/crsr/bookmrk.cxx|  276 +++--
 sw/source/core/doc/docbm.cxx   |   33 ++
 sw/source/core/inc/MarkManager.hxx |2 
 sw/source/core/inc/bookmrk.hxx |   31 +-
 sw/source/core/text/itrform2.cxx   |   93 ---
 sw/source/core/text/porfld.cxx |9 
 sw/source/core/text/porfld.hxx |8 
 sw/source/core/unocore/unobkm.cxx  |4 
 sw/source/filter/ww8/docxattributeoutput.cxx   |   91 ++
 sw/source/filter/ww8/docxattributeoutput.hxx   |3 
 sw/source/filter/ww8/docxexport.cxx|3 
 sw/source/filter/ww8/wrtw8nds.cxx  |  147 ++-
 sw/source/ui/dialog/swdlgfact.cxx  |2 
 sw/source/ui/dialog/swdlgfact.hxx  |2 
 sw/source/ui/fldui/DateFormFieldDialog.cxx |   36 +-
 sw/source/uibase/inc/DateFormFieldDialog.hxx   |6 
 sw/source/uibase/shells/textfld.cxx|   30 +-
 sw/source/uibase/shells/textsh1.cxx|3 
 writerfilter/source/dmapper/DomainMapper.cxx   |   81 +++---
 writerfilter/source/dmapper/SdtHelper.cxx  |   41 ++-
 writerfilter/source/dmapper/SdtHelper.hxx  |   12 
 xmloff/source/text/XMLTextMarkImportContext.cxx|5 
 31 files changed, 694 insertions(+), 416 deletions(-)

New commits:
commit 68e1be4ccbb90ee9a788962219a88312c4ffbea2
Author: Tamás Zolnai 
AuthorDate: Wed Jul 10 18:22:31 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Fri Jul 12 12:55:40 2019 +0200

MSForms: Rework text-based date form field's representation

* Better to represent it similar to text form field with two
marking characters selecting a text range
* So the text between the two marks can be anything (not only
a well formatted date) and also have any character formatting.
* With this we handle the case when the user needs a placeholder
text in the date field or when the user needs time values (hour,
minute, sec) next to the date.

Change-Id: Id60a50a2028058f8a6a080e265c0730d88b98543
Reviewed-on: https://gerrit.libreoffice.org/75459
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 9670e811f044..cba649ea077e 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -322,7 +322,7 @@ class IDocumentMarkAccess
 virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const 
SwPaM ) const=0;
 
 virtual void deleteFieldmarkAt(const SwPosition& rPos) = 0;
-virtual ::sw::mark::IFieldmark* 
changeNonTextFieldmarkType(::sw::mark::IFieldmark* pFieldmark, const OUString& 
rNewType) = 0;
+virtual ::sw::mark::IFieldmark* 
changeFormFieldmarkType(::sw::mark::IFieldmark* pFieldmark, const OUString& 
rNewType) = 0;
 
 virtual void NotifyCursorUpdate(const SwCursorShell& rCursorShell) = 0;
 virtual void ClearFieldActivation() = 0;
diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx
index e7275d9f5d56..b8ee6a4a2098 100644
--- a/sw/inc/IMark.hxx
+++ b/sw/inc/IMark.hxx
@@ -121,6 +121,25 @@ namespace sw { namespace mark
 ICheckboxFieldmark  =(ICheckboxFieldmark const&) = delete;
 };
 
+class SW_DLLPUBLIC IDateFieldmark
+: virtual public IFieldmark
+{
+protected:
+IDateFieldmark() = default;
+
+public:
+virtual OUString GetContent() const = 0;
+virtual void ReplaceContent(const OUString& sNewContent) = 0;
+
+virtual std::pair GetCurrentDate() const = 0;
+virtual void SetCurrentDate(double fDate) = 0;
+virtual OUString GetDateInStandardDateFormat(double fDate) const = 
0;
+
+private:
+IDateFieldmark(ICheckboxFieldmark const &) = delete;
+IDateFieldmark  =(ICheckboxFieldmark const&) = delete;
+};
+
 OUString ExpandFieldmark(IFieldmark* pBM);
 
 }}
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index c793069b8a41..d696d9388472 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -78,7 +78,7 @@ namespace com{namespace sun{namespace star{
 }}}
 
 
-namespace sw { namespace mark { class IFieldmark; } }
+namespace sw { namespace mark { class IFieldmark; class IDateFieldmark; } }
 
 typedef 

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

2019-01-09 Thread Libreoffice Gerrit user
 sw/inc/doc.hxx|5 
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|   14 +
 sw/source/core/doc/doctxm.cxx |   17 +-
 sw/source/core/unocore/unoidx.cxx |6 
 sw/source/filter/ww8/docxexport.cxx   |5 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |  159 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |5 
 7 files changed, 176 insertions(+), 35 deletions(-)

New commits:
commit ff4f2ba3242d303f7f238a7a142440f1f4b1f288
Author: Serge Krot 
AuthorDate: Thu Dec 6 19:11:58 2018 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Jan 9 22:30:08 2019 +0100

sw: DOCX: recognize TOC title during import

Change-Id: Ifa4fb59858d61580f76e3d104aa4caa6b5902d1b
Reviewed-on: https://gerrit.libreoffice.org/64735
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 3878c4299b89..4d1cf10c9010 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -917,6 +917,11 @@ public:
 const SfxItemSet* pSet = nullptr,
 bool bExpand = false,
 SwRootFrame const* pLayout = nullptr);
+SwTOXBaseSection* InsertTableOf( const SwPaM& aPam,
+const SwTOXBase& rTOX,
+const SfxItemSet* pSet = nullptr,
+bool bExpand = false,
+SwRootFrame const* pLayout = nullptr );
 void  InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
 const SwTOXBase& rTOX,
 const SfxItemSet* pSet );
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index b36fe833dcc3..90c7566e30d3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 #include 
@@ -144,6 +145,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121561_tocTitle, 
"tdf121456_tabsOffset.odt")
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtPr/w:docPartObj/w:docPartUnique", 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf121561_tocTitleDocx, 
"tdf121456_tabsOffset.odt")
+{
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+
+uno::Reference xIndexSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexes(xIndexSupplier->getDocumentIndexes( ), uno::UNO_QUERY);
+uno::Reference xTOCIndex(xIndexes->getByIndex(0), 
uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(OUString("Inhaltsverzeichnis"), 
getProperty(xTOCIndex, "Title"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf106174_rtlParaAlign, 
"tdf106174_rtlParaAlign.docx")
 {
 CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), 
getProperty(getParagraph(1), "ParaAdjust"));
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 4e7ab4507e06..923cd9b1084f 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -347,15 +347,24 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& 
rCurTOXMark,
 }
 
 SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
-const SwTOXBase& rTOX,
-const SfxItemSet* pSet,
-bool bExpand,
+const SwTOXBase& rTOX,
+const SfxItemSet* pSet,
+bool bExpand,
 SwRootFrame const*const pLayout)
 {
+SwPaM aPam( rPos );
+return InsertTableOf( aPam, rTOX, pSet, bExpand, pLayout );
+}
+
+SwTOXBaseSection* SwDoc::InsertTableOf( const SwPaM& aPam,
+const SwTOXBase& rTOX,
+const SfxItemSet* pSet,
+bool bExpand,
+SwRootFrame const*const pLayout )
+{
 GetIDocumentUndoRedo().StartUndo( SwUndoId::INSTOX, nullptr );
 
 OUString sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), 
rTOX.GetTOXName() );
-SwPaM aPam( rPos );
 SwSectionData aSectionData( TOX_CONTENT_SECTION, sSectNm );
 SwTOXBaseSection *const pNewSection = dynamic_cast(
 InsertSwSection( aPam, aSectionData, & rTOX, pSet, false ));
diff --git a/sw/source/core/unocore/unoidx.cxx 
b/sw/source/core/unocore/unoidx.cxx
index 7e40304a6f2a..c7f3397b62b0 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1340,10 +1340,6 @@ SwXDocumentIndex::attach(const uno::Reference< 
text::XTextRange > & xTextRange)
 }
 
 

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

2018-12-18 Thread Libreoffice Gerrit user
 sw/inc/cmdid.h|2 +
 sw/inc/unoframe.hxx   |2 +
 sw/inc/unoprnms.hxx   |2 +
 sw/qa/extras/odfexport/data/tdf99631.docx |binary
 sw/qa/extras/odfexport/odfexport.cxx  |8 -
 sw/source/core/unocore/unoframe.cxx   |   35 +-
 sw/source/core/unocore/unomap1.cxx|2 +
 sw/source/uibase/wrtsh/wrtsh1.cxx |   13 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 +
 writerfilter/source/dmapper/OLEHandler.cxx|   12 +++
 writerfilter/source/dmapper/OLEHandler.hxx|4 ++
 11 files changed, 74 insertions(+), 14 deletions(-)

New commits:
commit 69ce3374f90847f357249a41118314508da6bb98
Author: László Németh 
AuthorDate: Tue Dec 18 14:13:09 2018 +0100
Commit: László Németh 
CommitDate: Wed Dec 19 07:57:46 2018 +0100

tdf#99631 DOCX import: keep zoom of embedded XLSX

OLE objects by importing their VisibleArea settings

This also reverts commit 5c1a6c9adb5ccfbb869a0a7ac730d8860a1bf405
"tdf#99631 DOCX import: set 1:1 scale in embedded XLSX".

Change-Id: I73dc945c86d0200e72767810b2ff39f233729080
Reviewed-on: https://gerrit.libreoffice.org/65343
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index d829c3d45fe2..28a13ea71abd 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -599,6 +599,8 @@
 #define FN_UNO_HIDDEN   (FN_EXTRA2 + 122)
 #define FN_UNO_STYLE_INTEROP_GRAB_BAG   (FN_EXTRA2 + 123)
 #define FN_UNO_TABLE_TEMPLATE_NAME  (FN_EXTRA2 + 124)
+#define FN_UNO_VISIBLE_AREA_WIDTH   (FN_EXTRA2 + 125)
+#define FN_UNO_VISIBLE_AREA_HEIGHT  (FN_EXTRA2 + 126)
 
 // Area: Help
 // Region: Traveling & Selection
diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
index 41dc3292c53c..43876e94a580 100644
--- a/sw/inc/unoframe.hxx
+++ b/sw/inc/unoframe.hxx
@@ -72,6 +72,8 @@ private:
 std::unique_ptr  m_pCopySource;
 
 sal_Int64   m_nDrawAspect;
+sal_Int64   m_nVisibleAreaWidth;
+sal_Int64   m_nVisibleAreaHeight;
 
 protected:
 css::uno::Reference< css::beans::XPropertySet > mxStyleData;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 3e0383961b7a..b2de700dd23f 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -822,6 +822,8 @@
 #define UNO_NAME_RSID "Rsid"
 #define UNO_NAME_PARRSID "ParRsid"
 #define UNO_NAME_DRAW_ASPECT "DrawAspect"
+#define UNO_NAME_VISIBLE_AREA_WIDTH "VisibleAreaWidth"
+#define UNO_NAME_VISIBLE_AREA_HEIGHT "VisibleAreaHeight"
 
 #define UNO_NAME_LINE_STYLE "LineStyle"
 #define UNO_NAME_LINE_WIDTH "LineWidth"
diff --git a/sw/qa/extras/odfexport/data/tdf99631.docx 
b/sw/qa/extras/odfexport/data/tdf99631.docx
index 7fcb612c7f6d..c72950b7240a 100644
Binary files a/sw/qa/extras/odfexport/data/tdf99631.docx and 
b/sw/qa/extras/odfexport/data/tdf99631.docx differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index c8468eb90cdd..8e3df22527a8 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2125,12 +2125,18 @@ DECLARE_ODFEXPORT_TEST(tdf118502, "tdf118502.odt")
 
 DECLARE_ODFEXPORT_TEST(tdf99631, "tdf99631.docx")
 {
-// File asserting while saving in LO.
+// check import of VisualArea settings of the embedded XLSX OLE objects
 xmlDocPtr pXmlDoc = parseExport("Object 1/settings.xml");
 if (!pXmlDoc)
 return;
 assertXPathContent(pXmlDoc, 
"//config:config-item[@config:name='VisibleAreaWidth']", "4515");
 assertXPathContent(pXmlDoc, 
"//config:config-item[@config:name='VisibleAreaHeight']", "903");
+
+xmlDocPtr pXmlDoc2 = parseExport("Object 2/settings.xml");
+if (!pXmlDoc2)
+return;
+assertXPathContent(pXmlDoc2, 
"//config:config-item[@config:name='VisibleAreaWidth']", "4515");
+assertXPathContent(pXmlDoc2, 
"//config:config-item[@config:name='VisibleAreaHeight']", "1354");
 }
 #endif
 
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index a6edcfd6d31f..d63bd91847b1 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1138,7 +1138,9 @@ bool SwOLEProperties_Impl::AnyToItemSet(
 {
 const ::uno::Any* pTemp;
 if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && 
!GetProperty(FN_UNO_STREAM_NAME, 0, pTemp)
- && !GetProperty(FN_EMBEDDED_OBJECT, 0, pTemp) )
+ && !GetProperty(FN_EMBEDDED_OBJECT, 0, pTemp)
+ && !GetProperty(FN_UNO_VISIBLE_AREA_WIDTH, 0, pTemp)
+ && !GetProperty(FN_UNO_VISIBLE_AREA_HEIGHT, 0, pTemp) )
 return false;
 SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrameSet, rSet, rSizeFound);
 
@@ -1205,6 +1207,8 @@ SwXFrame::SwXFrame(FlyCntType eSet, const 

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

2018-12-10 Thread Libreoffice Gerrit user
 sw/inc/fmtfollowtextflow.hxx   |   22 +++
 sw/inc/unomid.h|4 
 sw/inc/unoprnms.hxx|1 
 sw/qa/extras/layout/data/tdf115094.docx|binary
 sw/qa/extras/layout/layout.cxx |   29 +
 sw/qa/extras/ooxmlimport/data/tdf115094v2.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx  |8 +
 sw/source/core/attr/fmtfollowtextflow.cxx  |   58 
++
 sw/source/core/inc/anchoredobjectposition.hxx  |5 
 sw/source/core/inc/environmentofanchoredobject.hxx |7 +
 sw/source/core/objectpositioning/anchoredobjectposition.cxx|1 
 sw/source/core/objectpositioning/environmentofanchoredobject.cxx   |6 -
 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx |2 
 sw/source/core/unocore/unoframe.cxx|   17 ++
 sw/source/core/unocore/unomap.cxx  |3 
 sw/source/core/unocore/unomap1.cxx |3 
 sw/source/core/unocore/unomapproperties.hxx|3 
 sw/source/uibase/utlui/attrdesc.cxx|1 
 writerfilter/source/dmapper/GraphicImport.cxx  |5 
 writerfilter/source/dmapper/PropertyIds.cxx|1 
 writerfilter/source/dmapper/PropertyIds.hxx|1 
 21 files changed, 166 insertions(+), 11 deletions(-)

New commits:
commit c3c80b6b63e998fd3117b5039e65a2ee9df90954
Author: Patrick Jaap 
AuthorDate: Wed Nov 14 16:25:45 2018 +0100
Commit: Miklos Vajna 
CommitDate: Mon Dec 10 14:20:43 2018 +0100

tdf#115094 Part II: OOXML Feature: Add layoutInCell to Doc model

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

diff --git a/sw/inc/fmtfollowtextflow.hxx b/sw/inc/fmtfollowtextflow.hxx
index 6cbc6dfe39e9..ff3aa9f9b32b 100644
--- a/sw/inc/fmtfollowtextflow.hxx
+++ b/sw/inc/fmtfollowtextflow.hxx
@@ -19,6 +19,7 @@
 #ifndef INCLUDED_SW_INC_FMTFOLLOWTEXTFLOW_HXX
 #define INCLUDED_SW_INC_FMTFOLLOWTEXTFLOW_HXX
 
+#include 
 #include 
 #include "hintids.hxx"
 #include "format.hxx"
@@ -28,9 +29,19 @@ class IntlWrapper;
 
 class SW_DLLPUBLIC SwFormatFollowTextFlow : public SfxBoolItem
 {
+private:
+bool mbLayoutInCell = false;
+
 public:
+
 SwFormatFollowTextFlow( bool bFlag = false )
-: SfxBoolItem( RES_FOLLOW_TEXT_FLOW, bFlag ) {}
+: SfxBoolItem( RES_FOLLOW_TEXT_FLOW, bFlag )
+{}
+
+SwFormatFollowTextFlow( bool bFlag, bool _bLayoutInCell  )
+: SfxBoolItem( RES_FOLLOW_TEXT_FLOW, bFlag )
+, mbLayoutInCell( _bLayoutInCell )
+{}
 
 
 /// "pure virtual methods" of SfxPoolItem
@@ -41,7 +52,16 @@ public:
   OUString ,
   const IntlWrapper& rIntl ) const override;
 
+bool GetLayoutInCell() const { return mbLayoutInCell; }
+
+
+bool PutValue(const css::uno::Any& rVal, sal_uInt8 aInt) override;
+
+bool QueryValue(css::uno::Any& rVal, sal_uInt8 aInt = 0) const override;
+
 void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
+
+bool operator==(const SfxPoolItem& rItem) const override;
 };
 
 inline const SwFormatFollowTextFlow ::GetFollowTextFlow(bool bInP) 
const
diff --git a/sw/inc/unomid.h b/sw/inc/unomid.h
index 020da9d7e08e..06e84c99acb1 100644
--- a/sw/inc/unomid.h
+++ b/sw/inc/unomid.h
@@ -147,6 +147,10 @@
 // SwFormatWrapInfluenceOnObjPos
 #define MID_WRAP_INFLUENCE  0
 
+// SwFormatFollowTextFlow
+#define MID_FOLLOW_TEXT_FLOW0
+#define MID_FTF_LAYOUT_IN_CELL  1
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index a168bbc38498..3e0383961b7a 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -743,6 +743,7 @@
 #define UNO_NAME_IS_SPLIT_ALLOWED "IsSplitAllowed"
 #define UNO_NAME_CHAR_HIDDEN "CharHidden"
 #define UNO_NAME_IS_FOLLOWING_TEXT_FLOW "IsFollowingTextFlow"
+#define UNO_NAME_IS_LAYOUT_IN_CELL "IsLayoutInCell"
 #define UNO_NAME_WIDTH_TYPE "WidthType"
 #define UNO_NAME_SCRIPT_URL "ScriptURL"
 #define UNO_NAME_RUNTIME_UID "RuntimeUID"
diff --git a/sw/qa/extras/layout/data/tdf115094.docx 
b/sw/qa/extras/layout/data/tdf115094.docx
new file mode 100644
index ..49a7c9194f1a
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf115094.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2fea76b5399a..633a31f3b30b 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -63,6 +63,7 @@ public:
 void testTdf120287b();
 

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

2017-12-11 Thread Patrick Jaap
 sw/inc/IDocumentSettingAccess.hxx   |2 +
 sw/qa/extras/ooxmlimport/data/tdf112443.docx|binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|   10 ++
 sw/source/core/doc/DocumentSettingManager.cxx   |7 
 sw/source/core/inc/DocumentSettingManager.hxx   |1 
 sw/source/core/layout/flylay.cxx|6 
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |   18 
 sw/source/filter/xml/xmlimp.cxx |7 
 sw/source/uibase/uno/SwXDocumentSettings.cxx|   17 +++
 writerfilter/source/filter/WriterFilter.cxx |2 -
 10 files changed, 67 insertions(+), 3 deletions(-)

New commits:
commit 8d62b79f168180c6992eb483ec864d473050635f
Author: Patrick Jaap 
Date:   Wed Nov 29 12:41:33 2017 +0100

tdf#112443 disable off-page content positioning

Disable the positioning for objects that are completely off-page.
During import, LO writer forces content always back to the page
and causes unwanted content on the page in constrast to MSO.

To achive this the top/left position of the content is compared to the 
bottom/right border of the clipping region.

A new compatibility flag OFF_PAGE_POSITIONING is introduced for
legacy rendering of legacy documents.

A unit test demonstrates the issue.

It resolves tdf#112443.

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

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 6e9942bce66c..41b2c4ff79c3 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -81,6 +81,8 @@ enum class DocumentSettingId
 SURROUND_TEXT_WRAP_SMALL,
 PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
 SUBTRACT_FLYS,
+// tdf#112443 disable off-page content positioning
+DISABLE_OFF_PAGE_POSITIONING,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/extras/ooxmlimport/data/tdf112443.docx 
b/sw/qa/extras/ooxmlimport/data/tdf112443.docx
new file mode 100644
index ..385ce514c1c9
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf112443.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index cafef1d2ee53..4d65beeb90c4 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -118,7 +118,6 @@ public:
 }
 };
 
-
 DECLARE_OOXMLIMPORT_TEST(testImageHyperlink, "image-hyperlink.docx")
 {
 OUString URL = getProperty(getShape(1), "HyperLinkURL");
@@ -1559,6 +1558,15 @@ DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx")
 sal_Int32(-1), getProperty(xText, "CharColor"));
 }
 
+
+DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx")
+{
+// the position of the flying text frame should be off page
+// 30624 below its anchor
+OUString aTop = parseDump("//fly[1]/infos/bounds", "top");
+CPPUNIT_ASSERT_EQUAL( OUString("30624"), aTop );
+
+}
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 47c513e1486e..77de92017537 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -87,7 +87,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbPropLineSpacingShrinksFirstLine(true),
 mbSubtractFlys(false),
 mApplyParagraphMarkFormatToNumbering(false),
-mbLastBrowseMode( false )
+mbLastBrowseMode( false ),
+mbDisableOffPagePositioning ( false )
 
 // COMPATIBILITY FLAGS END
 {
@@ -202,6 +203,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::EMBED_FONTS: return mEmbedFonts;
 case DocumentSettingId::EMBED_SYSTEM_FONTS: return mEmbedSystemFonts;
 case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING: 
return mApplyParagraphMarkFormatToNumbering;
+case DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING: return 
mbDisableOffPagePositioning;
 default:
 OSL_FAIL("Invalid setting id");
 }
@@ -416,6 +418,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
 mApplyParagraphMarkFormatToNumbering = value;
 break;
+case DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING:
+mbDisableOffPagePositioning = value;
+break;
 default:
 

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

2017-07-08 Thread Szymon Kłos
 sw/inc/cmdid.h|1 
 sw/inc/unoframe.hxx   |2 +
 sw/inc/unoprnms.hxx   |1 
 sw/qa/extras/ooxmlimport/data/tdf108545_embeddedDocxIcon.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   12 ++
 sw/source/core/unocore/unoframe.cxx   |   18 +++---
 sw/source/core/unocore/unomap1.cxx|1 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 ++
 writerfilter/source/dmapper/OLEHandler.cxx|5 ++
 writerfilter/source/dmapper/OLEHandler.hxx|2 +
 10 files changed, 42 insertions(+), 4 deletions(-)

New commits:
commit 3340ce30562832b584dd0576d9e0733aa03d867f
Author: Szymon Kłos 
Date:   Sat Jul 1 20:30:43 2017 +0200

tdf#108545 show an icon (DOCX inside DOCX)

If DrawAspect is equal "Icon", show an icon not document preview
Document is opened in the separate window, not in-place.

Change-Id: I3a8d81e7340b29d247f8ac440c06b0420bb65644
Reviewed-on: https://gerrit.libreoffice.org/39440
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 

diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 0c5726536511..91078196f67b 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -585,6 +585,7 @@
 #define FN_MATH_BASELINE_ALIGNMENT  (FN_EXTRA2 + 115)
 
 #define FN_EMBEDDED_OBJECT  (FN_EXTRA2 + 116)
+#define FN_UNO_DRAW_ASPECT  (FN_EXTRA2 + 117)
 #define FN_UNO_HEADER_FIRST (FN_EXTRA2 + 118)
 #define FN_UNO_FOOTER_FIRST (FN_EXTRA2 + 119)
 #define FN_UNO_TABLE_BORDER2(FN_EXTRA2 + 120)
diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
index 4bf9e3aa0647..44e27f6434b6 100644
--- a/sw/inc/unoframe.hxx
+++ b/sw/inc/unoframe.hxx
@@ -71,6 +71,8 @@ private:
 
 SwPaM*  m_pCopySource;
 
+sal_Int64   m_nDrawAspect;
+
 protected:
 css::uno::Reference< css::beans::XPropertySet > mxStyleData;
 css::uno::Reference< css::container::XNameAccess >  mxStyleFamily;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 24cc71cb8740..c78f08bf5577 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -813,6 +813,7 @@
 #define UNO_NAME_EMBEDDED_OBJECT "EmbeddedObject"
 #define UNO_NAME_RSID "Rsid"
 #define UNO_NAME_PARRSID "ParRsid"
+#define UNO_NAME_DRAW_ASPECT "DrawAspect"
 
 #define UNO_NAME_LINE_STYLE "LineStyle"
 #define UNO_NAME_LINE_WIDTH "LineWidth"
diff --git a/sw/qa/extras/ooxmlimport/data/tdf108545_embeddedDocxIcon.docx 
b/sw/qa/extras/ooxmlimport/data/tdf108545_embeddedDocxIcon.docx
new file mode 100644
index ..2e5429ce71b9
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf108545_embeddedDocxIcon.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 817c065f4e95..0ff3f1cdc71a 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1382,6 +1382,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108995, "xml_space.docx")
  paragraph->getString());
 }
 
+#if defined(_WIN32)
+DECLARE_OOXMLIMPORT_TEST(testTdf108545_embeddedDocxIcon, 
"tdf108545_embeddedDocxIcon.docx")
+{
+// Check if document shows an icon for embedded docx document
+// Due to different fonts used for icon labels on each OS, current 
checksum is for Windows only
+uno::Reference xSupplier(getShape(1), 
uno::UNO_QUERY);
+uno::Reference xGraphic = 
xSupplier->getReplacementGraphic();
+Graphic aGraphic(xGraphic);
+CPPUNIT_ASSERT_EQUAL(BitmapChecksum(SAL_CONST_UINT64(733876873106730813)), 
aGraphic.GetChecksum());
+}
+#endif
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index f463bf3f95fd..f43b6bace8e3 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1197,6 +1197,7 @@ SwXFrame::SwXFrame(FlyCntType eSet, const 
::SfxItemPropertySet* pSet, SwDoc *pDo
 , eType(eSet)
 , bIsDescriptor(true)
 , m_pCopySource(nullptr)
+, m_nDrawAspect(embed::Aspects::MSOLE_CONTENT)
 {
 // Register ourselves as a listener to the document (via the page 
descriptor)
 
pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
@@ -1984,6 +1985,16 @@ void SwXFrame::setPropertyValue(const OUString& 
rPropertyName, const ::uno::Any&
 {
 }
 }
+else if (FN_UNO_DRAW_ASPECT == pEntry->nWID)
+{
+OUString sAspect = "";
+aValue >>= sAspect;
+
+if (sAspect 

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

2016-08-30 Thread Justin Luth
 sw/inc/IDocumentSettingAccess.hxx |1 +
 sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx  |   10 ++
 sw/source/core/doc/DocumentSettingManager.cxx |6 ++
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/core/layout/flowfrm.cxx |4 +++-
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   13 +
 writerfilter/source/filter/WriterFilter.cxx   |1 +
 8 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 93d7fc90b57bb08052299c94fa0a28bb8f494a9c
Author: Justin Luth 
Date:   Tue Aug 30 17:51:07 2016 +0300

tdf#76349 writer: make 1column-as-page break a compatibility option

Unable to find/create a proof .doc document, so only implementing this
for .docx

Change-Id: I3a0cb2ddf7b3aeecc9200e595f70d8c88af4b122
Reviewed-on: https://gerrit.libreoffice.org/28501
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index e02cbce..f16ae42 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -52,6 +52,7 @@ enum class DocumentSettingId
 
 IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
 DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
+TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
 DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
 OUTLINE_LEVEL_YIELDS_OUTLINE_RULE,
 
diff --git a/sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odt 
b/sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odt
new file mode 100644
index 000..0ec4060
Binary files /dev/null and 
b/sw/qa/extras/odfimport/data/tdf76349_1columnBreak.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index ad475a5..02fb8b1 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -637,6 +637,16 @@ DECLARE_ODFIMPORT_TEST(testTdf76322_columnBreakInHeader, 
"tdf76322_columnBreakIn
 CPPUNIT_ASSERT_EQUAL( OUString("Test1"), 
parseDump("/root/page[1]/header/section/column[2]/body/txt/text()") );
 }
 
+DECLARE_ODFIMPORT_TEST(testTdf76349_1columnBreak, "tdf76349_1columnBreak.odt")
+{
+//single-column breaks should only be treated as page breaks for MS 
formats - should be only one page here.
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+uno::Reference 
xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+xCursor->jumpToLastPage();
+CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
+}
+
 DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt")
 {
 // Background of the formula frame was white (0xff), not green.
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index bdcc1ea..5cf29c0 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -81,6 +81,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbClippedPictures(false),
 mbBackgroundParaOverDrawings(false),
 mbTabOverMargin(false),
+mbTreatSingleColumnBreakAsPageBreak(false),
 mbSurroundTextWrapSmall(false),
 mbPropLineSpacingShrinksFirstLine(true),
 mbSubtractFlys(false),
@@ -175,6 +176,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::CLIPPED_PICTURES: return mbClippedPictures;
 case DocumentSettingId::BACKGROUND_PARA_OVER_DRAWINGS: return 
mbBackgroundParaOverDrawings;
 case DocumentSettingId::TAB_OVER_MARGIN: return mbTabOverMargin;
+case DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK: 
return mbTreatSingleColumnBreakAsPageBreak;
 case DocumentSettingId::SURROUND_TEXT_WRAP_SMALL: return 
mbSurroundTextWrapSmall;
 case DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE: return 
mbPropLineSpacingShrinksFirstLine;
 case DocumentSettingId::SUBTRACT_FLYS: return mbSubtractFlys;
@@ -339,6 +341,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 mbTabOverMargin = value;
 break;
 
+case DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
+mbTreatSingleColumnBreakAsPageBreak = value;
+break;
+
 case DocumentSettingId::SURROUND_TEXT_WRAP_SMALL:
 mbSurroundTextWrapSmall = value;
 break;
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx 
b/sw/source/core/inc/DocumentSettingManager.hxx
index eebd1db..b971cc5 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -147,6 +147,7 @@ class DocumentSettingManager :
 

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

2016-03-31 Thread Miklos Vajna
 sw/inc/IDocumentSettingAccess.hxx   |1 
 sw/qa/extras/uiwriter/data/tdf98987.docx|binary
 sw/qa/extras/uiwriter/uiwriter.cxx  |   19 
+
 sw/source/core/doc/DocumentSettingManager.cxx   |5 ++
 sw/source/core/inc/DocumentSettingManager.hxx   |1 
 sw/source/core/inc/anchoredobjectposition.hxx   |7 ++-
 sw/source/core/inc/txtfrm.hxx   |4 ++
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |   16 
++--
 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx  |   20 
+-
 sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx |4 +-
 sw/source/core/text/txtfrm.cxx  |   13 
++
 sw/source/uibase/uno/SwXDocumentSettings.cxx|   13 
++
 writerfilter/source/filter/WriterFilter.cxx |1 
 13 files changed, 87 insertions(+), 17 deletions(-)

New commits:
commit 50223ea6e212b60b7d33839c2753c5601fb50f95
Author: Miklos Vajna 
Date:   Thu Mar 31 15:05:48 2016 +0200

tdf#98987 sw: add AddVerticalFrameOffsets compat mode

The situation is the following: we have a text frame, with at least two
anchored objects: one is wrapped not-wrap-through, the other is. In case
the non-wrap-though one shifts the text content of the text frame right or
down, then layout may or may not want to re-consider what is the top
left corner of the text frame for anchoring purposes.

Regarding the x position, sw layout repositioned the anchor point
depending on the AddFrameOffsets compat mode: it's enabled for documents
imported from Word, disabled otherwise.  Regarding the y position, no
repositioning was done, however the bugdoc shows that Word does the same
repositioning on the vertical axis as well.

Add a new AddVerticalFrameOffsets compat mode that enables vertical
repositioning as well, and enable that mode for documents imported from
DOCX.

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

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 08359a2..e02cbce 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -37,6 +37,7 @@ enum class DocumentSettingId
 TAB_COMPAT,
 
 ADD_FLY_OFFSETS,
+ADD_VERTICAL_FLY_OFFSETS,
 
 OLD_NUMBERING,
 
diff --git a/sw/qa/extras/uiwriter/data/tdf98987.docx 
b/sw/qa/extras/uiwriter/data/tdf98987.docx
new file mode 100644
index 000..3b24e34
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf98987.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 135e1e9..b450520 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -194,6 +194,7 @@ public:
 void testTdf88453();
 void testTdf88453Table();
 void testClassificationPaste();
+void testTdf98987();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -290,6 +291,7 @@ public:
 CPPUNIT_TEST(testTdf88453);
 CPPUNIT_TEST(testTdf88453Table);
 CPPUNIT_TEST(testClassificationPaste);
+CPPUNIT_TEST(testTdf98987);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3573,6 +3575,23 @@ void SwUiWriterTest::testClassificationPaste()
 xSourceComponent->dispose();
 }
 
+void SwUiWriterTest::testTdf98987()
+{
+createDoc("tdf98987.docx");
+calcLayout();
+xmlDocPtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, 
"/root/page/body/txt/anchored/SwAnchoredDrawObject[2]/sdrObject", "name", 
"Rectangle 1");
+sal_Int32 nRectangle1 = getXPath(pXmlDoc, 
"/root/page/body/txt/anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32();
+assertXPath(pXmlDoc, 
"/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/sdrObject", "name", 
"Rectangle 2");
+sal_Int32 nRectangle2 = getXPath(pXmlDoc, 
"/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/bounds", "top").toInt32();
+CPPUNIT_ASSERT(nRectangle1 < nRectangle2);
+
+assertXPath(pXmlDoc, 
"/root/page/body/txt/anchored/SwAnchoredDrawObject[3]/sdrObject", "name", 
"Rectangle 3");
+sal_Int32 nRectangle3 = getXPath(pXmlDoc, 
"/root/page/body/txt/anchored/SwAnchoredDrawObject[3]/bounds", "top").toInt32();
+// This failed: the 3rd rectangle had a smaller "top" value than the 2nd 
one, it even overlapped with the 1st one.
+CPPUNIT_ASSERT(nRectangle2 < nRectangle3);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 

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

2014-07-11 Thread Sourav
 sw/inc/authfld.hxx|3 +++
 sw/inc/fldbas.hxx |2 ++
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   10 ++
 sw/source/core/fields/authfld.cxx |   22 ++
 sw/source/core/fields/fldbas.cxx  |6 ++
 sw/source/filter/ww8/docxattributeoutput.cxx  |2 +-
 sw/source/filter/ww8/ww8atr.cxx   |5 ++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 +++---
 8 files changed, 41 insertions(+), 15 deletions(-)

New commits:
commit f021524aadfe1aa1a07f4600bcb89e7c69ccfdb0
Author: Sourav sourav.maha...@synerzip.com
Date:   Wed Jun 25 12:32:59 2014 +0530

fdo#76279 Invalid Citation on RoundTrip

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

Change-Id: Idfe39761180ae1eeb0066ae3aac13de6ac6df0b9

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index e2b006b..6e3926b 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -153,6 +153,9 @@ public:
 /// For internal use only, in general continue using ExpandField() instead.
 OUString ConditionalExpand(ToxAuthorityField eField) const;
 
+//To handle Citation
+OUString ExpandCitation(ToxAuthorityField eField) const;
+
 SwAuthorityField(SwAuthorityFieldType* pType, const OUString 
rFieldContents);
 SwAuthorityField(SwAuthorityFieldType* pType, sal_IntPtr nHandle);
 virtual ~SwAuthorityField();
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 0d1724f..f6893e8 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -319,6 +319,8 @@ public:
   */
 OUStringExpandField(bool const bCached, ToxAuthorityField 
eField = AUTH_FIELD_IDENTIFIER) const;
 
+OUStringExpandCitation(ToxAuthorityField eField = 
AUTH_FIELD_IDENTIFIER) const;
+
 /// @return name or content.
 virtual OUStringGetFieldName() const;
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4c48e95..76c3fb9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3000,14 +3000,8 @@ DECLARE_OOXMLEXPORT_TEST(testCitation,FDO74775.docx)
 xmlDocPtr pXmlDoc = parseExport();
 if (!pXmlDoc)
 return;
-xmlXPathObjectPtr pXmlObj = 
getXPathNode(pXmlDoc,/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[3]/w:instrText);
-xmlNodeSetPtr pXmlNodes = pXmlObj-nodesetval;
-CPPUNIT_ASSERT(pXmlNodes != 0);
-CPPUNIT_ASSERT(pXmlNodes-nodeNr  0);
-xmlNodePtr pXmlNode = pXmlNodes-nodeTab[0];
-OUString contents = OUString::createFromAscii((const 
char*)((pXmlNode-children[0]).content));
-CPPUNIT_ASSERT(contents.match( CITATION [Kra06]));
-xmlXPathFreeObject(pXmlObj);
+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));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo76016, fdo76016.docx)
diff --git a/sw/source/core/fields/authfld.cxx 
b/sw/source/core/fields/authfld.cxx
index 4cfaf6a..2eff387 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -569,6 +569,28 @@ OUString 
SwAuthorityField::ConditionalExpand(ToxAuthorityField eField) const
 return sRet;
 }
 
+OUString SwAuthorityField::ExpandCitation(ToxAuthorityField eField) const
+{
+SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp();
+OUString sRet;
+
+if( pAuthType-IsSequence() )
+{
+   if(!pAuthType-GetDoc()-IsExpFldsLocked())
+   m_nTempSequencePos = pAuthType-GetSequencePos( m_nHandle );
+   if( m_nTempSequencePos = 0 )
+   sRet += OUString::number( m_nTempSequencePos );
+}
+else
+{
+const SwAuthEntry* pEntry = pAuthType-GetEntryByHandle(m_nHandle);
+//TODO: Expand to: identifier, number sequence, ...
+if(pEntry)
+sRet += pEntry-GetAuthorField(eField);
+}
+return sRet;
+}
+
 SwField* SwAuthorityField::Copy() const
 {
 SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp();
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 90600e2..0827a7f 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -405,6 +405,12 @@ OUString SwField::ExpandField(bool const bCached, 
ToxAuthorityField eField) cons
 return Expand();
 }
 
+OUString SwField::ExpandCitation(ToxAuthorityField eField) const
+{
+const SwAuthorityField* pAuthorityField = static_castconst 
SwAuthorityField*(this);
+return (pAuthorityField ? pAuthorityField-ExpandCitation(eField) : 
OUString());
+}
+
 SwField * SwField::CopyField() const
 {
 SwField *const pNew = Copy();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 

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

2014-04-10 Thread YogeshBharate
 sw/inc/tox.hxx |   19 +++
 sw/inc/unomap.hxx  |1 
 sw/inc/unoprnms.hxx|1 
 sw/qa/extras/ooxmlexport/data/IndexFieldFlagF.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx   |   11 +
 sw/source/core/tox/tox.cxx |7 +
 sw/source/core/unocore/unoidx.cxx  |   25 +
 sw/source/core/unocore/unomap.cxx  |1 
 sw/source/filter/ww8/ww8atr.cxx|   11 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |8 ++
 writerfilter/source/dmapper/PropertyIds.cxx|1 
 writerfilter/source/dmapper/PropertyIds.hxx|1 
 12 files changed, 86 insertions(+)

New commits:
commit a7bc9c1e4977bd3430df69287fa0a8377a686c58
Author: YogeshBharate yogesh.bhar...@synerzip.com
Date:   Fri Apr 4 15:56:03 2014 +0530

fdo#77051: Preservation of Index field flag '\f'.

Problem Description:
- In LibreOffice, the index field flag '\f' was not
  getting preserved after roundtrip as there was no
  support for it.
- '\f' field flag is used for Specific Entry Type.
  ex. In our case it is Syn

Implementation:
- Provided import  export support for Index field flag '\f'
  and added UT for the same.

Change-Id: I97c2456dd73c8bdf89ab105f8cac71bf7e2ad164
Reviewed-on: https://gerrit.libreoffice.org/8839
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 360f1d4..859374f 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -67,6 +67,7 @@ class SW_DLLPUBLIC SwTOXMark
 
 sal_uInt16  nLevel;
 OUStringm_aBookmarkName;
+OUStringm_aEntryTypeName;   // stored specific entry type name for 
INDEX field \f
 sal_BoolbAutoGenerated : 1; // generated using a concordance file
 sal_BoolbMainEntry : 1; // main entry emphasized by character 
style
 
@@ -107,6 +108,8 @@ public:
 inline sal_uInt16   GetLevel() const;
 inline void SetBookmarkName( const OUString bName);
 inline OUString GetBookmarkName() const;
+inline void SetEntryTypeName( const OUString sName);
+inline OUString GetEntryTypeName() const;
 
 // for alphabetical index only
 inline void SetPrimaryKey(const OUString rStr );
@@ -394,6 +397,7 @@ namespace nsSwTOXElement
 const SwTOXElement TOX_BOOKMARK = 1024;
 const SwTOXElement TOX_NEWLINE  = 2048;
 const SwTOXElement TOX_PARAGRAPH_OUTLINE_LEVEL = 4096;
+const SwTOXElement TOX_INDEX_ENTRY_TYPE   = 8192;
 }
 
 typedef sal_uInt16 SwTOIOptions;
@@ -438,6 +442,7 @@ class SW_DLLPUBLIC SwTOXBase : public SwClient
 OUStringaName;  // unique name
 OUStringaTitle; // title
 OUStringm_aBookmarkName;  //Bookmark Name
+OUStringm_aEntryTypeName;   // Type name
 
 OUStringsMainEntryCharStyle; // name of the character style applied to 
main index entries
 
@@ -507,6 +512,10 @@ public:
 OUStringGetMainEntryCharStyle() const {return 
sMainEntryCharStyle;}
 voidSetMainEntryCharStyle(const OUString rSet)  
{sMainEntryCharStyle = rSet;}
 
+// for record the Index field expression of MS Word
+OUString GetEntryTypeName() const;
+void  SetEntryTypeName(const OUString sName);
+
 // content index only
 inline void SetLevel(sal_uInt16);   // 
consider outline level
 inline sal_uInt16   GetLevel() const;
@@ -584,6 +593,9 @@ inline OUString SwTOXMark::GetAlternativeText() const
 inline OUString SwTOXMark::GetBookmarkName() const
 {   return m_aBookmarkName;}
 
+inline OUString SwTOXMark::GetEntryTypeName() const
+{   return m_aEntryTypeName;}
+
 inline const SwTOXType* SwTOXMark::GetTOXType() const
 { return (SwTOXType*)GetRegisteredIn(); }
 
@@ -600,6 +612,10 @@ inline void SwTOXMark::SetBookmarkName(const OUString 
bName)
 m_aBookmarkName = bName;
 }
 
+inline void SwTOXMark::SetEntryTypeName(const OUString sName)
+{
+m_aEntryTypeName = sName;
+}
 inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
 {
 SAL_WARN_IF( GetTOXType()  GetTOXType()-GetType() == TOX_INDEX, sw, 
Wrong type);
@@ -730,6 +746,9 @@ inline OUString SwTOXBase::GetTitle() const
 inline OUString SwTOXBase::GetBookmarkName() const
 { return m_aBookmarkName; }
 
+inline OUString SwTOXBase::GetEntryTypeName() const
+{ return m_aEntryTypeName; }
+
 inline OUString SwTOXBase::GetTypeName() const
 { return GetTOXType()-GetTypeName();  }
 
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 93c3fc5..cdd60de 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -220,6 +220,7 @@
 #define 

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

2014-03-14 Thread Rohit Deshmukh
 sw/inc/authfld.hxx|3 
 sw/inc/fldbas.hxx |4 -
 sw/inc/poolfmt.hrc|1 
 sw/inc/shellres.hxx   |1 
 sw/inc/tox.hxx|   15 
 sw/inc/toxe.hxx   |3 
 sw/qa/extras/ooxmlexport/data/FDO74775.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   10 ++
 sw/source/core/doc/docnew.cxx |2 
 sw/source/core/doc/doctxm.cxx |4 -
 sw/source/core/fields/authfld.cxx |7 +
 sw/source/core/fields/fldbas.cxx  |   11 ++-
 sw/source/core/tox/tox.cxx|2 
 sw/source/core/uibase/index/toxmgr.cxx|1 
 sw/source/core/uibase/utlui/initui.cxx|1 
 sw/source/core/uibase/utlui/initui.hrc|1 
 sw/source/core/uibase/utlui/initui.src|6 +
 sw/source/core/unocore/unoidx.cxx |   19 +
 sw/source/filter/ww8/docxattributeoutput.cxx  |   11 ++-
 sw/source/filter/ww8/fields.cxx   |3 
 sw/source/filter/ww8/fields.hxx   |3 
 sw/source/filter/ww8/ww8atr.cxx   |8 ++
 sw/source/ui/index/cnttab.cxx |3 
 sw/source/ui/utlui/poolfmt.src|4 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   80 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |1 
 writerfilter/source/dmapper/FieldTypes.hxx|7 +
 27 files changed, 198 insertions(+), 13 deletions(-)

New commits:
commit 06f7d1a96eef5aa69d4872ff6d96eb5085296d09
Author: Rohit Deshmukh rohit.deshm...@synerzip.com
Date:   Wed Mar 12 15:07:38 2014 +0530

fdo#74775: Preseved Citation after round trip.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/8473

Change-Id: Ie1b0ac3cb4d4b9bf305323599d5e4b63f913fb1b

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 55ed5b7..a26cc6d 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -150,6 +150,9 @@ class SwAuthorityField : public SwField
 virtual SwField*Copy() const;
 
 public:
+/// For internal use only, in general continue using ExpandField() instead.
+OUString ConditionalExpand(ToxAuthorityField eField) const;
+
 SwAuthorityField(SwAuthorityFieldType* pType, const OUString 
rFieldContents);
 SwAuthorityField(SwAuthorityFieldType* pType, sal_IntPtr nHandle);
 ~SwAuthorityField();
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 26df00f..90cd505 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -26,7 +26,7 @@
 #include com/sun/star/uno/Any.hxx
 #include cppuhelper/weakref.hxx
 #include vector
-
+#include toxe.hxx
 class SwDoc;
 class SvNumberFormatter;
 
@@ -317,7 +317,7 @@ public:
 SwTxtFormatter::NewFldPortion() sets things up properly.
 @return the generated text (suitable for display)
   */
-OUStringExpandField(bool const bCached) const;
+OUStringExpandField(bool const bCached, ToxAuthorityField 
eField = AUTH_FIELD_IDENTIFIER) const;
 
 /// @return name or content.
 virtual OUStringGetFieldName() const;
diff --git a/sw/inc/poolfmt.hrc b/sw/inc/poolfmt.hrc
index c9c87c6..423fad5 100644
--- a/sw/inc/poolfmt.hrc
+++ b/sw/inc/poolfmt.hrc
@@ -221,6 +221,7 @@
 #define STR_POOLCOLL_TOX_USER9  (RC_POOLCOLL_REGISTER_BEGIN+ 34)
 #define STR_POOLCOLL_TOX_USER10 (RC_POOLCOLL_REGISTER_BEGIN+ 35)
 
+#define STR_POOLCOLL_TOX_CITATION   (RC_POOLCOLL_REGISTER_BEGIN+ 36)
 
 // Category Chapter/Document
 #define STR_POOLCOLL_DOC_TITEL  (RC_POOLCOLL_DOC_BEGIN+ 0)
diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx
index df10cbd..60ab4a1 100644
--- a/sw/inc/shellres.hxx
+++ b/sw/inc/shellres.hxx
@@ -63,6 +63,7 @@ struct SW_DLLPUBLIC ShellResource : public Resource
 OUStringaTOXObjectsName;
 OUStringaTOXTablesName;
 OUStringaTOXAuthoritiesName;
+OUStringaTOXCitationName;
 
 OUStringaLinkCtrlClick;
 OUStringaLinkClick;
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index ee3b6c6..f6c578f 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -56,6 +56,7 @@ class SW_DLLPUBLIC SwTOXMark
 OUString aAltText;// Text of caption is different.
 OUString aPrimaryKey;
 OUString aSecondaryKey;
+OUString aCitationKeyReading;
 
 // three more strings for phonetic sorting
 OUString aTextReading;
@@ -113,12 +114,14 @@ public:
 inline void SetTextReading(const OUString rStr);
 inline void SetPrimaryKeyReading(const OUString rStr );
 inline void SetSecondaryKeyReading(const OUString rStr);
+inline void 

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

2014-02-26 Thread Rohit Deshmukh
 sw/inc/toxe.hxx   |3 -
 sw/qa/extras/ooxmlexport/data/FDO75133.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   11 +
 sw/source/core/doc/doctxm.cxx |6 ++
 sw/source/core/inc/doctxm.hxx |5 +-
 sw/source/core/tox/tox.cxx|1 
 sw/source/filter/ww8/fields.cxx   |3 -
 sw/source/filter/ww8/fields.hxx   |3 -
 sw/source/filter/ww8/ww8atr.cxx   |5 +-
 sw/source/ui/inc/cnttab.hxx   |1 
 sw/source/ui/index/cnttab.cxx |3 +
 sw/source/ui/index/toxmgr.cxx |   25 +++
 writerfilter/source/dmapper/DomainMapper.cxx  |4 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   48 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |8 +++
 writerfilter/source/dmapper/FieldTypes.hxx|5 +-
 16 files changed, 114 insertions(+), 17 deletions(-)

New commits:
commit 598d02d71f40901eab9275704c8bc0e1641b56e3
Author: Rohit Deshmukh rohit.deshm...@synerzip.com
Date:   Tue Feb 18 12:23:14 2014 +0530

fdo#75133: Preseved bibliography after round trip.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
writerfilter/source/dmapper/DomainMapper_Impl.hxx
Reviewed on:
https://gerrit.libreoffice.org/8124

Change-Id: Ieaea19600fbda3b536549a1a100f847f9ae3654b

diff --git a/sw/inc/toxe.hxx b/sw/inc/toxe.hxx
index 7de90e2..943a8e6 100644
--- a/sw/inc/toxe.hxx
+++ b/sw/inc/toxe.hxx
@@ -41,7 +41,8 @@ enum TOXTypes
 TOX_ILLUSTRATIONS,
 TOX_OBJECTS,
 TOX_TABLES,
-TOX_AUTHORITIES
+TOX_AUTHORITIES,
+TOX_BIBLIOGRAPHY
 };
 // this enum contains all types of sources
 enum ToxAuthorityType
diff --git a/sw/qa/extras/ooxmlexport/data/FDO75133.docx 
b/sw/qa/extras/ooxmlexport/data/FDO75133.docx
new file mode 100644
index 000..93170dd
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/FDO75133.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 337a69b..4d6e3b7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3715,6 +3715,17 @@ 
DECLARE_OOXMLEXPORT_TEST(testAlphabeticalIndex_AutoColumn,alphabeticalIndex_Aut
 assertXPath(pXmlDoc, /w:document/w:body/w:p/w:pPr/w:sectPr, 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testBibliography,FDO75133.docx)
+{
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+xmlNodeSetPtr pXmlNodes = 
getXPathNode(pXmlDoc,/w:document/w:body/w:p[3]/w:r[2]/w:instrText);
+xmlNodePtr pXmlNode = pXmlNodes-nodeTab[0];
+OUString contents = OUString::createFromAscii((const 
char*)((pXmlNode-children[0]).content));
+CPPUNIT_ASSERT(contents.match( BIBLIOGRAPHY ));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index ad894df..6ff26a53 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -463,6 +463,7 @@ const SwTOXBase* SwDoc::GetDefaultTOXBase( TOXTypes eTyp, 
bool bCreate )
 case  TOX_OBJECTS:  prBase = mpDefTOXBases-pObjBase;  break;
 case  TOX_ILLUSTRATIONS:prBase = mpDefTOXBases-pIllBase;  break;
 case  TOX_AUTHORITIES:  prBase = mpDefTOXBases-pAuthBase; break;
+case  TOX_BIBLIOGRAPHY:  prBase = mpDefTOXBases-pBiblioBase; break;
 }
 if(!(*prBase)  bCreate)
 {
@@ -485,6 +486,7 @@ voidSwDoc::SetDefaultTOXBase(const SwTOXBase rBase)
 case  TOX_OBJECTS:  prBase = mpDefTOXBases-pObjBase;  break;
 case  TOX_ILLUSTRATIONS:prBase = mpDefTOXBases-pIllBase;  break;
 case  TOX_AUTHORITIES:  prBase = mpDefTOXBases-pAuthBase; break;
+case  TOX_BIBLIOGRAPHY:  prBase = mpDefTOXBases-pBiblioBase; break;
 }
 if(*prBase)
 delete (*prBase);
@@ -1087,7 +1089,9 @@ SwTxtFmtColl* SwTOXBaseSection::GetTxtFmtColl( sal_uInt16 
nLevel )
 case TOX_ILLUSTRATIONS: nPoolFmt = RES_POOLCOLL_TOX_ILLUSH; break;
 case TOX_OBJECTS:   nPoolFmt = RES_POOLCOLL_TOX_OBJECTH;break;
 case TOX_TABLES:nPoolFmt = RES_POOLCOLL_TOX_TABLESH;break;
-case TOX_AUTHORITIES:   nPoolFmt = RES_POOLCOLL_TOX_AUTHORITIESH; 
break;
+case TOX_AUTHORITIES:
+case TOX_BIBLIOGRAPHY:
+nPoolFmt = RES_POOLCOLL_TOX_AUTHORITIESH; break;
 
 case TOX_CONTENT:
 // There's a jump in the ContentArea!
diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx
index d2e30a9..65cea1f 100644
--- a/sw/source/core/inc/doctxm.hxx
+++ b/sw/source/core/inc/doctxm.hxx
@@ -100,6 +100,7 @@ struct SwDefTOXBase_Impl
 SwTOXBase* pObjBase;
 SwTOXBase* pIllBase;
 SwTOXBase* pAuthBase;
+SwTOXBase* pBiblioBase;
 
 SwDefTOXBase_Impl() :
 

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

2014-01-20 Thread Pallavi Jadhav
 sw/inc/tox.hxx|1 
 sw/inc/unomap.hxx |1 
 sw/inc/unoprnms.hxx   |1 
 sw/qa/extras/ooxmlexport/data/testTOCFlag_u.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   16 +
 sw/source/core/unocore/unoidx.cxx |3 
 sw/source/core/unocore/unomap.cxx |2 
 sw/source/filter/ww8/ww8atr.cxx   |  227 +++---
 sw/source/ui/index/cntex.cxx  |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 
 writerfilter/source/dmapper/PropertyIds.cxx   |1 
 writerfilter/source/dmapper/PropertyIds.hxx   |1 
 12 files changed, 145 insertions(+), 113 deletions(-)

New commits:
commit 04a7ac6f062e9296eb643180cf54345bcdb260c4
Author: Pallavi Jadhav pallavi.jad...@synerzip.com
Date:   Thu Dec 26 19:08:16 2013 +0530

fdo#69613 : Fix for TOC with flag '\u' should get preserved after RT.

Issue :
DOCX contatining TOC Code field '\u' was not getting
preserved after RT.

Implementation :
1] Provided import  export support for TOC field flag '\u'.
2] Written export Unit Test for code field '\u'.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7202

Change-Id: I43872c7db21c25e0586bf874d5bb0c9115ab76af

diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 4a60fc3..9e4efeb 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -393,6 +393,7 @@ namespace nsSwTOXElement
 const SwTOXElement TOX_TAB_IN_TOC   = 512;
 const SwTOXElement TOX_BOOKMARK = 1024;
 const SwTOXElement TOX_NEWLINE  = 2048;
+const SwTOXElement TOX_PARAGRAPH_OUTLINE_LEVEL = 4096;
 }
 
 typedef sal_uInt16 SwTOIOptions;
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 060d0ae..084abde 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -220,6 +220,7 @@
 #define WID_SECONDARY_KEY_READING   1060
 #define WID_TOC_BOOKMARK1061
 #define WID_TOC_NEWLINE 1062
+#define WID_TOC_PARAGRAPH_OUTLINE_LEVEL 1063
 
 // Text document
 #define WID_DOC_CHAR_COUNT  1000
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 85e478c..0065f12 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -125,6 +125,7 @@
 #define UNO_NAME_TAB_IN_TOC TabInTOC
 #define UNO_NAME_TOC_BOOKMARK TOCBookmark
 #define UNO_NAME_TOC_NEWLINE TOCNewLine
+#define UNO_NAME_TOC_PARAGRAPH_OUTLINE_LEVEL TOCParagraphOutlineLevel
 
 #define UNO_NAME_CHAR_FLASH CharFlash
 #define UNO_NAME_CHAR_KERNING CharKerning
diff --git a/sw/qa/extras/ooxmlexport/data/testTOCFlag_u.docx 
b/sw/qa/extras/ooxmlexport/data/testTOCFlag_u.docx
new file mode 100644
index 000..077bccf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/testTOCFlag_u.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index fe92247..56d6acb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2348,7 +2348,7 @@ 
DECLARE_OOXMLEXPORT_TEST(testFieldFlagO,TOC_field_f.docx)
 xmlNodeSetPtr pXmlNodes = 
getXPathNode(pXmlDoc,/w:document/w:body/w:p[2]/w:r[2]/w:instrText);
 xmlNodePtr pXmlNode = pXmlNodes-nodeTab[0];
 OUString contents = OUString::createFromAscii((const 
char*)((pXmlNode-children[0]).content));
-CPPUNIT_ASSERT(contents.match( TOC \\z \\f \\o \1-3\ \\h));
+CPPUNIT_ASSERT(contents.match( TOC \\z \\f \\o \1-3\ \\u \\h));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTOCFlag_f, toc_doc.docx)
@@ -2517,6 +2517,20 @@ DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, 
shape-theme-preservation.d
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00b050), 
getPropertysal_Int32(getShape(3), FillColor));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTOCFlag_u,testTOCFlag_u.docx)
+{
+// DOCX contaning TOC should preserve code field '\u'.
+xmlDocPtr pXmlDoc = parseExport(word/document.xml);
+if (!pXmlDoc)
+return;
+// FIXME p[2] will have to be p[1], once the TOC import code is fixed
+// not to insert an empty paragraph before TOC.
+xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, 
/w:document/w:body/w:p[2]/w:r[2]/w:instrText);
+xmlNodePtr pXmlNode = pXmlNodes-nodeTab[0];
+OUString contents = OUString::createFromAscii((const 
char*)((pXmlNode-children[0]).content));
+CPPUNIT_ASSERT(contents.match( TOC \\z \\o \1-9\ \\u \\h));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unoidx.cxx 
b/sw/source/core/unocore/unoidx.cxx
index 7aa85ff..1172c8a 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -662,6 +662,9 @@ throw (beans::UnknownPropertyException, 
beans::PropertyVetoException,
 case WID_CREATE_FROM_OUTLINE:
 

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

2014-01-13 Thread YogeshBharate
 sw/inc/tox.hxx   |1 +
 sw/inc/unomap.hxx|1 +
 sw/inc/unoprnms.hxx  |1 +
 sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   11 +++
 sw/source/core/unocore/unoidx.cxx|3 +++
 sw/source/core/unocore/unomap.cxx|2 ++
 sw/source/filter/ww8/docxattributeoutput.cxx |5 +
 sw/source/filter/ww8/wrtww8.hxx  |1 +
 sw/source/filter/ww8/ww8atr.cxx  |5 +
 sw/source/ui/index/cntex.cxx |1 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|   12 +++-
 writerfilter/source/dmapper/PropertyIds.cxx  |1 +
 writerfilter/source/dmapper/PropertyIds.hxx  |1 +
 14 files changed, 40 insertions(+), 5 deletions(-)

New commits:
commit 8e634d0d557bcad6bf56adb30d202e88675f17d1
Author: YogeshBharate yogesh.bhar...@synerzip.com
Date:   Tue Dec 31 12:58:21 2013 +0530

fdo#69613: Code changes for TOC with flag '\w' should get preserved after 
RT.

Issue :
TOC field flag '\w' was not getting preserved after RT.

Implementation :
Provided import  export support for TOC field flag '\w'.

XML file difference :
In document.xml,

Before - w:instrText
TOC \o 1-3 \h \z \w
/w:instrText

After - w:instrText
TOC \w \o 1-3 \o 1-3 \h
/w:instrText

Conflicts:
sw/inc/tox.hxx
sw/inc/unomap.hxx
sw/inc/unoprnms.hxx
sw/source/core/unocore/unomap.cxx
sw/source/filter/ww8/ww8atr.cxx
sw/source/ui/index/cntex.cxx
writerfilter/source/dmapper/DomainMapper_Impl.cxx
writerfilter/source/dmapper/PropertyIds.cxx
writerfilter/source/dmapper/PropertyIds.hxx
Reviewed on:
https://gerrit.libreoffice.org/7238

Change-Id: Ia5d602c6db0b59933d325058ce2d8111e4f03df5

diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 3f54ad9..c4252a1 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -399,6 +399,7 @@ namespace nsSwTOXElement
 const SwTOXElement TOX_FRAME= 64;
 const SwTOXElement TOX_SEQUENCE = 128;
 const SwTOXElement TOX_TABLEADER= 256;
+const SwTOXElement TOX_TAB_IN_TOC   = 512;
 }
 
 typedef sal_uInt16 SwTOIOptions;
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index d3c983a..e9e63a7 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -179,6 +179,7 @@
 #define WID_LEVEL_FORMAT1021
 #define WID_LEVEL_PARAGRAPH_STYLES  1022
 #define WID_HIDE_TABLEADER_PAGENUMBERS  1023
+#define WID_TAB_IN_TOC  1024
 #define WID_MAIN_ENTRY_CHARACTER_STYLE_NAME 1025
 #define WID_CREATE_FROM_TABLES  1026
 #define WID_CREATE_FROM_TEXT_FRAMES 1027
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 674d984..da63af3 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -122,6 +122,7 @@
 #define UNO_NAME_CHAR_ESCAPEMENT_HEIGHT CharEscapementHeight
 #define UNO_NAME_CHAR_COLOR CharColor
 #define UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS HideTabLeaderAndPageNumber
+#define UNO_NAME_TAB_IN_TOC TabInTOC
 
 #define UNO_NAME_CHAR_FLASH CharFlash
 #define UNO_NAME_CHAR_KERNING CharKerning
diff --git a/sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docx 
b/sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docx
new file mode 100644
index 000..ac294fd
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/PreserveWfieldTOC.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index fb09a20..6dd2669 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2359,6 +2359,17 @@ 
DECLARE_OOXMLEXPORT_TEST(testPreserveZfield,preserve_Z_field_TOC.docx)
 CPPUNIT_ASSERT(contents.match( TOC \\z \\f \\o \1-3\ \\h));
 }
 
+ DECLARE_OOXMLEXPORT_TEST(testPreserveWfieldTOC, PreserveWfieldTOC.docx)
+{
+ xmlDocPtr pXmlDoc = parseExport(word/document.xml);
+if (!pXmlDoc)
+return;
+xmlNodeSetPtr pXmlNodes = 
getXPathNode(pXmlDoc,/w:document/w:body/w:p[2]/w:r[2]/w:instrText);
+xmlNodePtr pXmlNode = pXmlNodes-nodeTab[0];
+OUString contents = OUString::createFromAscii((const 
char*)((pXmlNode-children[0]).content));
+   CPPUNIT_ASSERT(contents.match( TOC \\z \\w \\f \\o \1-3\ \\h));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unoidx.cxx 
b/sw/source/core/unocore/unoidx.cxx
index d9c1c17..33942aa 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -655,6 +655,9 @@ throw (beans::UnknownPropertyException, 
beans::PropertyVetoException,
 case WID_CREATE_FROM_OUTLINE: