[Libreoffice-commits] core.git: leak-suppress.txt

2014-05-22 Thread Stephan Bergmann
 leak-suppress.txt |9 +
 1 file changed, 9 insertions(+)

New commits:
commit e72d794b3911eef7ed480fa895fa0b4ea0951f92
Author: Stephan Bergmann 
Date:   Thu May 22 10:52:06 2014 +0200

Moved leak-suppress.txt from dev-tools to core repo

from 
196396ffc72bbb1e4f9bbc8ff83432e22bf638af:leak-sanitizer/leak-suppress.txt

Change-Id: Icc7bab46de7a8e63ce149fd0277283f267fb2931

diff --git a/leak-suppress.txt b/leak-suppress.txt
new file mode 100644
index 000..5e99d64
--- /dev/null
+++ b/leak-suppress.txt
@@ -0,0 +1,9 @@
+
+#uno typelib
+leak:cppu/source/typelib/typelib.cxx
+
+# uno component context
+leak:cppu::defaultBootstrap_InitialComponentContext
+
+# global objects
+leak:SfxFilterContainer::ReadSingleFilter_Impl
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 3 commits - include/vcl vcl/Library_vcl.mk vcl/source

2014-05-22 Thread Michael Meeks
 include/vcl/debugevent.hxx   |   36 
 include/vcl/window.hxx   |3 
 vcl/Library_vcl.mk   |1 
 vcl/source/app/svmain.cxx|5 
 vcl/source/window/debugevent.cxx |  281 +++
 vcl/source/window/window.cxx |   12 +
 6 files changed, 338 insertions(+)

New commits:
commit 344dc7fd0684acc31f4c18e99e65bfa6700c9c64
Author: Michael Meeks 
Date:   Thu May 8 21:59:45 2014 +0100

Make the inserted text more European and sensible for now.

Change-Id: I8b2ecef11362c0fc1dc2b76780140881e769bb89

diff --git a/include/vcl/debugevent.hxx b/include/vcl/debugevent.hxx
index ce31570..2700324 100644
--- a/include/vcl/debugevent.hxx
+++ b/include/vcl/debugevent.hxx
@@ -20,7 +20,7 @@ class VCL_DLLPUBLIC DebugEventInjector : Timer {
   DebugEventInjector( sal_uInt32 nMaxEvents );
 
   Window *ChooseWindow();
-  void InjectKeyEvent();
+  void InjectTextEvent();
   void InjectMenuEvent();
   void InjectMouseEvent();
   void InjectEvent();
diff --git a/vcl/source/window/debugevent.cxx b/vcl/source/window/debugevent.cxx
index 37ca716..e83909e 100644
--- a/vcl/source/window/debugevent.cxx
+++ b/vcl/source/window/debugevent.cxx
@@ -7,7 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include 
+// #include 
 #include 
 #include 
 #include 
@@ -110,11 +110,11 @@ void DebugEventInjector::InjectMenuEvent()
 SalMenuEvent aEvent = aIds[ getRandom() * aIds.size() ];
 bool bHandled = ImplWindowFrameProc( pSysWin, NULL, nEvent, &aEvent);
 
-fprintf( stderr, "Injected menu event %p (%d) '%s' -> %d\n",
+/*fprintf( stderr, "Injected menu event %p (%d) '%s' -> %d\n",
  aEvent.mpMenu, aEvent.mnId,
  OUStringToOString( ((Menu *)aEvent.mpMenu)->GetItemText( 
aEvent.mnId ),
 RTL_TEXTENCODING_UTF8 ).getStr(),
- (int)bHandled);
+ (int)bHandled); */
 }
 
 static void InitKeyEvent( SalKeyEvent &rKeyEvent )
@@ -131,22 +131,43 @@ static void InitKeyEvent( SalKeyEvent &rKeyEvent )
 rKeyEvent.mnRepeat = 0;
 }
 
-void DebugEventInjector::InjectKeyEvent()
+void DebugEventInjector::InjectTextEvent()
 {
 SalKeyEvent aKeyEvent;
 Window *pWindow = ChooseWindow();
 
 InitKeyEvent( aKeyEvent );
-sal_uInt16 nCode = getRandom() * KEY_CODE;
-if( getRandom() < 0.05 ) // modifier
-nCode |= (sal_uInt16)( getRandom() * KEY_MODTYPE ) & KEY_MODTYPE;
 
-aKeyEvent.mnCode = nCode;
-aKeyEvent.mnCharCode = getRandom() * 0x;
+if (getRandom() < 0.10) // Occasionally a truly random event
+{
+aKeyEvent.mnCode = getRandom() * KEY_CODE;
+aKeyEvent.mnCharCode = getRandom() * 0x;
+}
+else
+{
+struct {
+sal_uInt16 nCodeStart, nCodeEnd;
+char   aCharStart;
+} nTextCodes[] = {
+{ KEY_0, KEY_9, '0' },
+{ KEY_A, KEY_Z, 'a' }
+};
+
+size_t i = getRandom() * SAL_N_ELEMENTS( nTextCodes );
+int offset = trunc( getRandom() * ( nTextCodes[i].nCodeEnd - 
nTextCodes[i].nCodeStart ) );
+aKeyEvent.mnCode = nTextCodes[i].nCodeStart + offset;
+aKeyEvent.mnCharCode = nTextCodes[i].aCharStart + offset;
+//fprintf( stderr, "Char '%c' offset %d into record %d base '%c'\n",
+// aKeyEvent.mnCharCode, offset, (int)i, 
nTextCodes[i].aCharStart );
+}
+
+if( getRandom() < 0.05 ) // modifier
+aKeyEvent.mnCode |= (sal_uInt16)( getRandom() * KEY_MODTYPE ) & 
KEY_MODTYPE;
 
 bool bHandled = ImplWindowFrameProc( pWindow, NULL, SALEVENT_KEYINPUT, 
&aKeyEvent);
-fprintf (stderr, "Injected key 0x%x -> %d win %p\n",
- (int) aKeyEvent.mnCode, (int)bHandled, pWindow);
+//fprintf( stderr, "Injected key 0x%x -> %d win %p\n",
+// (int) aKeyEvent.mnCode, (int)bHandled, pWindow );
+ImplWindowFrameProc( pWindow, NULL, SALEVENT_KEYUP, &aKeyEvent );
 }
 
 /*
@@ -155,12 +176,14 @@ void DebugEventInjector::InjectKeyEvent()
  */
 void DebugEventInjector::InjectEvent()
 {
+//fprintf( stderr, "%6d - ", (int)mnEventsLeft );
+
 double nRand = getRandom();
-if (nRand < 0.50)
+if (nRand < 0.30)
 {
 int nEvents = getRandom() * 10;
 for (int i = 0; i < nEvents; i++)
-InjectKeyEvent();
+InjectTextEvent();
 }
 else if (nRand < 0.60)
 InjectKeyNavEdit();
@@ -222,8 +245,8 @@ void DebugEventInjector::InjectKeyNavEdit()
 aKeyEvent.mnCharCode = 0x0; // hopefully unused.
 
 bool bHandled = ImplWindowFrameProc( pWindow, NULL, SALEVENT_KEYINPUT, 
&aKeyEvent );
-fprintf( stderr, "Injected edit / move key 0x%x -> %d win %p\n",
- (int) aKeyEvent.mnCode, (int)bHandled, pWindow );
+//fprintf( stderr, "Injected edit / move key 0x%x -> %d win %p\n",
+// (int) aKeyEvent.mnCode, (int)bHandled, pWindow );
 ImplWindowFrameProc( pWindow, NULL, SALEVENT_KEYUP, &aK

[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - oox/source

2014-05-22 Thread Miklos Vajna
 oox/source/core/xmlfilterbase.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b5e0ea4ae944482f43de447668758348ce0251c4
Author: Miklos Vajna 
Date:   Thu May 22 10:22:43 2014 +0200

oox: fix export of OOXML generator info

This time we did preserve this info, and we should not.

Change-Id: If2ddd7a266cd7da5642dc234411ce34e94bd3384
(cherry picked from commit 3bebb3c2d25601767e950de02f2d549acbdaa2d2)

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 14d50fc..746ba2e 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -658,7 +659,7 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< 
XDocumentProperties > xProp
 writeElement( pAppProps, XML_HyperlinksChanged, "hyperlinks changed" );
 writeElement( pAppProps, XML_DigSig,"digital signature" );
 #endif  /* def OOXTODO */
-writeElement( pAppProps, XML_Application,   
xProperties->getGenerator() );
+writeElement( pAppProps, XML_Application,   
utl::DocInfoHelper::GetGeneratorString() );
 #ifdef OOXTODO
 writeElement( pAppProps, XML_AppVersion,"app version" );
 writeElement( pAppProps, XML_DocSecurity,   "doc security" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - translations

2014-05-22 Thread Andras Timar
 translations |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9ec248e390f3384cbd1ff86f0f69af27ec1e8823
Author: Andras Timar 
Date:   Thu May 22 10:31:26 2014 +0200

Updated core
Project: translations  6a87b861c97099bc61e3d0156c7efdecd8707fed

diff --git a/translations b/translations
index 6c2c46d..6a87b86 16
--- a/translations
+++ b/translations
@@ -1 +1 @@
-Subproject commit 6c2c46db3641281b7f7a89a6e079fe2d4f5b0808
+Subproject commit 6a87b861c97099bc61e3d0156c7efdecd8707fed
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: translations

2014-05-22 Thread Andras Timar
 translations |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c39bf522eed16b5e53e3f955579692906579fc47
Author: Andras Timar 
Date:   Thu May 22 10:31:26 2014 +0200

Updated core
Project: translations  b31a57455b1bf9dcffd2cee0a4c79c4f6425dd6c

diff --git a/translations b/translations
index b1ee9c9..b31a574 16
--- a/translations
+++ b/translations
@@ -1 +1 @@
-Subproject commit b1ee9c9e1542b856cfe2412c6dffeeb5a353810a
+Subproject commit b31a57455b1bf9dcffd2cee0a4c79c4f6425dd6c
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source

2014-05-22 Thread Miklos Vajna
 oox/source/core/xmlfilterbase.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3bebb3c2d25601767e950de02f2d549acbdaa2d2
Author: Miklos Vajna 
Date:   Thu May 22 10:22:43 2014 +0200

oox: fix export of OOXML generator info

This time we did preserve this info, and we should not.

Change-Id: If2ddd7a266cd7da5642dc234411ce34e94bd3384

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 14d50fc..746ba2e 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -658,7 +659,7 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< 
XDocumentProperties > xProp
 writeElement( pAppProps, XML_HyperlinksChanged, "hyperlinks changed" );
 writeElement( pAppProps, XML_DigSig,"digital signature" );
 #endif  /* def OOXTODO */
-writeElement( pAppProps, XML_Application,   
xProperties->getGenerator() );
+writeElement( pAppProps, XML_Application,   
utl::DocInfoHelper::GetGeneratorString() );
 #ifdef OOXTODO
 writeElement( pAppProps, XML_AppVersion,"app version" );
 writeElement( pAppProps, XML_DocSecurity,   "doc security" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: external/clucene

2014-05-22 Thread Stephan Bergmann
 external/clucene/UnpackedTarball_clucene.mk |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit c1db9194a53f3da7688db3463309f65659e8
Author: Stephan Bergmann 
Date:   Thu May 22 10:28:05 2014 +0200

Record patch upstream notification

Change-Id: I102160cb6fac41f5ba3caa5cb947aebbcd62681f

diff --git a/external/clucene/UnpackedTarball_clucene.mk 
b/external/clucene/UnpackedTarball_clucene.mk
index d059241..93defa2 100644
--- a/external/clucene/UnpackedTarball_clucene.mk
+++ b/external/clucene/UnpackedTarball_clucene.mk
@@ -24,6 +24,8 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,clucene,0))
 #  http://sourceforge.net/mailarchive/message.php?msg_id=29143260
 # clucene-mutex.patch was proposed upstream, see
 #  http://sourceforge.net/mailarchive/message.php?msg_id=32314782
+# clucene-asan.patch was proposed upstream, see
+#  http://sourceforge.net/mailarchive/message.php?msg_id=32367781
 $(eval $(call gb_UnpackedTarball_add_patches,clucene,\
external/clucene/patches/clucene-debug.patch \
external/clucene/patches/clucene-multimap-put.patch \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-22 Thread Ravindra Vidhate
 sw/qa/extras/ooxmlexport/data/fdo78887.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   11 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   11 ++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 8555c24e069dc00071eaad23c711f1d1375e5afc
Author: Ravindra Vidhate 
Date:   Wed May 21 14:54:35 2014 +0530

fdo#78887  tag is not being preserved after export.

When we have  tag continuous like in the following cases...

"Title: Superstition\v\vComposer: Stevie Wonder\v\v"
or "\vLyrics: \v"

where "\n" is internally replaced by "\v" LO.

Before text "\v" or after text multiple "\v" is not preserved.

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

Change-Id: I2a6d0a7d2382dfbc2f0ab04f150653c9b17bbfd1

diff --git a/sw/qa/extras/ooxmlexport/data/fdo78887.docx 
b/sw/qa/extras/ooxmlexport/data/fdo78887.docx
new file mode 100644
index 000..db92fe4
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo78887.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a039e0b..a82f810 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3446,6 +3446,17 @@ DECLARE_OOXMLEXPORT_TEST(testfdo78886, "fdo78886.docx")
 assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:tbl[2]/w:tr[1]/w:tc[1]/w:p[1]/w:hyperlink[1]/w:r[2]/w:fldChar[1]",
 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFDO78887, "fdo78887.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+
+assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:br[1]", 1);
+assertXPathContent(pXmlDoc, 
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:t[1]", "Lyrics: ");
+assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:br[2]", 1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFdo78651, "fdo78651.docx")
 {
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index aafb31c..91562d7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1726,6 +1726,8 @@ void DocxAttributeOutput::RunText( const OUString& rText, 
rtl_TextEncoding /*eCh
 if ( m_pRedlineData && m_pRedlineData->GetType() == 
nsRedlineType_t::REDLINE_DELETE )
 nTextToken = XML_delText;
 
+sal_Unicode prevUnicode = *pBegin;
+
 for ( const sal_Unicode *pIt = pBegin; pIt < pEnd; ++pIt )
 {
 switch ( *pIt )
@@ -1733,20 +1735,26 @@ void DocxAttributeOutput::RunText( const OUString& 
rText, rtl_TextEncoding /*eCh
 case 0x09: // tab
 impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt );
 m_pSerializer->singleElementNS( XML_w, XML_tab, FSEND );
+prevUnicode = *pIt;
 break;
 case 0x0b: // line break
 {
-if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, 
pIt ))
+if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, 
pIt ) || (prevUnicode == *pIt))
+{
 m_pSerializer->singleElementNS( XML_w, XML_br, FSEND );
+prevUnicode = *pIt;
+}
 }
 break;
 case 0x1E: //non-breaking hyphen
 impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt );
 m_pSerializer->singleElementNS( XML_w, XML_noBreakHyphen, 
FSEND );
+prevUnicode = *pIt;
 break;
 case 0x1F: //soft (on demand) hyphen
 impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt );
 m_pSerializer->singleElementNS( XML_w, XML_softHyphen, FSEND );
+prevUnicode = *pIt;
 break;
 default:
 if ( *pIt < 0x0020 ) // filter out the control codes
@@ -1754,6 +1762,7 @@ void DocxAttributeOutput::RunText( const OUString& rText, 
rtl_TextEncoding /*eCh
 impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt 
);
 OSL_TRACE( "Ignored control code %x in a text run.", *pIt 
);
 }
+prevUnicode = *pIt;
 break;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-22 Thread Dinesh Patil
 sw/qa/extras/ooxmlexport/data/fdo78886.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |9 +
 sw/source/filter/ww8/docxattributeoutput.cxx |1 +
 3 files changed, 10 insertions(+)

New commits:
commit c5547beb47e6eb94cf917a319fcc426a36fed7af
Author: Dinesh Patil 
Date:   Tue May 20 15:29:27 2014 +0530

fdo#78886 File getting corrupted after Roundtrip due to fieldChar

In a hyperlink, extra field with fldCharType="end" is getting added
even though there is no begin and separate fldCharType. When hyperlink is
closing pageref was not set to false. Due to which LO was adding extra
end fldCharType.

Change-Id: I0f54ab03c38cec2888cf9a1638ec5435da90099c
Reviewed-on: https://gerrit.libreoffice.org/9414
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/fdo78886.docx 
b/sw/qa/extras/ooxmlexport/data/fdo78886.docx
new file mode 100644
index 000..e364948
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo78886.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 16d13a2..a039e0b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3437,6 +3437,15 @@ DECLARE_OOXMLEXPORT_TEST(testfdo78300,"fdo78300.docx")
 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo78886, "fdo78886.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+
+assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:tbl[2]/w:tr[1]/w:tc[1]/w:p[1]/w:hyperlink[1]/w:r[2]/w:fldChar[1]",
 0);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFdo78651, "fdo78651.docx")
 {
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index fb5933d..aafb31c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -802,6 +802,7 @@ void DocxAttributeOutput::EndRun()
 }
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
 m_startedHyperlink = false;
+m_endPageRef = false;
 m_nHyperLinkCount--;
 }
 m_closeHyperlinkInPreviousRun = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-22 Thread Umesh Kadam
 sw/qa/extras/ooxmlexport/data/ShapeOverlappingWithSdt.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx   |9 +
 sw/source/filter/ww8/attributeoutputbase.hxx   |9 +
 sw/source/filter/ww8/docxattributeoutput.cxx   |   69 +++
 sw/source/filter/ww8/docxattributeoutput.hxx   |6 +
 sw/source/filter/ww8/wrtw8nds.cxx  |   78 +++--
 sw/source/filter/ww8/wrtww8.hxx|   13 ++
 7 files changed, 174 insertions(+), 10 deletions(-)

New commits:
commit 80fd9fb7209cfd5c0622ee99d59e42e6db32f021
Author: Umesh Kadam 
Date:   Thu May 15 23:02:34 2014 +0530

fdo#78333 : SdtContent and a Shape overlapping causes corruption

- Normally if there is a case where text/shape is overlapped with (another)
   shape then LO used to write the text and the AlternateContent in the 
same run.
- This is supported in MSO and there is no visual difference.
- But in case if the SdtContent(with text) is overlapped with the Shape 
then LO
   processes sdtContent as a text and ends up putting the alternateContent 
and the
   text in a single run. Ultimately it includes the entire run in a 
SdtContent,
   which is incorrect.
- The fix checks for the aforementioned scenario and puts them in a 
different run
   and also restricts the sdtContent being written in an invalid 
AlternateContent.

Change-Id: I36f4cdb1b583523dd8f717ae094bdf09c7a61f62
Reviewed-on: https://gerrit.libreoffice.org/9374
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/ShapeOverlappingWithSdt.docx 
b/sw/qa/extras/ooxmlexport/data/ShapeOverlappingWithSdt.docx
new file mode 100644
index 000..e1ec074
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/ShapeOverlappingWithSdt.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 7a69e67..16d13a2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2052,6 +2052,15 @@ 
DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.
   assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pStyle", "val", 
"Normal");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testSdtAndShapeOverlapping,"ShapeOverlappingWithSdt.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+  assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:r[1]/mc:AlternateContent");
+  assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:sdt[1]/w:sdtContent[1]/w:r[1]/w:t[1]");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testRelorientation, "relorientation.docx")
 {
 uno::Reference xShape = getShape(1);
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx 
b/sw/source/filter/ww8/attributeoutputbase.hxx
index 5a25c86..d2df9c0 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -309,6 +309,15 @@ public:
 /// Has different headers/footers for the title page.
 virtual void SectionTitlePage() = 0;
 
+/// If the node has an anchor linked.
+virtual void SetAnchorIsLinkedToNode( bool /*bAnchorLinkedToNode*/){};
+
+/// Is processing of fly postponed ?
+virtual bool IsFlyProcessingPostponed(){ return false; };
+
+/// Reset the flag for FlyProcessing
+virtual void ResetFlyProcessingFlag(){};
+
 /// Description of the page borders.
 virtual void SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* 
pFirstPageFmt ) = 0;
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 96602c3..fb5933d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -287,6 +287,20 @@ void DocxAttributeOutput::StartParagraph( 
ww8::WW8TableNodeInfo::Pointer_t pText
 m_bIsFirstParagraph = false;
 }
 
+static void lcl_deleteAndResetTheLists( ::sax_fastparser::FastAttributeList* 
&pSdtPrTokenChildren, ::sax_fastparser::FastAttributeList* 
&pSdtPrDataBindingAttrs)
+{
+if( pSdtPrTokenChildren )
+{
+delete pSdtPrTokenChildren ;
+pSdtPrTokenChildren = NULL;
+}
+if( pSdtPrDataBindingAttrs )
+{
+delete pSdtPrDataBindingAttrs;
+pSdtPrDataBindingAttrs = NULL;
+}
+}
+
 void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t 
pTextNodeInfoInner )
 {
 // write the paragraph properties + the run, already in the correct order
@@ -382,8 +396,16 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 }
 
 m_pSerializer->endElementNS( XML_w, XML_p );
+if( !m_bAnchorLinkedToNode )
+WriteSdtBlock( m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, 
m_pParagraphSdtPrDataBindingAttrs );
+else
+{
+//These should be written out to the actua

<    1   2