[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-11-08 Thread Justin Luth
 sw/source/core/layout/paintfrm.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 0dda116236e1532f2006f488b974bb9c7067ac5f
Author: Justin Luth 
Date:   Wed Aug 30 18:08:15 2017 -0400

tdf#104602: don't re-draw page background when bOnlyTextBackground

In 2014 Writer gained support for Paragraph and PageStyle DrawingLayer
FillAttributes, it changed some behaviour with PaintBackground,
so that compat setting BACKGROUND_PARA_OVER_DRAWINGS now overwrote
the entire "hell" layer as the page background was re-applied.

Only DOCX uses this 2012 compatibility setting.

Change-Id: I69517efb7d82acd719d6a27a09ba61554dbf1ec9
Reviewed-on: https://gerrit.libreoffice.org/41744
Reviewed-by: Justin Luth 
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit de0993097cad2fd5819f8bea5ff53cddce7cde41)
Reviewed-on: https://gerrit.libreoffice.org/41902
(cherry picked from commit 7117e92448ea328bd4798e873a2faecda748a369)
Reviewed-on: https://gerrit.libreoffice.org/2
Tested-by: Justin Luth 
Reviewed-by: Andras Timar 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index ba8fdc916207..68d1440ac520 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6543,7 +6543,7 @@ void SwFrame::PaintBackground( const SwRect &rRect, const 
SwPageFrame *pPage,
 if( IsTextFrame() || IsSctFrame() )
 aPaintRect = UnionFrame( true );
 
-if ( aPaintRect.IsOver( rRect ) )
+if ( (!bOnlyTextBackground || IsTextFrame()) && aPaintRect.IsOver( rRect ) 
)
 {
 if ( bBack || bPageFrame || !bLowerMode )
 {
@@ -6637,7 +6637,6 @@ void SwFrame::PaintBackground( const SwRect &rRect, const 
SwPageFrame *pPage,
 // background transparency have to be considered
 // Set missing 5th parameter to the default value 
GRFNUM_NO
 // - see declaration in /core/inc/frmtool.hxx.
-if (IsTextFrame() || !bOnlyTextBackground)
 ::DrawGraphic(
 pItem,
 pOut,
@@ -6682,7 +6681,7 @@ void SwFrame::PaintBackground( const SwRect &rRect, const 
SwPageFrame *pPage,
 if ( ( pFrame->IsLayoutFrame() && bLowerBorder ) ||
  aFrameRect.IsOver( aRect ) )
 pFrame->PaintBackground( aRect, pPage, rTmpAttrs, bLowMode,
-   bLowerBorder );
+   bLowerBorder, bOnlyTextBackground );
 if ( bLowerBorder )
 pFrame->PaintBorder( aBorderRect, pPage, rTmpAttrs );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-10-02 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par.hxx  |7 +++
 sw/source/filter/ww8/ww8par2.cxx |   24 ++--
 2 files changed, 17 insertions(+), 14 deletions(-)

New commits:
commit 8580472270972733cda7fa6ecf23db73359d30bb
Author: Caolán McNamara 
Date:   Mon Oct 2 09:24:19 2017 +0100

ofz#3527 ofz#3532 Invalid read of size 8

use numrule name to look up numrule instead of cached numrule pointer

in case it was deleted on failure to apply the numrule over an invalid range

Invalid read of size 8
   at 0x1E875132: rtl::OUString::OUString(rtl::OUString const&) 
(ustring.hxx:143)
   by 0x1EB33D93: SwWW8ImplReader::StartAnl(unsigned char const*) 
(ww8par2.cxx:1094)
   by 0x1EB33003: SwWW8ImplReader::Read_ANLevelNo(unsigned short, unsigned 
char const*, short) (ww8par2.cxx:910)
   by 0x1EBA375D: SwWW8ImplReader::ImportSprm(unsigned char const*, int, 
unsigned short) (ww8par6.cxx:6337)
   by 0x1EAEEA24: SwWW8ImplReader::ReadTextAttr(int&, long, bool&) 
(ww8par.cxx:3810)
   by 0x1EAEF15A: SwWW8ImplReader::ReadAttrs(int&, int&, long, bool&) 
(ww8par.cxx:3921)
   by 0x1EAEF6E0: SwWW8ImplReader::ReadText(int, int, ManTypes) 
(ww8par.cxx:4003)
   by 0x1EAF6DCE: SwWW8ImplReader::CoreLoad(WW8Glossary const*) 
(ww8par.cxx:5219)
 Address 0x31831158 is 200 bytes inside a block of size 248 free'd
   at 0x4C2F21A: operator delete(void*) (vg_replace_malloc.c:576)
   by 0x253BC1B5: SwDoc::DelNumRule(rtl::OUString const&, bool) 
(docnum.cxx:1033)
   by 0x25CB943D: SwFltControlStack::SetAttrInDoc(SwPosition const&, 
SwFltStackEntry&) (fltshell.cxx:609)
   by 0x1EAE5011: SwWW8FltControlStack::SetAttrInDoc(SwPosition const&, 
SwFltStackEntry&) (ww8par.cxx:1445)
   by 0x25CB8A9E: SwFltControlStack::SetAttr(SwPosition const&, unsigned 
short, bool, long, bool) (fltshell.cxx:457)
   by 0x1EAE420E: SwWW8FltControlStack::SetAttr(SwPosition const&, unsigned 
short, bool, long, bool) (ww8par.cxx:1185)
   by 0x1EAE5C12: SwWW8ImplReader::Read_Tab(unsigned short, unsigned char 
const*, short) (ww8par.cxx:1625)
   by 0x1EBA35F0: SwWW8ImplReader::EndSprm(unsigned short) 
(ww8par6.cxx:6321)
   by 0x1EAEEA44: SwWW8ImplReader::ReadTextAttr(int&, long, bool&) 
(ww8par.cxx:3813)
   by 0x1EAEF15A: SwWW8ImplReader::ReadAttrs(int&, int&, long, bool&) 
(ww8par.cxx:3921)
   by 0x1EAEF6E0: SwWW8ImplReader::ReadText(int, int, ManTypes) 
(ww8par.cxx:4003)
   by 0x1EAF6DCE: SwWW8ImplReader::CoreLoad(WW8Glossary const*) 
(ww8par.cxx:5219)

Change-Id: Ia7ab67e42fc7a162d8089722e77841285f72a671
Reviewed-on: https://gerrit.libreoffice.org/43030
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 3eeb701ae6f8..419e4bd6cdb2 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -972,11 +972,10 @@ struct ApoTestResults
 
 struct ANLDRuleMap
 {
-SwNumRule* mpOutlineNumRule;// WinWord 6 numbering, variant 1
-SwNumRule* mpNumberingNumRule;  // WinWord 6 numbering, variant 2
-SwNumRule* GetNumRule(sal_uInt8 nNumType);
+OUString msOutlineNumRule;// WinWord 6 numbering, variant 1
+OUString msNumberingNumRule;  // WinWord 6 numbering, variant 2
+SwNumRule* GetNumRule(SwDoc& rDoc, sal_uInt8 nNumType);
 void SetNumRule(SwNumRule*, sal_uInt8 nNumType);
-ANLDRuleMap() : mpOutlineNumRule(nullptr), mpNumberingNumRule(nullptr) {}
 };
 
 struct SprmReadInfo;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index c5d11892a418..dca9b47c655c 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -956,17 +956,21 @@ WW8LvlType GetNumType(sal_uInt8 nWwLevelNo)
 return nRet;
 }
 
-SwNumRule *ANLDRuleMap::GetNumRule(sal_uInt8 nNumType)
+SwNumRule *ANLDRuleMap::GetNumRule(SwDoc& rDoc, sal_uInt8 nNumType)
 {
-return (WW8_Numbering == nNumType ? mpNumberingNumRule : mpOutlineNumRule);
+const OUString& rNumRule = WW8_Numbering == nNumType ? msNumberingNumRule 
: msOutlineNumRule;
+if (rNumRule.isEmpty())
+return nullptr;
+return rDoc.FindNumRulePtr(rNumRule);
 }
 
 void ANLDRuleMap::SetNumRule(SwNumRule *pRule, sal_uInt8 nNumType)
 {
+OUString sNumRule = pRule ? pRule->GetName() : OUString();
 if (WW8_Numbering == nNumType)
-mpNumberingNumRule = pRule;
+msNumberingNumRule = sNumRule;
 else
-mpOutlineNumRule = pRule;
+msOutlineNumRule = sNumRule;
 }
 
 // StartAnl is called at the beginning of a row area that contains
@@ -980,7 +984,7 @@ void SwWW8ImplReader::StartAnl(const sal_uInt8* pSprm13)
 return;
 
 m_nWwNumType = nT;
-SwNumRule *pNumRule = m_aANLDRules.GetNumRule(m_nWwNumType);
+SwNumRule *pNumRule = m_aANLDRules.GetNumRule(m_rDoc, m_nWwNumType);
 
 // check for COL numbering:
 const sal_uInt8* pS12 = nullptr;// sprmAnld
@@ -1048

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-09-27 Thread Michael Stahl
 sw/source/ui/frmdlg/frmpage.cxx |   17 ++---
 sw/source/uibase/app/docst.cxx  |1 +
 2 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 2f1ef1d7e3caa806e5f5abddb3ac3761538b935b
Author: Michael Stahl 
Date:   Tue Sep 26 16:56:31 2017 +0200

tdf#112574 sw: don't insert RES_ANCHOR into style item sets

Styles don't have anchors, only frames have anchors.

When using "New Style from Selection", clear the RES_ANCHOR from
the style item set.

Also, don't insert it in SwFramePage::DeactivatePage().

This was always broken and reportedly crashes since commit
e07feb9457f2ffb373ae69b73dda290140e4005f

Change-Id: I9320dbbcae980dfa0b00459b8cd808553d1a04f4
(cherry picked from commit 17fe1e19e01f8b23bcd23cc7c1789e8f7064d06e)
Reviewed-on: https://gerrit.libreoffice.org/42819
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index eab95eee09fc..8239a71c6419 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1749,13 +1749,16 @@ DeactivateRC SwFramePage::DeactivatePage(SfxItemSet * 
_pSet)
 {
 FillItemSet( _pSet );
 
-//FillItemSet doesn't set the anchor into the set when it matches
-//the original. But for the other pages we need the current anchor.
-SwWrtShell* pSh = m_bFormat ? ::GetActiveWrtShell()
-: getFrameDlgParentShell();
-RndStdIds eAnchorId = (RndStdIds)GetAnchor();
-SwFormatAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
-_pSet->Put( aAnc );
+if (!m_bFormat) // tdf#112574 no anchor in styles
+{
+//FillItemSet doesn't set the anchor into the set when it matches
+//the original. But for the other pages we need the current anchor.
+SwWrtShell* pSh = m_bFormat ? ::GetActiveWrtShell()
+: getFrameDlgParentShell();
+RndStdIds eAnchorId = (RndStdIds)GetAnchor();
+SwFormatAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
+_pSet->Put( aAnc );
+}
 }
 
 return DeactivateRC::LeavePage;
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index ee02b382a861..9d61b36877b0 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1219,6 +1219,7 @@ SfxStyleFamily SwDocShell::MakeByExample( const OUString 
&rName, SfxStyleFamily
 
 SfxItemSet aSet(GetPool(), aFrameFormatSetRange );
 pCurrWrtShell->GetFlyFrameAttr( aSet );
+aSet.ClearItem(RES_ANCHOR); // tdf#112574 no anchor in styles
 
 SwFrameFormat* pFFormat = 
pCurrWrtShell->GetSelectedFrameFormat();
 pFrame->SetDerivedFrom( pFFormat );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-09-22 Thread Caolán McNamara
 sw/source/filter/ww8/ww8scan.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 46882bb61b1381dd257cd96a255ed71f7af03166
Author: Caolán McNamara 
Date:   Fri Sep 22 09:37:43 2017 +0100

ofz#3457 Unknown Read

similar to

commit 35bac83ed2b5d48233c653cc7dc4eab5c234f7ac
Date:   Mon Aug 7 19:24:37 2017 +0100

ofz#2877: crash in SVTB16Short

Change-Id: Idc2ca89647a5e17484effaca49afce349b98f0a3
Reviewed-on: https://gerrit.libreoffice.org/42624
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 4d138aa6f5f7..82e56f82bca9 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3540,8 +3540,7 @@ const sal_uInt8* WW8PLCFx_SEPX::HasSprm( sal_uInt16 nId, 
sal_uInt8 n2nd ) const
 return nullptr;
 
 sal_uInt8* pSp = pSprms;
-
-sal_uInt16 i=0;
+size_t i = 0;
 while (i + maSprmParser.MinSprmLen() <= nSprmSiz)
 {
 // Sprm found?
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-09-18 Thread Michael Stahl
 sw/source/core/doc/DocumentRedlineManager.cxx |   66 --
 sw/source/core/inc/DocumentRedlineManager.hxx |1 
 2 files changed, 31 insertions(+), 36 deletions(-)

New commits:
commit a562be54f3127f4e22a3a38e62db2b38d48499f3
Author: Michael Stahl 
Date:   Fri Sep 15 13:51:04 2017 +0200

ofz#3301 sw: DeleteAndJoin found yet another way to delete new redline

Not only can that happen in CompressRedlines(), it can also happen
in the SwComparePosition::Outside case when the DeleteRedline()
decides in particular circumstances to split up the inserted
new redline.

Arguably it's wrong to split up the new redline in this case;
not sure if that ever happens in a legitimate use case though.

Avoid this by removing the hack to temporarily insert the new redline
and instead create a temporary SwUnoCursor that will be corrected
on behalf of the new redline, while the new redline is parked on a
safe node.

This not only avoids the crash on this file but also makes the
"corrupted redline table" assertions go away.

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

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index f2d51192759d..c5da74836240 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -575,6 +576,32 @@ namespace
 }
 }
 }
+
+/// in case some text is deleted, ensure that the not-yet-inserted
+/// SwRangeRedline has its positions corrected not to point to deleted node
+class TemporaryRedlineUpdater
+{
+private:
+SwRangeRedline & m_rRedline;
+std::shared_ptr m_pCursor;
+public:
+TemporaryRedlineUpdater(SwDoc & rDoc, SwRangeRedline & rRedline)
+: m_rRedline(rRedline)
+, m_pCursor(rDoc.CreateUnoCursor(*rRedline.GetPoint(), false))
+{
+if (m_rRedline.HasMark())
+{
+m_pCursor->SetMark();
+*m_pCursor->GetMark() = *m_rRedline.GetMark();
+*m_rRedline.GetMark() = 
SwPosition(rDoc.GetNodes().GetEndOfContent());
+}
+*m_rRedline.GetPoint() = 
SwPosition(rDoc.GetNodes().GetEndOfContent());
+}
+~TemporaryRedlineUpdater()
+{
+static_cast(m_rRedline) = *m_pCursor;
+}
+};
 }
 
 namespace sw
@@ -1223,19 +1250,11 @@ bool DocumentRedlineManager::AppendRedline( 
SwRangeRedline* pNewRedl, bool bCall
 {
 mpRedlineTable->Remove( n );
 bDec = true;
-// We insert temporarily so that pNew is
-// also dealt with when moving the indices.
 if( bCallDelete )
 {
-::comphelper::FlagGuard 
g(m_isForbidCompressRedlines);
-mpRedlineTable->Insert( pNewRedl );
+TemporaryRedlineUpdater const u(m_rDoc, 
*pNewRedl);
 
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pRedl );
-if( !mpRedlineTable->Remove( pNewRedl ) )
-{
-assert(false); // can't happen
-pNewRedl = nullptr;
-}
-bCompress = true; // delayed compress
+n = 0;  // re-initialize
 }
 delete pRedl;
 }
@@ -1257,17 +1276,8 @@ bool DocumentRedlineManager::AppendRedline( 
SwRangeRedline* pNewRedl, bool bCall
 
 if( bCallDelete )
 {
-// We insert temporarily so that pNew is
-// also dealt with when moving the indices.
-::comphelper::FlagGuard 
g(m_isForbidCompressRedlines);
-mpRedlineTable->Insert( pNewRedl );
+TemporaryRedlineUpdater const u(m_rDoc, 
*pNewRedl);
 
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
-if( !mpRedlineTable->Remove( pNewRedl ) )
-{
-assert(false); // can't happen

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-09-07 Thread Michael Stahl
 sw/source/core/text/frmform.cxx |   15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit b8e84ac201f5611635177f8404c28f7fa8d0c806
Author: Michael Stahl 
Date:   Wed Sep 6 23:18:23 2017 +0200

tdf#112163 sw: avoid crashing in layout on this document

SwTextFrame 0x5dfb7a0 is join locked so doesn't GetFormatted() so
doesn't have a SwTextLineAccess created; add some defensive programming
just to make it not crash.

Whether this is the right fix or just a workaround for something going
wrong in the 179 layout stack frames is beyond my meager knowledge.

In case anybody has an obvious idea, the layout frames that are
currently being formatted (SwTextFrame or SwTabFrame) are:

 #3 0x5dfb7a0 is master of 0x5e56330

 #4 0x5e56330

 #10 0x5e5f3f0 is follow of 0x5e56330

 #19 0x5e60d30 SwTabFrame::Split

 #30 0x5e56330

 #44 0x5dfb7a0

 #53 0x2cefae0 master of 0x5dfb7a0

 #57 0x63d1440 SwTabFrame::MakeAll is follow of #58

 #58 0x5e106c0 SwTabFrame::MakeAll

 #68 0x5e812d0

 #77 0x5e11f80 is master of #68

 #86 0x2cef600 is master of #77

 #90 0x5f86c00 SwTabFrame::MakeAll

 #91 0x63d0150 SwTabFrame::MakeAll

 #98 SwFlowFrame::MoveFwd
 #101 0x63cf3d0

 #110 0x5e05ff0 is master of #101

 #119 0x5e0c700 is master of #110

 #128 0x5bd0ad0 is master of #119

 #136 0x5f8b800 is master of #128

 #145 0x86b29a0 is master of #136

 #154 0x2c37340 is master of #145

 #158 0x5e04ab0 SwTabFrame::MakeAll

 #168 0x2c371a0

 #173 0x5e16340 SwTabFrame::MakeAll

Change-Id: I716b5faec1512cbf1fbdb04a436da302bd628c51
(cherry picked from commit 6c8c51231e7415ecc20d1343211acf838213)
Reviewed-on: https://gerrit.libreoffice.org/42041
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index ee0469a929ce..74a6ff817739 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1405,10 +1405,17 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, 
SwTextFormatInfo &rInf,
 {
 if( !pMaster->HasPara() )
 pMaster->GetFormatted();
-SwTextSizeInfo aInf( pMaster );
-SwTextIter aMasterLine( pMaster, &aInf );
-aMasterLine.Bottom();
-pLine = aMasterLine.GetCurr();
+if (!pMaster->HasPara())
+{   // master could be locked because it's being formatted upstack
+SAL_WARN("sw", "SwTextFrame::Format_: failed to format 
master!");
+}
+else
+{
+SwTextSizeInfo aInf( pMaster );
+SwTextIter aMasterLine( pMaster, &aInf );
+aMasterLine.Bottom();
+pLine = aMasterLine.GetCurr();
+}
 }
 SwLinePortion* pRest = pLine ?
 rLine.MakeRestPortion(pLine, GetOfst()) : nullptr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-09-01 Thread Pranav Kant
 sw/source/core/edit/acorrect.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f55b8571f3bd4b8b04004c2e0dd2017876207f97
Author: Pranav Kant 
Date:   Sat Jan 28 23:23:37 2017 +0530

tdf#105103 assertion failure crash

New document, insert mode on, press space (when autocorrect while
typing is on)

Change-Id: I54bc9a5cd1f9d8ef877eeca81d7d85ccd90e354a
Reviewed-on: https://gerrit.libreoffice.org/33651
Tested-by: Jenkins 
Reviewed-by: pranavk 
(cherry picked from commit 76dc7897b0efb1104dea56fe65d0aececab4eca0)
Reviewed-on: https://gerrit.libreoffice.org/41786
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index afc4d1832b45..6f116275ce10 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -164,7 +164,7 @@ bool SwAutoCorrDoc::ReplaceRange( sal_Int32 nPos, sal_Int32 
nSourceLength, const
 // text attributes with dummy characters must not be replaced!
 bool bDoReplace = true;
 sal_Int32 const nLen = rText.getLength();
-for ( sal_Int32 n = 0; n < nLen; ++n )
+for ( sal_Int32 n = 0; n < nLen && n + nPos < pNd->GetText().getLength(); 
++n )
 {
 sal_Unicode const Char = pNd->GetText()[n + nPos];
 if ( ( CH_TXTATR_BREAKWORD == Char || CH_TXTATR_INWORD == Char )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-08-29 Thread Caolán McNamara
 sw/source/filter/ww8/ww8graf.cxx |2 -
 sw/source/filter/ww8/ww8par.cxx  |4 +--
 sw/source/filter/ww8/ww8par.hxx  |2 -
 sw/source/filter/ww8/ww8par2.cxx |2 -
 sw/source/filter/ww8/ww8par3.cxx |4 +--
 sw/source/filter/ww8/ww8par6.cxx |4 +--
 sw/source/filter/ww8/ww8scan.cxx |   52 +++
 sw/source/filter/ww8/ww8scan.hxx |   11 
 8 files changed, 52 insertions(+), 29 deletions(-)

New commits:
commit f33a136dc6bcb8bc0ed6ddd6c3d38d75e067e6eb
Author: Caolán McNamara 
Date:   Mon Aug 28 12:13:41 2017 +0100

ofz#3154 check bounds of special sprm

Change-Id: I82566e2f2ad479c392f06ae7149e3781c0338e50

ofz: sanity check L_VAR2 record bounds

Change-Id: I862457a7239108974f360a87b4f6ccf433eae364
Reviewed-on: https://gerrit.libreoffice.org/37534
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 016e4d0e2650b2fb350068d86e8d392a7ef5acb1)

ofz: stay within available data

Change-Id: Ic959cf5b2cd92ba5bc297e686beb1fd50427a994
Reviewed-on: https://gerrit.libreoffice.org/36102
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit fdcac49119d3fc9f6216af834e7afc56d2c2e376)
Reviewed-on: https://gerrit.libreoffice.org/41648
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index bd1a8ca64cad..2664cdb3971e 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -617,7 +617,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long 
nStartCp, long nEndCp,
 // off and convert them later
 if (bStartAttr)
 {
-ImportSprm(aRes.pMemPos, aRes.nSprmId);
+ImportSprm(aRes.pMemPos, aRes.nMemLen, aRes.nSprmId);
 if (!bDoingSymbol && m_bSymbol)
 {
 bDoingSymbol = true;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 6757e3c3ec34..13173145c220 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3797,7 +3797,7 @@ long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTextPos, long 
nTextEnd, bool& rbStar
 if( bStartAttr ) // WW attributes
 {
 if( aRes.nMemLen >= 0 )
-ImportSprm(aRes.pMemPos, aRes.nSprmId);
+ImportSprm(aRes.pMemPos, aRes.nMemLen, aRes.nSprmId);
 }
 else
 EndSprm( aRes.nSprmId ); // Switch off Attr
@@ -6407,7 +6407,7 @@ bool SwMSDffManager::GetOLEStorageName(long nOLEId, 
OUString& rStorageName,
 while (nLen >= 2 && !nPictureId)
 {
 sal_uInt16 nId = aSprmParser.GetSprmId(pSprm);
-sal_uInt16 nSL = aSprmParser.GetSprmSize(nId, 
pSprm);
+sal_uInt16 nSL = aSprmParser.GetSprmSize(nId, 
pSprm, nLen);
 
 if( nLen < nSL )
 break; // Not enough Bytes left
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 3b4b3dd935f4..3eeb701ae6f8 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1846,7 +1846,7 @@ public: // really private, but can only be done public
 
 void DeleteFormImpl();
 
-short ImportSprm( const sal_uInt8* pPos, sal_uInt16 nId = 0 );
+short ImportSprm(const sal_uInt8* pPos, sal_Int32 nMemLen, sal_uInt16 nId 
= 0);
 
 bool SearchRowEnd(WW8PLCFx_Cp_FKP* pPap,WW8_CP &rStartCp, int nLevel) 
const;
 
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 2b4bccb33189..c5d11892a418 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -3622,7 +3622,7 @@ void WW8RStyle::ImportSprms(sal_uInt8 *pSprms, short 
nLen, bool bPap)
 #ifdef DEBUGSPRMREADER
 fprintf(stderr, "id is %x\n", aIter.GetAktId());
 #endif
-pIo->ImportSprm(pSprm);
+pIo->ImportSprm(pSprm, aSprmIter.GetRemLen(), aSprmIter.GetAktId());
 aSprmIter.advance();
 }
 
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index f3211bac3b6b..7b1c37c76bdf 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -714,7 +714,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, 
SfxItemSet*& rpItemSet,
 maSprmParser);
 while (const sal_uInt8* pSprm = aSprmIter.GetSprms())
 {
-rReader.ImportSprm(pSprm);
+rReader.ImportSprm(pSprm, aSprmIter.GetRemLen(), 
aSprmIter.GetAktId());
 aSprmIter.advance();
 }
 
@@ -1908,7 +1908,7 @@ void 
SwWW8ImplReader::RegisterNumFormatOnTextNode(sal_uInt16 nActLFO,
   

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-08-28 Thread Caolán McNamara
 sw/source/filter/ww8/ww8scan.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 35c07f69a28c24a8561f86ff82387f11a85d368a
Author: Caolán McNamara 
Date:   Mon Aug 28 10:17:56 2017 +0100

ofz#3110 GeneratePLCF only generated word6 sized missing entries

BTE was 2 bytes in word 7- but 4 bytes in word 8+

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

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 0026ade52132..1d51c27a5623 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2162,7 +2162,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, 
sal_Int32 ncpN)
 
 if (!failure)
 {
-size_t nSiz = 6 * nIMax + 4;
+size_t nSiz = (4 + nStru) * nIMax + 4;
 size_t nElems = ( nSiz + 3 ) / 4;
 pPLCF_PosArray = new sal_Int32[ nElems ]; // Pointer to Pos-array
 
@@ -2217,7 +2217,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, 
sal_Int32 ncpN)
 for (sal_Int32 i = 0; i < ncpN; ++i) // construct PNs
 {
 ShortToSVBT16(static_cast(nPN + i), p);
-p+=2;
+p += nStru;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-08-22 Thread Michael Stahl
 sw/source/core/doc/DocumentContentOperationsManager.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3ddc16fc26a06a95b7e373ee930881f91b22ad1f
Author: Michael Stahl 
Date:   Fri Aug 18 17:25:17 2017 +0200

tdf#99692 sw: fix the fix: don't set bNullContent if node was split

When showing the redlines in rhbz908615-13.odt, the following assertion
happens:

Assertion `IDocumentMarkAccess::IsLegalPaMForCrossRefHeadingBookmark(rPaM) 
&& "" "- creation of cross-reference 
bookmark with an illegal PaM that does not expand over exactly one whole 
paragraph."' failed.

This is because in DocumentContentOperationsManager::MoveRange() the
flag bNullContent is set after the node has been split; in this case the
nContent is of course always 0.

Later the function then restores aSavePam to the index 0 of the next
node, when it actually shouldn't do anything because the JoinNext()
already positioned it correctly at the merge-index of the re-joined node.

(regression from 850795942b3e168cab8ce88b4f2b421945ff29ca)

Change-Id: I64d50e70b19e2fd81537a9771fa8706898b17642
(cherry picked from commit 6a018363791945b6fd7f04f2aa311e4f4753f6aa)
Reviewed-on: https://gerrit.libreoffice.org/41305
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d6e014e474ec..4150718228fb 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2031,7 +2031,8 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& 
rPaM, SwPosition& rPos,
 // the manipulated range.
 // tdf#99692 don't Move() back if that would end up in another node
 // because moving backward is not necessarily the inverse of forward then.
-const bool bNullContent = aSavePam.GetPoint()->nContent == 0;
+// (but do Move() back if we have split the node)
+const bool bNullContent = !bSplit && aSavePam.GetPoint()->nContent == 0;
 if( bNullContent )
 {
 aSavePam.GetPoint()->nNode--;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-08-11 Thread Caolán McNamara
 sw/source/ui/index/swuiidxmrk.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 21bf73a005f38fc4970ee916dce89ac05c60e729
Author: Caolán McNamara 
Date:   Fri Aug 11 13:10:29 2017 +0100

Resolves: tdf#111571 crash on restarting writer with modeless biblio dialog

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

diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index e8d4ef2b492c..29e9e1f928ef 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1636,8 +1636,8 @@ SwAuthMarkFloatDlg::SwAuthMarkFloatDlg(SfxBindings* 
_pBindings,
 {
 Initialize(pInfo);
 SwWrtShell* pWrtShell = ::GetActiveWrtShell();
-OSL_ENSURE(pWrtShell, "No shell?");
-m_aContent.ReInitDlg(*pWrtShell);
+if (pWrtShell)
+m_aContent.ReInitDlg(*pWrtShell);
 }
 
 void SwAuthMarkFloatDlg::Activate()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source vcl/source

2017-08-09 Thread Caolán McNamara
 sw/source/core/docnode/ndnotxt.cxx |   18 +++---
 vcl/source/filter/jpeg/jpegc.cxx   |6 +++---
 vcl/source/gdi/graph.cxx   |   24 +---
 3 files changed, 19 insertions(+), 29 deletions(-)

New commits:
commit 939538e6a8d35c8ab4412908482feb053386bf3d
Author: Caolán McNamara 
Date:   Wed Aug 9 14:54:05 2017 +0100

Resolves: tdf#99286 for jpeg dpi use apis that know about MapUnit::MapPixel

move the code which can do this from sw to vcl

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

diff --git a/sw/source/core/docnode/ndnotxt.cxx 
b/sw/source/core/docnode/ndnotxt.cxx
index 5ff587ef6b7f..91b923cb097f 100644
--- a/sw/source/core/docnode/ndnotxt.cxx
+++ b/sw/source/core/docnode/ndnotxt.cxx
@@ -121,21 +121,9 @@ const tools::PolyPolygon *SwNoTextNode::HasContour() const
 {
 if ( !bPixelGrf && bPixelContour )
 {
-const Size aGrfPixelSize( GetGraphic().GetSizePixel() );
-const Size aGrfPrefMapModeSize( GetGraphic().GetPrefSize() 
);
-if ( aGrfMap.GetMapUnit() == MapUnit::MapInch )
-{
-nGrfDPIx = aGrfPixelSize.Width() / ( 
(double)aGrfMap.GetScaleX() * aGrfPrefMapModeSize.Width() );
-nGrfDPIy = aGrfPixelSize.Height() / ( 
(double)aGrfMap.GetScaleY() * aGrfPrefMapModeSize.Height() );
-}
-else
-{
-const Size aGrf1000thInchSize =
-OutputDevice::LogicToLogic( aGrfPrefMapModeSize,
-aGrfMap, 
MapUnit::Map1000thInch );
-nGrfDPIx = 1000.0 * aGrfPixelSize.Width() / 
aGrf1000thInchSize.Width();
-nGrfDPIy = 1000.0 * aGrfPixelSize.Height() / 
aGrf1000thInchSize.Height();
-}
+basegfx::B2DSize aDPI = GetGraphic().GetPPI();
+nGrfDPIx = aDPI.getX();
+nGrfDPIy = aDPI.getY();
 }
 }
 OSL_ENSURE( !bPixelGrf || aGrfMap == aContourMap,
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index 8fc0ed83b8bf..3353fe9c247a 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -251,7 +251,7 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, 
long* pLines,
 }
 
 bool WriteJPEG( JPEGWriter* pJPEGWriter, void* pOutputStream,
-long nWidth, long nHeight, basegfx::B2DSize const & aPPI, bool 
bGreys,
+long nWidth, long nHeight, basegfx::B2DSize const & rPPI, bool 
bGreys,
 long nQualityPercent, long aChromaSubsampling,
 css::uno::Reference const & 
status )
 {
@@ -290,8 +290,8 @@ bool WriteJPEG( JPEGWriter* pJPEGWriter, void* 
pOutputStream,
 jpeg_set_quality( &cinfo, (int) nQualityPercent, FALSE );
 
 cinfo.density_unit = 1;
-cinfo.X_density = aPPI.getX();
-cinfo.Y_density = aPPI.getY();
+cinfo.X_density = rPPI.getX();
+cinfo.Y_density = rPPI.getY();
 
 if ( ( nWidth > 128 ) || ( nHeight > 128 ) )
 jpeg_simple_progression( &cinfo );
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index db4f1a7d0363..f0ce35e0aaee 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -401,24 +402,25 @@ void Graphic::SetPrefMapMode( const MapMode& rPrefMapMode 
)
 
 basegfx::B2DSize Graphic::GetPPI() const
 {
-MapMode aMapMode = GetPrefMapMode();
+double nGrfDPIx;
+double nGrfDPIy;
 
-double fWidthInches = ( GetPrefSize().Width() * 
aMapMode.GetUnitMultiplier() ) / 2540;
-double fHeightInches = ( GetPrefSize().Height() * 
aMapMode.GetUnitMultiplier() ) / 2540;
-double fPpiX = 0;
-double fPpiY = 0;
-
-if ( fWidthInches > 0 || fHeightInches > 0 ) // we don't want a divide by 
0 situation
+const MapMode aGrfMap(GetPrefMapMode());
+const Size aGrfPixelSize(GetSizePixel());
+const Size aGrfPrefMapModeSize(GetPrefSize());
+if (aGrfMap.GetMapUnit() == MapUnit::MapInch)
 {
-fPpiX = GetSizePixel().Width() / fWidthInches;
-fPpiY = GetSizePixel().Height() / fHeightInches;
+nGrfDPIx = aGrfPixelSize.Width() / ( (double)aGrfMap.GetScaleX() * 
aGrfPrefMapModeSize.Width() );
+nGrfDPIy = aGrfPixelSize.Height() / ( (double)aGrfMap.GetScaleY() * 
aGrfPrefMapModeSize.Height() );
 }
 else
 {
-SAL_WARN("vcl", "PPI X is " << fPpiX << " and PPI Y is " << fPpiY << 
": thus we are making this 0 DPI. This is unlikely.");
+const Size aGrf1000thInchSize = 
OutputDevice::L

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-08-07 Thread Caolán McNamara
 sw/source/filter/ww8/ww8scan.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 19925f85fd3f9cf0cf82e8bcb0a4e90922879dc7
Author: Caolán McNamara 
Date:   Mon Aug 7 19:24:37 2017 +0100

ofz#2877: crash in SVTB16Short

sal_uInt16 wraparound

Change-Id: Ifd791bdd5f1b96576fdd4ca6665bb972fb8b1e4c
Reviewed-on: https://gerrit.libreoffice.org/40853
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index ec3dc11da85c..0026ade52132 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3509,7 +3509,7 @@ bool WW8PLCFx_SEPX::Find4Sprms(sal_uInt16 nId1,sal_uInt16 
nId2,sal_uInt16 nId3,s
 p4 = nullptr;
 
 sal_uInt8* pSp = pSprms;
-sal_uInt16 i=0;
+size_t i = 0;
 while (i + maSprmParser.MinSprmLen() <= nSprmSiz)
 {
 // Sprm found?
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-08-02 Thread Michael Stahl
 sw/source/core/doc/CntntIdxStore.cxx |6 ++
 sw/source/core/inc/MarkManager.hxx   |2 ++
 2 files changed, 8 insertions(+)

New commits:
commit 75a1dce57f7038bc88c74c4e50dd22306be8cf61
Author: Michael Stahl 
Date:   Fri Jul 28 23:44:53 2017 +0200

tdf#105705 sw: sort bookmarks in ContentIdxStoreImpl::RestoreBkmks()

The problem here is that the SplitNode() calls in SwRTFReader::Read()
destroy the order of the bookmarks, which causes an assert later
from the std::lower_bound() when a new mark is created.

The 2 marks that cause the problem are:
SwPosition (node 5, offset 0)
SwPosition (node 5, offset 0), SwPosition (node 5, offset 0)

During the 2 SplitNode calls, the second one is corrected by
ContentIdxStore and remains on 5, but the first one is not and
becomes:
SwPosition (node 7, offset 0)

ContentIdxStoreImpl::SaveBkmks() does different things when a
mark position is exactly on the parameter position: if it has
only one position, it is ignored, but if it has a second
position, then both its positions are corrected.

It is not possible to change the sort order so that marks with
one position are sorted behind marks with 2 positions, because
while SplitNode() corrects marks "backward", JoinNode() uses
ContentIdxStore to correct marks "forward"; hence manually sort
the marks.

Change-Id: If5b35f18bfd47ffe98c0f67e84d380ca801411a3
(cherry picked from commit f2d2093b2198bd4c65475a60329a5a6a7a8575f1)
Reviewed-on: https://gerrit.libreoffice.org/40544
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/doc/CntntIdxStore.cxx 
b/sw/source/core/doc/CntntIdxStore.cxx
index fafb771ab490..dee0a89f5c0a 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -265,6 +266,11 @@ void ContentIdxStoreImpl::RestoreBkmks(SwDoc* pDoc, 
updater_t& rUpdater)
 SetRightMarkPos(pMark, aEntry.m_bOther, &aNewPos);
 }
 }
+if (!m_aBkmkEntries.empty())
+{   // tdf#105705 sort bookmarks because SaveBkmks special handling of
+// "bMarkPosEqual" may destroy sort order
+dynamic_cast(pMarkAccess)->sortMarks();
+}
 }
 
 void ContentIdxStoreImpl::SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 
nContent)
diff --git a/sw/source/core/inc/MarkManager.hxx 
b/sw/source/core/inc/MarkManager.hxx
index bc0aecd6064a..093e11855bcb 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -101,7 +101,9 @@ namespace sw {
 
 // make names
 OUString getUniqueMarkName(const OUString& rName) const;
+public: // FIXME should be private, needs refactor
 void sortMarks();
+private:
 void sortSubsetMarks();
 
 // container for all marks
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-07-28 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par2.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 26222c3baca76eaed5f45dde4592a059e0e4a85d
Author: Caolán McNamara 
Date:   Thu Jul 27 21:23:49 2017 +0100

ofz#2759 null dereference

(cherry picked from commit 6f5841e60ed29ae2577e63623edacc9fe1467ba5)

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

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index bcc424d4fc83..2b4bccb33189 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -409,14 +409,16 @@ long SwWW8ImplReader::Read_Footnote(WW8PLCFManResult* 
pRes)
 if (eEDN == pRes->nSprmId)
 {
 aDesc.meType = MAN_EDN;
-if (m_pPlcxMan->GetEdn())
-aDesc.mbAutoNum = 0 != *static_cast(m_pPlcxMan->GetEdn()->GetData());
+WW8PLCFx_SubDoc* pEndNote = m_pPlcxMan->GetEdn();
+if (const void* pData = pEndNote ? pEndNote->GetData() : nullptr)
+aDesc.mbAutoNum = 0 != *static_cast(pData);
 }
 else
 {
 aDesc.meType = MAN_FTN;
-if (m_pPlcxMan->GetFootnote())
-aDesc.mbAutoNum = 0 != *static_cast(m_pPlcxMan->GetFootnote()->GetData());
+WW8PLCFx_SubDoc* pFootNote = m_pPlcxMan->GetFootnote();
+if (const void* pData = pFootNote ? pFootNote->GetData() : nullptr)
+aDesc.mbAutoNum = 0 != *static_cast(pData);
 }
 
 aDesc.mnStartCp = pRes->nCp2OrIdx;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-07-27 Thread Michael Stahl
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit be2a7025e5b62e9dab73886436ee52d5330ae381
Author: Michael Stahl 
Date:   Fri Jul 21 22:55:51 2017 +0200

tdf#99692 sw: fix bookmark positions in tables at start of redlines

The code assumes that if it can move the cursor backward in line 2038,
that move can be "inverted" by moving the cursor forward after the
content has been moved - but if the cursor moved back a node, and the
moved content does not start with a SwTextNode, the cursor will move
forward skipping over the non-text nodes, so offsets in the aSaveBkmks
(and aSaveRedl, presumably) are going to be wrong.

Just don't use Move() if it leaves the current node.

Change-Id: I95278a10c14aeba9f76558486bb2712f6726dbcb
(cherry picked from commit 850795942b3e168cab8ce88b4f2b421945ff29ca)
Reviewed-on: https://gerrit.libreoffice.org/40419
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 9e64e0acdda6..d6e014e474ec 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2029,12 +2029,19 @@ bool DocumentContentOperationsManager::MoveRange( 
SwPaM& rPaM, SwPosition& rPos,
 
 // Put back the Pam by one "content"; so that it's always outside of
 // the manipulated range.
-// If there's no content anymore, set it to the StartNode (that's
-// always there).
-const bool bNullContent = !aSavePam.Move( fnMoveBackward, GoInContent );
+// tdf#99692 don't Move() back if that would end up in another node
+// because moving backward is not necessarily the inverse of forward then.
+const bool bNullContent = aSavePam.GetPoint()->nContent == 0;
 if( bNullContent )
 {
 aSavePam.GetPoint()->nNode--;
+aSavePam.GetPoint()->nContent.Assign(aSavePam.GetContentNode(), 0);
+}
+else
+{
+bool const success(aSavePam.Move(fnMoveBackward, GoInContent));
+assert(success);
+(void) success;
 }
 
 // Copy all Bookmarks that are within the Move range into an array,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-07-20 Thread Samuel Mehrbrodt
 sw/source/uibase/utlui/unotools.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 14f9bb560cc1ebf588683bcf2297ab44cb8993eb
Author: Samuel Mehrbrodt 
Date:   Tue Jul 18 16:09:05 2017 +0200

tdf#109188 Always load documents read-only in SwOneExampleFrame

Should be no problem since 38a3743e0c5d52f9386f74097fd512d3133fbbe3

Change-Id: I0ce47bc2bdaa900559a16baf25305066977caa6d
Reviewed-on: https://gerrit.libreoffice.org/40140
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
Reviewed-on: https://gerrit.libreoffice.org/40213

diff --git a/sw/source/uibase/utlui/unotools.cxx 
b/sw/source/uibase/utlui/unotools.cxx
index 636039a3c0c2..429a8033298d 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -143,7 +143,7 @@ void SwOneExampleFrame::CreateControl()
 pValues[1].Name = "Referer";
 pValues[1].Value <<= OUString("private:user");
 pValues[2].Name = "ReadOnly";
-pValues[2].Value <<= (sTempURL != cFactory);
+pValues[2].Value <<= (true);
 uno::Any aArgs(aSeq);
 
 xPrSet->setPropertyValue( "LoaderArguments", aArgs );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-07-11 Thread Michael Stahl
 sw/source/core/layout/flowfrm.cxx   |   14 ++--
 sw/source/core/layout/objectformattertxtfrm.cxx |   27 +++-
 2 files changed, 38 insertions(+), 3 deletions(-)

New commits:
commit f8b32e4388cfc9cfcf1acebc82d023a8d3783463
Author: Michael Stahl 
Date:   Wed Jun 21 12:26:19 2017 +0200

tdf#101821 sw: fix layout footnote use-after-free

After inserting a header in the bugdoc, during SwFrame::Calc of a
SwTextFrame that is in a footnote, it decides move forward to the next
page.  This deletes the SwFootnoteFrame and SwFootnoteContFrame that
lcl_FormatContentOfLayoutFrame() are iterating over.

For want of a more elegant solution, use a big hammer to prevent the
problem and try to clean up so that no empty SwFootnoteFrame and
SwFootnoteContFrame remain (as that is known to crash in other places,
see commit c9fb347642729017ad0c613fe26310befd021db8)

Invalid read of size 8
   at 0x414E1F96: SwFrame::GetNext() (frame.hxx:485)
   by 0x41AFDD07: lcl_FormatContentOfLayoutFrame(SwLayoutFrame*, SwFrame*) 
(objectformattertxtfrm.cxx:646)
   by 0x41AFDCC0: lcl_FormatContentOfLayoutFrame(SwLayoutFrame*, SwFrame*) 
(objectformattertxtfrm.cxx:642)
   by 0x41AFDCC0: lcl_FormatContentOfLayoutFrame(SwLayoutFrame*, SwFrame*) 
(objectformattertxtfrm.cxx:642)
   by 0x41AFDEA7: 
SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs(SwTextFrame&) 
(objectformattertxtfrm.cxx:696)
   by 0x41AAA680: SwFlyAtContentFrame::MakeAll(OutputDevice*) 
(flycnt.cxx:415)
   by 0x41A7F211: SwFrame::PrepareMake(OutputDevice*) (calcmove.cxx:346)
   by 0x41B75758: SwFrame::Calc(OutputDevice*) const (trvlfrm.cxx:1761)
   by 0x41AA8927: SwFlyFrame::Calc(OutputDevice*) const (fly.cxx:2559)
   by 0x41ADB36B: SwLayAction::FormatLayoutFly(SwFlyFrame*) 
(layact.cxx:1414)
   by 0x41AF9658: SwObjectFormatter::FormatObj_(SwAnchoredObject&) 
(objectformatter.cxx:321)
   by 0x41AFCB6E: 
SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool) 
(objectformattertxtfrm.cxx:126)
   by 0x41AF9A6A: SwObjectFormatter::FormatObjsAtFrame_(SwTextFrame*) 
(objectformatter.cxx:443)
   by 0x41AFD275: SwObjectFormatterTextFrame::DoFormatObjs() 
(objectformattertxtfrm.cxx:328)
   by 0x41AF924A: SwObjectFormatter::FormatObjsAtFrame(SwFrame&, 
SwPageFrame const&, SwLayAction*) (objectformatter.cxx:191)
   by 0x41ADC213: SwLayAction::FormatContent(SwPageFrame const*) 
(layact.cxx:1633)
   by 0x41AD88DE: SwLayAction::InternalAction(OutputDevice*) 
(layact.cxx:760)
   by 0x41AD7080: SwLayAction::Action(OutputDevice*) (layact.cxx:351)
   by 0x41ADE32E: SwLayIdle::SwLayIdle(SwRootFrame*, SwViewShellImp*) 
(layact.cxx:2133)
   by 0x41FFC97E: SwViewShell::LayoutIdle() (viewsh.cxx:711)
 Address 0x505541a8 is 72 bytes inside a block of size 272 free'd
   at 0x4C2F21A: operator delete(void*) (vg_replace_malloc.c:576)
   by 0x41AD371A: SwFootnoteFrame::~SwFootnoteFrame() (ftnfrm.hxx:52)
   by 0x41B5B74C: SwFrame::DestroyFrame(SwFrame*) (ssfrm.cxx:391)
   by 0x41A97294: SwFlowFrame::CutTree(SwFrame*) (flowfrm.cxx:406)
   by 0x41A979AE: SwFlowFrame::MoveSubTree(SwLayoutFrame*, SwFrame*) 
(flowfrm.cxx:592)
   by 0x41ACFB69: SwContentFrame::MoveFootnoteCntFwd(bool, 
SwFootnoteBossFrame*) (ftnfrm.cxx:2756)
   by 0x41A9B78E: SwFlowFrame::MoveFwd(bool, bool, bool) (flowfrm.cxx:1813)
   by 0x41A85864: SwContentFrame::MakeAll(OutputDevice*) (calcmove.cxx:1681)
   by 0x41A7F211: SwFrame::PrepareMake(OutputDevice*) (calcmove.cxx:346)
   by 0x41B75758: SwFrame::Calc(OutputDevice*) const (trvlfrm.cxx:1761)
   by 0x41AFDCFB: lcl_FormatContentOfLayoutFrame(SwLayoutFrame*, SwFrame*) 
(objectformattertxtfrm.cxx:644)
   by 0x41AFDCC0: lcl_FormatContentOfLayoutFrame(SwLayoutFrame*, SwFrame*) 
(objectformattertxtfrm.cxx:642)
   by 0x41AFDCC0: lcl_FormatContentOfLayoutFrame(SwLayoutFrame*, SwFrame*) 
(objectformattertxtfrm.cxx:642)
   by 0x41AFDCC0: lcl_FormatContentOfLayoutFrame(SwLayoutFrame*, SwFrame*) 
(objectformattertxtfrm.cxx:642)
   by 0x41AFDEA7: 
SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs(SwTextFrame&) 
(objectformattertxtfrm.cxx:696)
   by 0x41AAA680: SwFlyAtContentFrame::MakeAll(OutputDevice*) 
(flycnt.cxx:415)
   by 0x41A7F211: SwFrame::PrepareMake(OutputDevice*) (calcmove.cxx:346)
   by 0x41B75758: SwFrame::Calc(OutputDevice*) const (trvlfrm.cxx:1761)
   by 0x41AA8927: SwFlyFrame::Calc(OutputDevice*) const (fly.cxx:2559)
   by 0x41ADB36B: SwLayAction::FormatLayoutFly(SwFlyFrame*) 
(layact.cxx:1414)
   by 0x41AF9658: SwObjectFormatter::FormatObj_(SwAnchoredObject&) 
(objectformatter.cxx:321)
   by 0x41AFCB6E: 
SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool) 
(objectformattertxtfrm.cxx:126)
   by 0x41AF9A6A: SwObjectFormatter::FormatObjsAtFrame_(SwTextFrame*) 
(objectformatter.cxx:443)
   

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-07-11 Thread Michael Stahl
 sw/source/core/access/accmap.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 665491f769c2012f83fdce032cf0265238740bad
Author: Michael Stahl 
Date:   Tue Jul 4 22:46:15 2017 +0200

sw: fix use-after-free in SwAccessibleMap::FireEvents()

As seen when running JunitTest_sw_unoapi_3 against "make debugrun",
the damn thing can call itself recursively via an odd corner case in
GetContext():

0  in SwAccessibleEventList_Impl::~SwAccessibleEventList_Impl() 
(this=0x9a6a170, __in_chrg=) at 
sw/source/core/access/accmap.cxx:498
1  in SwAccessibleMap::FireEvents() (this=0x8198bb0) at 
sw/source/core/access/accmap.cxx:3023
2  in 
SwAccessibleMap::InvalidateCursorPosition(com::sun::star::uno::Reference
 const&) (this=0x8198bb0, rAcc=uno::Reference to (SwAccessibleParagraph *) 
0x9a439d8) at sw/source/core/access/accmap.cxx:1069
3  in SwAccessibleMap::GetContext(SwFrame const*, bool) (this=0x8198bb0, 
pFrame=0x825ca10, bCreate=true) at sw/source/core/access/accmap.cxx:1925
4  in SwAccessibleMap::GetContextImpl(SwFrame const*, bool) 
(this=0x8198bb0, pFrame=0x825ca10, bCreate=true) at 
sw/source/core/access/accmap.cxx:1936
5  in 
SwAccessibleContext::InvalidateChildPosOrSize(sw::access::SwAccessibleChild 
const&, SwRect const&) (this=0x405a350, rChildFrameOrObj=..., rOldFrame=SwRect 
= {...}) at sw/source/core/access/acccontext.cxx:1196
6  in SwAccessibleMap::FireEvent(SwAccessibleEvent_Impl const&) 
(this=0x8198bb0, rEvent=...) at sw/source/core/access/accmap.cxx:898
7  in SwAccessibleMap::FireEvents() (this=0x8198bb0) at 
sw/source/core/access/accmap.cxx:3018
8  in SwViewShellImp::FireAccessibleEvents() (this=0x7744dc0) at 
sw/source/core/view/viewimp.cxx:460
9  in SwLayIdle::SwLayIdle(SwRootFrame*, SwViewShellImp*) 
(this=0x7ffc63395e30, pRt=0x7745120, pI=0x7744dc0) at 
sw/source/core/layout/layact.cxx:2267

Presumably all of mpEvents, mpEventMap and mpShapes must live until
the outermost FireEvents() completes.

Change-Id: I4e5a053035bf7fc12d9407913437d721889950ae
(cherry picked from commit ddf8d9a150e3e1725de65577c48d47918b4b11a8)
Reviewed-on: https://gerrit.libreoffice.org/39567
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
Reviewed-by: Eike Rathke 

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 0faee74144b7..84147a1826fd 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -3058,6 +3058,11 @@ void SwAccessibleMap::FireEvents()
 osl::MutexGuard aGuard( maEventMutex );
 if( mpEvents )
 {
+if (mpEvents->IsFiring())
+{
+return; // prevent recursive FireEvents()
+}
+
 mpEvents->SetFiring();
 mpEvents->MoveMissingXAccToEnd();
 for( auto const& aEvent : *mpEvents )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-07-07 Thread Xisco Fauli
 sw/source/core/text/frmform.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit f44f65019a60b5bd70b08eb11db8d1baf4f6e229
Author: Xisco Fauli 
Date:   Mon Jun 12 18:05:27 2017 +0200

tdf#104640, tdf#108469: Insert image where the cursor is

Partially revert 72a4987434368bfb0b15f5ebb70a52
Besides, add bDelta to the condition so the statement is false
if the image is resized

Change-Id: Ib07d328e040c38c63a30f6230ed9f6b605d76d9f
Reviewed-on: https://gerrit.libreoffice.org/38705
Tested-by: Jenkins 
Reviewed-by: Xisco Faulí 
(cherry picked from commit 3919d87210ea12ed3166c649ac52730026db01a4)
Reviewed-on: https://gerrit.libreoffice.org/38772
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 5d25abac0b13..ee0469a929ce 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1085,7 +1085,13 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
 
 const SwTwips nDocPrtTop = Frame().Top() + Prt().Top();
 const SwTwips nOldHeight = Prt().SSize().Height();
-const SwTwips nChg = rLine.CalcBottomLine() - nDocPrtTop - nOldHeight;
+SwTwips nChg = rLine.CalcBottomLine() - nDocPrtTop - nOldHeight;
+
+//#i84870# - no shrink of text frame, if it only contains one as-character 
anchored object.
+if ( nChg < 0 && !bDelta && bOnlyContainsAsCharAnchoredObj )
+{
+nChg = 0;
+}
 
 // Vertical Formatting:
 // The (rotated) repaint rectangle's x coordinate referes to the frame.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-07-06 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par3.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e2be5d28877a817ae302b3dca7af2f71597a912f
Author: Caolán McNamara 
Date:   Thu Jul 6 08:51:01 2017 +0100

ofz: stay inside string

Change-Id: Ia0d0ddfce4ee3d5f8763be6804fe52c514375bb3
Reviewed-on: https://gerrit.libreoffice.org/39629
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 073a2b2aef5c0b579aea8ed203dd9c1c5790b650)
Reviewed-on: https://gerrit.libreoffice.org/39645
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 497f5445d159..f3211bac3b6b 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -234,7 +234,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* 
pF, OUString& rStr)
 {
 WW8FormulaListBox aFormula(*this);
 
-if (rStr[pF->nLCode-1]==0x01)
+if (pF->nLCode > 0 && rStr.getLength() >= pF->nLCode && rStr[pF->nLCode-1] 
== 0x01)
 ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, 
WW8_CT_DROPDOWN);
 
 const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-07-04 Thread Michael Stahl
 sw/source/core/layout/ftnfrm.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 2d34d70eb928f6818d9f68f1da07673ce48f90ea
Author: Michael Stahl 
Date:   Mon Jun 19 11:40:12 2017 +0200

tdf#101821 sw: layout: don't move endnotes into footnotes' container

The bugdoc has a single 1-column section from start to end, no
footnotes but lots of endnotes, and the section has the settings
"Footnotes - collect at end of text" unchecked and "Endnotes - collect
at end of section" checked.

This means that the SwFootnoteContFrame for footnotes would be put
directly below the SwPageFrame (so that multiple sections on a single
page can share it), but the SwFootnoteContFrame for the endnotes is
put below the SwColumnFrame (which is created despite only 1 column)
below the SwSectionFrame.

Hence content in endnotes has the mbInfSct flag set, and the crash
happens because the endnotes are moved from below the SwSectionFrame to
a new SwFootnoteContFrame that is directly below a SwPageFrame, without
clearing the mbInfSct flag.

Fix the wrong call in SwFootnoteBossFrame::MoveFootnotes_() to
FindFootnoteBossFrame() that resulted in the wrong (unsuitable for
endnotes) SwFootnoteContFrame to be used as the target for the move.

Change-Id: I64f6b86441e5ac1f16433f005e97c274a1c69dfa
(cherry picked from commit 4c0b3520b66477334a7971dbed7ffcdcd265e749)
Reviewed-on: https://gerrit.libreoffice.org/39104
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 6ec9160ac346..290240b63e9b 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1905,7 +1905,8 @@ void SwFootnoteBossFrame::MoveFootnotes_( 
SwFootnoteFrames &rFootnoteArr, bool b
 SwFootnoteFrame* pLastInsertedFootnote = nullptr;
 for (SwFootnoteFrame* pFootnote : rFootnoteArr)
 {
-SwFootnoteBossFrame* pRefBoss = 
pFootnote->GetRef()->FindFootnoteBossFrame( true );
+SwFootnoteBossFrame* 
pRefBoss(pFootnote->GetRef()->FindFootnoteBossFrame(
+!pFootnote->GetAttr()->GetFootnote().IsEndNote()));
 if( pRefBoss != this )
 {
 const sal_uInt16 nRefNum = 
pRefBoss->FindPageFrame()->GetPhyPageNum();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-06-26 Thread Caolán McNamara
 sw/source/filter/ww8/ww8scan.cxx |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 63f5d076c1a79a125f01c140469fdf797bb7f120
Author: Caolán McNamara 
Date:   Mon Jun 26 13:21:49 2017 +0100

ofz#2392 restored props don't match saved props

Change-Id: Idb198f0121ac9c6b4083b157af07c5eb1cda66cb
Reviewed-on: https://gerrit.libreoffice.org/39267
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index a435d7ecbc5a..ec3dc11da85c 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -5337,8 +5337,19 @@ void WW8PLCFxDesc::Restore( const WW8PLCFxSave1& rSave )
 pPLCFx->GetSprms(&aD);
 pPLCFx->SetDirty(false);
 aD.ReduceByOffset();
-pMemPos = aD.pMemPos + rSave.nPLCFxMemOfs;
-nSprmsLen = nOrigSprmsLen - rSave.nPLCFxMemOfs;
+
+if (nOrigSprmsLen > aD.nSprmsLen)
+{
+//two entries exist for the same offset, cut and run
+SAL_WARN("sw.ww8", "restored properties don't match saved 
properties, bailing out");
+nSprmsLen = 0;
+pMemPos = nullptr;
+}
+else
+{
+nSprmsLen = nOrigSprmsLen - rSave.nPLCFxMemOfs;
+pMemPos = aD.pMemPos + rSave.nPLCFxMemOfs;
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-06-23 Thread Michael Stahl
 sw/source/core/layout/newfrm.cxx |   24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 6d4a041fe81b36e1e8f933bfe4216afcea72c76d
Author: Michael Stahl 
Date:   Thu Jun 22 10:39:36 2017 +0200

tdf#101821 sw: fix layout footnote use-after-free in SwRootFrame

The ClearSwLayouterEntries() accesses anchored objects and if they are
anchored in footnotes then RemoveFootnotes() has already deleted them.

(regression from 962d0500c4debaef43e5f146e47e08c66d851562)

Invalid write of size 1
   at 0x4143CCB3: SwAnchoredObject::SetTmpConsiderWrapInfluence(bool) 
(anchoredobject.cxx:739)
   by 0x414D8A21: SwObjsMarkedAsTmpConsiderWrapInfluence::Clear() 
(objstmpconsiderwrapinfl.cxx:58)
   by 0x414C943E: SwLayouter::ClearObjsTmpConsiderWrapInfluence(SwDoc 
const&) (layouter.cxx:401)
   by 0x411DBE57: sw::DocumentLayoutManager::ClearSwLayouterEntries() 
(DocumentLayoutManager.cxx:504)
   by 0x414D05D9: SwRootFrame::DestroyImpl() (newfrm.cxx:594)
   by 0x41535AB3: SwFrame::DestroyFrame(SwFrame*) (ssfrm.cxx:389)
   by 0x419E8171: std::_Sp_counted_deleter, (__gnu_cxx::_Lock_policy)2>::_M_dispose() 
(shared_ptr_base.h:464)
   by 0x40EB6DB5: 
std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() 
(shared_ptr_base.h:150)
   by 0x40EB5E76: 
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() 
(shared_ptr_base.h:662)
   by 0x419E65F9: std::__shared_ptr::~__shared_ptr() (shared_ptr_base.h:928)
   by 0x419E6615: std::shared_ptr::~shared_ptr() 
(shared_ptr.h:93)
   by 0x419E619D: SwViewShell::~SwViewShell() (vnew.cxx:285)
  Address 0x5feb6eee is 334 bytes inside a block of size 488 free'd
   at 0x4C2F21A: operator delete(void*) (vg_replace_malloc.c:576)
   by 0x41488962: SwFlyAtContentFrame::~SwFlyAtContentFrame() 
(flyfrms.hxx:134)
   by 0x41535AFC: SwFrame::DestroyFrame(SwFrame*) (ssfrm.cxx:391)
   by 0x415360BD: SwLayoutFrame::DestroyImpl() (ssfrm.cxx:477)
   by 0x41535AB3: SwFrame::DestroyFrame(SwFrame*) (ssfrm.cxx:389)
   by 0x414A2FF4: sw_RemoveFootnotes(SwFootnoteBossFrame*, bool, bool) 
(ftnfrm.cxx:852)
   by 0x414A3104: sw_RemoveFootnotes(SwFootnoteBossFrame*, bool, bool) 
(ftnfrm.cxx:874)
   by 0x414A321A: SwRootFrame::RemoveFootnotes(SwPageFrame*, bool, bool) 
(ftnfrm.cxx:897)
   by 0x414D0558: SwRootFrame::DestroyImpl() (newfrm.cxx:585)
   by 0x41535AB3: SwFrame::DestroyFrame(SwFrame*) (ssfrm.cxx:389)
   by 0x419E8171: std::_Sp_counted_deleter, (__gnu_cxx::_Lock_policy)2>::_M_dispose() 
(shared_ptr_base.h:464)
   by 0x40EB6DB5: 
std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() 
(shared_ptr_base.h:150)
   by 0x40EB5E76: 
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() 
(shared_ptr_base.h:662)
   by 0x419E65F9: std::__shared_ptr::~__shared_ptr() (shared_ptr_base.h:928)
   by 0x419E6615: std::shared_ptr::~shared_ptr() 
(shared_ptr.h:93)
   by 0x419E619D: SwViewShell::~SwViewShell() (vnew.cxx:285)

Change-Id: I147f46d49c90de46189ad34feed66c289adddc15
(cherry picked from commit c7782c7c27d85866872cc24a618df02504ff12ca)
Reviewed-on: https://gerrit.libreoffice.org/39106
Tested-by: Jenkins 
Reviewed-by: Björn Michaelsen 

diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index e1a96cd25ac1..dae63d1f8aa6 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -573,16 +573,6 @@ void SwRootFrame::DestroyImpl()
 {
 mbTurboAllowed = false;
 mpTurbo = nullptr;
-// fdo#39510 crash on document close with footnotes
-// Object ownership in writer and esp. in layout are a mess: Before the
-// document/layout split SwDoc and SwRootFrame were essentially one object
-// and magically/uncleanly worked around their common destruction by call
-// to SwDoc::IsInDtor() -- even from the layout. As of now destruction of
-// the layout proceeds forward through the frames. Since 
SwTextFootnote::DelFrames
-// also searches backwards to find the master of footnotes, they must be
-// considered to be owned by the SwRootFrame and also be destroyed here,
-// before tearing down the (now footnote free) rest of the layout.
-RemoveFootnotes(nullptr, false, true);
 
 if(pBlink)
 pBlink->FrameDelete( this );
@@ -591,8 +581,11 @@ void SwRootFrame::DestroyImpl()
 {
 SwDoc *pDoc = pRegisteredInNonConst->GetDoc();
 pDoc->DelFrameFormat( pRegisteredInNonConst );
+// do this before calling RemoveFootnotes() because footnotes
+// can contain anchored objects
 pDoc->GetDocumentLayoutManager().ClearSwLayouterEntries();
 }
+
 delete mpDestroy;
 mpDestroy = nullptr;
 
@@ -606,6 +599,17 @@ void SwRootFrame::DestroyImpl()
 // Some accessible shells are left => problems on second SwFrame::Destroy 
call
 assert(0 =

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-06-18 Thread Michael Stahl
 sw/source/core/inc/rootfrm.hxx|   22 ++
 sw/source/core/layout/flylay.cxx  |2 +-
 sw/source/core/layout/frmtool.cxx |2 ++
 sw/source/core/layout/trvlfrm.cxx |   26 +++---
 4 files changed, 28 insertions(+), 24 deletions(-)

New commits:
commit 9fa193f1a17eac56c19f611c76c2cdd022487b9e
Author: Michael Stahl 
Date:   Fri Jun 9 18:03:40 2017 +0200

tdf#108118 sw: fix recursive layouting during SwCursorShell::Paint()

The problem, in a nutshell, is that SwDrawContact::Changed() is called
during layout, and recursively starts another layout that removes a
drawing object that is being iterated over in frame #28
SwObjectFormatter::FormatObjsAtFrame_() from the layout.

Apparently SwDrawContact::Changed() is by far the most dangerous
function to call during layout; set the quite targeted flag
SetCallbackActionEnabled() to prevent the recursion.

0  SwSortedObjs::Remove(SwAnchoredObject&) (this=0x73e4a00, 
_rAnchoredObj=...) at sw/source/core/layout/sortedobjs.cxx:228
1  SwFrame::RemoveDrawObj(SwAnchoredObject&) (this=0x9430e20, 
_rToRemoveObj=...) at sw/source/core/layout/fly.cxx:2076
2  SwDrawVirtObj::RemoveFromWriterLayout() (this=0x95ce130) at 
sw/source/core/draw/dcontact.cxx:2199
3  SwDrawContact::DisconnectObjFromLayout(SdrObject*) (this=0x70fef00, 
_pDrawObj=0x95ce130) at sw/source/core/draw/dcontact.cxx:1663
4  SwLayoutFrame::DestroyImpl() (this=0x91c6c60) at 
sw/source/core/layout/ssfrm.cxx:489
5  SwFrame::DestroyFrame(SwFrame*) (pFrame=0x91c6c60) at 
sw/source/core/layout/ssfrm.cxx:389
6  SwLayoutFrame::DestroyImpl() (this=0x9435cd0) at 
sw/source/core/layout/ssfrm.cxx:500
7  SwPageFrame::DestroyImpl() (this=0x9435cd0) at 
sw/source/core/layout/pagechg.cxx:270
8  SwFrame::DestroyFrame(SwFrame*) (pFrame=0x9435cd0) at 
sw/source/core/layout/ssfrm.cxx:389
9  SwRootFrame::RemovePage(SwPageFrame**, SwRemoveResult) (this=0x36b26f0, 
pDelRef=0x7ffeafbf2e38, eResult=SwRemoveResult::Prev) at 
sw/source/core/layout/pagechg.cxx:1351
10 SwRootFrame::RemoveSuperfluous() (this=0x36b26f0) at 
sw/source/core/layout/pagechg.cxx:1426
11 SwLayAction::InternalAction(OutputDevice*) (this=0x7ffeafbf3250, 
pRenderContext=0x3595030) at sw/source/core/layout/layact.cxx:502
12 SwLayAction::Action(OutputDevice*) (this=0x7ffeafbf3250, 
pRenderContext=0x3595030) at sw/source/core/layout/layact.cxx:351
13 SwViewShell::ImplEndAction(bool) (this=0x364cc00, bIdleEnd=false) at 
sw/source/core/view/viewsh.cxx:279
14 SwViewShell::EndAction(bool) (this=0x364cc00, bIdleEnd=false) at 
sw/inc/viewsh.hxx:605
15 SwCursorShell::EndAction(bool, bool) (this=0x364cc00, bIdleEnd=false, 
DoSetPosX=false) at sw/source/core/crsr/crsrsh.cxx:259
16 SwRootFrame::EndAllAction(bool) (this=0x36b26f0, bVirDev=false) at 
sw/source/core/layout/pagechg.cxx:1728
17 SwDrawContact::Changed(SdrObject const&, SdrUserCallType, 
tools::Rectangle const&) (this=0x70fef00, rObj=..., 
eType=SdrUserCallType::MoveOnly, rOldBoundRect=...) at 
sw/source/core/draw/dcontact.cxx:985
18 SdrObject::SendUserCall(SdrUserCallType, tools::Rectangle const&) const 
(this=0x95ce130, eUserCall=SdrUserCallType::MoveOnly, rBoundRect=...) at 
svx/source/svdraw/svdobj.cxx:2736
19 SdrObject::Move(Size const&) (this=0x95ce130, rSiz=Size = {...}) at 
svx/source/svdraw/svdobj.cxx:1482
20 SwDrawVirtObj::Move(Size const&) (this=0x95ce130, rSiz=Size = {...}) at 
sw/source/core/draw/dcontact.cxx:2366
21 SwAnchoredDrawObject::SetObjTop_(long) (this=0x95ce250, _nTop=777490) at 
sw/source/core/layout/anchoreddrawobject.cxx:677
22 SwAnchoredObject::SetObjTop(long) (this=0x95ce250, _nTop=777490) at 
sw/source/core/layout/anchoredobject.cxx:593
23 objectpositioning::SwToContentAnchoredObjectPosition::CalcPosition() 
(this=0x7ffeafbf3980) at 
sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx:739
24 SwAnchoredDrawObject::MakeObjPosAnchoredAtPara() (this=0x95ce250) at 
sw/source/core/layout/anchoreddrawobject.cxx:421
25 SwAnchoredDrawObject::MakeObjPos() (this=0x95ce250) at 
sw/source/core/layout/anchoreddrawobject.cxx:318
26 SwObjectFormatter::FormatObj_(SwAnchoredObject&) (this=0x90623d0, 
_rAnchoredObj=...) at sw/source/core/layout/objectformatter.cxx:374
27 SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool) 
(this=0x90623d0, _rAnchoredObj=..., _bCheckForMovedFwd=false) at 
sw/source/core/layout/objectformattertxtfrm.cxx:126
28 SwObjectFormatter::FormatObjsAtFrame_(SwTextFrame*) (this=0x90623d0, 
_pMasterTextFrame=0x0) at sw/source/core/layout/objectformatter.cxx:443
29 SwObjectFormatterTextFrame::DoFormatObjs() (this=0x90623d0) at 
sw/source/core/layout/objectformattertxtfrm.cxx:328
30 SwObjectFormatter::FormatObjsAtFrame(SwFrame&, SwPageFrame const&, 
SwLayAction*) (_rAnchorFrame=..., _rPageFrame=..., _pLayAction=0x0) at 
sw/source/core/layout/objectformatter.

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source xmloff/inc xmloff/Library_xo.mk xmloff/source

2017-06-13 Thread Troy Rollo
 sw/source/core/unocore/unostyle.cxx |3 
 sw/source/filter/xml/xmlfmt.cxx |   53 ++-
 xmloff/Library_xo.mk|1 
 xmloff/inc/prstylecond.hxx  |   23 ++
 xmloff/source/style/prstylecond.cxx |  125 
 xmloff/source/style/styleexp.cxx|   50 ++
 6 files changed, 251 insertions(+), 4 deletions(-)

New commits:
commit e9869b9b38d4e4e7f893aecb26f73d985f17e350
Author: Troy Rollo 
Date:   Tue Jun 6 17:41:33 2017 +1000

tdf#103091 conditional style conditions not saved

Change-Id: Iccf3eb531ee3382d27105e5ccce6013707a646b6
Reviewed-on: https://gerrit.libreoffice.org/38451
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit a5b4cb3f836c991d0647f55e1ef4920ce6115eac)
Reviewed-on: https://gerrit.libreoffice.org/38747

diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index 63ce5d95beb6..ad6dd78b687e 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -2013,7 +2013,8 @@ void SwXStyle::SetPropertyValues_Impl(const 
uno::Sequence& rPropertyNa
 {
 if(!m_pDoc)
 throw uno::RuntimeException();
-const SfxItemPropertySet* pPropSet = 
aSwMapProvider.GetPropertySet(m_rEntry.m_nPropMapType);
+sal_Int8 nPropSetId = m_bIsConditional ? 
PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.m_nPropMapType;
+const SfxItemPropertySet* pPropSet = 
aSwMapProvider.GetPropertySet(nPropSetId);
 const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
 if(rPropertyNames.getLength() != rValues.getLength())
 throw lang::IllegalArgumentException();
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index b65cb0dc525b..b5aabd8cd96f 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -31,6 +31,7 @@
 #include "docary.hxx"
 #include 
 #include "unostyle.hxx"
+#include "unoprnms.hxx"
 #include "fmtpdsc.hxx"
 #include "pagedesc.hxx"
 #include 
@@ -44,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "xmlimp.hxx"
 #include "xmltbli.hxx"
 #include "cellatr.hxx"
@@ -51,10 +53,13 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
 using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
 using namespace ::xmloff::token;
 
 class SwXMLConditionParser_Impl
@@ -205,8 +210,11 @@ public:
 const uno::Reference< xml::sax::XAttributeList > & xAttrList );
 virtual ~SwXMLConditionContext_Impl() override;
 
-
 bool IsValid() const { return 0 != nCondition; }
+
+sal_uInt32 getCondition() const { return nCondition; }
+sal_uInt32 getSubCondition() const { return nSubCondition; }
+OUString const &getApplyStyle() const { return sApplyStyle; }
 };
 
 SwXMLConditionContext_Impl::SwXMLConditionContext_Impl(
@@ -257,10 +265,12 @@ typedef 
std::vector> SwXMLConditions_
 class SwXMLTextStyleContext_Impl : public XMLTextStyleContext
 {
 std::unique_ptr pConditions;
+uno::Reference < style::XStyle > xNewStyle;
 
 protected:
 
 virtual uno::Reference < style::XStyle > Create() override;
+virtual void Finish( bool bOverwrite ) override;
 
 public:
 
@@ -280,7 +290,6 @@ public:
 
 uno::Reference < style::XStyle > SwXMLTextStyleContext_Impl::Create()
 {
-uno::Reference < style::XStyle > xNewStyle;
 
 if( pConditions && XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() )
 {
@@ -302,6 +311,46 @@ uno::Reference < style::XStyle > 
SwXMLTextStyleContext_Impl::Create()
 return xNewStyle;
 }
 
+void
+SwXMLTextStyleContext_Impl::Finish( bool bOverwrite )
+{
+
+if( pConditions && XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() && 
xNewStyle.is() )
+{
+CommandStruct const *aCommands = SwCondCollItem::GetCmds();
+
+Reference< XPropertySet > xPropSet( xNewStyle, UNO_QUERY );
+
+uno::Sequence< beans::NamedValue > aSeq( pConditions->size() );
+
+std::vector>::size_type i;
+unsigned j;
+
+for( i = 0; i < pConditions->size(); ++i )
+{
+if( (*pConditions)[i]->IsValid() )
+{
+sal_uInt32 nCond = (*pConditions)[i]->getCondition();
+sal_uInt32 nSubCond = (*pConditions)[i]->getSubCondition();
+
+for( j = 0; j < COND_COMMAND_COUNT; ++j )
+{
+if( aCommands[j].nCnd == nCond &&
+aCommands[j].nSubCond == nSubCond )
+{
+aSeq[i].Name = GetCommandContextByIndex( j );
+aSeq[i].Value <<= GetImport().GetStyleDisplayName( 
GetFamily(), (*pConditions)[i]->getApplyStyle() );
+break;
+}
+}
+}
+}
+
+xPropSet->setPropertyValue( UNO_NAME_PARA_STYLE_CONDITIONS, 
uno::makeAny( aSeq )  );
+}
+   

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-06-09 Thread Michael Stahl
 sw/source/uibase/shells/frmsh.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit e64a85d50dbd4db7a3de1ee2f6caf52cc60f6a50
Author: Michael Stahl 
Date:   Wed Jun 7 17:47:15 2017 +0200

tdf#108305 sw: fix crash on fly "Position and Size"

Everything else in SwFrameShell::Execute() checks pArgs isn't null so do
the same here.

(regression from d02f75a8c36705924ddd6a5921fe3012fafce812)

Change-Id: I73d85b111a5d2c088b9d888b8595ceb3979e8d2b
(cherry picked from commit 28d760e5220a175a5eb8e859498baa4c7f97f3e2)
Reviewed-on: https://gerrit.libreoffice.org/38521
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/uibase/shells/frmsh.cxx 
b/sw/source/uibase/shells/frmsh.cxx
index 2a6ad96916c8..a70097dcc0b3 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -351,13 +351,15 @@ void SwFrameShell::Execute(SfxRequest &rReq)
 bool bApplyNewSize = false;
 
 Size aNewSize = aMgr.GetSize();
-if ( SfxItemState::SET == pArgs->GetItemState( 
SID_ATTR_TRANSFORM_WIDTH, false, &pItem ) )
+if (pArgs &&
+SfxItemState::SET == 
pArgs->GetItemState(SID_ATTR_TRANSFORM_WIDTH, false, &pItem))
 {
 aNewSize.setWidth( static_cast< const SfxUInt32Item* 
>(pItem)->GetValue() );
 bApplyNewSize = true;
 }
 
-if ( SfxItemState::SET == pArgs->GetItemState( 
SID_ATTR_TRANSFORM_HEIGHT, false, &pItem ) )
+if (pArgs &&
+SfxItemState::SET == 
pArgs->GetItemState(SID_ATTR_TRANSFORM_HEIGHT, false, &pItem))
 {
 aNewSize.setHeight( static_cast< const SfxUInt32Item* 
>(pItem)->GetValue() );
 bApplyNewSize = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-06-06 Thread Bernhard Widl
 sw/source/uibase/fldui/fldmgr.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 48e75d8107d64920dd90c5d98b79dc982e311fa3
Author: Bernhard Widl 
Date:   Fri May 12 13:55:50 2017 +0200

tdf#107795 fixed cursor position after inserting input field

Change-Id: I3c063c0393b524132e522914a7a9885c8a9c3b78
Reviewed-on: https://gerrit.libreoffice.org/37536
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit 408a7e320db978a8f784fa25e35caedf931612c5)
Reviewed-on: https://gerrit.libreoffice.org/38443
Reviewed-by: Katarina Behrens 

diff --git a/sw/source/uibase/fldui/fldmgr.cxx 
b/sw/source/uibase/fldui/fldmgr.cxx
index a51dd7666f3d..35c6f5ebd28e 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1328,10 +1328,14 @@ bool SwFieldMgr::InsertField(
 
 if (TYP_INPUTFLD == rData.m_nTypeId)
 {
+pCurShell->Push();
+
 // start dialog, not before the field is inserted tdf#99529
 pCurShell->Left(CRSR_SKIP_CHARS,
 false, (INP_VAR == (nSubType & 0xff)) ? 1 : 2, false );
 pCurShell->StartInputFieldDlg(pField, false, rData.m_pParent);
+
+pCurShell->Pop(false);
 }
 
 if(bExp && bEvalExp)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-30 Thread Armin Le Grand
 sw/source/uibase/docvw/edtdd.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 78f84a9a92f8dcd50747480d931f60c58b2344ec
Author: Armin Le Grand 
Date:   Fri May 26 11:49:58 2017 +0200

tdf#106131 no global drag when anchor drag active

If in Writer dragging the anchor is already active
it is not allowed to enter global object drag mode.
This check was missing and may lead to various
inconsistencies

Change-Id: I7d8dd2a62737e6d5d72f69747ceb21bcb73c45ed
Reviewed-on: https://gerrit.libreoffice.org/38059
Tested-by: Jenkins 
Reviewed-by: Armin Le Grand 
(cherry picked from commit 1b27bed2d5b6915cda408c6f8d27d15bf13cc9be)
Reviewed-on: https://gerrit.libreoffice.org/38188
Tested-by: Armin Le Grand 
(cherry picked from commit c3c208e1fdfd60b95fc09ed48d9ee975bddb214d)
Reviewed-on: https://gerrit.libreoffice.org/38209
Reviewed-by: Michael Stahl 

diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx
index 4a496dacba7d..62ab5bfb0cb5 100644
--- a/sw/source/uibase/docvw/edtdd.cxx
+++ b/sw/source/uibase/docvw/edtdd.cxx
@@ -88,11 +88,17 @@ void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const 
Point& rPosPixel )
 //We are not selecting and aren't at a selection
 bStart = true;
 else if ( !g_bFrameDrag && rSh.IsSelFrameMode() &&
-rSh.IsInsideSelectedObj( aDocPos ) )
+rSh.IsInsideSelectedObj( aDocPos ) &&
+nullptr == m_pAnchorMarker)
 {
 //We are not dragging internally and are not at an
 //object (frame, draw object)
 
+// tdf#106131 *and* AnchorDrag is *not* active: When active,
+// entering global drag mode will destroy the AnchorHdl but
+// keep the now invalid ptr in place, next access will crash.
+// It is indeed wrong to enter drag mode when AnchorDrag is
+// already active
 bStart = true;
 }
 else if( !g_bFrameDrag && m_rView.GetDocShell()->IsReadOnly() &&
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-30 Thread Jan Holesovsky
 sw/source/uibase/app/apphdl.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 824426811897347d8a9aacff4f304572cec1473c
Author: Jan Holesovsky 
Date:   Tue May 30 10:19:16 2017 +0200

tdf#107729: Disable toolbar items that are not available yet.

Otherwise trying to use them crashes LibreOffice.

Change-Id: I268e5b783905ec7aaaf50cbc629fd44e6341bf8d
Reviewed-on: https://gerrit.libreoffice.org/38185
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 61a9e31b9f08..5abd1de7c9fa 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -248,6 +248,9 @@ void SwModule::StateOther(SfxItemSet &rSet)
 // #i51949# hide e-Mail option if e-Mail is not supported
 // #i63267# printing might be disabled
 if (!xConfigItem ||
+!xConfigItem->GetResultSet().is() ||
+xConfigItem->GetCurrentDBData().sDataSource.isEmpty() ||
+xConfigItem->GetCurrentDBData().sCommand.isEmpty() ||
 (nWhich == FN_MAILMERGE_PRINT_DOCUMENTS && 
Application::GetSettings().GetMiscSettings().GetDisablePrinting()) ||
 (nWhich == FN_MAILMERGE_EMAIL_DOCUMENTS && 
!xConfigItem->IsMailAvailable()))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-29 Thread Michael Stahl
 sw/source/core/para/paratr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2990a2c2b29ca5c3316f28e5d3be74220c4948a4
Author: Michael Stahl 
Date:   Fri May 26 11:25:06 2017 +0200

sw: coverity#1409899 Null pointer dereferences

Change-Id: I152def3c629980aedb705ac511f154cc6e9d1b0f
(cherry picked from commit 40587c191ecf6ec667f40e9148c197246e3c45a5)
Reviewed-on: https://gerrit.libreoffice.org/38060
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx
index 8fc36009722b..bdc07540105f 100644
--- a/sw/source/core/para/paratr.cxx
+++ b/sw/source/core/para/paratr.cxx
@@ -77,7 +77,7 @@ SwFormatDrop::~SwFormatDrop()
 
 void SwFormatDrop::SetCharFormat( SwCharFormat *pNew )
 {
-assert(!pNew->IsDefault()); // expose cases that lead to use-after-free
+assert(!pNew || !pNew->IsDefault()); // expose cases that lead to 
use-after-free
 // Rewire
 if ( GetRegisteredIn() )
 GetRegisteredInNonConst()->Remove( this );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-25 Thread Maxim Monastirsky
 sw/source/uibase/app/apphdl.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 6b921e1c8a4779dfd6f5531842ab89d85aa99a85
Author: Maxim Monastirsky 
Date:   Thu May 25 02:17:06 2017 +0300

tdf#105002 Don't crash on mail wizard recreation

Change-Id: I8af4753cc654ec475d40223a64afa50a9de332ab
Reviewed-on: https://gerrit.libreoffice.org/38007
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 
(cherry picked from commit ce40f2798f0fa2f8f6e3084e4bbbd50e749c55d6)
Reviewed-on: https://gerrit.libreoffice.org/38037

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 5e2b80979791..61a9e31b9f08 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -575,6 +575,7 @@ IMPL_LINK_NOARG( SwMailMergeWizardExecutor, EndDialogHdl, 
Dialog&, void )
 xMMConfig->SetTargetView(nullptr);
 
 // destroy wizard asynchronously
+m_pWizardToDestroyInCallback = m_pWizard;
 Application::PostUserEvent(
 LINK( this, SwMailMergeWizardExecutor, CloseFrameHdl ), 
m_pWizard );
 
@@ -668,6 +669,7 @@ IMPL_LINK_NOARG(SwMailMergeWizardExecutor, CloseFrameHdl, 
void*, void)
 m_pView2Close->GetViewFrame()->DoClose();
 m_pView2Close = nullptr;
 }
+m_pWizardToDestroyInCallback.disposeAndClear();
 }
 } // namespace
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-22 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit dea663395aa4256b1b0270320d3023fcfd6b4a33
Author: Caolán McNamara 
Date:   Sun May 21 14:44:37 2017 +0100

ofz: check for null para

Change-Id: Id31273b2a203414f8ad4f827c334ae17689560af
(cherry picked from commit ebc2abf207c8d903b07f53ecefbca5731edcb1d6)
Reviewed-on: https://gerrit.libreoffice.org/37876
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index cd6213e5f26d..6757e3c3ec34 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2167,14 +2167,18 @@ void SwWW8ImplReader::Read_HdFtFootnoteText( const 
SwNodeIndex* pSttIdx,
 long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
 {
 WW8PLCFx_SubDoc* pSD = m_pPlcxMan->GetAtn();
-if( !pSD )
+if (!pSD)
+return 0;
+
+const void* pData = pSD->GetData();
+if (!pData)
 return 0;
 
 OUString sAuthor;
 OUString sInitials;
 if( m_bVer67 )
 {
-const WW67_ATRD* pDescri = static_cast(pSD->GetData());
+const WW67_ATRD* pDescri = static_cast(pData);
 const OUString* pA = GetAnnotationAuthor(SVBT16ToShort(pDescri->ibst));
 if (pA)
 sAuthor = *pA;
@@ -2187,7 +2191,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
 }
 else
 {
-const WW8_ATRD* pDescri = static_cast(pSD->GetData());
+const WW8_ATRD* pDescri = static_cast(pData);
 {
 const sal_uInt16 nLen = 
std::min(SVBT16ToShort(pDescri->xstUsrInitl[0]),
  
SAL_N_ELEMENTS(pDescri->xstUsrInitl)-1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-16 Thread Michael Stahl
 sw/source/core/layout/tabfrm.cxx  |   16 
 sw/source/core/txtnode/thints.cxx |4 
 2 files changed, 20 insertions(+)

New commits:
commit 23c333b10c270397dd7ff4bb36c94d6076dec003
Author: Michael Stahl 
Date:   Fri May 12 18:34:17 2017 +0200

sw: table-in-footnote: delete SwFootnoteFrame if it becomes empty

Crashed in a11y code with a SwFootnoteFrame that survived a JoinNode and
subsequent deletion of its reference-containing SwTextFrame and thus had
a stale "pRef" member; presumably the SwTableFrame needs to delete an
empty footnote frame like the SwTextFrame does from SwContentFrame::Cut(),
called from DelFrames(), called from CutImpl().

Change-Id: I5a30357ecd3bf474bfc4a5451de89beb245fb0ae
(cherry picked from commit c9fb347642729017ad0c613fe26310befd021db8)
Reviewed-on: https://gerrit.libreoffice.org/37562
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index b2e56e8bbbc6..d08468aaa1e1 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3463,6 +3463,22 @@ void SwTabFrame::Cut()
 pSct->InvalidateSize_();
 }
 }
+// table-in-footnote: delete empty footnote frames (like 
SwContentFrame::Cut)
+else if (!pUp->Lower() && pUp->IsFootnoteFrame() && 
!pUp->IsColLocked())
+{
+if (pUp->GetNext() && !pUp->GetPrev())
+{
+if (SwFrame *const pTmp = 
static_cast(pUp->GetNext())->ContainsAny())
+{
+pTmp->InvalidatePrt_();
+}
+}
+if (!pUp->IsDeleteForbidden())
+{
+pUp->Cut();
+SwFrame::DestroyFrame(pUp);
+}
+}
 else if( (Frame().*aRectFnSet->fnGetHeight)() )
 {
 // OD 26.08.2003 #i18103# - *no* 'ColUnlock' of section -
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 0e6f73fd5939..eb2180702b1e 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1400,6 +1400,10 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, 
const SetAttrMode nMode )
 SwContentNode* pCNd = rNodes[ nSttIdx 
]->GetContentNode();
 if( nullptr != pCNd )
 pCNd->DelFrames();
+else if (SwTableNode *const pTable = 
rNodes[nSttIdx]->GetTableNode())
+{
+pTable->DelFrames();
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-16 Thread Michael Stahl
 sw/source/core/layout/findfrm.cxx |2 +-
 sw/source/core/layout/flowfrm.cxx |2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit c4b55ea03da881590e5fac1ffc97177e4ce16b0b
Author: Michael Stahl 
Date:   Fri May 12 17:08:01 2017 +0200

tdf#107568 sw: prevent moving/splitting of tables in footnotes

The problem here is that for a table in a footnote on page 42,
SwTabFrm::MakeAll() calls Split(), which first creates a
follow-table-frame and then reformats the last row of the table;
somehow the SwTextFrame id="4636" in that row doesn't fit and wants
to split and then move to the following page with that page's footnote
container as its parent.

So this doesn't work currently.

commit 971adcd9e19e0bcab5855aae9be58d2203b46169 tried to prevent just
the moving forward of the table itself, but the table can still be split;
if IsMoveable() returns false then that also prevents splitting the table.

Change-Id: I1977c65f97cb0f66dbe5b89d7ef7e2cd05125331
(cherry picked from commit f6785b99a3f7e7531c8ef7ed16402cc4e02c9750)
Reviewed-on: https://gerrit.libreoffice.org/37561
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index 89cf31663e2c..9caa4894e1f9 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1330,7 +1330,7 @@ bool SwFrame::IsMoveable( const SwLayoutFrame* 
_pLayoutFrame ) const
 }
 }
 }
-else
+else if (!(_pLayoutFrame->IsInFootnote() && (IsTabFrame() || 
IsInTab(
 {
 bRetVal = true;
 }
diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index 7ab8e85c7119..c2ccaddaf66c 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1805,6 +1805,8 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool 
bPageBreak, bool bMoveAlways )
 return false;
 if (m_rThis.IsInFootnote())
 {
+assert(!m_rThis.IsTabFrame()); // prevented by IsMoveable()
+assert(!m_rThis.IsInTab());
 if (!m_rThis.IsContentFrame() || !pOldBoss)
 {
 SAL_WARN("sw.core", "Tables in footnotes are not truly supported");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-16 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b462870a3a5053b1efd507960c2d0d2a13a838c7
Author: Caolán McNamara 
Date:   Fri May 12 13:59:36 2017 +0100

Resolves: tdf#107786 crash on null pointer access

Change-Id: I371d509e7ab6e7e0ef757e302d54ab75aa6c4c9b
(cherry picked from commit 858d1e065530997a695dc303b9224fd136137c8d)
Reviewed-on: https://gerrit.libreoffice.org/37537
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index cf06fc768513..cd6213e5f26d 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4317,7 +4317,7 @@ void wwSectionManager::SetSegmentToPageDesc(const 
wwSection &rSection,
 Rectangle aRect(0, 0, 100, 100); // A dummy, we don't care about the 
size
 SvxMSDffImportData aData(aRect);
 SdrObject* pObject = nullptr;
-if (mrReader.m_pMSDffManager->GetShape(0x401, pObject, aData))
+if (mrReader.m_pMSDffManager->GetShape(0x401, pObject, aData) && 
!aData.empty())
 {
 // Only handle shape if it is a background shape
 if (((*aData.begin())->nFlags & 0x400) != 0)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-08 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit a36a425f28a1cff5e364d1e9f667c92e7698c7f7
Author: Caolán McNamara 
Date:   Sun May 7 14:56:51 2017 +0100

ofz check against expected struct size

don't copy vector and const up as well

Change-Id: Ia9c9dd9e0dee2300f8f60eec15b67e4a349c8a93
(cherry picked from commit f5c0d7508b972898153bbf4069c9ea48f53d64d5)
Reviewed-on: https://gerrit.libreoffice.org/37345
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 80749085cb86..cf06fc768513 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5021,10 +5021,14 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
 
 for (size_t i=0; i < aLinkStrings.size() && i < aStringIds.size(); ++i)
 {
-ww::bytes stringId = aStringIds[i];
-WW8_STRINGID *stringIdStruct = 
reinterpret_cast(&stringId[0]);
-m_aLinkStringMap[SVBT16ToShort(stringIdStruct->nStringId)] =
-aLinkStrings[i];
+const ww::bytes& stringId = aStringIds[i];
+if (stringId.size() < sizeof(WW8_STRINGID))
+{
+SAL_WARN("sw.ww8", "SwWW8ImplReader::CoreLoad: WW8_STRINGID is too 
short");
+continue;
+}
+const WW8_STRINGID *stringIdStruct = reinterpret_cast(stringId.data());
+m_aLinkStringMap[SVBT16ToShort(stringIdStruct->nStringId)] = 
aLinkStrings[i];
 }
 
 ReadDocVars(); // import document variables as meta information.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-04 Thread LeMoyne Castle
 sw/source/core/unocore/unotbl.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 066cd52857ad9c2494c584bc36b38fc34836d10f
Author: LeMoyne Castle 
Date:   Tue Apr 25 22:44:16 2017 -0600

tdf#107350 - prevent crash in unotbl.cxx

check pointer and throw exception instead of SIGABRT
when reading data from text tables that have
varying row &/or col lengths from
 - merged cells after first row,
 - split cells in first row, etc.

add backstop safety check -> exception because
 - complexity check fails (wrong/not called)
 - OOo uno api doc calls for exception when
   text table is 'too complex'
v2:  better error message for crash point and
   its parallel (getData[Array])

Change-Id: Ifb844c3e29042dab6b6cdb2448f7728e6ccb631d
Reviewed-on: https://gerrit.libreoffice.org/37002
Tested-by: Jenkins 
Reviewed-by: Björn Michaelsen 
(cherry picked from commit eea79562f1a5785a8a22cde732a091725e46bbad)
Reviewed-on: https://gerrit.libreoffice.org/37264
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index 0eab02785d22..4087921e9666 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -3697,7 +3697,7 @@ uno::Sequence> SAL_CALL 
SwXCellRange::getDataArray()
 {
 auto pCell(static_cast(pCurrentCell->get()));
 if(!pCell)
-throw uno::RuntimeException();
+throw uno::RuntimeException("Table too complex", 
static_cast(this));
 rCellAny = pCell->GetAny();
 ++pCurrentCell;
 }
@@ -3764,6 +3764,8 @@ SwXCellRange::getData() throw (uno::RuntimeException, 
std::exception)
 rRow = uno::Sequence(nColCount);
 for(auto& rValue : rRow)
 {
+if (!(*pCurrentCell).is())
+throw uno::RuntimeException("Table too complex", 
static_cast(this));
 rValue = (*pCurrentCell)->getValue();
 ++pCurrentCell;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-03 Thread Michael Stahl
 sw/source/core/doc/DocumentRedlineManager.cxx |   21 +
 sw/source/core/inc/DocumentRedlineManager.hxx |1 +
 2 files changed, 22 insertions(+)

New commits:
commit 5d1c6f1c9f392679cec6f1f4ab9673ab31e96585
Author: Michael Stahl 
Date:   Tue Apr 25 21:38:28 2017 +0200

ofz#1262 sw: DeleteAndJoin could delete proposed new redline

... because that calls CompressRedlines, which may combine the new
redline with a previous one.

In that case, the part of the new redline that follows the currently
handled overlap cannot be checked for overlaps with subsequent existing
redlines.

So prevent this with a new flag m_isForbidCompressRedlines and instead
call CompressRedlines() at the end of AppendRedline().

Change-Id: I7567962c31366ded9a433a13232d3db985745e43
Reviewed-on: https://gerrit.libreoffice.org/37041
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 6db6b797dc35..f2d51192759d 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -1226,10 +1227,15 @@ bool DocumentRedlineManager::AppendRedline( 
SwRangeRedline* pNewRedl, bool bCall
 // also dealt with when moving the indices.
 if( bCallDelete )
 {
+::comphelper::FlagGuard 
g(m_isForbidCompressRedlines);
 mpRedlineTable->Insert( pNewRedl );
 
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pRedl );
 if( !mpRedlineTable->Remove( pNewRedl ) )
+{
+assert(false); // can't happen
 pNewRedl = nullptr;
+}
+bCompress = true; // delayed compress
 }
 delete pRedl;
 }
@@ -1253,10 +1259,15 @@ bool DocumentRedlineManager::AppendRedline( 
SwRangeRedline* pNewRedl, bool bCall
 {
 // We insert temporarily so that pNew is
 // also dealt with when moving the indices.
+::comphelper::FlagGuard 
g(m_isForbidCompressRedlines);
 mpRedlineTable->Insert( pNewRedl );
 
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
 if( !mpRedlineTable->Remove( pNewRedl ) )
+{
+assert(false); // can't happen
 pNewRedl = nullptr;
+}
+bCompress = true; // delayed compress
 n = 0;  // re-initialize
 }
 bDec = true;
@@ -1279,10 +1290,15 @@ bool DocumentRedlineManager::AppendRedline( 
SwRangeRedline* pNewRedl, bool bCall
 {
 // We insert temporarily so that pNew is
 // also dealt with when moving the indices.
+::comphelper::FlagGuard 
g(m_isForbidCompressRedlines);
 mpRedlineTable->Insert( pNewRedl );
 
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
 if( !mpRedlineTable->Remove( pNewRedl ) )
+{
+assert(false); // can't happen
 pNewRedl = nullptr;
+}
+bCompress = true; // delayed compress
 n = 0;  // re-initialize
 bDec = true;
 }
@@ -1777,6 +1793,11 @@ bool DocumentRedlineManager::AppendTableCellRedline( 
SwTableCellRedline* pNewRed
 
 void DocumentRedlineManager::CompressRedlines()
 {
+if (m_isForbidCompressRedlines)
+{
+return;
+}
+
 CHECK_REDLINE( *this )
 
 void (SwRangeRedline::*pFnc)(sal_uInt16, size_t) = nullptr;
diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx 
b/sw/source/core/inc/DocumentRedlineManager.hxx
index bdcd45c5fc67..999cbd7137ce 100644
--- a/sw/source/core/

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-02 Thread Michael Stahl
 sw/source/uibase/wrtsh/wrtsh1.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit e07c2c3861f47946ed72fc9b67aafeaa8598468d
Author: Michael Stahl 
Date:   Fri Apr 28 13:26:01 2017 +0200

tdf#107474 sw: fix crash when deleting header with active SdrObject

The problem is that the SdrView's text edit mode remains active when
the header is deleted, which deletes the active SdrObject that is
anchored in the header.

Then the next call to SdrBeginTextEdit() will call SdrEndTextEdit()
but the mxTextEditObj WeakReference is null then and so the cleanup
code that resets the SdrOutliner's UndoManager is not called,
but then the SdrOutliner is deleted.

What's really horrible about this is that while text editing is active,
both SdrObjEditView and ImpEditEngine consider themselves the
exclusive owner of SwDoc's UndoManager.

(regression from 12a4200e8ff7f045efcc7e9d15a24b15b248c437
 and d7b7c9fdfe63deec26c420efc3ff1fd73c21bb27)

Change-Id: I17c5165a03d2de1eaba8a335dfbfded56573f8a2
(cherry picked from commit 7f207fca577ef820be2aec0a442df7e8ab6e14a6)
Reviewed-on: https://gerrit.libreoffice.org/37069
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 7695865d8e16..1f8ae7ba9023 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1765,6 +1765,11 @@ void SwWrtShell::SetReadonlyOption(bool bSet)
 void SwWrtShell::ChangeHeaderOrFooter(
 const OUString& rStyleName, bool bHeader, bool bOn, bool bShowWarning)
 {
+SdrView *const pSdrView = GetDrawView();
+if (pSdrView && pSdrView->IsTextEdit())
+{   // tdf#107474 deleting header may delete active drawing object
+pSdrView->SdrEndTextEdit(true);
+}
 addCurrentPosition();
 StartAllAction();
 StartUndo( UNDO_HEADER_FOOTER ); // #i7983#
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-05-02 Thread Thorsten Behrens
 sw/source/core/undo/unattr.cxx |   22 +++---
 sw/source/core/undo/unfmco.cxx |2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit e7068a7d9b945e0c6d4965445b6d951038e9c987
Author: Thorsten Behrens 
Date:   Thu Apr 27 18:07:54 2017 +0200

tdf#88555: band-aid fix, using GetPos/find instead of Contains

to find out whether given format still exists.

GetPos was replaced by Contains on multiple places in commit
98436c4b53639d86f261ac630c46d32e3c7b8e28 but sometimes after
series of undos/redos, vtable of some items in those format arrays
becomes corrupt and it makes dynamic_cast (as used by Contains)
fail and Writer falls flat on its face.

This is just a workaround, no idea about the root cause.

Change-Id: I1e02fd932dbac741687c15900841b9b7c778e2d4
Reviewed-on: https://gerrit.libreoffice.org/37038
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 1df637bde32c484b681ecdfebf56fdca03db7fc1)
Reviewed-on: https://gerrit.libreoffice.org/37043
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 4641aa08cd39..58087e2c0aa0 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -200,21 +200,21 @@ bool SwUndoFormatAttr::IsFormatInDoc( SwDoc* pDoc )
 {
 // search for the Format in the Document; if it does not exist any more,
 // the attribute is not restored!
-bool bFound = false;
+size_t nPos = SIZE_MAX;
 switch ( m_nFormatWhich )
 {
 case RES_TXTFMTCOLL:
 case RES_CONDTXTFMTCOLL:
-bFound = pDoc->GetTextFormatColls()->Contains( m_pFormat );
+nPos = pDoc->GetTextFormatColls()->GetPos( m_pFormat );
 break;
 
 case RES_GRFFMTCOLL:
-bFound = pDoc->GetGrfFormatColls()->Contains(
+nPos = pDoc->GetGrfFormatColls()->GetPos(
 static_cast(m_pFormat) );
 break;
 
 case RES_CHRFMT:
-bFound = pDoc->GetCharFormats()->Contains( m_pFormat );
+nPos = pDoc->GetCharFormats()->GetPos( m_pFormat );
 break;
 
 case RES_FRMFMT:
@@ -225,14 +225,14 @@ bool SwUndoFormatAttr::IsFormatInDoc( SwDoc* pDoc )
 {
 m_pFormat =
 
static_cast(pNd)->GetTable().GetFrameFormat();
-bFound = true;
+nPos = 0;
 break;
 }
 else if ( pNd->IsSectionNode() )
 {
 m_pFormat =
 
static_cast(pNd)->GetSection().GetFormat();
-bFound = true;
+nPos = 0;
 break;
 }
 else if ( pNd->IsStartNode() && (SwTableBoxStartNode ==
@@ -246,7 +246,7 @@ bool SwUndoFormatAttr::IsFormatInDoc( SwDoc* pDoc )
 if ( pBox )
 {
 m_pFormat = pBox->GetFrameFormat();
-bFound = true;
+nPos = 0;
 break;
 }
 }
@@ -255,13 +255,13 @@ bool SwUndoFormatAttr::IsFormatInDoc( SwDoc* pDoc )
 SAL_FALLTHROUGH;
 case RES_DRAWFRMFMT:
 case RES_FLYFRMFMT:
-if (pDoc->GetSpzFrameFormats()->Contains( m_pFormat )
-|| pDoc->GetFrameFormats()->Contains( m_pFormat ))
-bFound = true;
+if ( ( pDoc->GetSpzFrameFormats()->find( 
static_cast(m_pFormat) ) != pDoc->GetSpzFrameFormats()->end() )
+|| ( pDoc->GetFrameFormats()->find( 
static_cast( m_pFormat ) ) != pDoc->GetFrameFormats()->end() ) )
+nPos = 0;
 break;
 }
 
-if ( !bFound )
+if ( nPos == SIZE_MAX )
 {
 // Format does not exist; reset
 m_pFormat = nullptr;
diff --git a/sw/source/core/undo/unfmco.cxx b/sw/source/core/undo/unfmco.cxx
index 5aeaf87e70d5..c473f630ab92 100644
--- a/sw/source/core/undo/unfmco.cxx
+++ b/sw/source/core/undo/unfmco.cxx
@@ -74,7 +74,7 @@ void SwUndoFormatColl::DoSetFormatColl(SwDoc & rDoc, SwPaM & 
rPaM)
 // this array.
 
 // does the format still exist?
-if( 
rDoc.GetTextFormatColls()->Contains(static_cast(pFormatColl))
 )
+if( SIZE_MAX != 
rDoc.GetTextFormatColls()->GetPos(static_cast(pFormatColl)) )
 {
 rDoc.SetTextFormatColl(rPaM, 
static_cast(pFormatColl), mbReset,
mbResetListAttrs);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-27 Thread Michael Stahl
 sw/source/core/layout/flowfrm.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 27bbee974eaf59f722c115c9717faa8c74b9d815
Author: Michael Stahl 
Date:   Wed Apr 26 17:10:09 2017 +0200

tdf#107398 sw: do not leave empty footnote container in layout

... when applying loop control in SwFlowFrame::MoveBwd().

The SwFootnoteContFrame is newly created in MoveBwd(), line 2062:
pNewUpper = m_rThis.GetLeaf( MAKEPAGE_FTN, false );

If it stays empty, that is not a valid layout so delete it again.

Since the idle/timer refactoring in VCL the invalid layout stays
until the document is closed; presumably before LO 5.0 the timer
based layout would reformat things again.

(regression from af41b7f91f22052d49654d41ae9916d6981db3f6)

Change-Id: I841f42b465f8123f9246f1fa70d1417ffdd57700
(cherry picked from commit e15b8997f0d2e54fa7b8345063755616d0b100b9)
Reviewed-on: https://gerrit.libreoffice.org/37008
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index 29e1300a4a98..7ab8e85c7119 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -2404,6 +2404,12 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat )
  ( pNextNewUpper == m_rThis.GetUpper() ||
pNextNewUpper->GetType() != m_rThis.GetUpper()->GetType() ) )
 {
+// tdf#107398 do not leave empty footnote container around
+if (!pNewUpper->Lower() && pNewUpper->IsFootnoteContFrame())
+{
+pNewUpper->Cut();
+SwFrame::DestroyFrame(pNewUpper);
+}
 pNewUpper = nullptr;
 OSL_FAIL( " - layout loop control for 
layout action  applied!" );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-27 Thread Michael Stahl
 sw/source/core/crsr/crsrsh.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit adc0b3b214323d7588cadd17f2b4faafeb5e4e80
Author: Michael Stahl 
Date:   Wed Apr 26 14:51:40 2017 +0200

tdf#107427 sw: fix crash when deleting header with selected table

Restore resetting of the table cursor point position in
SwCursorShell::ParkCursor(), which somehow prevents the crash.

(regression from efc5995170f2ffe98374acb16a4f851bede6842d)

Change-Id: Ia7ec2967c84cfcffe1718e9604d6b8506c3839a4
(cherry picked from commit b2fdb61446bc072ae1b6db380a584a87a1173f11)
Reviewed-on: https://gerrit.libreoffice.org/37007
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 274a501f4856..aa158ceeb1e1 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2567,6 +2567,8 @@ void SwCursorShell::ParkPams( SwPaM* pDelRg, 
SwShellCursor** ppDelRing )
 }
 else
 {
+pTmpDel->GetPoint()->nContent.Assign(nullptr, 0);
+pTmpDel->GetPoint()->nNode = 0;
 pTmpDel->DeleteMark();
 }
 pTmpDel = nullptr;
@@ -2627,6 +2629,8 @@ void SwCursorShell::ParkCursor( const SwNodeIndex &rIdx )
 SwNode* pTableNd = 
pTCursor->GetPoint()->nNode.GetNode().FindTableNode();
 if ( pTableNd )
 {
+pTCursor->GetPoint()->nContent.Assign(nullptr, 0);
+pTCursor->GetPoint()->nNode = 0;
 pTCursor->DeleteMark();
 pSh->m_pCurrentCursor->GetPoint()->nNode = *pTableNd;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-27 Thread Michael Stahl
 sw/source/core/access/accframe.cxx |1 +
 sw/source/core/access/accmap.cxx   |5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 19850d847745adca4e9a2506673cc104933489dd
Author: Michael Stahl 
Date:   Fri Apr 21 23:50:23 2017 +0200

sw: fix a11y crash on double Dispose

When testing with the bugdoc for tdf#107126, it happend that upon
applying a page style, SwAccessibleContext::Dispose() was called twice,
and that's not supposed to happen (and crashes, too, at least inside
an assertion).

There was an Action that queued up a bunch of events, but the Action did
not complete formatting the document, so right after that during Paint
more formatting happened and then the FireEvents() called Dispose()
and InvalidatePosOrSize() called it again.  Guess we shouldn't generate
events for objects that we know are disposed due to not being visible.

(cherry picked from commit c99f72bebdce6d294eb47e070fa1397a98ba2087)

fix the build
(cherry picked from commit 42b40ede8c496aad1021e68a72523af4f57e89f6)

sw: let's check GetFrame() instead, it's already public
(cherry picked from commit 3b83ef0d24347a39a925996c5d2958fcdc2473d7)

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

diff --git a/sw/source/core/access/accframe.cxx 
b/sw/source/core/access/accframe.cxx
index b4beb8c5d77d..8f8a09953995 100644
--- a/sw/source/core/access/accframe.cxx
+++ b/sw/source/core/access/accframe.cxx
@@ -418,6 +418,7 @@ SwAccessibleFrame::SwAccessibleFrame( const SwRect& 
rVisArea,
 mbIsInPagePreview( bIsPagePreview ),
 bIsAccDocUse( false )
 {
+assert(mpFrame);
 }
 
 SwAccessibleFrame::~SwAccessibleFrame()
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 114e7f17b4a8..0faee74144b7 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -2401,7 +2401,10 @@ void SwAccessibleMap::InvalidatePosOrSize( const SwFrame 
*pFrame,
 else
 {
 FireEvents();
-xAccImpl->InvalidatePosOrSize( rOldBox );
+if (xAccImpl->GetFrame()) // not if disposed by FireEvents()
+{
+xAccImpl->InvalidatePosOrSize(rOldBox);
+}
 }
 }
 else if( xParentAccImpl.is() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-27 Thread Michael Stahl
 sw/source/core/layout/calcmove.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 0ae68775afc6227afb881e28c1b2045b3030ad53
Author: Michael Stahl 
Date:   Fri Apr 21 22:44:14 2017 +0200

tdf#107126 sw: fix layout crash with section in footnote

SwContentFrame::WouldFit_() contains a hack to temporarily reparent a
SwTextFrame.  In the bugdoc, there is a SwTextFrame below a
SwSectionFrame below a SwFootnoteFrame.  The reparenting ignores the
SwSectionFrame so the result is a SwTextFrame below SwFootnoteFrame, but
it still has its mbInfSct set, hence crashes with a null pointer.

If the SwTextFrame is permanently moved later on, in
SwFlowFrame::MoveBwd() line 2450 a new SwSectionFrame is created.

Change-Id: I45a7ab793b4459e551bd11b7fb83dedc58a6c8da
(cherry picked from commit 4d43f9e9dda5edeeb6e4b99487b5b6a1fae4bd56)
Reviewed-on: https://gerrit.libreoffice.org/37004
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index c7ebf84ae900..baa4e0577190 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1868,6 +1868,11 @@ bool SwContentFrame::WouldFit_( SwTwips nSpace,
 SwFrame *pOldNext = pTmpFrame->GetNext();
 pTmpFrame->RemoveFromLayout();
 pTmpFrame->InsertBefore( pNewUpper, nullptr );
+// tdf#107126 for a section in a footnote, we have only inserted
+// the SwTextFrame but no SwSectionFrame - reset mbInfSct flag
+// to avoid crashing (but perhaps we should create a temp
+// SwSectionFrame here because WidowsAndOrphans checks for that?)
+pTmpFrame->InvalidateInfFlags();
 if ( pFrame->IsTextFrame() &&
  ( bTstMove ||
static_cast(pFrame)->HasFollow() ||
@@ -1885,6 +1890,7 @@ bool SwContentFrame::WouldFit_( SwTwips nSpace,
 
 pTmpFrame->RemoveFromLayout();
 pTmpFrame->InsertBefore( pUp, pOldNext );
+pTmpFrame->InvalidateInfFlags(); // restore flags
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-27 Thread Michael Stahl
 sw/source/core/layout/atrfrm.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2951a80e79fdc71b231eeadf2231c265307cabe9
Author: Michael Stahl 
Date:   Thu Apr 27 15:03:21 2017 +0200

sw: fix always-true condition in lcl_DelHFFormat ...

... that prevents headers from being deleted if they have a client.

(regression from d4267231754c1e6b03c7723a6fecc46750e7c780)

Change-Id: I71f52f8806e59c97b81aa14144c700c14c5527b0
(cherry picked from commit 99777c5a15df2d92bb8a9ddb6329fc3df1b2b8bf)
Reviewed-on: https://gerrit.libreoffice.org/37031
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 1a9168d257ee..a436e9bad595 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -118,7 +118,7 @@ static void lcl_DelHFFormat( SwClient *pToRemove, 
SwFrameFormat *pFormat )
 // It's suboptimal if the format is deleted beforehand.
 SwIterator aIter(*pFormat);
 for(SwClient* pLast = aIter.First(); bDel && pLast; pLast = 
aIter.Next())
-if(dynamic_cast( pLast ) ==  nullptr || 
!SwXHeadFootText::IsXHeadFootText(pLast))
+if (dynamic_cast(pLast) == nullptr && 
!SwXHeadFootText::IsXHeadFootText(pLast))
 bDel = false;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-24 Thread Caolán McNamara
 sw/source/filter/ww8/ww8graf.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2b014a80022215a72d22bb950b2ee350c123c401
Author: Caolán McNamara 
Date:   Mon Apr 24 15:06:10 2017 +0100

ofz#1220 sanitize nTyp to legal values

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

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 718faff1c16c..bd1a8ca64cad 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1294,7 +1294,7 @@ SdrObject* SwWW8ImplReader::ReadCaptionBox(WW8_DPHEAD* 
pHd, SfxAllItemSet &rSet)
 else// nein -> Nimm Linie
 SetStdAttr( rSet, aCallB.dpPolyLine.aLnt, aCallB.dptxbx.aShd );
 SetFill( rSet, aCallB.dptxbx.aFill );
-rSet.Put( SdrCaptionTypeItem( aCaptA[nTyp] ) );
+rSet.Put(SdrCaptionTypeItem(aCaptA[nTyp % SAL_N_ELEMENTS(aCaptA)]));
 
 return pObj;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-21 Thread Michael Stahl
 sw/source/filter/xml/xmlimp.cxx |   24 
 sw/source/ui/utlui/poolfmt.src  |1 +
 2 files changed, 25 insertions(+)

New commits:
commit 05710ae52ff9962c0852a4e2e59e1814c785b461
Author: Michael Stahl 
Date:   Fri Apr 21 11:41:21 2017 +0200

tdf#107211 sw: ODF import: add a horrible hack to import "Default"

... character style for hyperlinks and index-entry-templates.

The problem is that the "Default" character style doesn't actually
exist, it is just displayed in the UI so you can remove a character
style that is set.  So for the most part there is no need to store
"Default" in ODF files, except that for hyperlinks the default isn't
"Default" but "Internet Link"/"Visited Internet Link".

Hence it was not really a good idea to rename "Default" to "Default
Style", because when importing existing documents the
text:style-name="Default" is not found, and for new documents
text:style-name="Default_20_Style" is not found either because
there is no style:style element that sets up the mapping between the
encoded style-name and the unencoded display-style-name.

Add some hack in SwXMLBodyContext_Impl::SwXMLBodyContext_Impl(), when
all style:style elements have been read (so we don't override what's
in the document) to create the mapping for "Default", "Default_20_Style"
and whatever the translation of that is.

(regression from 783d13a9276931e274a90b9b53de2c92dc8c055e)

Change-Id: I8a80847571f194204c5df267cb48e826a82328b2
(cherry picked from commit 157013219230f251346a5aa662c39d02f15420ec)
Reviewed-on: https://gerrit.libreoffice.org/36788
Reviewed-by: Jan Holesovsky 
Tested-by: Jenkins 

diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index a72fd26e1a06..a2f911417da0 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "xmlimp.hxx"
 #include "xmltexti.hxx"
 #include 
@@ -138,6 +139,29 @@ SwXMLBodyContext_Impl::SwXMLBodyContext_Impl( SwXMLImport& 
rImport,
 const Reference< xml::sax::XAttributeList > & /*xAttrList*/ ) :
 SvXMLImportContext( rImport, nPrfx, rLName )
 {
+// tdf#107211: if at this point we don't have a defined char style 
"Default"
+// or "Default Style", add a mapping for it as it is not written
+// into the file since it's not really a style but "no style"
+// (hence referencing it actually makes no sense except for hyperlinks
+// which default to something other than "Default")
+OUString const sDefault(SW_RES(STR_POOLCOLL_STANDARD));
+uno::Reference const& xStyles(
+rImport.GetTextImport()->GetTextStyles());
+if (!xStyles->hasByName("Default"))
+{   // this old name was used before LO 4.0
+rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, "Default", 
sDefault);
+}
+if (!xStyles->hasByName("Default_20_Style"))
+{   // this new name contains a space which is converted to _20_ on export
+rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, 
"Default_20_Style", sDefault);
+}
+bool isEncoded(false);
+OUString const defaultEncoded(
+rImport.GetMM100UnitConverter().encodeStyleName(sDefault, &isEncoded));
+if (isEncoded && !xStyles->hasByName(defaultEncoded))
+{   // new name may contain a space which is converted to _20_ on export
+rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, 
defaultEncoded, sDefault);
+}
 }
 
 SwXMLBodyContext_Impl::~SwXMLBodyContext_Impl()
diff --git a/sw/source/ui/utlui/poolfmt.src b/sw/source/ui/utlui/poolfmt.src
index c6efa70a35d2..c0a876b64797 100644
--- a/sw/source/ui/utlui/poolfmt.src
+++ b/sw/source/ui/utlui/poolfmt.src
@@ -155,6 +155,7 @@ String STR_POOLFRM_LABEL
 
  // Template names
 
+// tdf#107211 please don't change STANDARD, except back to "Default"
 String STR_POOLCOLL_STANDARD
 {
 Text [ en-US ] = "Default Style" ;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-13 Thread Caolán McNamara
 sw/source/filter/ww8/ww8graf.cxx |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit d180418fedd4592044c33558426e9ea9be6f1ebd
Author: Caolán McNamara 
Date:   Thu Apr 13 13:01:35 2017 +0100

ofz: header has to be at least 1 pair long

Change-Id: I5725048519a2b68265e90d12b1e4bcb506c56fc2
(cherry picked from commit e72f3ce68e18ac604469ce5e856341a469af27ff)
Reviewed-on: https://gerrit.libreoffice.org/36519
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 09e6dfd3f893..718faff1c16c 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1246,12 +1246,20 @@ SdrObject* SwWW8ImplReader::ReadCaptionBox(WW8_DPHEAD* 
pHd, SfxAllItemSet &rSet)
 return nullptr;
 
 sal_uInt16 nCount = SVBT16ToShort( aCallB.dpPolyLine.aBits1 ) >> 1 & 
0x7fff;
+if (nCount < 1)
+{
+SAL_WARN("sw.ww8", "Short CaptionBox header");
+return nullptr;
+}
+
 std::unique_ptr xP(new SVBT16[nCount * 2]);
 
 bool bCouldRead = checkRead(*m_pStrm, xP.get(), nCount * 4);  // 
Punkte einlesen
-OSL_ENSURE(bCouldRead, "Short CaptionBox header");
 if (!bCouldRead)
+{
+SAL_WARN("sw.ww8", "Short CaptionBox header");
 return nullptr;
+}
 
 sal_uInt8 nTyp = (sal_uInt8)nCount - 1;
 if( nTyp == 1 && SVBT16ToShort( xP[0] ) == SVBT16ToShort( xP[2] ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-12 Thread Caolán McNamara
 sw/source/core/crsr/crstrvl.cxx |   20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 244d2abb6c1bcd89cedf773d8721f62451708c3f
Author: Caolán McNamara 
Date:   Mon Apr 10 15:14:37 2017 +0100

Resolves: tdf#106078 get bounding box of commented region for gtk3 tooltips

Change-Id: I4fdc1f471c6c191be9c7c611926bd2b5b2b41308
(cherry picked from commit eb433f83a5f66dd1ca8ed0c62ef9cc0761b7f0ac)
Reviewed-on: https://gerrit.libreoffice.org/36383
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index c024e0eb7d69..9bdc9b932768 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1440,12 +1440,18 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 
 if( pFieldRect && nullptr != ( pFrame = 
pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) )
 {
+//get bounding box of range
 SwRect aStart;
 SwPosition aStartPos(*pTextNd, nSt);
 pFrame->GetCharRect(aStart, aStartPos, 
&aTmpState);
 SwRect aEnd;
 SwPosition aEndPos(*pTextNd, nEnd);
 pFrame->GetCharRect(aEnd, aEndPos, &aTmpState);
+if (aStart.Top() != aEnd.Top() || 
aStart.Bottom() != aEnd.Bottom())
+{
+aStart.Left(pFrame->Frame().Left());
+aEnd.Right(pFrame->Frame().Right());
+}
 *pFieldRect = aStart.Union(aEnd);
 }
 }
@@ -1463,7 +1469,19 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 bRet = true;
 
 if( pFieldRect && nullptr != ( pFrame = 
pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) )
-pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState 
);
+{
+//get bounding box of range
+SwRect aStart;
+pFrame->GetCharRect(aStart, *pRedl->Start(), 
&aTmpState);
+SwRect aEnd;
+pFrame->GetCharRect(aEnd, *pRedl->End(), 
&aTmpState);
+if (aStart.Top() != aEnd.Top() || aStart.Bottom() 
!= aEnd.Bottom())
+{
+aStart.Left(pFrame->Frame().Left());
+aEnd.Right(pFrame->Frame().Right());
+}
+*pFieldRect = aStart.Union(aEnd);
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-12 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par6.cxx |  128 ---
 1 file changed, 68 insertions(+), 60 deletions(-)

New commits:
commit 38b8896a700ec626fbcf924b8909af9f3295341a
Author: Caolán McNamara 
Date:   Wed Apr 5 14:24:09 2017 +0100

ofz: treat short properties as run end

Change-Id: I1250f74c9f4ed6679a89c7915fb704c8b8cd693f
(cherry picked from commit 5252673d686913210dd65608b7d24b0e9d51cf00)
Reviewed-on: https://gerrit.libreoffice.org/36147
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 1e5b5bf55305..5bb3eb8eb507 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -311,7 +311,7 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrameFormat 
&rFormat, const wwSection &r
 
 void SwWW8ImplReader::Read_ParaBiDi(sal_uInt16, const sal_uInt8* pData, short 
nLen)
 {
-if( nLen < 0 )
+if (nLen < 1)
 m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_FRAMEDIR);
 else
 {
@@ -2683,7 +2683,7 @@ const SfxPoolItem* SwWW8ImplReader::GetFormatAttr( 
sal_uInt16 nWhich )
 // parameters according to the table in WWScan.cxx.
 void SwWW8ImplReader::Read_Special(sal_uInt16, const sal_uInt8* pData, short 
nLen)
 {
-if( nLen < 0 )
+if (nLen < 1)
 {
 m_bSpec = false;
 return;
@@ -2694,7 +2694,7 @@ void SwWW8ImplReader::Read_Special(sal_uInt16, const 
sal_uInt8* pData, short nLe
 // Read_Obj is used for fObj and for fOle2 !
 void SwWW8ImplReader::Read_Obj(sal_uInt16 , const sal_uInt8* pData, short nLen)
 {
-if( nLen < 0 )
+if (nLen < 1)
 m_bObj = false;
 else
 {
@@ -2717,7 +2717,7 @@ void SwWW8ImplReader::Read_Obj(sal_uInt16 , const 
sal_uInt8* pData, short nLen)
 
 void SwWW8ImplReader::Read_PicLoc(sal_uInt16 , const sal_uInt8* pData, short 
nLen )
 {
-if( nLen < 0 )
+if (nLen < 4)
 {
 m_nPicLocFc = 0;
 m_bSpec = false;  // Is this always correct?
@@ -2746,7 +2746,7 @@ void SwWW8ImplReader::Read_POutLvl(sal_uInt16, const 
sal_uInt8* pData, short nLe
 if (pSI != nullptr)
 {
 pSI->mnWW8OutlineLevel =
-static_cast< sal_uInt8 >( ( pData ? *pData : 0 ) );
+static_cast< sal_uInt8 >( ( (pData && nLen >= 1) ? *pData 
: 0 ) );
 NewAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, 
SwWW8StyInf::WW8OutlineLevelToOutlinelevel( pSI->mnWW8OutlineLevel ) ) );
 }
 }
@@ -2754,7 +2754,7 @@ void SwWW8ImplReader::Read_POutLvl(sal_uInt16, const 
sal_uInt8* pData, short nLe
 {
 const sal_uInt8 nOutlineLevel
 = SwWW8StyInf::WW8OutlineLevelToOutlinelevel(
-static_cast((pData ? *pData : 0)));
+static_cast(((pData && nLen >= 1) ? *pData : 0)));
 NewAttr(SfxUInt16Item(RES_PARATR_OUTLINELEVEL, nOutlineLevel));
 }
 }
@@ -2763,7 +2763,7 @@ void SwWW8ImplReader::Read_Symbol(sal_uInt16, const 
sal_uInt8* pData, short nLen
 {
 if( !m_bIgnoreText )
 {
-if( nLen < 0 )
+if (nLen < (m_bVer67 ? 3 : 4))
 {
 //otherwise disable after we print the char
 if (m_pPlcxMan && m_pPlcxMan->GetDoingDrawTextBox())
@@ -2848,7 +2848,7 @@ void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const 
sal_uInt8* pData, shor
 
 sal_uInt16 nMask = 1 << nI;
 
-if (nLen < 0)
+if (nLen < 1)
 {
 if (nI < 2)
 {
@@ -2914,7 +2914,7 @@ void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const 
sal_uInt8* pData, shor
 
 void SwWW8ImplReader::Read_Bidi(sal_uInt16, const sal_uInt8* pData, short nLen)
 {
-if( nLen < 0 )  //Property end
+if (nLen < 1)  //Property end
 {
 m_bBidi = false;
 m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(),RES_CHRATR_BIDIRTL);
@@ -3028,7 +3028,7 @@ void SwWW8ImplReader::Read_BoldBiDiUsw(sal_uInt16 nId, 
const sal_uInt8* pData,
 
 sal_uInt16 nMask = 1 << nI;
 
-if( nLen < 0 )
+if (nLen < 1)
 {
 m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(),nEndIds[nI]);
 m_pCtrlStck->SetToggleBiDiAttr(nI, false);
@@ -3196,7 +3196,8 @@ void SwWW8ImplReader::ChkToggleBiDiAttr_( sal_uInt16 
nOldStyle81Mask,
 
 void SwWW8ImplReader::Read_SubSuper( sal_uInt16, const sal_uInt8* pData, short 
nLen )
 {
-if( nLen < 0 ){
+if (nLen < 1)
+{
 m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_ESCAPEMENT );
 return;
 }
@@ -3288,15 +3289,15 @@ bool SwWW8ImplReader::ConvertSubToGraphicPlacement()
 
 void SwWW8ImplReader::Read_SubSuperProp( sal_uInt16, const sal_uInt8* pData, 
short nLen )
 {
-if( nLen < 0 )
+ww::WordVersion eVersion = m_pWwFib->GetFIBVersion();
+
+if (nLen < (eVersion <= ww::eWW2 ? 1 : 2))
 {
 if (!ConvertSubToGraphicPlacement())
 m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_ESCAPEMENT );
 return;
 }
 
-ww::WordVersion eVersion = m_pWwFib->GetFI

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-10 Thread Michael Stahl
 sw/source/core/crsr/crstrvl.cxx   |4 
 sw/source/uibase/uiview/view2.cxx |   25 -
 2 files changed, 4 insertions(+), 25 deletions(-)

New commits:
commit 644aacd1e4b419f2f85b6c2e18026ca04206b378
Author: Michael Stahl 
Date:   Wed Apr 5 16:54:57 2017 +0200

rhbz#1438179 sw: fix toolbar "Next Track Change" / "Previous..."

There's some confusing workarounds in SwView::Execute() that aren't
needed if the SwCursorShell just calls NormalizePam() so it always
makes progress.

Change-Id: I3b014079b19925041234fcd858526148890f560c
(cherry picked from commit 25eb0899227830cca7f28006376962d84f8e9c7a)
Reviewed-on: https://gerrit.libreoffice.org/36166
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 6099b32aec51..c024e0eb7d69 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1982,6 +1982,8 @@ const SwRangeRedline* SwCursorShell::SelNextRedline()
 SwCallLink aLk( *this ); // watch Cursor-Moves
 SwCursorSaveState aSaveState( *m_pCurrentCursor );
 
+// ensure point is at the end so alternating SelNext/SelPrev works
+NormalizePam(false);
 pFnd = GetDoc()->getIDocumentRedlineAccess().SelNextRedline( 
*m_pCurrentCursor );
 if( pFnd && !m_pCurrentCursor->IsInProtectTable() && 
!m_pCurrentCursor->IsSelOvr() )
 UpdateCursor( 
SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
@@ -2000,6 +2002,8 @@ const SwRangeRedline* SwCursorShell::SelPrevRedline()
 SwCallLink aLk( *this ); // watch Cursor-Moves
 SwCursorSaveState aSaveState( *m_pCurrentCursor );
 
+// ensure point is at the start so alternating SelNext/SelPrev works
+NormalizePam(true);
 pFnd = GetDoc()->getIDocumentRedlineAccess().SelPrevRedline( 
*m_pCurrentCursor );
 if( pFnd && !m_pCurrentCursor->IsInProtectTable() && 
!m_pCurrentCursor->IsSelOvr() )
 UpdateCursor( 
SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 8865d294597a..7b639f6628d8 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -714,7 +714,6 @@ void SwView::Execute(SfxRequest &rReq)
 if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == 
SfxItemState::SET)
 nRedline = static_cast(pItem)->GetValue();
 
-const SwRangeRedline *pCurrent = m_pWrtShell->GetCurrRedline();
 SwDoc* pDoc = m_pWrtShell->GetDoc();
 const SwRedlineTable& rTable = 
pDoc->getIDocumentRedlineAccess().GetRedlineTable();
 const SwRangeRedline *pNext = nullptr;
@@ -723,15 +722,6 @@ void SwView::Execute(SfxRequest &rReq)
 else
 pNext = m_pWrtShell->SelNextRedline();
 
-// FN_REDLINE_PREV_CHANGE leaves the selection point at the start 
of the redline.
-// In such cases, SelNextRedline (which starts searching from the 
selection point)
-// immediately finds the current redline and advances the 
selection point to its end.
-
-// This behavior means that PREV_CHANGE followed by NEXT_CHANGE 
would not change
-// the current redline, so we detect it and select the next 
redline again.
-if (pCurrent && pCurrent == pNext && nRedline == USHRT_MAX)
-pNext = m_pWrtShell->SelNextRedline();
-
 if (pNext)
 m_pWrtShell->SetInSelect();
 }
@@ -739,24 +729,9 @@ void SwView::Execute(SfxRequest &rReq)
 
 case FN_REDLINE_PREV_CHANGE:
 {
-const SwPaM *pCursor = m_pWrtShell->GetCursor();
-const SwPosition initialCursorStart = *pCursor->Start();
 const SwRangeRedline *pPrev = m_pWrtShell->SelPrevRedline();
 
 if (pPrev)
-{
-// FN_REDLINE_NEXT_CHANGE leaves the selection point at the 
end of the redline.
-// In such cases, SelPrevRedline (which starts searching from 
the selection point)
-// immediately finds the current redline and advances the 
selection point to its
-// start.
-
-// This behavior means that NEXT_CHANGE followed by 
PREV_CHANGE would not change
-// the current redline, so we detect it and move to the 
previous redline again.
-if (initialCursorStart == *pPrev->Start())
-pPrev = m_pWrtShell->SelPrevRedline();
-}
-
-if (pPrev)
 m_pWrtShell->SetInSelect();
 }
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-10 Thread Caolán McNamara
 sw/source/core/frmedt/fews.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 32f2370ac805513c4a968bd461d08f66958651d7
Author: Caolán McNamara 
Date:   Fri Apr 7 16:55:37 2017 +0100

Resolves: tdf#102286 lets not crash on null pFrame

this is the FlyEmbeddedPrt case

ensure we don't end up with a null pFrame at return time

(cherry picked from commit 5ce387c4812466e6752b434cf0f5a54f98c6a147)

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

diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 58d0c904f837..c3ba3a6bd6ee 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -123,12 +123,15 @@ const SwRect& SwFEShell::GetAnyCurRect( CurRectType 
eType, const Point* pPt,
 
 case RECT_FLY_PRT_EMBEDDED: bFrame = false;
 SAL_FALLTHROUGH;
-case RECT_FLY_EMBEDDED: pFrame = xObj.is() ? FindFlyFrame( xObj )
+case RECT_FLY_EMBEDDED:
+{
+const SwFrame *pFlyFrame = xObj.is() ? 
FindFlyFrame(xObj) : nullptr;
+pFrame = pFlyFrame ? pFlyFrame
 : pFrame->IsFlyFrame()
 ? pFrame
 : pFrame->FindFlyFrame();
 break;
-
+}
 case RECT_OUTTABSECTION_PRT:
 case RECT_OUTTABSECTION :   if( pFrame->IsInTab() )
 pFrame = pFrame->FindTabFrame();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-06 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par6.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fedd27b758db58bfc0e283a03e3fbf7d7fb6090c
Author: Caolán McNamara 
Date:   Thu Apr 6 15:12:10 2017 +0100

ofz: treat short properties as run end

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

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index d1f9e76ba051..1e5b5bf55305 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -3827,7 +3827,7 @@ void SwWW8ImplReader::Read_Language( sal_uInt16 nId, 
const sal_uInt8* pData, sho
 return;
 }
 
-if( nLen < 0 )  // end of attribute
+if (nLen < 2)  // end of attribute
 m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), nId );
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-05 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par2.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 14028af4d978f126779e641a9605c6d4d864b3b6
Author: Caolán McNamara 
Date:   Tue Apr 4 19:13:12 2017 +0100

ofz: check olst sprm for valid ANLD payload len

Change-Id: Ic1b6681a3f48ef0fe3f52eda9db8b7bc003ded55
(cherry picked from commit 98151bf95bda8d647310bdba6936dc6b388b05de)
Reviewed-on: https://gerrit.libreoffice.org/36098
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index bfab2e78a20f..bcc424d4fc83 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -926,6 +926,14 @@ void SwWW8ImplReader::Read_OLST( sal_uInt16, const 
sal_uInt8* pData, short nLen
 m_pNumOlst = nullptr;
 return;
 }
+
+if (static_cast(nLen) < sizeof(WW8_OLST))
+{
+SAL_WARN("sw.ww8", "WW8_OLST property is " << nLen << " long, needs to 
be at least " << sizeof(WW8_OLST));
+m_pNumOlst = nullptr;
+return;
+}
+
 m_pNumOlst = new WW8_OLST;
 if( nLen < sal::static_int_cast< sal_Int32 >(sizeof( WW8_OLST )) )   // 
fill if to short
 memset( m_pNumOlst, 0, sizeof( *m_pNumOlst ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-04 Thread Caolán McNamara
 sw/source/filter/ww8/ww8scan.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit feecc82753c48b1c82df2315896b9996e33af2e2
Author: Caolán McNamara 
Date:   Tue Apr 4 12:31:04 2017 +0100

ofz: guard against bogus sprm len

Change-Id: I9b4074e1024753549f468f427afbfdf9cd01b674
(cherry picked from commit d30fb62f4f1022ae6294e246974d0018596cf8ec)

ofz: guard harder against bogus sprm len

Change-Id: Ic82526e1454b24f094d3deee89647e88760bc44b
(cherry picked from commit 924624b40a97d6925f66374259c2c21707805fcd)
Reviewed-on: https://gerrit.libreoffice.org/36078
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index b2a1fe3d04ff..439acd15ecd0 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -4902,6 +4902,11 @@ void WW8PLCFMan::GetSprmStart( short nIdx, 
WW8PLCFManResult* pRes ) const
 {
 // Length of actual sprm
 pRes->nMemLen = maSprmParser.GetSprmSize(pRes->nSprmId, pRes->pMemPos);
+if (pRes->nMemLen > p->nSprmsLen)
+{
+SAL_WARN("sw.ww8", "Short sprm, len " << pRes->nMemLen << " 
claimed, max possible is " << p->nSprmsLen);
+pRes->nSprmId = 0;
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-04 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par2.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 5d5731a372e540fbb9344533b6dd7e06fc123687
Author: Caolán McNamara 
Date:   Mon Apr 3 21:22:00 2017 +0100

ofz: check anldPap sprm for valid ANLD payload len

Change-Id: Ie034e3b37e01c29cf19fe8ad78b1121f6eadecb2
Reviewed-on: https://gerrit.libreoffice.org/36053
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 29cf858a971273039fff50808082f231dbd43c92)
Reviewed-on: https://gerrit.libreoffice.org/36075
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 566417e8d93b..bfab2e78a20f 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -857,6 +857,13 @@ void SwWW8ImplReader::Read_ANLevelDesc( sal_uInt16, const 
sal_uInt8* pData, shor
 return;
 }
 
+if (static_cast(nLen) < sizeof(WW8_ANLD))
+{
+SAL_WARN("sw.ww8", "ANLevelDesc property is " << nLen << " long, needs 
to be at least " << sizeof(WW8_ANLD));
+m_nSwNumLevel = 0xff;
+return;
+}
+
 if( m_nSwNumLevel <= MAXLEVEL // Value range mapping WW:1..9 -> 
SW:0..8
 && m_nSwNumLevel <= 9 ){  // No Bullets or Numbering
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-04-04 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par.hxx   |2 +-
 sw/source/filter/ww8/ww8par2.cxx  |   29 -
 sw/source/filter/ww8/ww8struc.hxx |2 +-
 3 files changed, 26 insertions(+), 7 deletions(-)

New commits:
commit 09f5f4a39e4a9304d81565c33c009e8e0552778d
Author: Caolán McNamara 
Date:   Mon Apr 3 20:36:06 2017 +0100

ofz: check anlv text bounds

Change-Id: I6288aae2d439cde6a2b95c005a2090f73e21bb7a
(cherry picked from commit 3feabd87ad8066b45b55d61cd72684e47fd79082)
Reviewed-on: https://gerrit.libreoffice.org/36051
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 7a986b677b05..3b4b3dd935f4 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1537,7 +1537,7 @@ private:
 // the corresponding structures are: LSTF, LVLF, LFO LFOLVL
 
 void SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV, const 
sal_uInt8* pText,
-bool bOutline);
+size_t nStart, size_t nElements, bool bOutline);
 void SetAnld(SwNumRule* pNumR, WW8_ANLD const * pAD, sal_uInt8 nSwLevel, 
bool bOutLine);
 void SetNumOlst( SwNumRule* pNumR, WW8_OLST* pO, sal_uInt8 nSwLevel );
 SwNumRule* GetStyRule();
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 146d22693acc..566417e8d93b 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -654,8 +654,14 @@ static void SetBaseAnlv(SwNumFormat &rNum, WW8_ANLV const 
&rAV, sal_uInt8 nSwLev
 }
 
 void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV,
-const sal_uInt8* pText, bool bOutline)
+const sal_uInt8* pText, size_t nStart, size_t nElements, bool bOutline)
 {
+if (nStart > nElements)
+return;
+
+pText += nStart;
+nElements -= nStart;
+
 bool bInsert = false;   // Default
 rtl_TextEncoding eCharSet = m_eStructCharSet;
 
@@ -663,13 +669,26 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, 
WW8_ANLV const &rAV,
 bool bListSymbol = pF && ( pF->chs == 2 );  // Symbol/WingDings/...
 
 OUString sText;
+sal_uInt32 nLen = rAV.cbTextBefore + rAV.cbTextAfter;
 if (m_bVer67)
 {
-sText = OUString(reinterpret_cast(pText), 
rAV.cbTextBefore + rAV.cbTextAfter, eCharSet);
+if (nLen > nElements)
+{
+SAL_WARN("sw.ww8", "SetAnlvStrings: ignoring out of range "
+<< nLen << " vs " << nElements << " max");
+return;
+}
+sText = OUString(reinterpret_cast(pText), nLen, 
eCharSet);
 }
 else
 {
-for(sal_Int32 i = 0; i < rAV.cbTextBefore + rAV.cbTextAfter; ++i, 
pText += 2)
+if (nLen > nElements / 2)
+{
+SAL_WARN("sw.ww8", "SetAnlvStrings: ignoring out of range "
+<< nLen << " vs " << nElements / 2 << " max");
+return;
+}
+for(sal_uInt32 i = 0; i < nLen; ++i, pText += 2)
 {
 sText += OUStringLiteral1(SVBT16ToShort(*reinterpret_cast(pText)));
 }
@@ -754,7 +773,7 @@ void SwWW8ImplReader::SetAnld(SwNumRule* pNumR, WW8_ANLD 
const * pAD, sal_uInt8
 m_bAktAND_fNumberAcross = 0 != pAD->fNumberAcross;
 WW8_ANLV const &rAV = pAD->eAnlv;
 SetBaseAnlv(aNF, rAV, nSwLevel);// set the base 
format
-SetAnlvStrings(aNF, rAV, pAD->rgchAnld, bOutLine ); // set the rest
+SetAnlvStrings(aNF, rAV, pAD->rgchAnld, 0, 
SAL_N_ELEMENTS(pAD->rgchAnld), bOutLine); // set the rest
 }
 pNumR->Set(nSwLevel, aNF);
 }
@@ -884,7 +903,7 @@ void SwWW8ImplReader::SetNumOlst(SwNumRule* pNumR, 
WW8_OLST* pO, sal_uInt8 nSwLe
 
 if (!m_bVer67)
 nTextOfs *= 2;
-SetAnlvStrings(aNF, rAV, pO->rgch + nTextOfs, true); // and apply
+SetAnlvStrings(aNF, rAV, pO->rgch, nTextOfs, SAL_N_ELEMENTS(pO->rgch), 
true); // and apply
 pNumR->Set(nSwLevel, aNF);
 }
 
diff --git a/sw/source/filter/ww8/ww8struc.hxx 
b/sw/source/filter/ww8/ww8struc.hxx
index 097391dde1e2..ba7768caac0b 100644
--- a/sw/source/filter/ww8/ww8struc.hxx
+++ b/sw/source/filter/ww8/ww8struc.hxx
@@ -649,7 +649,7 @@ struct WW8_ANLD
 sal_uInt8 fNumberAcross;// 0x11 number across cells in table 
rows(instead of down)
 sal_uInt8 fRestartHdn;  // 0x12 restart heading number on section 
boundary
 sal_uInt8 fSpareX;  // 0x13 unused( should be 0)
-sal_uInt8  rgchAnld[32]; // 0x14 characters displayed before/after 
autonumber
+sal_uInt8 rgchAnld[32]; // 0x14 characters displayed before/after 
autonumber
 };
 
 struct WW8_OLST
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-03-31 Thread Patrick Jaap
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit da18188c359dee813fa1d4c7000490f1512c277b
Author: Patrick Jaap 
Date:   Wed Mar 29 11:35:25 2017 +0200

tdf#101627 disable shrinking for footer textboxes

the shrinking patch a4dee94afed9ade6ac50237c8d99a6e49d3bebc1
causes problems, if the textboxes are anchored in the
footer. Therefore, disable it in this case.
For details, see comments in bug tracker.

Change-Id: I117a99041ff67c19a9de17803ff7864c62afdb50
Reviewed-on: https://gerrit.libreoffice.org/34517
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit 80b9b6761e8cb974e0cdc0c7be0eb95f8745d86f)
Reviewed-on: https://gerrit.libreoffice.org/35844

diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx 
b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index 4b300ce8bf3f..c1e7808517c1 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -486,8 +486,12 @@ SwTwips SwAnchoredObjectPosition::ImplAdjustVertRelPos( 
const SwTwips nTopOfAnch
 nAdjustedRelPosY = aPgAlignArea.Top() - nTopOfAnch;
 }
 
-// tdf#91260 - allow textboxes extending beyond the page bottom
-if ( nAdjustedRelPosY < nProposedRelPosY )
+// tdf#91260  - allow textboxes extending beyond the page bottom
+// tdf#101627 - the patch a4dee94afed9ade6ac50237c8d99a6e49d3bebc1
+//  for tdf#91260 causes problems if the textbox
+//  is anchored in the footer, so exclude this case
+if ( !( GetAnchorFrame().GetUpper() && 
GetAnchorFrame().GetUpper()->IsFooterFrame() )
+ && nAdjustedRelPosY < nProposedRelPosY )
 {
 const SwFrameFormat* pFormat = &(GetFrameFormat());
 if ( SwTextBoxHelper::isTextBox(&GetObject()) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-03-29 Thread Michael Stahl
 sw/source/core/doc/doctxm.cxx |   42 +++---
 1 file changed, 27 insertions(+), 15 deletions(-)

New commits:
commit 123bb36e7eafde85732b57e84d0377586a0a66d8
Author: Michael Stahl 
Date:   Tue Mar 21 11:01:20 2017 +0100

tdf#106377 sw: fix Undo of delete of ToXMark from dialog

The problem is that SwUndoResetAttr and the SwHistorySetTOXMark by
design only insert the SwTextAttr, they don't insert the dummy char of
a SwTextAttr that needs one, like the ToXMark does if it marks a point.

So just change SwDoc::DeleteTOXMark to create SwUndoDelete instead.

Change-Id: Ic1eebac4cf859771a6032bffb2fd8e198aa08084
(cherry picked from commit 63f7da77985674ddf59bb566bdada9c41893e822)
Reviewed-on: https://gerrit.libreoffice.org/35501
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index b3462b761a41..46496a78d662 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -154,26 +154,38 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
 SwTextNode& rTextNd = const_cast(pTextTOXMark->GetTextNode());
 OSL_ENSURE( rTextNd.GetpSwpHints(), "cannot be deleted" );
 
-std::unique_ptr aRHst;
-if (GetIDocumentUndoRedo().DoesUndo())
+if (pTextTOXMark->HasDummyChar())
 {
-// save attributes for Undo
-SwUndoResetAttr* pUndo = new SwUndoResetAttr(
-SwPosition( rTextNd, SwIndex( &rTextNd, pTextTOXMark->GetStart() ) 
),
-RES_TXTATR_TOXMARK );
-GetIDocumentUndoRedo().AppendUndo( pUndo );
-
-aRHst.reset(new SwRegHistory(rTextNd, &pUndo->GetHistory()));
-rTextNd.GetpSwpHints()->Register(aRHst.get());
+// tdf#106377 don't use SwUndoResetAttr, it uses NOTXTATRCHR
+SwPaM tmp(rTextNd, pTextTOXMark->GetStart(),
+  rTextNd, pTextTOXMark->GetStart()+1);
+assert(rTextNd.GetText()[pTextTOXMark->GetStart()] == 
CH_TXTATR_INWORD);
+getIDocumentContentOperations().DeleteRange(tmp);
 }
+else
+{
+std::unique_ptr aRHst;
+if (GetIDocumentUndoRedo().DoesUndo())
+{
+// save attributes for Undo
+SwUndoResetAttr* pUndo = new SwUndoResetAttr(
+SwPosition( rTextNd, SwIndex( &rTextNd, 
pTextTOXMark->GetStart() ) ),
+RES_TXTATR_TOXMARK );
+GetIDocumentUndoRedo().AppendUndo( pUndo );
+
+aRHst.reset(new SwRegHistory(rTextNd, &pUndo->GetHistory()));
+rTextNd.GetpSwpHints()->Register(aRHst.get());
+}
 
-rTextNd.DeleteAttribute( const_cast(pTextTOXMark) );
+rTextNd.DeleteAttribute( const_cast(pTextTOXMark) );
 
-if (GetIDocumentUndoRedo().DoesUndo())
-{
-if( rTextNd.GetpSwpHints() )
-rTextNd.GetpSwpHints()->DeRegister();
+if (GetIDocumentUndoRedo().DoesUndo())
+{
+if( rTextNd.GetpSwpHints() )
+rTextNd.GetpSwpHints()->DeRegister();
+}
 }
+
 getIDocumentState().SetModified();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-03-21 Thread Michael Stahl
 sw/source/core/doc/docbm.cxx |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 4c7775247fbbf38cd397fd7649bf10810f27a0b4
Author: Michael Stahl 
Date:   Fri Feb 3 16:48:02 2017 +0100

tdf#104447 sw: make lcl_DebugMarks output more readable, pos. at the start

(cherry picked from commit f6596a35c2d9a8c365bb78e1256a2def57ee1a36)

The pass-by-value is also fixed here which is a surprisingly expensive
performance regression.

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

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index f75dd0e2c5de..1604d7ccf35c 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -288,28 +288,28 @@ namespace
 [&rName] (IDocumentMarkAccess::pMark_t const& rpMark) { return 
rpMark->GetName() == rName; } );
 }
 
-void lcl_DebugMarks(IDocumentMarkAccess::container_t vMarks)
+void lcl_DebugMarks(IDocumentMarkAccess::container_t const& rMarks)
 {
 #if OSL_DEBUG_LEVEL > 0
-SAL_INFO("sw.core", vMarks.size() << " Marks");
-for(IDocumentMarkAccess::iterator_t ppMark = vMarks.begin();
-ppMark != vMarks.end();
-ppMark++)
+SAL_INFO("sw.core", rMarks.size() << " Marks");
+for (IDocumentMarkAccess::const_iterator_t ppMark = rMarks.begin();
+ ppMark != rMarks.end();
+ ++ppMark)
 {
 IMark* pMark = ppMark->get();
 const SwPosition* const pStPos = &pMark->GetMarkStart();
 const SwPosition* const pEndPos = &pMark->GetMarkEnd();
 SAL_INFO("sw.core",
-typeid(*pMark).name() << " " <<
-pMark->GetName() << " " <<
 pStPos->nNode.GetIndex() << "," <<
 pStPos->nContent.GetIndex() << " " <<
 pEndPos->nNode.GetIndex() << "," <<
-pEndPos->nContent.GetIndex());
+pEndPos->nContent.GetIndex() << " " <<
+typeid(*pMark).name() << " " <<
+pMark->GetName());
 }
 #endif
-assert(std::is_sorted(vMarks.begin(), vMarks.end(), 
lcl_MarkOrderingByStart));
-(void) vMarks;
+assert(std::is_sorted(rMarks.begin(), rMarks.end(), 
lcl_MarkOrderingByStart));
+(void) rMarks;
 };
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-03-14 Thread Caolán McNamara
 sw/source/uibase/dbui/dbmgr.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 445b719b8bbff9181cea3601649bb21c27acd7b5
Author: Caolán McNamara 
Date:   Mon Mar 13 12:44:10 2017 +

Resolves: rhbz#1431540 crash in SwDBManager::releaseRevokeListener

Change-Id: I8e61163de7e6192bdf613ab6b58906326499d6c2
Reviewed-on: https://gerrit.libreoffice.org/35137
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit e1f36eddf4596901a51de42322ccbf8d1df9d139)
Reviewed-on: https://gerrit.libreoffice.org/35138

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 2d85ff7..9adf98c 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -3118,8 +3118,11 @@ SwDoc* SwDBManager::getDoc() const
 
 void SwDBManager::releaseRevokeListener()
 {
-pImpl->m_xDataSourceRemovedListener->Dispose();
-pImpl->m_xDataSourceRemovedListener.clear();
+if (pImpl->m_xDataSourceRemovedListener.is())
+{
+pImpl->m_xDataSourceRemovedListener->Dispose();
+pImpl->m_xDataSourceRemovedListener.clear();
+}
 }
 
 
SwConnectionDisposedListener_Impl::SwConnectionDisposedListener_Impl(SwDBManager&
 rManager)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-03-08 Thread Michael Stahl
 sw/source/core/doc/doccomp.cxx |   22 ++
 1 file changed, 22 insertions(+)

New commits:
commit a990b46ccc788db45ff4d8f0d47b799782ecb2af
Author: Michael Stahl 
Date:   Tue Mar 7 23:12:44 2017 +0100

tdf#106218 sw: compare document: tweak special handling of EndOfContent

In case the last paragraph in the document is inserted or deleted, the
redline must not be positioned on the EndOfContent node (i#101009).

But then rejecting the redline will have an additional paragraph as
compared to the original document.  Try to avoid that by tweaking the
start position of the redline to the end of the previous paragraph.

(regression from f4609c4c294a62023b6cd6baeb6a73d44992dec3)

Change-Id: Iae75042a3124d0f3bca955fb856c94a6f478b986
(cherry picked from commit 9b3fa51e7ba4e2bfe9806295c3cbc8db347480d8)
Reviewed-on: https://gerrit.libreoffice.org/34960
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 5357682..c2da0bc 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1683,6 +1683,17 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo )
 SwContentNode *const pContentNode( pTmp->GetContentNode() );
 pTmp->GetPoint()->nContent.Assign( pContentNode,
 (pContentNode) ? pContentNode->Len() : 0 );
+// tdf#106218 try to avoid losing a paragraph break here:
+if (pTmp->GetMark()->nContent == 0)
+{
+SwNodeIndex const prev(pTmp->GetMark()->nNode, -1);
+if (prev.GetNode().IsTextNode())
+{
+*pTmp->GetMark() = SwPosition(
+*prev.GetNode().GetTextNode(),
+prev.GetNode().GetTextNode()->Len());
+}
+}
 }
 
 rDoc.getIDocumentRedlineAccess().DeleteRedline( *pTmp, false, 
USHRT_MAX );
@@ -1715,6 +1726,17 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo )
 SwContentNode *const pContentNode( pTmp->GetContentNode() );
 pTmp->GetPoint()->nContent.Assign( pContentNode,
 (pContentNode) ? pContentNode->Len() : 0 );
+// tdf#106218 try to avoid losing a paragraph break here:
+if (pTmp->GetMark()->nContent == 0)
+{
+SwNodeIndex const prev(pTmp->GetMark()->nNode, -1);
+if (prev.GetNode().IsTextNode())
+{
+*pTmp->GetMark() = SwPosition(
+*prev.GetNode().GetTextNode(),
+prev.GetNode().GetTextNode()->Len());
+}
+}
 }
 } while( pInsRing != ( pTmp = pTmp->GetNext()) );
 SwRedlineData aRedlnData( nsRedlineType_t::REDLINE_INSERT, nAuthor, 
aTimeStamp,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-03-07 Thread Michael Stahl
 sw/source/filter/ww8/docxattributeoutput.cxx |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

New commits:
commit 69b89daa2c583d02da0eb04f9a388d86d87f6ed5
Author: Michael Stahl 
Date:   Thu Mar 2 23:11:29 2017 +0100

tdf#101178 sw: DOCX export: fix crash

These conditions in DocxAttributeOutput::EndRun() are apparently not
mutually exclusive, so don't increment m_nFieldsInHyperlink twice.

Whether the m_nFieldsInHyperlink makes any sense considering there are
*2* hyperlinks then, i can't tell.

Change-Id: I5030f3303bd83633fcb044573860bc8ecaacae32
(cherry picked from commit 103efac8110be7e6f42fffcecc74abdcae4df7f9)
Reviewed-on: https://gerrit.libreoffice.org/34837
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1673f74..36872e7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1141,12 +1141,9 @@ void DocxAttributeOutput::EndRun()
 continue;
 }
 
-if (m_startedHyperlink)
-++m_nFieldsInHyperlink;
-
-if ( m_pHyperlinkAttrList.is() )
+if (m_startedHyperlink || m_pHyperlinkAttrList.is())
 {
-m_nFieldsInHyperlink++;
+++m_nFieldsInHyperlink;
 }
 }
 ++pIt;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-03-03 Thread Caolán McNamara
 sw/source/filter/ww8/wrtww8.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit d4b88da06634d85709b45176811ac3a0791f4c99
Author: Caolán McNamara 
Date:   Wed Mar 1 17:24:21 2017 +

Resolves: tdf#106261 throw away old node map for table

when generating a new one, otherwise on exporting the same table
twice to two consecutive .doc footnotes will think the second
export of the table is a level lower because it will find it
in the map and

WW8TableNodeInfo::Pointer_t WW8TableInfo::insertTableNodeInfo

does pNodeInfo->setDepth(nDepth + pNodeInfo->getDepth());
using the cached pNodeInfo depth and not a new fresh pNodeInfo of
depth 0

Change-Id: I7aa7ac6a19814910c1d19d78f04cfd9886c444c5
(cherry picked from commit 6f3e24ad64dd40b3ef8def7d879ba395a16874a1)
Reviewed-on: https://gerrit.libreoffice.org/34765
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 7c2dff0..9a7bf2a 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1831,8 +1831,16 @@ void MSWordExportBase::WriteSpecialText( sal_uLong 
nStart, sal_uLong nEnd, sal_u
 // clear linked textboxes since old ones can't be linked to frames in this 
section
 m_aLinkedTextboxesHelper.clear();
 
+// tdf#106261 Reset table infos, otherwise the depth of the cells will be
+// incorrect, in case the header/footer had table(s) and we try to export
+// the same table second time.
+ww8::WW8TableInfo::Pointer_t pOldTableInfo = m_pTableInfo;
+m_pTableInfo = std::make_shared();
+
 WriteText();
 
+m_pTableInfo = pOldTableInfo;
+
 m_bOutPageDescs = bOldPageDescs;
 delete m_pCurPam;// delete Pam
 m_pCurPam = pOldPam;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source sw/uiconfig

2017-03-01 Thread Michael Stahl
 sw/source/ui/table/tabledlg.cxx |   63 +---
 sw/source/uibase/table/tablepg.hxx  |3 -
 sw/uiconfig/swriter/ui/tabletextflowpage.ui |   10 +++-
 3 files changed, 49 insertions(+), 27 deletions(-)

New commits:
commit 362ff67556cca0890ca01f2de44596491c0e9bc8
Author: Michael Stahl 
Date:   Wed Mar 1 17:20:41 2017 +0100

tdf#77111 sw: fix page number offset on table dialog "Text Flow"

Commit c2ccd20c0fd92bddfff76447754541705e3eb8f3 introduced 0 as a valid
value for page number offset in sw core.

Unfortunately the table dialog was not changed then; previously
page number 0 would do automatic numbering, but since then 0 was set as
the offset, and once you have a 0 offset there's no easy way to remove
it, you have to remove the whole page break.

* change the label before the text number edit widget to a checkbox
  that disables the edit widget
* keep the id "pagenoft" so that translations still work
* set initial value to 1; 0 is a really bad default since we can't
  export it to ODF
* add a little bit of left margin so the line is indented below the
  upper line

Change-Id: I70cf5a66d4191acd2c19b3d0a83609e2b348a886
(cherry picked from commit c1e7fc6f497d7570cb0832c43647d295f8592567)
Reviewed-on: https://gerrit.libreoffice.org/34763
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index e96e195..611a2ce 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -1282,7 +1282,7 @@ SwTextFlowPage::SwTextFlowPage(vcl::Window* pParent, 
const SfxItemSet& rSet)
 
 get(m_pPageCollCB, "pagestyle");
 get(m_pPageCollLB, "pagestylelb");
-get(m_pPageNoFT, "pagenoft");
+get(m_pPageNoCB, "pagenoft");
 get(m_pPageNoNF, "pagenonf");
 
 get(m_pSplitCB, "split");
@@ -1307,6 +1307,8 @@ SwTextFlowPage::SwTextFlowPage(vcl::Window* pParent, 
const SfxItemSet& rSet)
 LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
 m_pPgBrkRB->SetClickHdl(
 LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
+m_pPageNoCB->SetClickHdl(
+LINK(this, SwTextFlowPage, PageNoClickHdl_Impl));
 m_pSplitCB->SetClickHdl(
 LINK( this, SwTextFlowPage, SplitHdl_Impl));
 m_pSplitRowCB->SetClickHdl(
@@ -1341,7 +1343,7 @@ void SwTextFlowPage::dispose()
 m_pPgBrkAfterRB.clear();
 m_pPageCollCB.clear();
 m_pPageCollLB.clear();
-m_pPageNoFT.clear();
+m_pPageNoCB.clear();
 m_pPageNoNF.clear();
 m_pSplitCB.clear();
 m_pSplitRowCB.clear();
@@ -1387,10 +1389,10 @@ bool  SwTextFlowPage::FillItemSet( SfxItemSet* rSet )
 
 //If we have a page style, then there's no break
 bool bPageItemPut = false;
-if ( bState != (m_pPageCollCB->GetSavedValue() == 1) ||
- ( bState &&
-   m_pPageCollLB->IsValueChangedFromSaved() )
-   || (m_pPageNoNF->IsEnabled() && m_pPageNoNF->IsValueModified()) )
+if (   bState != (m_pPageCollCB->GetSavedValue() == TRISTATE_TRUE)
+|| (bState && m_pPageCollLB->IsValueChangedFromSaved())
+|| (m_pPageNoCB->IsEnabled() && m_pPageNoCB->IsValueChangedFromSaved())
+|| (m_pPageNoNF->IsEnabled() && m_pPageNoNF->IsValueModified()))
 {
 OUString sPage;
 
@@ -1399,12 +1401,15 @@ bool  SwTextFlowPage::FillItemSet( SfxItemSet* rSet )
 sPage = m_pPageCollLB->GetSelectEntry();
 }
 sal_uInt16 nPgNum = static_cast< sal_uInt16 >(m_pPageNoNF->GetValue());
-if ( !pDesc || !pDesc->GetPageDesc() ||
-( pDesc->GetPageDesc() && ((pDesc->GetPageDesc()->GetName() != 
sPage) ||
-!comphelper::string::equals(m_pPageNoNF->GetSavedValue(), 
nPgNum
+bool const usePageNo(bState && m_pPageNoCB->IsChecked());
+boost::optional const oPageNum(
+(usePageNo) ? nPgNum : boost::optional());
+if (!pDesc || !pDesc->GetPageDesc()
+|| (pDesc->GetPageDesc()->GetName() != sPage)
+|| (pDesc->GetNumOffset() != oPageNum))
 {
 SwFormatPageDesc aFormat( pShell->FindPageDescByName( sPage, true 
) );
-aFormat.SetNumOffset(bState ? nPgNum : 0);
+aFormat.SetNumOffset(oPageNum);
 bModified |= nullptr != rSet->Put( aFormat );
 bPageItemPut = bState;
 }
@@ -1526,12 +1531,18 @@ void   SwTextFlowPage::Reset( const SfxItemSet* rSet )
 OUString sPageDesc;
 const SwPageDesc* pDesc = static_cast(pItem)->GetPageDesc();
 
-//m_pPageNoNF->SetValue(static_cast(pItem)->GetNumOffset());
 ::boost::optional oNumOffset = static_cast(pItem)->GetNumOffset();
 if (oNumOffset)
+{
+m_pPageNoCB->Check();
+m_pPageNoNF->Enable(true)

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-28 Thread Caolán McNamara
 sw/source/uibase/utlui/content.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 4024318a1d656388f3417a0f74794ccf05b3509a
Author: Caolán McNamara 
Date:   Thu Feb 23 17:15:04 2017 +

Resolves: tdf#106159 right click + left click with comments in navigator

results in a disposed submenu in the menu, we need to flag with bSubPop4
that we have inserted the submenu into the parent menu to not dispose
it

Change-Id: I5b9711c0bba750c11d64dc175efd452f4bc8f4e5
(cherry picked from commit 58659cbaa8c955b135737bf9d77e4e57813310e5)
Reviewed-on: https://gerrit.libreoffice.org/34590
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index dd8a2bf..ed5cb81 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1240,6 +1240,7 @@ VclPtr SwContentTree::CreateContextMenu()
 SwContentType* pType = 
static_cast(pEntry->GetUserData());
 if ( (pType->GetType() == ContentTypeId::POSTIT) &&  
(!m_pActiveShell->GetView().GetDocShell()->IsReadOnly()) && ( 
pType->GetMemberCount() > 0) )
 {
+bSubPop4 = true;
 pSubPop4->InsertItem(600, m_sPostItShow );
 pSubPop4->InsertItem(601, m_sPostItHide );
 pSubPop4->InsertItem(602, m_sPostItDelete );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-27 Thread Justin Luth
 sw/source/filter/xml/xmlimpit.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ae225329435cb49e61e3c9fc76129aa4e334598a
Author: Justin Luth 
Date:   Wed Jan 18 15:52:33 2017 +0300

tdf#77111 odt import: treat PAGEDESC_PAGENUMOFFSET==0 as auto

Ever since 2010 commit 7edaf190 zeroes have been saved as XML_AUTO.
Ever since 2014 commit c2ccd20c, a numoffset of zero is no longer
considered to be auto (for MS compatibility) but is still treated
as auto during xml export. Thus, any older documents that had been
saved with a zero should still xml import as auto instead of as 0.

Change-Id: I1a0df32a8e2f1b30b2bedbf4c9bb07ebec239637
Reviewed-on: https://gerrit.libreoffice.org/33267
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-by: Michael Stahl 
(cherry picked from commit e36f0860f00af139a8fa94d36302f7b0c56383fe)
Reviewed-on: https://gerrit.libreoffice.org/34694

diff --git a/sw/source/filter/xml/xmlimpit.cxx 
b/sw/source/filter/xml/xmlimpit.cxx
index bb0f51e..058c951 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -786,7 +786,7 @@ bool SvXMLImportItemMapper::PutXMLValue(
 sal_Int32 nVal;
 bOk = ::sax::Converter::convertNumber(
 nVal, rValue, 0, USHRT_MAX);
-if( bOk )
+if( bOk && nVal > 0 )
 rPageDesc.SetNumOffset( (sal_uInt16)nVal );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-24 Thread Caolán McNamara
 sw/source/core/doc/docbm.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit b8a0289f89cda6b816c710f687f4a4735e0f2bf4
Author: Caolán McNamara 
Date:   Thu Feb 16 11:18:41 2017 +

assert on export of ooo59665-1.sxw to odt

rSecondStart.nContent in this case has no m_pIndexReg

just move on with our lives wrt this sorting

Change-Id: I9642c5d345dabd02f3feea83bc2ffbf3f7adb082
Reviewed-on: https://gerrit.libreoffice.org/34336
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit 5d6b5bb57bb82a0dc480ca2ea17da5396f598af7)
Reviewed-on: https://gerrit.libreoffice.org/34593
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 4fd53d0..f75dd0e 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -84,9 +84,11 @@ namespace
 {
 return rFirstStart.nNode < rSecondStart.nNode;
 }
-if (rFirstStart.nContent != 0 || rSecondStart.nContent != 0)
+const sal_Int32 nFirstContent = rFirstStart.nContent.GetIndex();
+const sal_Int32 nSecondContent = rSecondStart.nContent.GetIndex();
+if (nFirstContent != 0 || nSecondContent != 0)
 {
-return rFirstStart.nContent < rSecondStart.nContent;
+return nFirstContent < nSecondContent;
 }
 auto *const pCRFirst (dynamic_cast<::sw::mark::CrossRefBookmark 
const*>(rpFirst.get()));
 auto *const pCRSecond(dynamic_cast<::sw::mark::CrossRefBookmark 
const*>(rpSecond.get()));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-23 Thread Michael Stahl
 sw/source/filter/ww8/ww8par2.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit a7377b9c3df9a2c964d1832d9636d1410f49a29c
Author: Michael Stahl 
Date:   Wed Feb 22 21:36:51 2017 +0100

sw: fix import of table in ooo44732-2.doc

The problem is that the first call to SwWW8ImplReader::TestApo()
from WW8TabDesc::WW8TabDesc() wrongly uses style 1 to construct the
Apo, when the actual style on the first cell of the 2nd row is 4.

Here style 1 contains PDxaWidth and PWHeightAbs sprms, which are
both overridden by the 1st paragraph, 1st cell, 1st row to 0.

The reason is that during the WW8TabDesc, apparently nothing actually
updates m_nAktColl, so it's always the style of the 1st cell, 1st row.

Clearly when called from WW8TabDesc this should not be using m_nAktColl,
but it's not clear to me if calling GetColl() here always works.

Change-Id: I3e3ac0c243112154d40d99684149e1c5f0e51129
(cherry picked from commit 33a3a5a7eb52ed6a883216cbba83f620f00f61b1)
Reviewed-on: https://gerrit.libreoffice.org/34556
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 41e0657..146d226 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -488,8 +488,9 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, 
bool bTableRowEnd,
 ApoTestResults aRet;
 // Frame in Style Definition (word appears to ignore them if inside an
 // text autoshape)
-if (!m_bTxbxFlySection && m_nAktColl < m_vColl.size())
-aRet.mpStyleApo = StyleExists(m_nAktColl) ? 
m_vColl[m_nAktColl].m_xWWFly.get() : nullptr;
+sal_uInt16 const nStyle(m_pPlcxMan->GetColl());
+if (!m_bTxbxFlySection && nStyle < m_vColl.size())
+aRet.mpStyleApo = StyleExists(nStyle) ? m_vColl[nStyle].m_xWWFly.get() 
: nullptr;
 
 /*
 #i1140#
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-16 Thread Caolán McNamara
 sw/source/filter/ww8/ww8graf2.cxx |   27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

New commits:
commit 7b6bf8348f36e5b98c5a6d5ddc4815df07f4fbbc
Author: Caolán McNamara 
Date:   Wed Feb 15 14:28:55 2017 +

Resolves: tdf#101000 ensure unique image names in .docs

(cherry picked from commit 432f605e3287269d1a20383f4eeebf012ee3679d)

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

diff --git a/sw/source/filter/ww8/ww8graf2.cxx 
b/sw/source/filter/ww8/ww8graf2.cxx
index 90e6021..dbcfdc3 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -30,8 +30,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -454,6 +455,19 @@ void SwWW8ImplReader::PicRead(SvStream *pDataStream, 
WW8_PIC *pPic,
 pDataStream->SeekRel(2);  //cProps
 }
 
+namespace
+{
+sal_uInt8 GetNodeType(SwFrameFormat &rSource)
+{
+const SwNodeIndex* pNodeIndex = rSource.GetContent().GetContentIdx();
+if (!pNodeIndex)
+return 0;
+const SwNode& rCSttNd = pNodeIndex->GetNode();
+SwNodeRange aRg(rCSttNd, 1, *rCSttNd.EndOfSectionNode());
+return aRg.aStart.GetNode().GetNodeType();
+}
+}
+
 SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj* pTextObj,
 SwFrameFormat* pOldFlyFormat)
 {
@@ -670,12 +684,11 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj* 
pTextObj,
 if (pRecord)
 SetAttributesAtGrfNode(pRecord, pRet, nullptr);
 
-// #i68101#
-// removed pObject->HasSetName() usage since always 
returned
-// true, also removed else-part and wrote an informing mail
-// to Henning Brinkmann about this to clarify.
-pRet->SetName(pObject->GetName());
-
+OUString aObjectName(pObject->GetName());
+if (aObjectName.isEmpty() || 
!m_rDoc.FindFlyByName(aObjectName, GetNodeType(*pRet)))
+pRet->SetName(aObjectName);
+else
+m_aGrfNameGenerator.SetUniqueGraphName(pRet, 
aObjectName);
 
 // determine the pointer to the new object and update
 // Z-order-list accordingly (or delete entry)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-15 Thread Xisco Fauli
 sw/source/core/tox/ToxTextGenerator.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 05116fb49efa563610f6486d0c3f6216624dcd13
Author: Xisco Fauli 
Date:   Wed Feb 15 11:06:00 2017 +0100

tdf#104315: Revert "tdf#44282 fix missing space...

... for numbered lists in TOC"

This commit is causing lot of regressions in TOC.
Besides, as the comment says, it's an ugly hack,
so I'd prefer to revert it and find a better solution

This reverts commit 250252d02bac88877845a4bc27e3f1837f1312ba.

Change-Id: I9f57d1cb0f7237372030c12651ba92fbe5a60945
Reviewed-on: https://gerrit.libreoffice.org/34293
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit dc8ebf205c3231ffc4d6737b53cee396c2ac0bfd)
Reviewed-on: https://gerrit.libreoffice.org/34295

diff --git a/sw/source/core/tox/ToxTextGenerator.cxx 
b/sw/source/core/tox/ToxTextGenerator.cxx
index 9d6a887..4eaaf8c3 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -215,10 +215,7 @@ ToxTextGenerator::GenerateText(SwDoc* pDoc, const 
std::vector
 }
 
 case TOKEN_TEXT:
-{
- if(rText.getLength() > 0) rText = rText.copy(0, 
rText.getLength() - 1);  //Ugly hack to remove default spacing when user 
specifies 
- rText += aToken.sText;
-}
+rText += aToken.sText;
 break;
 
 case TOKEN_PAGE_NUMS:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-10 Thread Michael Stahl
 sw/source/uibase/docvw/PostItMgr.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 3b8fdbab0ec79608e24421241c668f2a4027d301
Author: Michael Stahl 
Date:   Thu Feb 9 21:33:24 2017 +0100

tdf#91596 sw: make Format All Comments persistent

Change-Id: I8f9a20084d2dc8abd7699f64307b81321699498c
(cherry picked from commit bd269f902b86ecb5dde0043838be14c867ee8bec)
Reviewed-on: https://gerrit.libreoffice.org/34105
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index f5316cc..0cacd24 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1472,6 +1472,8 @@ void SwPostItMgr::FormatAll(const SfxItemSet &rNewAttr)
 pOLV->SetAttribs(rNewAttr);
 //restore old selection
 pOLV->SetSelection(aOrigSel);
+// tdf#91596 store updated formatting in SwField
+(*i)->pPostIt->UpdateData();
 }
 
 mpWrtShell->EndUndo();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-07 Thread Michael Stahl
 sw/source/core/doc/docbm.cxx |   18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

New commits:
commit e48a474f9f9b5f213811b39c157800ab29e5d345
Author: Michael Stahl 
Date:   Fri Feb 3 17:58:05 2017 +0100

sw: fix assertion on exporting novell633099-1.doc to DOC

This asserts because MarkManager::m_vAllMarks is not sorted.

info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,39 1493,39 
N2sw4mark8BookmarkE _Source_Device_Configuration
info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,39 1493,39 
N2sw4mark8BookmarkE _Deploying_the_Connector
info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,39 1493,39 
N2sw4mark8BookmarkE _Setting_up_Connection
info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,39 1493,39 
N2sw4mark8BookmarkE _Testing_the_Audit
info:sw.core:32273:1:sw/source/core/doc/docbm.cxx:286: 1493,0 1493,0 
N2sw4mark23CrossRefHeadingBookmarkE __RefHeading___Toc270687978

This happens while called from SwRangeRedline::MoveFromSection; the
target paragraph has some normal bookmarks and a CrossRefBookmark
all at index 0 before, but the move messes up the sorting.

The reason is that SwIndexReg::Update() has a special case HACK to avoid
adjusting the content index of CrossRefBookmark away from 0.

Prevent the problem by tweaking the bookmark sort function to always
sort CrossRefBookmark before other marks in the paragraph.

(cherry picked from commit 3a3b4f2b51005eef62a38d43d1dbef4c8201cc5c)

loplugin:simplifybool
(cherry picked from commit ad2935eee6640a5ee09d0b21c7c1f83dbfcd4c58)

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

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 07bf110..4fd53d0 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -78,7 +78,23 @@ namespace
 bool lcl_MarkOrderingByStart(const IDocumentMarkAccess::pMark_t& rpFirst,
 const IDocumentMarkAccess::pMark_t& rpSecond)
 {
-return rpFirst->GetMarkStart() < rpSecond->GetMarkStart();
+auto const& rFirstStart(rpFirst->GetMarkStart());
+auto const& rSecondStart(rpSecond->GetMarkStart());
+if (rFirstStart.nNode != rSecondStart.nNode)
+{
+return rFirstStart.nNode < rSecondStart.nNode;
+}
+if (rFirstStart.nContent != 0 || rSecondStart.nContent != 0)
+{
+return rFirstStart.nContent < rSecondStart.nContent;
+}
+auto *const pCRFirst (dynamic_cast<::sw::mark::CrossRefBookmark 
const*>(rpFirst.get()));
+auto *const pCRSecond(dynamic_cast<::sw::mark::CrossRefBookmark 
const*>(rpSecond.get()));
+if ((pCRFirst == nullptr) == (pCRSecond == nullptr))
+{
+return false; // equal
+}
+return pCRFirst != nullptr; // cross-ref sorts *before*
 }
 
 bool lcl_MarkOrderingByEnd(const IDocumentMarkAccess::pMark_t& rpFirst,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-06 Thread Mark Hung
 sw/source/core/text/itrcrsr.cxx  |3 ++-
 sw/source/core/text/itrpaint.cxx |3 ++-
 sw/source/core/text/porlay.hxx   |1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit bf357ae90811edc101ff13774c2e28a16bb5420d
Author: Mark Hung 
Date:   Thu Feb 2 21:15:01 2017 +0800

tdf#104270 count hanging margin only if there is hanging portion.

GetHangingMargin() also returns offset for PostItPortion, assure
there is a hanging portion before using the value.

Cherry-picked from 542421402d4e4f32bd9c499673d7a3fa98b00683

Change-Id: I750b8078fbd607d49f4bf5f76ea606fc36ea5c23
Reviewed-on: https://gerrit.libreoffice.org/33832
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
Reviewed-on: https://gerrit.libreoffice.org/33891

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 884e5ce..684e0e3 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1260,7 +1260,8 @@ sal_Int32 SwTextCursor::GetCursorOfst( SwPosition *pPos, 
const Point &rPoint,
 // x is the horizontal offset within the line.
 SwTwips x = rPoint.X();
 const SwTwips nLeftMargin  = GetLineStart();
-SwTwips nRightMargin = GetLineEnd() + GetCurr()->GetHangingMargin();
+SwTwips nRightMargin = GetLineEnd() +
+( GetCurr()->IsHanging() ? GetCurr()->GetHangingMargin() : 0 );
 if( nRightMargin == nLeftMargin )
 nRightMargin += 30;
 
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index be1b63a..8d4545a 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -440,7 +440,8 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, 
SwSaveClip &rClip,
 if ( bAdjustBaseLine )
 GetInfo().Y( GetInfo().GetPos().Y()
+ AdjustBaseLine( *m_pCurr, &aEnd ) );
-GetInfo().X( GetInfo().X() + GetCurr()->GetHangingMargin() );
+GetInfo().X( GetInfo().X() +
+( GetCurr()->IsHanging() ? GetCurr()->GetHangingMargin() : 
0 ) );
 aEnd.Paint( GetInfo() );
 GetInfo().Y( nOldY );
 }
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index 76d0921..109cb66 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -126,6 +126,7 @@ public:
 inline void SetForcedLeftMargin() { m_bForcedLeftMargin = true; }
 inline bool HasForcedLeftMargin() const { return m_bForcedLeftMargin; }
 inline void SetHanging( const bool bNew = true ) { m_bHanging = bNew; }
+inline bool IsHanging() const { return m_bHanging; }
 inline void SetUnderscore( const bool bNew = true ) { m_bUnderscore = 
bNew; }
 inline bool HasUnderscore() const { return m_bUnderscore; }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-04 Thread Noel Grandin
 sw/source/uibase/app/apphdl.cxx |   18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

New commits:
commit aa09fd58bd499a2a2c3a32c5f613892bad54076c
Author: Noel Grandin 
Date:   Fri Feb 3 14:04:18 2017 +0200

tdf#105684 crash in mail merge wizard

commit eca5ea9f79181d45cd7fbabe2313617d3025818a
"make the AbstractDialog stuff extend from VclReferenceBase"
introduced this regression.

Fix up the asynchronous delete to work again - necessary because
the delete is triggered from deep inside the object it wants to
delete.

Change-Id: I18d5a899fbb2da772552ebba7fe6a8e810314010
Reviewed-on: https://gerrit.libreoffice.org/33881
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
(cherry picked from commit 71863c6188a5a0bf9dd1c31c8ad9c7b8b9b9001b)
Reviewed-on: https://gerrit.libreoffice.org/33889
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 00a9f81..5e2b809 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -383,11 +383,13 @@ class SwMailMergeWizardExecutor : public 
salhelper::SimpleReferenceObject
 SwView*  m_pView;   // never owner
 SwView*  m_pView2Close; // never owner
 VclPtr m_pWizard; // always owner
+VclPtr m_pWizardToDestroyInCallback;
+
 bool m_bDestroyMMToolbarOnCancel;
 
 DECL_LINK( EndDialogHdl, Dialog&, void );
 DECL_LINK( DestroyDialogHdl, void*, void );
-DECL_STATIC_LINK( SwMailMergeWizardExecutor, DestroyWizardHdl, void*, void 
);
+DECL_LINK( DestroyWizardHdl, void*, void );
 DECL_LINK( CancelHdl, void*, void );
 DECL_LINK( CloseFrameHdl, void*, void );
 
@@ -505,9 +507,11 @@ IMPL_LINK_NOARG( SwMailMergeWizardExecutor, EndDialogHdl, 
Dialog&, void )
 {
 SwView* pNewView = lcl_LoadDoc(m_pView, 
m_pWizard->GetReloadDocument());
 
-// destroy wizard asynchronously
+// Destroy wizard asynchronously, since we are deep inside the 
wizard and dialog
+// machinery code here
+m_pWizardToDestroyInCallback = m_pWizard;
 Application::PostUserEvent(
-LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), 
m_pWizard );
+LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), 
nullptr );
 
 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
 std::shared_ptr xMMConfig = 
m_pView->GetMailMergeConfigItem();
@@ -537,8 +541,9 @@ IMPL_LINK_NOARG( SwMailMergeWizardExecutor, EndDialogHdl, 
Dialog&, void )
 if(pTargetView)
 {
 // destroy wizard asynchronously
+m_pWizardToDestroyInCallback = m_pWizard;
 Application::PostUserEvent(
-LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), 
m_pWizard );
+LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), 
nullptr );
 
 SwAbstractDialogFactory* pFact = 
SwAbstractDialogFactory::Create();
 m_pWizard = pFact->CreateMailMergeWizard(*pTargetView, 
xMMConfig);
@@ -616,10 +621,9 @@ IMPL_LINK_NOARG(SwMailMergeWizardExecutor, 
DestroyDialogHdl, void*, void)
 release();
 }
 
-IMPL_STATIC_LINK(SwMailMergeWizardExecutor, DestroyWizardHdl, void*, pDialog, 
void )
+IMPL_LINK_NOARG(SwMailMergeWizardExecutor, DestroyWizardHdl, void*, void)
 {
-VclPtr p = 
static_cast(pDialog);
-p.disposeAndClear();
+m_pWizardToDestroyInCallback.disposeAndClear();
 }
 
 IMPL_LINK_NOARG(SwMailMergeWizardExecutor, CancelHdl, void*, void)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-02 Thread Caolán McNamara
 sw/source/filter/ww8/ww8atr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8cf44d483d6696ab1ec4c5da82782e69a6a1fd54
Author: Caolán McNamara 
Date:   Thu Feb 2 16:02:42 2017 +

bffvalidator: animated text srpm has 1 byte payload, not 2

which is why my sample document creates a .doc which triggers
word's safe mode

this has been wrong since initial impl in

commit 4d5c193b2fd38c6cab049fcb97189462fff0fddb
...
2003/07/17 14:13:17 mmaher 1.64.6.6: #110851# Added support for 
animated text effects

a mere 13+ years ago

Change-Id: I8c4d95dac8e03f6523a2a036f0100f425f787a13
(cherry picked from commit 6263d03d538f014af2e17a4ecf3d218387ba5219)
Reviewed-on: https://gerrit.libreoffice.org/33837
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 400f7f5..1e0b847 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1125,7 +1125,7 @@ void WW8AttributeOutput::CharAnimatedText( const 
SvxBlinkItem& rBlink )
 {
 m_rWW8Export.InsUInt16( NS_sprm::LN_CSfxText );
 // At the moment the only animated text effect we support is blinking
-m_rWW8Export.InsUInt16( rBlink.GetValue() ? 2 : 0 );
+m_rWW8Export.pO->push_back( rBlink.GetValue() ? 2 : 0 );
 }
 
 void WW8AttributeOutput::CharCrossedOut( const SvxCrossedOutItem& rCrossed )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-02-01 Thread Caolán McNamara
 sw/source/uibase/utlui/content.cxx |  127 +
 1 file changed, 61 insertions(+), 66 deletions(-)

New commits:
commit 77275c4f0a41d55f2689fb2cce97f888e7f4e027
Author: Caolán McNamara 
Date:   Wed Feb 1 10:06:53 2017 +

with navigator in sidebar, press space, crash

because root entries have UserData of type SwContentType while children have
UserData of type SwContent (both inherit from SwTypeNumber)

(cherry picked from commit dfdd01d12226cfbd9b9d2618bd9da71191bfc4b9)

turn switch with one case into if

Change-Id: I413f195bb5571eb536e948a7e9ffb982b3619e65
(cherry picked from commit 567cd9043c09e42d8521a6b81545994ae4539beb)

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

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 0d241c7..dd8a2bf 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2670,86 +2670,81 @@ void SwContentTree::KeyInput(const KeyEvent& rEvent)
 
m_pActiveShell->GetView().GetViewFrame()->GetWindow().ToTop();
 }
 
-SwContent* pCnt = 
static_cast(pEntry->GetUserData());
+SwContent* pCnt = 
dynamic_cast(static_cast(pEntry->GetUserData()));
 
-switch(pCnt->GetParent()->GetType())
+if (pCnt && pCnt->GetParent()->GetType() == 
ContentTypeId::DRAWOBJECT)
 {
-case ContentTypeId::DRAWOBJECT:
+SdrView* pDrawView = m_pActiveShell->GetDrawView();
+if (pDrawView)
 {
-SdrView* pDrawView = m_pActiveShell->GetDrawView();
-if (pDrawView)
-{
-pDrawView->SdrEndTextEdit();//Change from 
"EndTextEdit" to "SdrEndTextEdit" for acc migration
+pDrawView->SdrEndTextEdit();//Change from 
"EndTextEdit" to "SdrEndTextEdit" for acc migration
 
-SwDrawModel* pDrawModel = 
m_pActiveShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
-SdrPage* pPage = pDrawModel->GetPage(0);
-const size_t nCount = pPage->GetObjCount();
-bool hasObjectMarked = false;
+SwDrawModel* pDrawModel = 
m_pActiveShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
+SdrPage* pPage = pDrawModel->GetPage(0);
+const size_t nCount = pPage->GetObjCount();
+bool hasObjectMarked = false;
 
-SdrObject* pObject = nullptr;
-pObject = GetDrawingObjectsByContent( pCnt );
-if( pObject )
+SdrObject* pObject = nullptr;
+pObject = GetDrawingObjectsByContent( pCnt );
+if( pObject )
+{
+SdrPageView* pPV = 
pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/);
+if( pPV )
 {
-SdrPageView* pPV = 
pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/);
-if( pPV )
-{
-bool bUnMark = 
pDrawView->IsObjMarked(pObject);
-pDrawView->MarkObj( pObject, pPV, bUnMark);
+bool bUnMark = pDrawView->IsObjMarked(pObject);
+pDrawView->MarkObj( pObject, pPV, bUnMark);
 
-}
 }
-for( size_t i=0; iGetObj(i);
+bool bMark = pDrawView->IsObjMarked(pTemp);
+switch( pTemp->GetObjIdentifier() )
 {
-SdrObject* pTemp = pPage->GetObj(i);
-bool bMark = pDrawView->IsObjMarked(pTemp);
-switch( pTemp->GetObjIdentifier() )
-{
-case OBJ_GRUP:
-case OBJ_TEXT:
-case OBJ_TEXTEXT:
-case OBJ_wegFITTEXT:
-case OBJ_LINE:
-case OBJ_RECT:
-case OBJ_CIRC:
-case OBJ_SECT:
-case OBJ_CARC:
-case OBJ_CCUT:
-case OBJ_POLY:
-   

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-30 Thread Caolán McNamara
 sw/source/core/unocore/unostyle.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit b51be29b8c24294d26706cb2d0fd52c1878768bb
Author: Caolán McNamara 
Date:   Mon Jan 30 11:35:15 2017 +

Resolves: tdf#101664 dropcaps not set in styles on load

regression from...

commit 6766760e86b517c726204f9601b33a19cb0c5451
Date:   Thu Jan 14 21:05:59 2016 +0100

refactor out to limit scope: RES_PARATR_DROP

Change-Id: I8813b5676504e6de2af70d181fa9e905538fb05c

where MID_DROPCAP_CHAR_STYLE_NAME != nMemberId branch
in the past went to the default handler, while in
rework it ended up ignored

Change-Id: I8efa131750a064f594c1a2354d7aad19c2dc6b16
(cherry picked from commit d27aba549cdbcad6825ac6c955ee7d603aba1989)
Reviewed-on: https://gerrit.libreoffice.org/33695
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index 382255e..2bbf137 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1916,10 +1916,13 @@ void 
SwXStyle::SetPropertyValue(const SfxItemPropertySimple
 SetPropertyValue(rEntry, rPropSet, rValue, o_rStyleBase);
 }
 template<>
-void SwXStyle::SetPropertyValue(const 
SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet&, const uno::Any& 
rValue, SwStyleBase_Impl& o_rStyleBase)
+void SwXStyle::SetPropertyValue(const 
SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const 
uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
 {
 if(MID_DROPCAP_CHAR_STYLE_NAME != rEntry.nMemberId)
+{
+SetPropertyValue(rEntry, rPropSet, rValue, o_rStyleBase);
 return;
+}
 if(!rValue.has())
 throw lang::IllegalArgumentException();
 SfxItemSet& rStyleSet(o_rStyleBase.GetItemSet());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-25 Thread Caolán McNamara
 sw/source/ui/index/cnttab.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 24077d0551dc67914bc8f06889be3367fa1aaba6
Author: Caolán McNamara 
Date:   Wed Jan 25 15:05:27 2017 +

fix index widget control positions on first view

Change-Id: Ic70006d65100b0ed8b337d43ff81577fb4579192
(cherry picked from commit 1337932c038d0a0f689e59de7c8ffd272dbdafa4)
Reviewed-on: https://gerrit.libreoffice.org/33545
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 5e7fb34..8105357 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -2737,6 +2737,7 @@ void SwTokenWindow::setAllocation(const Size &rAllocation)
 aSize.Height() = aControlSize.Height();
 pControl->SetSizePixel(aSize);
 }
+AdjustPositions();
 }
 
 SwTokenWindow::~SwTokenWindow()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-25 Thread Caolán McNamara
 sw/source/core/layout/flowfrm.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d7858b0d23f88a3ecec4ed7cc863ee0867086209
Author: Caolán McNamara 
Date:   Thu Jan 19 10:47:56 2017 +

Related: tdf#100813 don't crash traversing table in page 43

master has...

commit 1281bd5d87361fa516cdf247b055aeb4bb5e13fb
Author: Mike Kaganski 
Date:   Wed Jan 18 09:25:55 2017 +0300

tdf#104181 related: don't throw on this document

which is more extreme, keep it minimal for the backport,
MoveFootnoteCntFwd always derefs pOldBoss so check for null
before calling into it here

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

diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index f9faba4..29e1300 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1805,7 +1805,7 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool 
bPageBreak, bool bMoveAlways )
 return false;
 if (m_rThis.IsInFootnote())
 {
-if (!m_rThis.IsContentFrame())
+if (!m_rThis.IsContentFrame() || !pOldBoss)
 {
 SAL_WARN("sw.core", "Tables in footnotes are not truly supported");
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-22 Thread Maxim Monastirsky
 sw/source/uibase/uiview/viewling.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ff0fbfab197f6d717fd7f0afed2954356b3fe791
Author: Maxim Monastirsky 
Date:   Wed Jan 18 23:28:16 2017 +0200

tdf#105409 Use ScopedVclPtr

so disposeAndClear is called.

Change-Id: I40da317ac03f815c8664e8a4648870c2066f9650
(cherry picked from commit 6884550c20f95a635357ad848799a1aae555968a)
Reviewed-on: https://gerrit.libreoffice.org/33324
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/uibase/uiview/viewling.cxx 
b/sw/source/uibase/uiview/viewling.cxx
index 5ac4f9f..56f3b7e 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -718,7 +718,7 @@ bool SwView::ExecSpellPopup(const Point& rPt)
 aEvent.SourceWindow = VCLUnoHelper::GetInterface( m_pEditWin );
 aEvent.ExecutePosition.X = aPixPos.X();
 aEvent.ExecutePosition.Y = aPixPos.Y();
-VclPtr pMenu;
+ScopedVclPtr pMenu;
 
 OUString sMenuName  = bUseGrammarContext ?
 OUString("private:resource/GrammarContextMenu") : 
OUString("private:resource/SpellContextMenu");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-20 Thread Mike Kaganski
 sw/source/core/layout/flowfrm.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 8098cdaca08abaf12a32bbebcd058a98c2af03bd
Author: Mike Kaganski 
Date:   Wed Jan 18 09:25:55 2017 +0300

tdf#104181 related: don't throw on this document

Related to: 
http://crashreport.libreoffice.org/stats/signature/SwContentFrame::MoveFootnoteCntFwd(bool,SwFootnoteBossFrame%20*)

Change-Id: I53abf3267e1a75e944de8c6ea80a72de0e7e
Reviewed-on: https://gerrit.libreoffice.org/33245
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 
(cherry picked from commit 1281bd5d87361fa516cdf247b055aeb4bb5e13fb)
Reviewed-on: https://gerrit.libreoffice.org/6
Tested-by: Jenkins 

diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index d517103..f9faba4 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1800,6 +1800,9 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool 
bPageBreak, bool bMoveAlways )
 {
 //MoveFootnoteCntFwd might need to be updated as well.
 SwFootnoteBossFrame *pOldBoss = m_rThis.FindFootnoteBossFrame();
+assert(pOldBoss);
+if (!pOldBoss)
+return false;
 if (m_rThis.IsInFootnote())
 {
 if (!m_rThis.IsContentFrame())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-20 Thread Jan Holesovsky
 sw/source/uibase/uno/unotxdoc.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 5bfa9f02f41c9beb755e3b2f69ba5bdf05b1613f
Author: Jan Holesovsky 
Date:   Thu Jan 19 19:40:58 2017 +0100

Preserve whitespace with tiled rendering.

Online is often used for taking minutes, and during that, people don't have
time to play with the formatting - so it is annoying when autocorrect goes 
in
the way.

Change-Id: Ia1794c46d3003198764f666951821f693d710653
Reviewed-on: https://gerrit.libreoffice.org/33326
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 

diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index e649784..a65616a 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3308,6 +3308,10 @@ void SwXTextDocument::initializeForTiledRendering(const 
css::uno::SequenceGetSwFlags().bAutoCompleteWords = 
false;
+
+// don't change the whitespace at the beginning of paragraphs, this is
+// annoying when taking minutes without further formatting
+SwEditShell::GetAutoFormatFlags()->bAFormatByInpDelSpacesAtSttEnd = false;
 }
 
 void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-17 Thread Stephan Bergmann
 sw/source/core/unocore/unoobj.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 1eadd137ade5e2c4361990cce3f153e46110a1e9
Author: Stephan Bergmann 
Date:   Tue Jan 17 10:03:49 2017 +0100

tdf#105212: BASIC sets Delimiter prop to integer value

LO's BASIC doesn't have first-class support for the UNO CHAR type, often 
uses
integer values to represent such CHAR values (cf. 
).

Since 0b07406f7147b9abbb2095d9e038b13293cb8b10 "Use C++11 char16_t for
sal_Unicode" (for non-Windows, since LO 5.1) resp.
e16fa715c43dcdf836ce8c400b6d54eae87b627d "Handle wchar_t as native C++11 
type on
windows" (for Windows, since LO 5.2), C++ css::uno::Any >>=, <<=, etc. with 
a
sal_Unicode argument no longer silently treat the argument as sal_uInt16
instead.  That means that BASIC code putting an integer value into a UNO ANY
that shall hold a value of CHAR type may no longer work.  (Arguably, such 
code
only ever happened to work by coincidence.  For example, if the ANY were
processed by Java instead of C++ code, it would never have worked.)

Luckily, the use of CHAR in the UNO API is rare (for a good reason, as a 
single
UTF-16 code unit is hardly ever the right choice to represent "a 
character").
The only documented place I could find using a CHAR property is Delimiter 
in the
css.text.TextSortDescriptor and css.text.TextSortDescriptor2 services.  And 
the
only processing of such a property that I could find across the LO code 
base is
in the file modified here, which thus just takes a one-off special effort to
take care of this problem.

The direction from C++ to BASIC is left as-is.  The value of the Delimiter
property is now reported as a CHAR value (where in the past it 
was---arguably
erroneously---reported as an UNSIGNED SHORT value), and BASIC is generally
capable of handling such CHAR values it receives well.  For example, in the
BASIC code attached to tdf#105212,

>   MsgBox("Sort: " + SortDesc(1).Name  + " = " + SortDesc(1).Value)

SortDesc(1).Value will now print a (space) character instead of its numeric
value (32).  Also, any other uses of individual CHAR values in the UNO API 
apart
from properties appear to already be handled well enough by BASIC, as the 
sample
code

> Sub Main
>  tk = createunoservice("com.sun.star.awt.Toolkit")
>  dev = tk.createScreenCompatibleDevice(100, 100)
>  descs = dev.getFontDescriptors()
>  msgbox("Font """ + descs(1).Name + )
>  font = dev.getFont(descs(1))
>  n = font.getCharWidth(97) ' 'a'
>  msgbox("Width 'a' = " + n)
>  met = font.getFontMetric()
>  msgbox("FirstChar = '" + met.FirstChar + "', LastChar = '" + 
met.LastChar + "'")
>  met.LastChar = 122 ' 'z'
>  msgbox("New LastChar = '" + met.LastChar + "'")
>
>  trans = createunoservice("com.sun.star.i18n.Transliteration")
>  c1 = trans.transliterateChar2Char(97) ' 'a'
>  c2 = trans.transliterateChar2Char(c1)
>  msgbox("Transliterate, '" + c1 + "' '" + c2 + "'")
> End Sub

demonstrates.

Change-Id: I2aec1ce374c024bfac61f6c832241dfeb561addc
(cherry picked from commit 1b835cdb5ef4cebeae729b1edf2a773f4a582c0f)
Reviewed-on: https://gerrit.libreoffice.org/33212
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/unocore/unoobj.cxx 
b/sw/source/core/unocore/unoobj.cxx
index c3b1300..9c9bb65 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2688,10 +2688,17 @@ bool SwUnoCursorHelper::ConvertSortProperties(
 else if ( rPropName == "Delimiter" )
 {
 sal_Unicode uChar;
+sal_uInt16 nChar;
 if (aValue >>= uChar)
 {
 rSortOpt.cDeli = uChar;
 }
+else if (aValue >>= nChar)
+{
+// For compatibility with BASIC, also accept an ANY containing
+// an UNSIGNED SHORT:
+rSortOpt.cDeli = nChar;
+}
 else
 {
 bRet = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-13 Thread Justin Luth
 sw/source/core/edit/autofmt.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 098d90920a7aea1cc2ee53a79b909f0eef67ca02
Author: Justin Luth 
Date:   Fri Jan 13 20:58:02 2017 +0300

tdf#105294 - only add spacing for the border being set

related to bug 41542 which now allows the space-to-contents value
even if the border is not visible.

For years, LO has been resetting the spacing to zero when a line
is diabled. Setting all border distances here was a mistake that
was never caught before, and the documents created because of
this oversight will likely cause some grief to bug 41542.

Change-Id: Id2708cf20600e29e97dc6c8d8b779894ad9c38d1
Reviewed-on: https://gerrit.libreoffice.org/33055
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
(cherry picked from commit 9e7526044c8fa6b006b0cb791d15f2476c96ebf2)
Reviewed-on: https://gerrit.libreoffice.org/33062

diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 1109e5d..fbc8351 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -584,7 +584,7 @@ bool SwAutoFormat::DoUnderline()
 aSet.Put( SwParaConnectBorderItem( false ) );
 SvxBoxItem aBox( RES_BOX );
 aBox.SetLine( &aLine, SvxBoxItemLine::BOTTOM );
-aBox.SetAllDistances(42); // ~0,75 mm
+aBox.SetDistance(42, SvxBoxItemLine::BOTTOM ); // ~0,75 mm
 aSet.Put(aBox);
 m_pDoc->getIDocumentContentOperations().InsertItemSet( m_aDelPam, aSet 
);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-13 Thread Alex McMurchy1917
 sw/source/uibase/dbui/dbmgr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4c8be6327f6d71d426bbf9887fd7d8a24ffd06a3
Author: Alex McMurchy1917 
Date:   Thu Jan 12 11:06:52 2017 +

tdf#105071 MM no emails sent when using doc as mail body

The conditional statement exits if there is data to process and
continues if there is no data to process. Thus all records are lost.

This commit reverses this behaviour so that data is processed
by the rest of the Mail merge activities.

Change-Id: I4c92cbd7ca55be7842b07ad887813e417430ba4f
Reviewed-on: https://gerrit.libreoffice.org/32994
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jan-Marek Glogowski 
(cherry picked from commit 03ec9c397c676faff51041d992f6d715c475ff13)
Reviewed-on: https://gerrit.libreoffice.org/33012
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index e9d6363..6052e11 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1055,7 +1055,7 @@ uno::Reference< mail::XMailMessage > 
lcl_CreateMailFromDoc(
 SfxMedium aMedium( sFileURL, StreamMode::READ );
 SvStream* pInStream = aMedium.GetInStream();
 assert( pInStream && "no output file created?" );
-if( pInStream )
+if( !pInStream )
 return xMessage;
 
 pInStream->SetStreamCharSet( sMailEncoding );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-11 Thread Michael Stahl
 sw/source/core/undo/rolbck.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit eeb0b8c5fcfcc24b05b773e921b04f3325991247
Author: Michael Stahl 
Date:   Tue Jan 10 23:25:47 2017 +0100

tdf#105077 sw: fix wrong assert corner-case in SwRegHistory::InsertItems

There is a tricky corner-case when an item set is inserted that
contains items that are all identical to what's in the node's item set.

In this case a SwHistorySetText will be created for an overwritten hint,
but no new AUTOFMT hint will be inserted so there is no
SwHistoryResetText.

So it looks like AUTOFMT can't be checked at all here.

(regression from b44e70e3d17c79eaf78f9bfe8bd0275d7ed9325f)

Change-Id: I83a241588cef6a9ec074d4f0e39322987394ca86
(cherry picked from commit db4badfc971b9cc60809c3408f579bae04a77c34)
Reviewed-on: https://gerrit.libreoffice.org/32942
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index a8cafba..3e55338 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1317,8 +1317,10 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet,
 (isCHRATR(nWhich) || RES_TXTATR_UNKNOWN_CONTAINER == nWhich)
 ? RES_TXTATR_AUTOFMT
 : static_cast(nWhich));
-if (RES_TXTATR_AUTOFMT == nExpected && 0 == nStart && 
pTextNode->Len() == nEnd)
+if (RES_TXTATR_AUTOFMT == nExpected)
 continue; // special case, may get set on text node itself
+  // tdf#105077 even worse, node's set could cause
+  // nothing at all to be inserted
 assert(std::find_if(
 m_pHistory->m_SwpHstry.begin(), m_pHistory->m_SwpHstry.end(),
 [nExpected](SwHistoryHint *const pHint) -> bool {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-09 Thread Michael Stahl
 sw/source/core/access/accfrmobj.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 97b9f00e3a443f636416d047e7fdcb7a91fac937
Author: Michael Stahl 
Date:   Fri Jan 6 22:37:17 2017 +0100

tdf#105009 sw: fix a11y crash when removing drawing object

SwFrame::RemoveDrawObj() calls SwAnchoredObject::ChgAnchorFrame(0)
so the SwAnchoredDrawObj has no anchor frame later when
SwAccessibleMap::InvalidateCursorPosition() asks for the parent.

(regression from 76c549eb01dcb7b5bf28a271ce00e386f3d388ba)

Change-Id: Id55cb5fc41a4e37e863498265d1565e1621d508e
(cherry picked from commit ade1d4c36053c2a7aed959e3dd09ebc1b8430ea8)
Reviewed-on: https://gerrit.libreoffice.org/32802
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/access/accfrmobj.cxx 
b/sw/source/core/access/accfrmobj.cxx
index cf3e295..5b59078 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -367,10 +367,14 @@ const SwFrame* SwAccessibleChild::GetParent( const bool 
bInPagePreview ) const
 else
 {
 // In any other case the parent is the root frm
-if( bInPagePreview )
-pParent = pContact->GetAnchorFrame()->FindPageFrame();
-else
-pParent = pContact->GetAnchorFrame()->getRootFrame();
+SwFrame const*const pAnchor(pContact->GetAnchorFrame());
+if (pAnchor) // null if object removed from layout
+{
+if (bInPagePreview)
+pParent = pAnchor->FindPageFrame();
+else
+pParent = pAnchor->getRootFrame();
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-04 Thread Justin Luth
 sw/source/ui/misc/docfnote.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c63fe08c485baba133ebbeaef28fe97113dded35
Author: Justin Luth 
Date:   Tue Jan 3 15:24:48 2017 +0300

tdf#43370 docfnote.cxx: return correct FTNNUM for GetNumbering

way back in 2001 commit a7afc46b3766e4000ae5a9b8a914ede36bbd2991
removed the option to select per-chapter footnote-numbering for
footnotes placed at the end of the document (or perhaps chapter
since the variable is called FTNPOS_CHAPTER, but the UI refers to
it as document).  So only "Per Document" remained. However the
function GetNumbering was never updated to reflect that fact that
2 options were removed from the list now, instead of one.

So, the UI reported the choice as "Per Page", the only dropdown choice
available was "Per Document", and the actual implemented choice
was "Per Chapter".  How's that for a mess?

Change-Id: Ib8dc3d07c0ef62d39afdd2a1c78c14527649c6df
Reviewed-on: https://gerrit.libreoffice.org/32700
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
Reviewed-by: Michael Stahl 
(cherry picked from commit 15ca00601701c50ccdb3d8dbe08ba705787386a7)
Reviewed-on: https://gerrit.libreoffice.org/32732

diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx
index 30f053b..9feb8a1 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -276,7 +276,7 @@ void SwEndNoteOptionPage::SelectNumbering(int eNum)
 int SwEndNoteOptionPage::GetNumbering() const
 {
 const sal_Int32 nPos = m_pNumCountBox->GetSelectEntryPos();
-return (int) bPosDoc? nPos + 1: nPos;
+return (int) bPosDoc? nPos + 2: nPos;
 }
 
 void SwEndNoteOptionPage::SetShell( SwWrtShell &rShell )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2017-01-02 Thread Justin Luth
 sw/source/filter/ww8/ww8par6.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 70b3dd697cb248fb56830db691269fe9e78c57fb
Author: Justin Luth 
Date:   Sat Dec 24 12:00:21 2016 +0300

tdf#81263 ww8par6: only use valid sal_uInt16 values for ULSpace

VerticalOrient position returns a signed SwTwips number,
but ULSpace uses unsigned int16, so negative numbers
were creating huge margins.

fixes commit 3755c87d0426a499d4755e82d8fbc77caa240764

Change-Id: I23daea9a913ef73efc42a65e0adfc393eaf4e775
Reviewed-on: https://gerrit.libreoffice.org/32400
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
(cherry picked from commit 604cf7024fce29143150ab77b2f14b59a45e61eb)
Reviewed-on: https://gerrit.libreoffice.org/32402
Tested-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 68b017e..0477795 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2355,8 +2355,9 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo,
 if (aFlySet.HasItem(RES_VERT_ORIENT, &pItem))
 {
 const SwFormatVertOrient* pOrient = static_cast(pItem);
-if (pOrient->GetPos() != 0)
-pULSpaceItem->SetUpper(pOrient->GetPos());
+SwTwips nPos = pOrient->GetPos();
+if( 0 < nPos && nPos <= SAL_MAX_UINT16 )
+pULSpaceItem->SetUpper( sal_uInt16(nPos) );
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2016-12-22 Thread Justin Luth
 sw/source/filter/ww8/ww8par6.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 588d917d0af740bb75c7cf5085f0db63e35f2df0
Author: Justin Luth 
Date:   Thu Dec 15 20:24:46 2016 +0300

tdf#75856 SwTwips: replace with unambiguous sal_Int32

Change-Id: Ifa59f8dad31ad0445c32ac0265d7c1573da4
Reviewed-on: https://gerrit.libreoffice.org/32051
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 426215ca6fedd13ece07463ee95dd33bdb1a9a28)
Reviewed-on: https://gerrit.libreoffice.org/32330
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 59112cb..68b017e 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -599,7 +599,7 @@ void wwSectionManager::SetPageULSpaceItems(SwFrameFormat 
&rFormat,
 else
 {
 // #i48832# - set correct spacing between header and body.
-const SwTwips nHdLowerSpace( std::abs(rSection.maSep.dyaTop) - 
rData.nSwUp - rData.nSwHLo );
+const sal_Int32 nHdLowerSpace( std::abs(rSection.maSep.dyaTop) 
- rData.nSwUp - rData.nSwHLo );
 pHdFormat->SetFormatAttr(SwFormatFrameSize(ATT_FIX_SIZE, 0, 
rData.nSwHLo + nHdLowerSpace));
 aHdUL.SetLower( static_cast< sal_uInt16 >(nHdLowerSpace) );
 pHdFormat->SetFormatAttr(SwHeaderAndFooterEatSpacingItem(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2016-12-21 Thread Michael Stahl
 sw/source/core/attr/calbck.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 0cf5d53208e487f98f4351b4ca40110079914288
Author: Michael Stahl 
Date:   Tue Dec 20 23:08:31 2016 +0100

assert SwDrawContact unhandled attr. on exporting ooo67621-1.odt to DOCX

Check in SwModify::Remove() that unrelated clients aren't inserted into
an active SwClientIter.

Old value = (sw::WriterListener *) 0x0
New value = (SwDrawFrameFormat *) 0x72d83f0
SwModify::Remove (this=0x37fd850, pDepend=0x6ca85a8) at 
sw/source/core/attr/calbck.cxx:220
 0 in SwModify::Remove(SwClient*) (this=0x37fd850, pDepend=0x6ca85a8) at 
sw/source/core/attr/calbck.cxx:220
 1 in ClientModify(SwClient*, SfxPoolItem const*, SfxPoolItem const*) 
(pClient=0x6ca85a8, pOld=0x7ffe9d041bf0, pNew=0x7ffe9d041c10) at 
sw/source/core/unocore/unoobj2.cxx:326
 2 in SwXShape::Modify(SfxPoolItem const*, SfxPoolItem const*) 
(this=0x6ca8540, pOld=0x7ffe9d041bf0, pNew=0x7ffe9d041c10) at 
sw/source/core/unocore/unodraw.cxx:2037
 3 in SwClient::ModifyNotification(SfxPoolItem const*, SfxPoolItem const*) 
(this=0x6ca85a8, pOldValue=0x7ffe9d041bf0, pNewValue=0x7ffe9d041c10) at 
sw/inc/calbck.hxx:130
 4 in SwFormat::~SwFormat() (this=0x39e6320, __in_chrg=) at 
sw/source/core/attr/format.cxx:239
 5 in SwFrameFormat::~SwFrameFormat() (this=0x39e6320, __in_chrg=) at sw/source/core/layout/atrfrm.cxx:2519

So the SwXShape was a client of the SwFrameFormat that is deleted, then
is removed and added at the parent SwFrameFormat by ~SwFormat, then it
is removed *again* when its own Modify handles the SwFormatChg
notification, but this time it messes up the SwClientIter in ~SwFormat,
putting in a m_pPosition SwFrameFormat that is actually a client of the
parent SwFrameFormat, not the deleted one!

Thus the deleted SwFrameFormat is confused and sends a "sibling" of
itself the SwFormatChg notification and that then asserts with
dcontact.cxx:1468 " - unhandled attribute?".

Change-Id: Ifba7fa8a1f41f09b1a3fcbb4cdf17f340e0fbe33
(cherry picked from commit 654b86cf3425d7a49b13a97e4b11223d43b9e86e)
Reviewed-on: https://gerrit.libreoffice.org/32260
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 54a036b..a9598b8 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -219,7 +219,8 @@ SwClient* SwModify::Remove( SwClient* pDepend )
 {
 for(auto& rIter : 
sw::ClientIteratorBase::our_pClientIters->GetRingContainer())
 {
-if( rIter.m_pCurrent == pDepend || rIter.m_pPosition == pDepend )
+if (&rIter.m_rRoot == this &&
+(rIter.m_pCurrent == pDepend || rIter.m_pPosition == pDepend))
 {
 // if object being removed is the current or next object in an
 // iterator, advance this iterator
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2016-12-19 Thread Michael Stahl
 sw/source/filter/inc/msfilter.hxx |1 
 sw/source/filter/ww8/writerhelper.cxx |   56 ++
 sw/source/filter/ww8/ww8par5.cxx  |3 +
 3 files changed, 60 insertions(+)

New commits:
commit 4a5ee9a074c94f2a0cc9733e12d5e412926633d1
Author: Michael Stahl 
Date:   Wed Dec 14 23:02:07 2016 +0100

sw: WW8 import: try to prevent overlapping field-marks and redlines

As one knows, the features of Writer's document model that most impress
by their sheer quality of implementation are redlines and field marks.
Unsurprisingly, if the two meet in the context of the WW8 import, epic
disasters are imminent; ooo83574-1.doc is one such train wreck that
asserts with:

sw/source/core/crsr/bookmrk.cxx:111: void 
{anonymous}::lcl_RemoveFieldMarks(sw::mark::Fieldmark*, SwDoc*, sal_Unicode, 
sal_Unicode): Assertion `pStartTextNode->GetText()[rStart.nContent.GetIndex()] 
== aStartMark' failed.

This happens when, at the end of the import, the redlines are hidden by
moving them into their special SwNodes section.  The reason why this one
asserts is that a previous SwRedline erroneously deleted the start dummy
char of this field mark, because that SwRedline had the wrong start/end
positions.

In Word the problematic paragraph is shown like this, where \a\b mark fields
and I D F redlines:

"Coming out of the work of Rummler and Brache’s \a(Rummler & Brache, 
1995)(1995)\b work is the is the notion
   D  
DD   III

another” \a(p. 9)\b\a(Rummler & Brache, 1995, p. 9)\b.. ( italics in the 
original)"
   IIDD  
IDDDI

FF

The first mis-positioned redline here ranges from 71 to 79, ")(1995)\b",
so it deletes the end dummy char of the field mark.  It should range
from 72 to 78.

This commit adds some rather crude hacks which appear to work to avoid
the problem:
1. when a field mark is inserted, the start positions of the redlines
   may need to be moved
2. when the end position of a redline is set, it may need adjustment to
   exclude a field-mark that ends at the same position

Change-Id: I723f1858c84def2c063e2cb126317d06e8ac98b5
(cherry picked from commit d195a3e5f4ec5c616ae83f99d48f5d4eefe5f22e)
Reviewed-on: https://gerrit.libreoffice.org/32191
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/inc/msfilter.hxx 
b/sw/source/filter/inc/msfilter.hxx
index 66771cf..3710424 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -345,6 +345,7 @@ namespace sw
 
 public:
 explicit RedlineStack(SwDoc &rDoc) : mrDoc(rDoc) {}
+void MoveAttrs(const SwPosition& rPos);
 void open(const SwPosition& rPos, const SfxPoolItem& rAttr);
 bool close(const SwPosition& rPos, RedlineType_t eType);
 void close(const SwPosition& rPos, RedlineType_t eType,
diff --git a/sw/source/filter/ww8/writerhelper.cxx 
b/sw/source/filter/ww8/writerhelper.cxx
index 4c1ef18..65b6775 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -52,6 +52,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 using namespace com::sun::star;
 
@@ -740,6 +742,26 @@ namespace sw
 SameOpenRedlineType(eType));
 if (aResult != maStack.rend())
 {
+SwTextNode *const pNode(rPos.nNode.GetNode().GetTextNode());
+sal_Int32 const nIndex(rPos.nContent.GetIndex());
+// HACK to prevent overlap of field-mark and redline,
+// which would destroy field-mark invariants when the redline
+// is hidden: move the redline end one to the left
+if (pNode && nIndex > 0
+&& pNode->GetText()[nIndex - 1] == CH_TXT_ATR_FIELDEND)
+{
+SwPosition const end(*rPos.nNode.GetNode().GetTextNode(),
+ nIndex - 1);
+sw::mark::IFieldmark *const pFieldMark(
+
rPos.GetDoc()->getIDocumentMarkAccess()->getFieldmarkFor(end));
+assert(pFieldMark);
+if (pFieldMark->GetMarkPos().nNode.GetIndex() == 
(*aResult)->m_aMkPos.m_nNode.GetIndex()+1
+&& pFieldMark->GetMarkPos().nContent.GetIndex() < 
(*aResult)->m_aMkPos.m_nContent)
+{
+(*aResult)->SetEndPos(end);
+return true;
+}
+}
 (*aResult)->SetEndPos(rPos);
 return true;
 }
@@ -751,6 +773,

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2016-12-19 Thread Michael Stahl
 sw/source/core/view/viewimp.cxx |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 2e74bf2e05f0c98bb9ca318e6b0f9e715d0fdba7
Author: Michael Stahl 
Date:   Thu Dec 15 23:08:53 2016 +0100

tdf#104488 sw: assert if exception escapes from UpdateAccessible()

SwViewShellImp::UpdateAccessible() is called during scrolling and the
like, and if the a11y code doesn't catch the exceptions the document
view won't get repainted.

Change-Id: I4ec591aacf514bef8c5a66a7e674b0cee3b7201a
(cherry picked from commit 9ada2da6f1bceb5d24f23d8df08103535714918a)
Reviewed-on: https://gerrit.libreoffice.org/32189
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index e403be9..335f45a 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -297,7 +297,17 @@ void SwViewShellImp::UpdateAccessible()
 OSL_ENSURE( pWin, "no window, no access" );
 
 if( IsAccessible() && rIDLA.GetCurrentViewShell() && pWin )
-GetAccessibleMap().GetDocumentView();
+{
+try
+{
+GetAccessibleMap().GetDocumentView();
+}
+catch (uno::Exception const& e)
+{
+SAL_WARN("sw.a11y", "exception: " << e.Message);
+assert(!"SwViewShellImp::UpdateAccessible: unhandled exception");
+}
+}
 }
 
 void SwViewShellImp::DisposeAccessible(const SwFrame *pFrame,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2016-12-17 Thread Justin Luth
 sw/source/core/layout/frmtool.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 7382c06de7a2c78055279e1a1e7c377f490cccd1
Author: Justin Luth 
Date:   Sat Dec 17 09:11:25 2016 +0300

tdf#104613 fix logic error in code replacement: CalcLineSpace

since m_bBorderDist is currently always true, this will not have
any real impact, but it should be ,m_bBorderDist instead of ,true.

Fixes commit 5d9d0f3c979732ade57b9c4c4960dd030ffdc9f9
   there is a function for that: CalcLineSpace(xx, bEvenIfNoLine)

Change-Id: Iee4b2e5b112be02573c71ed583ffa8c91457689a
Reviewed-on: https://gerrit.libreoffice.org/32112
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/32117
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 6c47053..09ffe34 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1955,28 +1955,28 @@ long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) 
const
 
 void SwBorderAttrs::CalcTopLine_()
 {
-m_nTopLine = m_rBox.CalcLineSpace( SvxBoxItemLine::TOP, 
/*bEvenIfNoLine*/true );
+m_nTopLine = m_rBox.CalcLineSpace( SvxBoxItemLine::TOP, 
/*bEvenIfNoLine*/m_bBorderDist );
 m_nTopLine = m_nTopLine + 
m_rShadow.CalcShadowSpace(SvxShadowItemSide::TOP);
 m_bTopLine = false;
 }
 
 void SwBorderAttrs::CalcBottomLine_()
 {
-m_nBottomLine = m_rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM, true );
+m_nBottomLine = m_rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM, 
m_bBorderDist );
 m_nBottomLine = m_nBottomLine + 
m_rShadow.CalcShadowSpace(SvxShadowItemSide::BOTTOM);
 m_bBottomLine = false;
 }
 
 void SwBorderAttrs::CalcLeftLine_()
 {
-m_nLeftLine = m_rBox.CalcLineSpace( SvxBoxItemLine::LEFT, true );
+m_nLeftLine = m_rBox.CalcLineSpace( SvxBoxItemLine::LEFT, m_bBorderDist );
 m_nLeftLine = m_nLeftLine + 
m_rShadow.CalcShadowSpace(SvxShadowItemSide::LEFT);
 m_bLeftLine = false;
 }
 
 void SwBorderAttrs::CalcRightLine_()
 {
-m_nRightLine = m_rBox.CalcLineSpace(SvxBoxItemLine::RIGHT, true );
+m_nRightLine = m_rBox.CalcLineSpace( SvxBoxItemLine::RIGHT, m_bBorderDist 
);
 m_nRightLine = m_nRightLine + 
m_rShadow.CalcShadowSpace(SvxShadowItemSide::RIGHT);
 m_bRightLine = false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2016-12-16 Thread Caolán McNamara
 sw/source/core/draw/dcontact.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f4b7650ecd46e5404b35dccfb8b7d3b0a385d633
Author: Caolán McNamara 
Date:   Thu Dec 15 21:21:38 2016 +

coverity#1397207 Dereference before null check

Change-Id: I2578d59e98a2b1b040d9284b0ad0f68fd331d0df
(cherry picked from commit 7a9d5485a815af26c63790e3165477c68e164117)

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index ded98a2..a62d9a4 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -415,9 +415,9 @@ const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( 
const SdrObject* _pSdr
 
 const SwAnchoredObject* pRetAnchoredObj = nullptr;
 
-if ( _pSdrObj && dynamic_cast( _pSdrObj) !=  
nullptr )
+if (const SwVirtFlyDrawObj* pFlyDrawObj = dynamic_cast(_pSdrObj))
 {
-pRetAnchoredObj = static_cast(_pSdrObj)->GetFlyFrame();
+pRetAnchoredObj = pFlyDrawObj->GetFlyFrame();
 }
 
 return pRetAnchoredObj;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2016-12-14 Thread Julien Nabet
 sw/source/core/doc/tblcpy.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 39e6f271d1b0e91456d2dc5f14fad7191ce6bb13
Author: Julien Nabet 
Date:   Wed Dec 14 21:43:10 2016 +0100

tdf#104554: fix iterator calculus

and avoid unexpected behaviours when pasting columns between tables

regression from:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=f0fa43ea99ac7564f2cc7ca1d997831808056b68

http://www.cplusplus.com/reference/list/list/insert/
and http://www.cplusplus.com/reference/deque/deque/insert/
helped me to understand my mistake

Change-Id: I6ff6b84a90c7ea8db1e4d7c2d12dd191f96141ae
Reviewed-on: https://gerrit.libreoffice.org/32020
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 
(cherry picked from commit 14a0d26d6ae0ee59a685c254ec235fea81636475)
Reviewed-on: https://gerrit.libreoffice.org/32028

diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index b5bc61c..c6d42e6 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -336,7 +336,6 @@ namespace
 if( rpCol == maCols.end() || *rpCol > rnBorder )
 {
 rpCol = maCols.insert( rpCol, rnBorder );
---rpCol;
 incColSpan( nLine, rnCol );
 }
 aInfo.mnColSpan = rnCol - nLeftCol;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2016-12-14 Thread Jan Holesovsky
 sw/source/uibase/uno/unotxdoc.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit ee0461902fe7ffa23351f5359ae9a3dc8c0bcf0a
Author: Jan Holesovsky 
Date:   Wed Dec 14 13:56:42 2016 +0100

Disable the auto-completion for LibreOfficeKit for good.

The editeng-like approach is terribly annoying when typing, particularly in
bullet lists.

Change-Id: I66175579f801fa028273d9680d7383d8eb37bf28
Reviewed-on: https://gerrit.libreoffice.org/32009
Tested-by: Jenkins 
Reviewed-by: Andras Timar 

diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 8ea5fdf..e649784 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -33,6 +33,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -3302,6 +3304,10 @@ void SwXTextDocument::initializeForTiledRendering(const 
css::uno::SequenceGetSwFlags().bAutoCompleteWords = 
false;
 }
 
 void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

2016-12-13 Thread Justin Luth
 sw/source/uibase/shells/textsh1.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 496fe48b64e6b395e525852e8494f67f67406148
Author: Justin Luth 
Date:   Tue Dec 13 14:23:24 2016 +0300

tdf#104545 SID_PARA_DLG: use passed PaM instead of GetCursor

reverts portion of commit 7d9bb549d498d6beed2c4050c402d09643febdfa

Change-Id: Ia683c3bac786a9c2c3b13732b1cb49389074beda
Reviewed-on: https://gerrit.libreoffice.org/31953
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 
(cherry picked from commit e08355618e13a83210b746c67bb9f7a0b425e1dc)
Reviewed-on: https://gerrit.libreoffice.org/31982
Reviewed-by: Justin Luth 

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index e6bbef6..89c493b 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -940,7 +940,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
 0);
 
 // get also the list level indent values merged as LR-SPACE item, 
if needed.
-rWrtSh.GetCurAttr( aCoreSet, true );
+rWrtSh.GetPaMAttr( pPaM, aCoreSet, true );
 
 // create needed items for XPropertyList entries from the 
DrawModel so that
 // the Area TabPage can access them
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >