[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-10-15 Thread Libreoffice Gerrit user
 sw/source/uibase/docvw/edtwin2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2c93c692bcea531b1a02b3d200a44f3c4584455a
Author: Michael Stahl 
AuthorDate: Thu Oct 11 10:57:05 2018 +0200
Commit: Miklos Vajna 
CommitDate: Mon Oct 15 09:40:31 2018 +0200

sw: fix invalid cast in SwEditWin::RequestHelp()

This results in a garbage OUString.

Change-Id: I03b8030a812d7016df5c29f1341749fbdedf1729
Reviewed-on: https://gerrit.libreoffice.org/61652
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit bf0276f0b53c01ac434fef88e97f6b0dd4c41787)
Reviewed-on: https://gerrit.libreoffice.org/61674
Reviewed-by: Thorsten Behrens 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/docvw/edtwin2.cxx 
b/sw/source/uibase/docvw/edtwin2.cxx
index e279bc2d2d98..3ee49222b88f 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -170,7 +170,7 @@ void SwEditWin::RequestHelp(const HelpEvent )
 
 case IsAttrAtPos::InetAttr:
 {
-sText = static_cast(aContentAtPos.aFnd.pAttr)->GetValue();
+sText = static_cast(aContentAtPos.aFnd.pAttr)->GetValue();
 sText = URIHelper::removePassword( sText,
 
INetURLObject::EncodeMechanism::WasEncoded,

INetURLObject::DecodeMechanism::Unambiguous);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-09-21 Thread Libreoffice Gerrit user
 sw/source/filter/ww8/ww8par3.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c5d9823a5726d06aaa816360bc0d48e7ae882085
Author: Caolán McNamara 
AuthorDate: Thu Sep 20 16:03:24 2018 +0100
Commit: Michael Stahl 
CommitDate: Fri Sep 21 10:28:39 2018 +0200

ofz#10523 guard aginst 0 pF->nLCode

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

diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index c00f7f09a916..d61e4d1ab319 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -88,7 +88,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* 
pF, OUString& rStr )
 {
 WW8FormulaEditBox aFormula(*this);
 
-if (rStr[pF->nLCode-1]==0x01) {
+if (pF->nLCode && rStr[pF->nLCode-1]==0x01) {
 ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_EDIT);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-09-11 Thread Libreoffice Gerrit user
 sw/source/core/crsr/crstrvl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 6a8b0d2a9c52b0706772c3b05edc4da995211dc6
Author: Juergen Funk 
AuthorDate: Fri Sep 7 10:25:16 2018 +0200
Commit: Michael Stahl 
CommitDate: Tue Sep 11 12:15:41 2018 +0200

sw: tdf#119742 fix null pointer in SetCursorInHdFt

In SwWrtShell::ChangeHeaderOrFooter the ChgPageDesc destroys the frames
of the header, that's why GetCurrFrame returns null later.

Change-Id: I26915237c8b455a5b8ad0bbd5c2de38537dfef08
Reviewed-on: https://gerrit.libreoffice.org/60130
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 
(cherry picked from commit 77d075facaf4fc8954666ad541ed14f75d964fba)
Reviewed-on: https://gerrit.libreoffice.org/60302
Tested-by: Jenkins

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 798793238edd..f4df137fe82d 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -200,7 +200,8 @@ bool SwCursorShell::SetCursorInHdFt( size_t nDescNo, bool 
bInHeader )
 if( SIZE_MAX == nDescNo )
 {
 // take the current one
-const SwPageFrame* pPage = GetCurrFrame()->FindPageFrame();
+const SwContentFrame *pCurrFrame = GetCurrFrame();
+const SwPageFrame* pPage = (pCurrFrame == nullptr) ? nullptr : 
pCurrFrame->FindPageFrame();
 if( pPage && pMyDoc->ContainsPageDesc(
 pPage->GetPageDesc(), ) )
 pDesc = pPage->GetPageDesc();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-08-30 Thread Libreoffice Gerrit user
 sw/source/uibase/app/apphdl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 55498d196c31c098b02da5f4638fc0ca155b60b4
Author: Ilhan Yesil 
AuthorDate: Tue Aug 28 18:39:57 2018 +0200
Commit: Michael Stahl 
CommitDate: Thu Aug 30 17:26:30 2018 +0200

tdf#117823 Save mail merge config item in new view

The config object is now saved in a newly created document.

Regression from commit id 00fa85e701d4a8984cfa3a24c9b7a3963b031fa0.

Change-Id: I2265de1dd69038d447e28dfda2e85c7cf89903c6
Reviewed-on: https://gerrit.libreoffice.org/59728
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 9d847ff825c1c94286e8ab864a88fc5375d9341c)
Reviewed-on: https://gerrit.libreoffice.org/59803

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 467112e58956..2752aace725d 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -518,6 +518,7 @@ IMPL_LINK_NOARG( SwMailMergeWizardExecutor, EndDialogHdl, 
Dialog&, void )
 std::shared_ptr xMMConfig = 
m_pView->GetMailMergeConfigItem();
 if (pNewView)
 {
+pNewView->SetMailMergeConfigItem(xMMConfig);
 m_pView = pNewView;
 xMMConfig->DocumentReloaded();
 //new source view!
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-08-20 Thread Libreoffice Gerrit user
 sw/source/filter/ww8/ww8scan.cxx |   39 +--
 sw/source/filter/ww8/ww8scan.hxx |2 +-
 2 files changed, 14 insertions(+), 27 deletions(-)

New commits:
commit c57538b2b3c9ffbb206590089c0a5ca69056304d
Author: Caolán McNamara 
AuthorDate: Wed Aug 15 17:28:41 2018 +0100
Commit: Michael Stahl 
CommitDate: Mon Aug 20 12:14:32 2018 +0200

ofz#9917 use a WW8SprmIter to find the sprm

extend WW8SprmIter to support the needed paramater match feature and
drop the custom WW8PLCFx_SEPX::HasSprm logic

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

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 6a90d83e8e3c..6e5e863767c7 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -917,7 +917,7 @@ void WW8SprmIter::UpdateMyMembers()
 }
 }
 
-SprmResult WW8SprmIter::FindSprm(sal_uInt16 nId)
+SprmResult WW8SprmIter::FindSprm(sal_uInt16 nId, sal_uInt8* pNextByteMatch)
 {
 while (GetSprms())
 {
@@ -925,7 +925,13 @@ SprmResult WW8SprmIter::FindSprm(sal_uInt16 nId)
 {
 sal_uInt16 nFixedLen =  mrSprmParser.DistanceToData(nId);
 sal_uInt16 nL = mrSprmParser.GetSprmSize(nId, GetSprms(), 
GetRemLen());
-return SprmResult(GetAktParams(), nL - nFixedLen); // SPRM found!
+SprmResult aRet(GetAktParams(), nL - nFixedLen); // SPRM found!
+// typically pNextByteMatch is nullptr and we just return the 
first match
+if (!pNextByteMatch)
+return aRet;
+// very occasionally we want one with a specific following byte
+if (aRet.nRemainingData >= 1 && *aRet.pSprm == *pNextByteMatch)
+return aRet;
 }
 advance();
 }
@@ -3769,32 +3775,13 @@ bool WW8PLCFx_SEPX::Find4Sprms(sal_uInt16 
nId1,sal_uInt16 nId2,sal_uInt16 nId3,s
 
 SprmResult WW8PLCFx_SEPX::HasSprm( sal_uInt16 nId, sal_uInt8 n2nd ) const
 {
-if (!pPLCF)
-return SprmResult();
-
-sal_uInt8* pSp = pSprms.get();
-size_t i = 0;
-while (i + maSprmParser.MinSprmLen() <= nSprmSiz)
+SprmResult aRet;
+if (pPLCF)
 {
-// Sprm found?
-const sal_uInt16 nAktId = maSprmParser.GetSprmId(pSp);
-const sal_uInt16 x = maSprmParser.GetSprmSize(nAktId, pSp, nSprmSiz - 
i);
-if (nAktId == nId)
-{
-sal_uInt16 nFixedLen =  maSprmParser.DistanceToData(nId);
-const sal_uInt8 *pRet = pSp + nFixedLen;
-SprmResult aRet(pRet, x - nFixedLen);
-if (aRet.nRemainingData >= 1 && *aRet.pSprm == n2nd)
-{
-return aRet;
-}
-}
-// increment pointer so that it points to next SPRM
-i += x;
-pSp += x;
+WW8SprmIter aIter(pSprms.get(), nSprmSiz, maSprmParser);
+aRet = aIter.FindSprm(nId, );
 }
-
-return SprmResult();   // Sprm not found
+return aRet;
 }
 
 WW8PLCFx_SubDoc::WW8PLCFx_SubDoc(SvStream* pSt, const WW8Fib& rFib,
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index ff2246155899..841067d2a241 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -281,7 +281,7 @@ public:
 explicit WW8SprmIter(const sal_uInt8* pSprms_, sal_Int32 nLen_,
 const wwSprmParser );
 void  SetSprms(const sal_uInt8* pSprms_, sal_Int32 nLen_);
-SprmResult FindSprm(sal_uInt16 nId);
+SprmResult FindSprm(sal_uInt16 nId, sal_uInt8* pNextByteMatch = nullptr);
 void  advance();
 const sal_uInt8* GetSprms() const
 { return ( pSprms && (0 < nRemLen) ) ? pSprms : nullptr; }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-08-15 Thread Libreoffice Gerrit user
 sw/source/core/unocore/unochart.cxx |   47 +---
 1 file changed, 17 insertions(+), 30 deletions(-)

New commits:
commit eadf6f4551416430b58efc42a5756556df0a237d
Author: Caolán McNamara 
AuthorDate: Wed Aug 15 14:13:02 2018 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 15 17:46:19 2018 +0200

outer loop unrelated to inner loop

since original checkin of...

commit 9cddf9da7fb256418e1bc3b4719abb55e3b0604c
Date:   Tue May 22 15:33:44 2007 +

INTEGRATION: CWS chart2mst3 (1.1.2); FILE ADDED
...
2006/12/13 12:31:03 tl 1.1.2.38: #i71244# update charts in writer

where I think this LockUnlockAllCharts chart2 loop was modelled on
the previous chart[1] styles loop of e.g. DoUpdateAllCharts which
loop over tables.

chart2 objects are unrelated to these tables, so remove the outer
loop, which then means the ofz#9689 ofz#9856 ofz9874 crashes that
made me look at it will get fixed

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

diff --git a/sw/source/core/unocore/unochart.cxx 
b/sw/source/core/unocore/unochart.cxx
index 1d06634c6950..0ffe06c6df05 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -117,43 +117,30 @@ void SwChartLockController_Helper::LockUnlockAllCharts( 
bool bLock )
 if (!pDoc)
 return;
 
-const SwFrameFormats& rTableFormats = *pDoc->GetTableFrameFormats();
-for( size_t n = 0; n < rTableFormats.size(); ++n )
+uno::Reference< frame::XModel > xRes;
+SwOLENode *pONd;
+SwStartNode *pStNd;
+SwNodeIndex aIdx( 
*pDoc->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+while( nullptr != (pStNd = aIdx.GetNode().GetStartNode()) )
 {
-SwTable* pTmpTable;
-const SwTableNode* pTableNd;
-const SwFrameFormat* pFormat = rTableFormats[ n ];
-
-if( nullptr != ( pTmpTable = SwTable::FindTable( pFormat ) ) &&
-nullptr != ( pTableNd = pTmpTable->GetTableNode() ) &&
-pTableNd->GetNodes().IsDocNodes() )
+++aIdx;
+if (nullptr != ( pONd = aIdx.GetNode().GetOLENode() ) &&
+!pONd->GetChartTableName().isEmpty() /* is chart object? */)
 {
-uno::Reference< frame::XModel > xRes;
-SwOLENode *pONd;
-SwStartNode *pStNd;
-SwNodeIndex aIdx( 
*pDoc->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
-while( nullptr != (pStNd = aIdx.GetNode().GetStartNode()) )
+uno::Reference < embed::XEmbeddedObject > xIP = 
pONd->GetOLEObj().GetOleRef();
+if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
 {
-++aIdx;
-if (nullptr != ( pONd = aIdx.GetNode().GetOLENode() ) &&
-!pONd->GetChartTableName().isEmpty() /* is chart object? 
*/)
+xRes.set( xIP->getComponent(), uno::UNO_QUERY );
+if (xRes.is())
 {
-uno::Reference < embed::XEmbeddedObject > xIP = 
pONd->GetOLEObj().GetOleRef();
-if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
-{
-xRes.set( xIP->getComponent(), uno::UNO_QUERY );
-if (xRes.is())
-{
-if (bLock)
-xRes->lockControllers();
-else
-xRes->unlockControllers();
-}
-}
+if (bLock)
+xRes->lockControllers();
+else
+xRes->unlockControllers();
 }
-aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
 }
 }
+aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
 }
 
 bIsLocked = bLock;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-08-15 Thread Libreoffice Gerrit user
 sw/source/core/unocore/unotbl.cxx |   22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 30be37d5919024992a81603494a81f0fb1d8f775
Author: Caolán McNamara 
AuthorDate: Tue Aug 14 12:30:36 2018 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 15 17:30:54 2018 +0200

tdf#117127 crash on inspecting value describing a table

since...

commit f86d0413f7cedf096b285c2eb6698653dd99c21e
Date:   Mon Mar 30 01:26:21 2015 +0200

SwXCellRange:: and SwXTextTable::getDataArray() do the same

which used to have more checks than its replacement

Change-Id: Id931882ef7c749ffa18ef3474e3e661ba8614ab0
Reviewed-on: https://gerrit.libreoffice.org/58978
Tested-by: Jenkins
Tested-by: Xisco Faulí 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index de6adc6a2130..d16986b65248 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -2316,7 +2316,7 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL 
SwXTextTable::getDataArray()
 std::pair const 
RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this));
 uno::Reference const xAllRange(
 getCellRangeByPosition(0, 0, RowsAndColumns.second-1, 
RowsAndColumns.first-1),
-uno::UNO_QUERY);
+uno::UNO_QUERY_THROW);
 return xAllRange->getDataArray();
 }
 
@@ -2326,7 +2326,7 @@ void SAL_CALL SwXTextTable::setDataArray(const 
uno::Sequence< uno::Sequence< uno
 std::pair const 
RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this));
 uno::Reference const xAllRange(
 getCellRangeByPosition(0, 0, RowsAndColumns.second-1, 
RowsAndColumns.first-1),
-uno::UNO_QUERY);
+uno::UNO_QUERY_THROW);
 return xAllRange->setDataArray(rArray);
 }
 
@@ -2336,7 +2336,7 @@ uno::Sequence< uno::Sequence< double > > 
SwXTextTable::getData()
 std::pair const 
RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this));
 uno::Reference const xAllRange(
 getCellRangeByPosition(0, 0, RowsAndColumns.second-1, 
RowsAndColumns.first-1),
-uno::UNO_QUERY);
+uno::UNO_QUERY_THROW);
 static_cast(xAllRange.get())->SetLabels(
 m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel);
 return xAllRange->getData();
@@ -2348,7 +2348,7 @@ void SwXTextTable::setData(const uno::Sequence< 
uno::Sequence< double > >& rData
 std::pair const 
RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this));
 uno::Reference const xAllRange(
 getCellRangeByPosition(0, 0, RowsAndColumns.second-1, 
RowsAndColumns.first-1),
-uno::UNO_QUERY);
+uno::UNO_QUERY_THROW);
 static_cast(xAllRange.get())->SetLabels(
 m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel);
 xAllRange->setData(rData);
@@ -2362,7 +2362,7 @@ uno::Sequence SwXTextTable::getRowDescriptions()
 std::pair const 
RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this));
 uno::Reference const xAllRange(
 getCellRangeByPosition(0, 0, RowsAndColumns.second-1, 
RowsAndColumns.first-1),
-uno::UNO_QUERY);
+uno::UNO_QUERY_THROW);
 static_cast(xAllRange.get())->SetLabels(
 m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel);
 return xAllRange->getRowDescriptions();
@@ -2374,7 +2374,7 @@ void SwXTextTable::setRowDescriptions(const 
uno::Sequence& rRowDesc)
 std::pair const 
RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this));
 uno::Reference const xAllRange(
 getCellRangeByPosition(0, 0, RowsAndColumns.second-1, 
RowsAndColumns.first-1),
-uno::UNO_QUERY);
+uno::UNO_QUERY_THROW);
 static_cast(xAllRange.get())->SetLabels(
 m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel);
 xAllRange->setRowDescriptions(rRowDesc);
@@ -2386,7 +2386,7 @@ uno::Sequence 
SwXTextTable::getColumnDescriptions()
 std::pair const 
RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this));
 uno::Reference const xAllRange(
 getCellRangeByPosition(0, 0, RowsAndColumns.second-1, 
RowsAndColumns.first-1),
-uno::UNO_QUERY);
+uno::UNO_QUERY_THROW);
 static_cast(xAllRange.get())->SetLabels(
 m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel);
 return xAllRange->getColumnDescriptions();
@@ -2398,7 +2398,7 @@ void SwXTextTable::setColumnDescriptions(const 
uno::Sequence& rColumnD
 std::pair const 
RowsAndColumns(SwXTextTable::Impl::ThrowIfComplex(*this));
 uno::Reference const xAllRange(
 getCellRangeByPosition(0, 0, RowsAndColumns.second-1, 
RowsAndColumns.first-1),
-uno::UNO_QUERY);
+uno::UNO_QUERY_THROW);
 static_cast(xAllRange.get())->SetLabels(
 m_pImpl->m_bFirstRowAsLabel, m_pImpl->m_bFirstColumnAsLabel);
 return 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-08-08 Thread Libreoffice Gerrit user
 sw/source/core/layout/frmtool.cxx |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 8d14c10639a4ff161e31156348c9928498df71ef
Author: Michael Stahl 
AuthorDate: Mon Aug 6 19:03:22 2018 +0200
Commit: Thorsten Behrens 
CommitDate: Wed Aug 8 12:18:02 2018 +0200

sw: fix ignored frames in AppendAllObjs()

The problem is that AppendAllObjs() doesn't check if MakeFrames()
actually created frames, it just assumes success.

If there are frames anchored in frames, then it could go through
the circular_buffer, find a dependent frame before its anchor frame,
unsuccessfully call MakeFrames(), then call MakeFrames() on the anchor
frame, and then the vector is empty.

A surprising aspect is that push_back on a boost::circular_buffer will
silently pop the first element if it's already "full".  Possibly this
is what caused tdf#112447.

1. insert section
2. in paragraph in section, insert frame
3. repeat 2
4. drag anchor of frame 1 into body of frame 2
5. edit section, click hide
6. edit section, un-click hide
7. only one frame is displayed

(regression from 575e222a1742918be052f2b716ddf57ce0008404 and/or
 ce2fce9a41729774689080c8b5552b60c2e6ee2d)

Change-Id: Ie782252ac388524dfb083f655320a50e95239b24
Reviewed-on: https://gerrit.libreoffice.org/58676
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 31e66bd07c1082bb375be8aaf7835f019351d9bb)
Reviewed-on: https://gerrit.libreoffice.org/58680
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 936c4e02dc40..3f9267d73422 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1098,18 +1098,24 @@ void AppendAllObjs(const SwFrameFormats* pTable, const 
SwFrame* pSib)
 if(!isConnected)
 {
 pFormat->MakeFrames();
-pFirstRequeued = nullptr;
+
pFormat->CallSwClientNotify(sw::GetObjectConnectedHint(isConnected, pRoot));
 }
-else
+// do this *before* push_back! the circular_buffer can be "full"!
+vFormatsToConnect.pop_front();
+if (!isConnected)
 {
 if(pFirstRequeued == pFormat)
 // If nothing happens anymore we can stop.
 break;
 if(!pFirstRequeued)
 pFirstRequeued = pFormat;
+assert(!vFormatsToConnect.full());
 vFormatsToConnect.push_back(pFormat);
 }
-vFormatsToConnect.pop_front();
+else
+{
+pFirstRequeued = nullptr;
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-08-07 Thread Libreoffice Gerrit user
 sw/source/filter/ww8/ww8par.cxx  |1 +
 sw/source/filter/ww8/ww8par.hxx  |2 +-
 sw/source/filter/ww8/ww8par5.cxx |6 ++
 3 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 71aae473c9c3cf15f75e2722afc7153a3af76d44
Author: Caolán McNamara 
AuthorDate: Thu Aug 2 21:18:15 2018 +0100
Commit: Michael Stahl 
CommitDate: Tue Aug 7 17:24:59 2018 +0200

forcepoint#69 ditch any unclosed m_pPosAfterTOC before dropping cursor

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

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 5aebb80ee873..1d0213f58347 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5410,6 +5410,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const 
*pGloss)
 
 SAL_WARN_IF(m_pTableEndPaM, "sw.ww8", "document ended without table 
ending");
 m_pTableEndPaM.reset();  //ensure this is deleted before pPaM
+m_pPosAfterTOC.reset();
 mpCursor.reset();
 m_pPaM = nullptr;
 m_pLastAnchorPos.reset();//ensure this is deleted before UpdatePageDescs
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 11e53a5a9a05..c0a4b44c4c93 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1355,7 +1355,7 @@ private:
 // Indicate that current on loading a hyperlink, which is inside a TOC; 
Managed by Read_F_Hyperlink() and End_Field()
 bool m_bLoadingTOXHyperlink;
 // a document position recorded the after-position of TOC section, managed 
by Read_F_TOX() and End_Field()
-SwPaM* m_pPosAfterTOC;
+std::unique_ptr m_pPosAfterTOC;
 // used for some dropcap tweaking
 SwTextNode* m_pPreviousNode;
 
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index e6dee54d5d50..c599aa59e2d1 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -567,8 +567,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
 if (m_pPosAfterTOC)
 {
 *m_pPaM = *m_pPosAfterTOC;
-delete m_pPosAfterTOC;
-m_pPosAfterTOC = nullptr;
+m_pPosAfterTOC.reset();
 }
 }
 }
@@ -3382,8 +3381,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, 
OUString& rStr )
 
 //The TOC field representation contents should be inserted into TOC 
section, but not after TOC section.
 //So we need update the document position when loading TOC representation 
and after loading TOC;
-delete m_pPosAfterTOC;
-m_pPosAfterTOC = new SwPaM(*m_pPaM, m_pPaM);
+m_pPosAfterTOC.reset(new SwPaM(*m_pPaM, m_pPaM));
 (*m_pPaM).Move(fnMoveBackward);
 SwPaM aRegion(*m_pPaM, m_pPaM);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-08-02 Thread Libreoffice Gerrit user
 sw/source/ui/fldui/DropDownFieldDialog.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f36207cb94ef8245bdb62651bae9ca290a4744df
Author: Caolán McNamara 
AuthorDate: Mon Jul 30 11:12:04 2018 +0100
Commit: Christian Lohmaier 
CommitDate: Thu Aug 2 13:52:17 2018 +0200

Resolves: tdf#118965 fix input list edit button

regression since...

commit 7d5245848c28f5786258476cd7aa2a4523645de3
Date:   Fri Sep 15 17:39:48 2017 +0200

tdf#79877 revert to old behavior when clicking on input fields.

Change-Id: I5e67a8f0c8d2599c139d3d728298c30f4a31c8d1
Reviewed-on: https://gerrit.libreoffice.org/58317
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx 
b/sw/source/ui/fldui/DropDownFieldDialog.cxx
index f72d9a696cec..664b7d8c57da 100644
--- a/sw/source/ui/fldui/DropDownFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx
@@ -131,7 +131,7 @@ bool sw::DropDownFieldDialog::NextButtonPressed() const
 IMPL_LINK_NOARG(sw::DropDownFieldDialog, EditHdl, Button*, void)
 {
 m_pPressedButton = m_pEditPB;
-EndDialog(RET_OK);
+EndDialog(RET_YES);
 }
 
 IMPL_LINK_NOARG(sw::DropDownFieldDialog, PrevHdl, Button*, void)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-07-25 Thread Libreoffice Gerrit user
 sw/source/filter/html/swhtml.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 46b6a3b0e244596f8eed88584efacae3debd1917
Author: Caolán McNamara 
AuthorDate: Wed Jul 18 16:13:19 2018 +0100
Commit: Eike Rathke 
CommitDate: Thu Jul 26 00:23:18 2018 +0200

tdf#118579 ignore body in body instead of flagging as an error

Change-Id: Ie6626a320a5264aea004f7c57244643798703de8
Reviewed-on: https://gerrit.libreoffice.org/57654
Tested-by: Jenkins
Tested-by: Xisco Faulí 
Reviewed-by: Eike Rathke 

diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 01f15c570a30..07ea0ca88639 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -1248,9 +1248,7 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken )
 switch( nToken )
 {
 case HtmlTokenId::BODY_ON:
-if (m_bBodySeen)
-eState = SvParserState::Error;
-else
+if (!m_bBodySeen)
 {
 m_bBodySeen = true;
 if( !m_aStyleSource.isEmpty() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-07-25 Thread Libreoffice Gerrit user
 sw/source/core/layout/layact.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit b26718458b46e23e2d644b1580565d30f3df8871
Author: Caolán McNamara 
AuthorDate: Tue Jul 17 16:26:35 2018 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 25 18:27:05 2018 +0200

Resolves: tdf#118545 restore to historic logic

revert

commit 9eff9e699e17cc5a8a25895bd28dc8e4ceb8071e
Date:   Wed Aug 10 09:47:40 2016 +0200

Don't re-check valid SwPageDescs when layouting

and then revert

commit 60d34e1c840d2c317bb7d0a5b14f4602c22b3fcc
Date:   Wed Nov 12 20:33:06 2014 +

coverity#735517 Logically dead code

its possible that this was the original intent, maybe

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

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 7b23377bb48d..b813f8cbe284 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -444,10 +444,8 @@ void SwLayAction::InternalAction(OutputDevice* 
pRenderContext)
 sal_uInt16 nPercentPageNum = 0;
 while ( (pPage && !IsInterrupt()) || m_nCheckPageNum != USHRT_MAX )
 {
-// nCheckPageNum is set to USHRT_MAX in this code path after we have
-// checked the SwPageDescs and set tos the minimal changed SwPageDesc.
-// We don't need to check the SwPageDescs without changes.
-if ( (m_nCheckPageNum != USHRT_MAX) && (!pPage || 
pPage->GetPhyPageNum() >= m_nCheckPageNum) )
+if ( !pPage && m_nCheckPageNum != USHRT_MAX &&
+ (!pPage || pPage->GetPhyPageNum() >= m_nCheckPageNum) )
 {
 if ( !pPage || pPage->GetPhyPageNum() > m_nCheckPageNum )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-07-18 Thread Libreoffice Gerrit user
 sw/source/uibase/uno/unotxdoc.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cc124e47db9e0302b5a07ace961b061b8dca15ad
Author: Thorsten Behrens 
AuthorDate: Thu Jul 12 00:11:30 2018 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 18 17:24:45 2018 +0200

Make setPagePrintSettings() accept IsLandscape again

Regression from 80c35d97b9b3b60a091aae77de0ffef38cbf531a - invert
the check for boost::optional validity.

Change-Id: If4e041e1fe349c1fcb2c74b2e5780bf57300486f
Reviewed-on: https://gerrit.libreoffice.org/57309
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 0853b05b1fabb231a7d57d811c5a06ee542d3295)
Reviewed-on: https://gerrit.libreoffice.org/57315
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index a6431a67975f..9bc330c09532 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1130,7 +1130,7 @@ void SwXTextDocument::setPagePrintSettings(const 
Sequence< beans::PropertyValue
 else if(sName == "IsLandscape")
 {
 auto b = o3tl::tryAccess(rVal);
-bException = bool(b);
+bException = !b;
 if (b)
 {
 aData.SetLandscape(*b);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-07-10 Thread Mike Kaganski
 sw/source/ui/fldui/flddb.cxx |   19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 3ca2651cae0477a0bfc72e2c2a17ba0433881092
Author: Mike Kaganski 
Date:   Wed Jul 4 01:33:38 2018 +1000

tdf#116543: don't forget to commit registrations in DB field editor

This avoids revoking the uncommitted registration when any mailmerge
doc is destroyed.

Also don't forget to pass relevant SwDocShell when registering data
source. This allows to register the data source for current document.

Change-Id: Id89be82b0120661700e9fee6a075e5877d76e3b0
Reviewed-on: https://gerrit.libreoffice.org/56891
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-on: https://gerrit.libreoffice.org/57008
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index cb2763b475a6..4c823118ae3a 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "flddb.hxx"
 #include 
@@ -78,6 +79,14 @@ SwFieldDBPage::~SwFieldDBPage()
 
 void SwFieldDBPage::dispose()
 {
+SwWrtShell* pSh = GetWrtShell();
+if (!pSh)
+pSh = ::GetActiveWrtShell();
+// This would cleanup in the case of cancelled dialog
+SwDBManager* pDbManager = pSh->GetDoc()->GetDBManager();
+if (pDbManager)
+pDbManager->RevokeLastRegistrations();
+
 m_pTypeLB.clear();
 m_pDatabaseTLB.clear();
 m_pAddDBPB.clear();
@@ -208,6 +217,10 @@ bool SwFieldDBPage::FillItemSet(SfxItemSet* )
 if(!pSh)
 pSh = ::GetActiveWrtShell();
 
+SwDBManager* pDbManager = pSh->GetDoc()->GetDBManager();
+if (pDbManager)
+pDbManager->CommitLastRegistrations();
+
 if (aData.sDataSource.isEmpty())
 aData = pSh->GetDBData();
 
@@ -477,7 +490,11 @@ IMPL_LINK( SwFieldDBPage, TreeSelectHdl, SvTreeListBox *, 
pBox, void )
 
 IMPL_LINK_NOARG(SwFieldDBPage, AddDBHdl, Button*, void)
 {
-OUString sNewDB = SwDBManager::LoadAndRegisterDataSource(this);
+SwWrtShell* pSh = GetWrtShell();
+if (!pSh)
+pSh = ::GetActiveWrtShell();
+
+OUString sNewDB = SwDBManager::LoadAndRegisterDataSource(this, 
pSh->GetDoc()->GetDocShell());
 if(!sNewDB.isEmpty())
 {
 m_pDatabaseTLB->AddDataSource(sNewDB);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-07-10 Thread Caolán McNamara
 sw/source/core/unocore/unoportenum.cxx |   25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 6725491ce8ef2e41feb9b732ad7ac366ba545ca9
Author: Caolán McNamara 
Date:   Tue Jun 26 12:15:19 2018 +0100

forcepoint#48 null deref

Change-Id: I790fc6dafc0d8c9783b9dddc266b313af2a046d7
Reviewed-on: https://gerrit.libreoffice.org/56463
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index d40ec5bf5135..043fb179d0fa 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -288,22 +288,25 @@ namespace
 ::sw::mark::AnnotationMark* const pAnnotationMark =
 dynamic_cast< ::sw::mark::AnnotationMark* >(ppMark->get());
 
-if ( pAnnotationMark == nullptr )
-{
+if (!pAnnotationMark)
 continue;
-}
 
 const SwPosition& rStartPos = pAnnotationMark->GetMarkStart();
-if ( rStartPos.nNode == nOwnNode )
+if (rStartPos.nNode != nOwnNode)
+continue;
+
+const SwFormatField* pAnnotationFormatField = 
pAnnotationMark->GetAnnotationFormatField();
+if (!pAnnotationFormatField)
 {
-const SwFormatField* pAnnotationFormatField = 
pAnnotationMark->GetAnnotationFormatField();
-assert(pAnnotationFormatField != nullptr);
-rAnnotationStartArr.insert(
-std::make_shared(
-SwXTextField::CreateXTextField(,
-pAnnotationFormatField),
-rStartPos));
+SAL_WARN("sw.core", "missing annotation format field");
+continue;
 }
+
+rAnnotationStartArr.insert(
+std::make_shared(
+SwXTextField::CreateXTextField(,
+pAnnotationFormatField),
+rStartPos));
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-07-10 Thread Michael Stahl
 sw/source/uibase/uiview/view2.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3bd5ff846120f65d21a8dfdf9cf5253669c68554
Author: Michael Stahl 
Date:   Mon Jul 9 17:57:13 2018 +0200

tdf#118578 sw: allow inserting only TextDocument

There are 3 sw document services: TextDocument, WebDocument and
GlobalDocument.

The current logic in SwView::InsertDoc() and
SwView_Impl::StartDocumentInserter() is to request a filter with the
same document service as the existing target document, so you can insert
only a GlobalDocument into a GlobalDocument, which doesn't make much
sense.

As it happens there are 2 different HTML import filters: "HTML" and
"HTML (StarWriter)", the latter using the TextDocument service.

So just hard-code to allow TextDocument regardless of the target
document.

(regression from 805fd1ca343d6295b8114a24cc29bdac332f266d)

Change-Id: I7dc0dd4789fba8b61625ca8eae74a864aea383b0
Reviewed-on: https://gerrit.libreoffice.org/57193
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 572b298e636612416b8223ff6e6f2d26ab51a243)
Reviewed-on: https://gerrit.libreoffice.org/57223
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 4cb021a90f3c..2bcc735e0bbf 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2084,7 +2084,8 @@ long SwView::InsertDoc( sal_uInt16 nSlotId, const 
OUString& rFileName, const OUS
 else
 {
 m_pViewImpl->StartDocumentInserter(
-pDocSh->GetFactory().GetFactoryName(),
+// tdf#118578 allow inserting any Writer document except GlobalDoc
+SwDocShell::Factory().GetFactoryName(),
 LINK( this, SwView, DialogClosedHdl ),
 nSlotId
 );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-07-08 Thread Michael Stahl
 sw/source/uibase/utlui/content.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a900c91447897e725fc0cf674205eee633b326eb
Author: Michael Stahl 
Date:   Fri Jul 6 18:39:20 2018 +0200

tdf#115890 sw: fix invalid cast in SwContentTree::GetEntryAltText()

AccessibleListBoxEntry calls this for any entry.

This was always broken but now we have asserts to tell us about it.

Change-Id: I7094a1dfbffd359e0f536ca60cba2478e2a62464
Reviewed-on: https://gerrit.libreoffice.org/57086
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit 2986f4baa8bdef1f9ab9108240ea890075321be1)
Reviewed-on: https://gerrit.libreoffice.org/57152
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 9b59a912c722..9012fd86fbcf 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -902,7 +902,7 @@ Size SwContentTree::GetOptimalSize() const
 
 OUString SwContentTree::GetEntryAltText( SvTreeListEntry* pEntry ) const
 {
-if( pEntry == nullptr)
+if (pEntry == nullptr || !lcl_IsContent(pEntry))
 return OUString();
 
 assert(pEntry->GetUserData() == nullptr || 
dynamic_cast(static_cast(pEntry->GetUserData(;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-06-26 Thread Mike Kaganski
 sw/source/ui/frmdlg/cption.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9f836f9bcebba4f47d427cc3343ff59956dfa721
Author: Mike Kaganski 
Date:   Fri Jun 22 14:40:13 2018 +0200

tdf#118316: fix off-by-1 error (outline level is 0-based)

regression since commit 4730b23b1da929b802d527611e974ff1b1e6d6c5

Change-Id: I50627cde3a9a91189db61e19850768412b058064
Reviewed-on: https://gerrit.libreoffice.org/56295
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 28f45e406da9ca2c87d1e4285b0138c081125ec8)
Reviewed-on: https://gerrit.libreoffice.org/56308

diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index d8bc996a03ce..62e7e5942161 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -365,7 +365,7 @@ void SwCaptionDialog::DrawSample()
 if( pFieldType && pFieldType->GetOutlineLvl() < MAXLEVEL )
 {
 SwNumberTree::tNumberVector aNumVector;
-aNumVector.insert(aNumVector.end(), 
pFieldType->GetOutlineLvl(), 1);
+aNumVector.insert(aNumVector.end(), 
pFieldType->GetOutlineLvl() + 1, 1);
 
 OUString sNumber( rSh.GetOutlineNumRule()->
 MakeNumString(aNumVector, false ));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-06-18 Thread Bjoern Michaelsen
 sw/source/core/layout/frmtool.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b1d679a1b06de087fe2a1af079e0c6c46473c0e3
Author: Bjoern Michaelsen 
Date:   Fri Jun 15 01:05:09 2018 +0200

tdf#117723: nullcheck the ContentAnchor before deref

Change-Id: I4043efc204c8e3af8463ecd325313c99a9d61128
Reviewed-on: https://gerrit.libreoffice.org/55839
Reviewed-by: Björn Michaelsen 
Tested-by: Björn Michaelsen 
(cherry picked from commit d8142da066b6ee80444694e0eb6b0da9375a89c7)
Reviewed-on: https://gerrit.libreoffice.org/55953
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 2276f7fa2b99..936c4e02dc40 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1080,8 +1080,9 @@ void AppendAllObjs(const SwFrameFormats* pTable, const 
SwFrame* pSib)
 // frames nor objects which are anchored to character bounds.
 if ((rAnch.GetAnchorId() != RndStdIds::FLY_AT_PAGE) && 
(rAnch.GetAnchorId() != RndStdIds::FLY_AS_CHAR))
 {
+auto pContentAnchor = rAnch.GetContentAnchor();
 // formats in header/footer have no dependencies
-
if(pFormat->GetDoc()->IsInHeaderFooter(rAnch.GetContentAnchor()->nNode))
+if(pContentAnchor && 
pFormat->GetDoc()->IsInHeaderFooter(pContentAnchor->nNode))
 pFormat->MakeFrames();
 else
 vFormatsToConnect.push_back(pFormat);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-06-11 Thread Noel Grandin
 sw/source/core/layout/trvlfrm.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 97cac82274698cc48b20d010983803e385264a85
Author: Noel Grandin 
Date:   Mon Jun 11 08:47:47 2018 +0200

tdf#102907 selection indicator missing on vertical text

regression from

commit 79800559268c636740fec69018b1f99f047c3f93
convert MT_ constants to scoped enum

The original code used bit-wise operations and some clever constant
values, which I did not convert correctly

Change-Id: I2fcd9e2584638d4a690773ef3f178415153b8b19
Reviewed-on: https://gerrit.libreoffice.org/55596
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
(cherry picked from commit 16b1d80070142e2ffecaba64b62dbe836daafb4f)
Reviewed-on: https://gerrit.libreoffice.org/55599

diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index 2b9cd10d..cb9093daeddf 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2245,7 +2245,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor )
 Sub( aRegion, aTmp );
 
 // The next statement means neither ruby nor rotate(90):
-if( MultiPortionType::RUBY != pEnd2Pos->nMultiType )
+if( MultiPortionType::RUBY != pEnd2Pos->nMultiType && 
MultiPortionType::ROT_90 != pEnd2Pos->nMultiType )
 {
 SwTwips nTmp = fnRectX.GetTop(pEnd2Pos->aLine);
 if( fnRectX.GetTop(aEndRect) != nTmp )
@@ -2340,7 +2340,9 @@ void SwRootFrame::CalcFrameRects(SwShellCursor )
 if( pStartFrame == pEndFrame )
 {
 bool bSameRotatedOrBidi = pSt2Pos && pEnd2Pos &&
-( MultiPortionType::BIDI == pSt2Pos->nMultiType ) &&
+( MultiPortionType::BIDI == pSt2Pos->nMultiType  ||
+  MultiPortionType::ROT_270 == pSt2Pos->nMultiType ||
+  MultiPortionType::ROT_90  == pSt2Pos->nMultiType ) &&
 pSt2Pos->aPortion == pEnd2Pos->aPortion;
 //case 1: (Same frame and same row)
 if( bSameRotatedOrBidi ||
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-06-07 Thread Caolán McNamara
 sw/source/uibase/dbui/dbmgr.cxx |   20 
 1 file changed, 20 insertions(+)

New commits:
commit 9ae93085c90bdd00bcbf796ab399154bb7ab9e39
Author: Caolán McNamara 
Date:   Wed Jun 6 12:59:58 2018 +0100

tdf#117824 switch embedded database storage away from doc on revoke

otherwise the database document still has the embedded storage
open when the attempt to remove the storage is made

Change-Id: Ie313923b969bdbc53b27b00e379ac20240ffb6e3
Reviewed-on: https://gerrit.libreoffice.org/55388
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit a432a2e481baffa77e6f25584efbfbb3b68bc9a6)
Reviewed-on: https://gerrit.libreoffice.org/55407
Reviewed-by: Mike Kaganski 

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 5132a0b75e3b..bb1bdf760efb 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -100,6 +100,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2915,11 +2916,30 @@ OUString SwDBManager::LoadAndRegisterDataSource(const 
OUString , const OUSt
 return LoadAndRegisterDataSource_Impl( DBConnURIType::UNKNOWN, nullptr, 
INetURLObject(rURI), nullptr, pDestDir, nullptr );
 }
 
+namespace
+{
+// tdf#117824 switch the embedded database away from using its current 
storage and point it to temporary storage
+// which allows the original storage to be deleted
+void switchEmbeddedDatabaseStorage(uno::Reference& 
rDatabaseContext, const OUString& rName)
+{
+uno::Reference 
xDS(rDatabaseContext->getByName(rName), uno::UNO_QUERY);
+if (!xDS)
+return;
+uno::Reference 
xStorageDoc(xDS->getDatabaseDocument(), uno::UNO_QUERY);
+if (!xStorageDoc)
+return;
+
xStorageDoc->switchToStorage(comphelper::OStorageHelper::GetTemporaryStorage());
+}
+}
+
 void SwDBManager::RevokeDataSource(const OUString& rName)
 {
 uno::Reference xDatabaseContext = 
sdb::DatabaseContext::create(comphelper::getProcessComponentContext());
 if (xDatabaseContext->hasByName(rName))
+{
+switchEmbeddedDatabaseStorage(xDatabaseContext, rName);
 xDatabaseContext->revokeObject(rName);
+}
 }
 
 void SwDBManager::LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, 
const SwDocShell& rDocShell)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-05-31 Thread Caolán McNamara
 sw/source/ui/fldui/fldvar.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a828a0fe795fb44e1daa0ece9c994973b3975fce
Author: Caolán McNamara 
Date:   Thu May 31 14:22:18 2018 +0100

Resolves: tdf#116268 use on/off data, not pos to determine which is which

Change-Id: I73127bc6ea78daaf1e79596067c1cdeb692e1566
Reviewed-on: https://gerrit.libreoffice.org/55134
Tested-by: Jenkins 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index cf3434c42e80..2594567d3c6e 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -531,7 +531,7 @@ void SwFieldVarPage::SubTypeHdl(ListBox const * pBox)
 if (IsFieldEdit() || pBox)// only when interacting via 
mouse
 m_pNameED->SetText(OUString());
 
-if (nSelPos != 0 && nSelPos != LISTBOX_ENTRY_NOTFOUND)
+if (nSelData != 0 && nSelData != SIZE_MAX)
 {
 bValue = true;  // SubType OFF - knows no Offset
 if (GetCurField() && IsFieldEdit())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-05-02 Thread Caolán McNamara
 sw/source/filter/xml/xmltexti.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit cd25a97bbadc0a5c1fd6b0e8603c8b6ebd051926
Author: Caolán McNamara 
Date:   Tue May 1 12:57:02 2018 +0100

set Referer on link mediadescriptor

to allow determining if the source document is from a trusted/untrusted
location

Change-Id: I780568652d2ef0cc8543c27ba26289277b5d9d0c
Reviewed-on: https://gerrit.libreoffice.org/53693
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/sw/source/filter/xml/xmltexti.cxx 
b/sw/source/filter/xml/xmltexti.cxx
index 78cab08507f0..33548de42f6c 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -570,16 +570,21 @@ uno::Reference< XPropertySet > 
SwXMLTextImportHelper::createAndInsertOOoLink(
 uno::Sequence< beans::PropertyValue > aMediaDescriptor( 1 );
 aMediaDescriptor[0].Name = "URL";
 aMediaDescriptor[0].Value <<= aURLObj.GetMainURL( 
INetURLObject::DecodeMechanism::NONE );
-if ( pDoc->GetDocShell() && pDoc->GetDocShell()->GetMedium() )
+
+if (SfxMedium* pMedium = pDoc->GetDocShell() ? 
pDoc->GetDocShell()->GetMedium() : nullptr)
 {
-uno::Reference< task::XInteractionHandler > xInteraction =
-
pDoc->GetDocShell()->GetMedium()->GetInteractionHandler();
+uno::Reference< task::XInteractionHandler > xInteraction = 
pMedium->GetInteractionHandler();
 if ( xInteraction.is() )
 {
 aMediaDescriptor.realloc( 2 );
 aMediaDescriptor[1].Name = "InteractionHandler";
 aMediaDescriptor[1].Value <<= xInteraction;
 }
+
+const auto nLen = aMediaDescriptor.getLength() + 1;
+aMediaDescriptor.realloc(nLen);
+aMediaDescriptor[nLen - 1].Name = "Referer";
+aMediaDescriptor[nLen - 1].Value <<= pMedium->GetName();
 }
 
 uno::Reference < embed::XEmbeddedObject > xObj(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-04-29 Thread Maxim Monastirsky
 sw/source/uibase/docvw/SidebarTxtControl.cxx |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

New commits:
commit 09fa7200d41403e8687dc639dfe74299da808d2b
Author: Maxim Monastirsky 
Date:   Sun Apr 29 11:04:08 2018 +0300

tdf#117311 Ctrl/Shift+Insert do not work in Writer comments

Change-Id: Ide4f3c57f67107995a90dff965a53324c052f715
Reviewed-on: https://gerrit.libreoffice.org/53619
Tested-by: Jenkins 
Reviewed-by: Maxim Monastirsky 
(cherry picked from commit 4f0598ebe9b65c8cdfcb59645d552e3e4d11fe03)
Reviewed-on: https://gerrit.libreoffice.org/53621
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx 
b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index e8540298706e..a101120a85cb 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -242,12 +242,9 @@ void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt 
)
 {
 mrSidebarWin.SwitchToFieldPos();
 }
-else if ( nKey == KEY_INSERT )
+else if ( rKeyCode.GetFullCode() == KEY_INSERT )
 {
-if ( !rKeyCode.IsMod1() && !rKeyCode.IsMod2() )
-{
-mrSidebarWin.ToggleInsMode();
-}
+mrSidebarWin.ToggleInsMode();
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-04-10 Thread Markus Mohrhard
 sw/source/ui/frmdlg/frmpage.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9d3444ffe5b0ec37ad99d6969179184abea21385
Author: Markus Mohrhard 
Date:   Sun Apr 8 12:43:13 2018 +0200

fix global-buffer-overflow found through UI testing on UBSAN jenkins job

Change-Id: Ie4d81561057bb4d67fe050ca7fb82861d5d207a2
Reviewed-on: https://gerrit.libreoffice.org/52587
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit c442ac8c20cfceb8c87e96c494dcd8372dc6e206)
Reviewed-on: https://gerrit.libreoffice.org/52609
Reviewed-by: Michael Stahl 

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index d2ab2ce96c8d..a69f8c59d6d8 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -782,7 +782,7 @@ void SwFramePage::setOptimalFrameWidth()
 { aHFrameMap, SAL_N_ELEMENTS(aHFrameMap) },
 { aHFlyHtmlMap, SAL_N_ELEMENTS(aHFlyHtmlMap) },
 { aVFrameMap, SAL_N_ELEMENTS(aVFrameMap) },
-{ aVFlyHtmlMap, SAL_N_ELEMENTS(aVFrameMap) },
+{ aVFlyHtmlMap, SAL_N_ELEMENTS(aVFlyHtmlMap) },
 { aHParaMap, SAL_N_ELEMENTS(aHParaMap) },
 { aHParaHtmlMap, SAL_N_ELEMENTS(aHParaHtmlMap) },
 { aHParaHtmlAbsMap, SAL_N_ELEMENTS(aHParaHtmlAbsMap) },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-04-10 Thread Caolán McNamara
 sw/source/ui/index/cnttab.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7d95ef515c604bf67e68fd4824aa0073d8a76d07
Author: Caolán McNamara 
Date:   Mon Apr 9 14:16:40 2018 +0100

Related: tdf#77919 GetPosPixel() is relative to parent, not grandparent

so the tooltip rectangle is wrong and doesn't shown under mutter

we could use pCtrl->OutputToScreenPixel(Point(0, 0)) here too

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

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index ac3b7fc411d0..bd3693404b76 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -3477,7 +3477,7 @@ bool SwTokenWindow::CreateQuickHelp(Control const * pCtrl,
 (ToxAuthorityField) rToken.nAuthorityField);
 }
 
-Point aPos = OutputToScreenPixel(pCtrl->GetPosPixel());
+Point aPos = 
m_pCtrlParentWin->OutputToScreenPixel(pCtrl->GetPosPixel());
 tools::Rectangle aItemRect( aPos, pCtrl->GetSizePixel() );
 if ( rToken.eTokenType != TOKEN_TAB_STOP )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-04-09 Thread Matteo Casalin
 sw/source/core/tox/tox.cxx |   33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

New commits:
commit c6e8460a5b47fa6fa971dde2a89e80662b6e97ae
Author: Matteo Casalin 
Date:   Sun Jan 14 19:12:30 2018 +0100

Return correct length for Authority token

Regression from f4fd558ac9d61fe06aa0f56d829916ef9e5ee7b9
Take the chance to calculate token prefix just once.

Change-Id: I19ce5cb037198cb918e79c760a92b285f9b725f1
(cherry picked from commit 34b98af8e5a4e568d8316700bea1ce604d825ce8)
Reviewed-on: https://gerrit.libreoffice.org/52621
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index ed4716579063..c86b4c9efc50 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -745,30 +745,29 @@ static FormTokenType lcl_GetTokenType(const OUString & 
sToken,
 {
 static struct
 {
-OUString sNm;
-sal_uInt16 nOffset;
-FormTokenType eToken;
+OUString sTokenStart;
+sal_Int16 nTokenLength;
+FormTokenType eTokenType;
 } const aTokenArr[] = {
-{ SwForm::GetFormTab(), 1, TOKEN_TAB_STOP },
-{ SwForm::GetFormPageNums(),1, TOKEN_PAGE_NUMS },
-{ SwForm::GetFormLinkStt(), 1, TOKEN_LINK_START },
-{ SwForm::GetFormLinkEnd(), 1, TOKEN_LINK_END },
-{ SwForm::GetFormEntryNum(),1, TOKEN_ENTRY_NO },
-{ SwForm::GetFormEntryText(),1, TOKEN_ENTRY_TEXT },
-{ SwForm::GetFormChapterMark(), 1, TOKEN_CHAPTER_INFO },
-{ SwForm::GetFormText(),1, TOKEN_TEXT },
-{ SwForm::GetFormEntry(),   1, TOKEN_ENTRY },
-{ SwForm::GetFormAuth(),3, TOKEN_AUTHORITY }
+{ SwForm::GetFormTab().copy(0, 2), 3, TOKEN_TAB_STOP },
+{ SwForm::GetFormPageNums().copy(0, 2),3, TOKEN_PAGE_NUMS },
+{ SwForm::GetFormLinkStt().copy(0, 3), 4, TOKEN_LINK_START },
+{ SwForm::GetFormLinkEnd().copy(0, 3), 4, TOKEN_LINK_END },
+{ SwForm::GetFormEntryNum().copy(0, 3),4, TOKEN_ENTRY_NO },
+{ SwForm::GetFormEntryText().copy(0, 3),   4, TOKEN_ENTRY_TEXT },
+{ SwForm::GetFormChapterMark().copy(0, 2), 3, TOKEN_CHAPTER_INFO },
+{ SwForm::GetFormText().copy(0, 2),3, TOKEN_TEXT },
+{ SwForm::GetFormEntry().copy(0, 2),   3, TOKEN_ENTRY },
+{ SwForm::GetFormAuth().copy(0, 2),5, TOKEN_AUTHORITY }
 };
 
 for(const auto & i : aTokenArr)
 {
-const sal_Int32 nLen(i.sNm.getLength());
-if( sToken.startsWith( i.sNm.copy(0, nLen - i.nOffset) ))
+if( sToken.startsWith( i.sTokenStart ) )
 {
 if (pTokenLen)
-*pTokenLen = nLen;
-return i.eToken;
+*pTokenLen = i.nTokenLength;
+return i.eTokenType;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-04-08 Thread Julien Nabet
 sw/source/uibase/uno/unodispatch.cxx |   15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 1e80227ff76896a2bb6243acff19a49567bb2387
Author: Julien Nabet 
Date:   Sun Apr 8 09:58:11 2018 +0200

Fix regressions from d727476cff29382a34103b137542e15e1aeeb4b9

Calls to statusChanged may call addStatusListener or removeStatusListener
so copy m_aStatusListenerVector on stack and iterate on the copy

Thank you Michael for having pointed these

Change-Id: I8399db84874d7f68e24c57891a9ab408e7ebef78
Reviewed-on: https://gerrit.libreoffice.org/52579
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
(cherry picked from commit 8fced3ec9ff6f55a6e0b939183cf33b6c3c4a1db)
Reviewed-on: https://gerrit.libreoffice.org/52584
Reviewed-by: Michael Stahl 

diff --git a/sw/source/uibase/uno/unodispatch.cxx 
b/sw/source/uibase/uno/unodispatch.cxx
index fb6c66b38442..acb2496b4b81 100644
--- a/sw/source/uibase/uno/unodispatch.cxx
+++ b/sw/source/uibase/uno/unodispatch.cxx
@@ -257,7 +257,10 @@ void SwXDispatch::dispatch(const util::URL& aURL,
 aEvent.State <<= aDescriptor.createPropertyValueSequence();
 aEvent.IsEnabled = !rData.sDataSource.isEmpty();
 
-for ( auto & status : m_aStatusListenerVector )
+// calls to statusChanged may call addStatusListener or 
removeStatusListener
+// so copy m_aStatusListenerVector on stack
+auto copyStatusListenerVector = m_aStatusListenerVector;
+for (auto & status : copyStatusListenerVector)
 {
 if(status.aURL.Complete == cURLDocumentDataSource)
 {
@@ -348,7 +351,10 @@ void SwXDispatch::selectionChanged( const 
lang::EventObject&  )
 aEvent.IsEnabled = bEnable;
 aEvent.Source = *static_cast(this);
 
-for ( auto & status : m_aStatusListenerVector )
+// calls to statusChanged may call addStatusListener or 
removeStatusListener
+// so copy m_aStatusListenerVector on stack
+auto copyStatusListenerVector = m_aStatusListenerVector;
+for (auto & status : copyStatusListenerVector)
 {
 aEvent.FeatureURL = status.aURL;
 if (status.aURL.Complete != cURLDocumentDataSource)
@@ -367,7 +373,10 @@ void SwXDispatch::disposing( const lang::EventObject& 
rSource )
 
 lang::EventObject aObject;
 aObject.Source = static_cast(this);
-for ( auto & status : m_aStatusListenerVector )
+// calls to statusChanged may call addStatusListener or 
removeStatusListener
+// so copy m_aStatusListenerVector on stack
+auto copyStatusListenerVector = m_aStatusListenerVector;
+for (auto & status : copyStatusListenerVector)
 {
 status.xListener->disposing(aObject);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-07 Thread Michael Meeks
 sw/source/uibase/utlui/navipi.cxx |3 +++
 vcl/source/window/window.cxx  |   15 ++-
 2 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit f4082279078b59f0960d6683d0d039756354eccd
Author: Michael Meeks 
Date:   Thu Mar 29 17:18:42 2018 +0100

Avoid crash-reporter crash.


http://crashreport.libreoffice.org/stats/crash_details/f5086a7d-3c67-46e4-945e-e0882a604eee

Change-Id: Ic9ceed2e736a4ad1c155a31d3b2dc453e6a562aa
Reviewed-on: https://gerrit.libreoffice.org/52119
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Reviewed-on: https://gerrit.libreoffice.org/52516
Reviewed-by: Markus Mohrhard 

diff --git a/sw/source/uibase/utlui/navipi.cxx 
b/sw/source/uibase/utlui/navipi.cxx
index 47d261547c6e..d45454b5bec3 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -938,6 +938,9 @@ IMPL_LINK( SwNavigationPI, MenuSelectHdl, Menu *, pMenu, 
bool )
 
 void SwNavigationPI::UpdateListBox()
 {
+if (isDisposed())
+return;
+
 m_aDocListBox->SetUpdateMode(false);
 m_aDocListBox->Clear();
 SwView *pActView = GetCreateView();
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 4a6cab270591..135372d9a2c9 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2983,15 +2983,20 @@ void Window::Scroll( long nHorzScroll, long nVertScroll,
 
 void Window::Flush()
 {
-
-const tools::Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( 
mnOutWidth, mnOutHeight ) );
-mpWindowImpl->mpFrame->Flush( aWinRect );
+if (mpWindowImpl)
+{
+const tools::Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( 
mnOutWidth, mnOutHeight ) );
+mpWindowImpl->mpFrame->Flush( aWinRect );
+}
 }
 
 void Window::SetUpdateMode( bool bUpdate )
 {
-mpWindowImpl->mbNoUpdate = !bUpdate;
-CompatStateChanged( StateChangedType::UpdateMode );
+if (mpWindowImpl)
+{
+mpWindowImpl->mbNoUpdate = !bUpdate;
+CompatStateChanged( StateChangedType::UpdateMode );
+}
 }
 
 void Window::GrabFocus()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-04-05 Thread Caolán McNamara
 sw/source/filter/xml/xmltbli.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 7d99214d77ea0300cd149655bac70012a57278fe
Author: Caolán McNamara 
Date:   Mon Mar 26 08:45:21 2018 +0100

forcepoint #28 missing cell on abw import

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

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 7025f9efb2f1..2b56be867328 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -1591,8 +1592,10 @@ void SwXMLTableContext::InsertCell( const OUString& 
rStyleName,
 for( sal_uInt32 j=nRowSpan; j>0; --j )
 {
 const bool bCovered = i != nColSpan || j != nRowSpan;
-GetCell( nRowsReq-j, nColsReq-i )
-->Set( sStyleName, j, i, pStartNode,
+SwXMLTableCell_Impl *pCell = GetCell( nRowsReq-j, nColsReq-i );
+if (!pCell)
+throw css::lang::IndexOutOfBoundsException();
+pCell->Set( sStyleName, j, i, pStartNode,
pTable, bProtect, pFormula, bHasValue, bCovered, fValue,
pStringValue, i_rXmlId );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-04-05 Thread Caolán McNamara
 sw/source/core/frmedt/fews.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 2028cb82837393ac0ae283a41ac7187d203085dc
Author: Caolán McNamara 
Date:   Tue Mar 20 11:48:28 2018 +

Resolves: tdf#116474 bring hidden text property under undo control

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

diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 05f011bdb9de..e1e8f46c78ab 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -521,7 +521,8 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const 
OUString , con
 SvxCharHiddenItem aHidden(true, RES_CHRATR_HIDDEN);
 SfxItemSet aSet(GetDoc()->GetAttrPool(), {{aHidden.Which(), 
aHidden.Which()}});
 aSet.Put(aHidden);
-pTextNode->SetAttr(aSet, nIndex, nIndex + 1);
+SwPaM aPam(*pTextNode, nIndex, *pTextNode, nIndex + 1);
+SetAttrSet(aSet, SetAttrMode::DEFAULT, );
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-28 Thread Noel Grandin
 sw/source/core/layout/paintfrm.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4027823b5aff2bc0503ed63baae64a33d75c6ffb
Author: Noel Grandin 
Date:   Fri Mar 23 08:21:30 2018 +0200

tdf#116525 writer, no shadow around box

regression from

commit 2ccde70d60d3a5074faf49260e8fe0ccdb91ff26
teach redundantcast plugin about functional casts

because we are now passing the same variable as a both an in-parameter
and an out-parameter

Change-Id: I6454103fbc46530180cde5f725273e062eb2e25d
Reviewed-on: https://gerrit.libreoffice.org/51757
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
(cherry picked from commit 327fd7ea7209c9131ac86757fa8d5ca925eeccb5)
Reviewed-on: https://gerrit.libreoffice.org/52012
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 9d15ac754622..9ace67161ffc 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4945,7 +4945,7 @@ void PaintCharacterBorder(
 
 if( aShadow.GetLocation() != SvxShadowLocation::NONE )
 {
-lcl_PaintShadow( aAlignedRect, aAlignedRect, aShadow,
+lcl_PaintShadow( rPaintArea, aAlignedRect, aShadow,
  false, bTop, bBottom, bLeft, bRight, gProp);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-26 Thread Jim Raykowski
 sw/source/ui/table/tautofmt.cxx|   20 +++-
 sw/source/uibase/shells/basesh.cxx |7 ++-
 2 files changed, 9 insertions(+), 18 deletions(-)

New commits:
commit 30db8c9b1d9654e62c11657140fac24f0f52c547
Author: Jim Raykowski 
Date:   Tue Mar 13 19:04:44 2018 -0800

tdf#115573 Revert: tdf#107555 Apply 'Default Style' table style

...to newly inserted tables

Revert due to tables with autoformat style not able to persist direct
formatting.

Reviewed-on: https://gerrit.libreoffice.org/51253
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit eeb4a2ec37bf88b26a9f243cc5682e96c9e35df6)

Conflicts:
sw/source/ui/table/tautofmt.cxx

Change-Id: Ic33033235b9f5bfba15ec74fa88e94da2dc21b69
Reviewed-on: https://gerrit.libreoffice.org/51362
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 530b05850106..d9cb9f92d209 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -262,16 +262,6 @@ void SwAutoFormatDlg::UpdateChecks( const 
SwTableAutoFormat& rFormat, bool bEnab
 m_pBtnAlignment->Check( rFormat.IsJustify() );
 }
 
-static void lcl_SetProperties( SwTableAutoFormat* pTableAutoFormat, bool bVal )
-{
-pTableAutoFormat->SetFont( bVal );
-pTableAutoFormat->SetJustify( bVal );
-pTableAutoFormat->SetFrame( bVal );
-pTableAutoFormat->SetBackground( bVal );
-pTableAutoFormat->SetValueFormat( bVal );
-pTableAutoFormat->SetWidthHeight( bVal );
-}
-
 void SwAutoFormatDlg::FillAutoFormatOfIndex( SwTableAutoFormat*& rToFill ) 
const
 {
 if( 255 != nIndex )
@@ -284,8 +274,7 @@ void SwAutoFormatDlg::FillAutoFormatOfIndex( 
SwTableAutoFormat*& rToFill ) const
 else
 {
 delete rToFill;
-rToFill = new SwTableAutoFormat( SwViewShell::GetShellRes()->aStrNone 
);
-lcl_SetProperties( rToFill, false );
+rToFill = nullptr;
 }
 }
 
@@ -493,7 +482,12 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFormatHdl, ListBox&, 
void)
 nIndex = 255;
 
 SwTableAutoFormat aTmp( SwViewShell::GetShellRes()->aStrNone );
-lcl_SetProperties( , false );
+aTmp.SetFont( false );
+aTmp.SetJustify( false );
+aTmp.SetFrame( false );
+aTmp.SetBackground( false );
+aTmp.SetValueFormat( false );
+aTmp.SetWidthHeight( false );
 
 if( nOldIdx != nIndex )
 m_pWndPreview->NotifyChange( aTmp );
diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index b938767159bb..81df7be4048c 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -109,7 +109,6 @@
 
 #include 
 #include 
-#include 
 
 FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;
 
@@ -2688,7 +2687,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
 {
 // record before shell change
 _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, 
aTableName ) );
-if ( !aAutoName.isEmpty() && aAutoName != 
SwViewShell::GetShellRes()->aStrNone )
+if ( !aAutoName.isEmpty() )
 _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoName 
) );
 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, 
nCols ) );
 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows 
) );
@@ -2708,9 +2707,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
 if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) )
 rSh.GetTableFormat()->SetName( aTableName );
 
-if( pTAFormat == nullptr )
-rSh.SetTableStyle( SwStyleNameMapper::GetUIName( 
RES_POOLTABSTYLE_DEFAULT, OUString() ) );
-else
+if( pTAFormat != nullptr && aAutoName != 
SwStyleNameMapper::GetUIName( RES_POOLTABSTYLE_DEFAULT, OUString() ) )
 rSh.SetTableStyle( aAutoName );
 
 rSh.EndAllAction();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-21 Thread Caolán McNamara
 sw/source/core/frmedt/feshview.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit deb5db7bf6d45338c9b6f6f4a1d62fba168b7a85
Author: Caolán McNamara 
Date:   Wed Mar 21 14:08:49 2018 +

Resolves: tdf#116429 unwanted extra step in undo insert shape

Change-Id: I23065275baa60a09f2a3c15513e3f2b8160e2bf0
Reviewed-on: https://gerrit.libreoffice.org/51706
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 655d7340536ed2847d1da873b141d8776f791d12)
Reviewed-on: https://gerrit.libreoffice.org/51711

diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 8f6e3ef357b9..69b41e9a3c98 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -2005,6 +2005,14 @@ bool SwFEShell::ImpEndCreate()
 }
 else
 {
+if (rSdrObj.GetName().isEmpty())
+{
+bool bRestore = GetDoc()->GetIDocumentUndoRedo().DoesDrawUndo();
+GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false);
+rSdrObj.SetName(GetUniqueShapeName());
+GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(bRestore);
+}
+
 Point aRelNullPt;
 if( OBJ_CAPTION == nIdent )
 aRelNullPt = static_cast(rSdrObj).GetTailPos();
@@ -2060,9 +2068,6 @@ bool SwFEShell::ImpEndCreate()
 pAnch = pTmp;
 }
 
-if (rSdrObj.GetName().isEmpty())
-rSdrObj.SetName(GetUniqueShapeName());
-
 pContact->ConnectToLayout();
 
 // mark object at frame the object is inserted at.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-19 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par4.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d3a0ba91dbe0c517ed70fcb9d109b4d63d828fb4
Author: Caolán McNamara 
Date:   Sun Mar 18 12:51:07 2018 +

ofz#6999 check available data len

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

diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index 7ee6fac81825..8a6bcee8c420 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -477,8 +477,8 @@ void SwWW8ImplReader::Read_CRevisionMark(RedlineType_t 
eType,
 const sal_uInt8* pSprmCDttmRMark;
 if( nsRedlineType_t::REDLINE_FORMAT == eType )
 {
-pSprmCIbstRMark = pData+1;
-pSprmCDttmRMark = pData+3;
+pSprmCIbstRMark = nLen >= 3 ? pData+1 : nullptr;
+pSprmCDttmRMark = nLen >= 7 ? pData+3 : nullptr;
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-15 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par.cxx  |   17 ++---
 sw/source/filter/ww8/ww8par.hxx  |2 ++
 sw/source/filter/ww8/ww8par6.cxx |   34 +++---
 3 files changed, 35 insertions(+), 18 deletions(-)

New commits:
commit 69b4389bb41913cac3550cec8300207576df752f
Author: Caolán McNamara 
Date:   Thu Mar 15 17:26:36 2018 +

ofz#6827 Bad-cast

Change-Id: I856d781f122c21c02a0a8cd01369d49f50b8a555
Reviewed-on: https://gerrit.libreoffice.org/51364
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 e448087db0f3..5aebb80ee873 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3981,7 +3981,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP 
nTextLen, ManTypes nType)
 long nCpOfs = m_xPlcxMan->GetCpOfs(); // Offset for Header/Footer, Footnote
 
 WW8_CP nNext = m_xPlcxMan->Where();
-SwTextNode* pPreviousNode = nullptr;
+m_pPreviousNode = nullptr;
 sal_uInt8 nDropLines = 0;
 SwCharFormat* pNewSwCharFormat = nullptr;
 const SwCharFormat* pFormat = nullptr;
@@ -4013,7 +4013,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP 
nTextLen, ManTypes nType)
 
 // If the previous paragraph was a dropcap then do not
 // create a new txtnode and join the two paragraphs together
-if (bStartLine && !pPreviousNode) // Line end
+if (bStartLine && !m_pPreviousNode) // Line end
 {
 bool bSplit = true;
 if (m_bCareFirstParaEndInToc)
@@ -4037,10 +4037,10 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP 
nTextLen, ManTypes nType)
 }
 }
 
-if (pPreviousNode && bStartLine)
+if (m_pPreviousNode && bStartLine)
 {
 SwTextNode* pEndNd = m_pPaM->GetNode().GetTextNode();
-const sal_Int32 nDropCapLen = pPreviousNode->GetText().getLength();
+const sal_Int32 nDropCapLen = 
m_pPreviousNode->GetText().getLength();
 
 // Need to reset the font size and text position for the dropcap
 {
@@ -4067,12 +4067,12 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP 
nTextLen, ManTypes nType)
 SwPosition aStart(*pEndNd);
 m_xCtrlStck->NewAttr(aStart, aDrop);
 m_xCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_PARATR_DROP);
-pPreviousNode = nullptr;
+m_pPreviousNode = nullptr;
 }
 else if (m_bDropCap)
 {
 // If we have found a dropcap store the textnode
-pPreviousNode = m_pPaM->GetNode().GetTextNode();
+m_pPreviousNode = m_pPaM->GetNode().GetTextNode();
 
 SprmResult aDCS;
 if (m_bVer67)
@@ -4083,7 +4083,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP 
nTextLen, ManTypes nType)
 if (aDCS.pSprm && aDCS.nRemainingData >= 1)
 nDropLines = (*aDCS.pSprm) >> 3;
 else// There is no Drop Cap Specifier hence no dropcap
-pPreviousNode = nullptr;
+m_pPreviousNode = nullptr;
 
 SprmResult aDistance = m_xPlcxMan->GetPapPLCF()->HasSprm(0x842F);
 if (aDistance.pSprm && aDistance.nRemainingData >= 2)
@@ -4155,6 +4155,8 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP 
nTextLen, ManTypes nType)
 }
 }
 
+m_pPreviousNode = nullptr;
+
 if (m_pPaM->GetPoint()->nContent.GetIndex())
 AppendTextNode(*m_pPaM->GetPoint());
 
@@ -4271,6 +4273,7 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, 
SotStorage* pStorage,
 , m_nEmbeddedTOXLevel(0)
 , m_bLoadingTOXHyperlink(false)
 , m_pPosAfterTOC(nullptr)
+, m_pPreviousNode(nullptr)
 , m_bCareFirstParaEndInToc(false)
 , m_bCareLastParaEndInToc(false)
 , m_aTOXEndCps()
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 23e27a127713..11e53a5a9a05 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1356,6 +1356,8 @@ private:
 bool m_bLoadingTOXHyperlink;
 // a document position recorded the after-position of TOC section, managed 
by Read_F_TOX() and End_Field()
 SwPaM* m_pPosAfterTOC;
+// used for some dropcap tweaking
+SwTextNode* m_pPreviousNode;
 
 std::unique_ptr< SwPosition > m_pLastAnchorPos;
 
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 1d88c6fac4e8..249597032fa0 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2438,19 +2438,31 @@ bool SwWW8ImplReader::JoinNode(SwPaM , bool 
bStealAttr)
 if (bStealAttr)
 m_xCtrlStck->StealAttr(rPam.GetPoint()->nNode);
 
-if (m_pLastAnchorPos.get())
+if (m_pLastAnchorPos || m_pPreviousNode)
 {
-//If 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-15 Thread Caolán McNamara
 sw/source/core/crsr/crstrvl.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 31ea1ebe851eff9257c7fa4acc1e04aa1c9fd32f
Author: Caolán McNamara 
Date:   Wed Mar 14 15:03:08 2018 +

tdf#116397 get bounds of full field, not start of char inside field

The pSpecialPos is set for the StartTag case (#i75130#) and I surmise
we only care about it if we are a smarttag

Change-Id: Ic764bbf31a7784ab021f306f74a08473c8dd0a77
Reviewed-on: https://gerrit.libreoffice.org/51298
Tested-by: Jenkins 
Tested-by: Xisco Faulí 
Reviewed-by: Michael Meeks 

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index b65ba7d8dcf3..798793238edd 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1231,7 +1231,14 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 if ( pField )
 {
 if( pFieldRect && nullptr != ( pFrame = 
pTextNd->getLayoutFrame( GetLayout(),  ) ) )
+{
+//tdf#116397 now that we looking for the bounds of 
the field drop the SmartTag
+//index within field setting so we don't the 
bounds of the char within the field
+SwSpecialPos* pSpecialPos = 
aTmpState.m_pSpecialPos;
+aTmpState.m_pSpecialPos = nullptr;
 pFrame->GetCharRect( *pFieldRect, aPos,  
);
+aTmpState.m_pSpecialPos = pSpecialPos;
+}
 
 if( bSetCursor )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-13 Thread Caolán McNamara
 sw/source/core/crsr/crstrvl.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit b8345af80078f9eee29a391fe84b2506b37d24ea
Author: Caolán McNamara 
Date:   Mon Mar 12 14:29:48 2018 +

tdf#107094 backward heading search doesn't always work

regression from...

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

coverity#982189 Unchecked return value

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

Change-Id: I6f5ef42b38236ea5f70ddbccfa25a81f2f3e976c

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

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 8c1a0627f1d0..b65ba7d8dcf3 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -976,8 +976,9 @@ bool SwCursorShell::GotoPrevOutline()
 
 SwNode* pNd = &(pCursor->GetNode());
 SwOutlineNodes::size_type nPos;
-bool bRet = rNds.GetOutLineNds().Seek_Entry(pNd, );
-if (bRet && nPos)
+bool bRet = false;
+(void)rNds.GetOutLineNds().Seek_Entry(pNd, );
+if (nPos)
 {
 --nPos; // before
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-12 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par6.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 1a6dceee2ac1e334804de31fb6c387a41706b1c4
Author: Caolán McNamara 
Date:   Sun Mar 11 21:24:05 2018 +

ofz#6827 drop last anchor pos if it will be joined

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

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 3678807b542f..1d88c6fac4e8 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2438,6 +2438,21 @@ bool SwWW8ImplReader::JoinNode(SwPaM , bool 
bStealAttr)
 if (bStealAttr)
 m_xCtrlStck->StealAttr(rPam.GetPoint()->nNode);
 
+if (m_pLastAnchorPos.get())
+{
+//If the last anchor pos is here, then clear the anchor pos.
+//This "last anchor pos" is only used for fixing up the
+//positions of things anchored to page breaks and here
+//we are removing the last paragraph of a frame, so there
+//cannot be a page break at this point so we can
+//safely reset m_pLastAnchorPos to avoid any dangling
+//SwIndex's pointing into the deleted paragraph
+SwNodeIndex aLastAnchorPos(m_pLastAnchorPos->nNode);
+SwNodeIndex aToBeJoined(aPref, 1);
+if (aLastAnchorPos == aToBeJoined)
+m_pLastAnchorPos.reset();
+}
+
 pNode->JoinNext();
 
 bRet = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-07 Thread Gabor Kelemen
 sw/source/core/view/vprint.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 176356a3c802151967c26dc78f58244fcab9693a
Author: Gabor Kelemen 
Date:   Wed Feb 28 00:34:00 2018 +0100

tdf#91680 Reserve space in margin for comments only if there are comments

Change-Id: Ida08737cf537d85a94a72572e8cbc7e2bfad9333
Reviewed-on: https://gerrit.libreoffice.org/50505
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit c77e01d63b4bd4805c4a499e4e0cab917d0eb403)
Reviewed-on: https://gerrit.libreoffice.org/50803

diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index f88e26532356..dbd320ab718e 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -463,7 +463,12 @@ bool SwViewShell::PrintOrPDFExport(
 GDIMetaFile *pOrigRecorder(nullptr);
 GDIMetaFile *pMetaFile(nullptr);
 SwPostItMode nPostItMode = rPrintData.GetPrintPostIts();
-if (nPostItMode == SwPostItMode::InMargins)
+
+// tdf#91680 Reserve space in margin for comments only if there are 
comments
+const bool bHasPostItsToPrintInMargins = ( nPostItMode == 
SwPostItMode::InMargins ) &&
+sw_GetPostIts( 
()->getIDocumentFieldsAccess(), nullptr );
+
+if ( bHasPostItsToPrintInMargins )
 {
 //get and disable the existing recorder
 pOrigRecorder = pOutDev->GetConnectMetaFile();
@@ -534,8 +539,8 @@ bool SwViewShell::PrintOrPDFExport(
 
 SwPaintQueue::Repaint();
 
-SwPostItMgr *pPostItManager = (nPostItMode == SwPostItMode::InMargins) 
?
-pShell->GetPostItMgr() : nullptr;
+SwPostItMgr *pPostItManager = bHasPostItsToPrintInMargins ? 
pShell->GetPostItMgr() : nullptr;
+
 if (pPostItManager)
 {
 pPostItManager->CalcRects();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-06 Thread Michael Stahl
 sw/source/core/layout/sectfrm.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 45d59e98f4905475648d5e3ccacfa1279eb69a18
Author: Michael Stahl 
Date:   Tue Mar 6 09:51:46 2018 +0100

forcepoint #18 sw: fix condition for detecting section-in-table splits

The problem with the bugdoc is that SwFrame::GetNextSctLeaf() creates a
follow frame for a section in a table, and puts it outside the table,
below the page's body frame, while moving text frames that have the
mbInfTab flag set into the follow frame.

Checking for CanContainSplitSection() at this point doesn't make sense
to me: if it's not allowed to split the section, we can't just split it
anyway and put the follow outside the table.

Just removing it fails in testTableInNestedSection() but it turns out
that the problem there is that the mbInfTab flag is set on a outermost
SwTabFrame itself, so we need to check the parent's flag instead to
check if this frame needs to go into a cell.

(regression from 652556ec3e9218655a67b4c4de4e26fbe81855de)

Change-Id: I79663391fb1b2cb10f008676feb01a2607cfb33d
Reviewed-on: https://gerrit.libreoffice.org/50804
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit 054be0850ed7574473452ed965001504caf0b5e2)
Reviewed-on: https://gerrit.libreoffice.org/50821
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 2b6def165059..c0479dc53673 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1601,9 +1601,9 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType 
eMakePage )
 SwLayoutFrame *pLayLeaf;
 
 SwLayoutFrame* pCellLeaf = nullptr;
-if (IsInTab() && CanContainSplitSection(this))
+if (GetUpper()->IsInTab())
 {
-// We are in a table (which is itself not in a section), see if there
+// We are *in* a table (not an outermost SwTabFrame), see if there
 // is a follow cell frame created already.
 pCellLeaf = GetNextCellLeaf();
 if (!pCellLeaf)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-02 Thread Caolán McNamara
 sw/source/core/txtnode/fntcache.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 7a7116f2f570eb2d3bdc681a357046391efe9857
Author: Caolán McNamara 
Date:   Fri Mar 2 11:33:24 2018 +

forcepoint #17 nTextBreak is an index into pKernArray of len rInf.GetLen()

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

diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index fbb4ee5f4951..a7484a5ac4a7 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2347,9 +2347,8 @@ sal_Int32 SwFont::GetTextBreak( SwDrawTextInfo const & 
rInf, long nTextWidth )
 rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(),
 rInf.GetIdx(), rInf.GetLen() );
 long nCurrPos = pKernArray[nTextBreak] + nGridWidthAdd;
-while( nTextBreak < rInf.GetLen() && nTextWidth >= nCurrPos)
+while (++nTextBreak < rInf.GetLen() && nTextWidth >= nCurrPos)
 {
-nTextBreak++;
 nCurrPos = pKernArray[nTextBreak] + nGridWidthAdd * ( 
nTextBreak + 1 );
 }
 return nTextBreak + rInf.GetIdx();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-03-02 Thread Caolán McNamara
 sw/source/uibase/fldui/fldmgr.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 731aa4b4b93bea443c2a44a37fa6289aeb84a873
Author: Caolán McNamara 
Date:   Mon Feb 26 11:50:22 2018 +

Resolves: tdf#115951 wrong entry selected for numbering pos

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

diff --git a/sw/source/uibase/fldui/fldmgr.cxx 
b/sw/source/uibase/fldui/fldmgr.cxx
index e74c9ec12efc..687e4d84cd25 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -832,13 +832,14 @@ sal_uInt16 SwFieldMgr::GetFormatId(sal_uInt16 nTypeId, 
sal_uInt32 nFormatId) con
 {
 Sequence aTypes = 
m_xNumberingInfo->getSupportedNumberingTypes();
 const sal_Int16* pTypes = aTypes.getConstArray();
+sal_Int32 nOffset = aSwFields[nPos].nFormatLength;
 sal_Int32 nValidEntry = 0;
 for (sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
 {
 sal_Int16 nCurrent = pTypes[nType];
 if (nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
 {
-if (nValidEntry == ((sal_Int32)nFormatId))
+if (nValidEntry == static_cast(nFormatId) - 
nOffset)
 {
 nId = pTypes[nType];
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-27 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par.hxx  |2 +-
 sw/source/filter/ww8/ww8par2.cxx |   27 ---
 2 files changed, 25 insertions(+), 4 deletions(-)

New commits:
commit 0ad7f0ceb897963b5e2051bf86009e97fc81a300
Author: Caolán McNamara 
Date:   Tue Feb 27 16:17:04 2018 +

ofz#6576 check border param len

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

diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index b0af113b8194..23e27a127713 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1034,7 +1034,7 @@ struct WW8TabBandDesc
 void ReadDef(bool bVer67, const sal_uInt8* pS, short nLen);
 void ProcessDirection(const sal_uInt8* pParams);
 void ProcessSprmTSetBRC(int nBrcVer, const sal_uInt8* pParamsTSetBRC);
-void ProcessSprmTTableBorders(int nBrcVer, const sal_uInt8* pParams);
+void ProcessSprmTTableBorders(int nBrcVer, const sal_uInt8* pParams, 
sal_uInt16 nParamsLen);
 void ProcessSprmTDxaCol(const sal_uInt8* pParamsTDxaCol);
 void ProcessSprmTDelete(const sal_uInt8* pParamsTDelete);
 void ProcessSprmTInsert(const sal_uInt8* pParamsTInsert);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 43320f9efb2e..1ab43e948b90 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -1403,11 +1403,16 @@ void WW8TabBandDesc::ProcessSprmTSetBRC(int nBrcVer, 
const sal_uInt8* pParamsTSe
 
 }
 
-void WW8TabBandDesc::ProcessSprmTTableBorders(int nBrcVer, const sal_uInt8* 
pParams)
+void WW8TabBandDesc::ProcessSprmTTableBorders(int nBrcVer, const sal_uInt8* 
pParams, sal_uInt16 nParamsLen)
 {
 // sprmTTableBorders
 if( nBrcVer == 6 )
 {
+if (nParamsLen < sizeof(WW8_BRCVer6) * 6)
+{
+SAL_WARN("sw.ww8", "table border property is too short");
+return;
+}
 WW8_BRCVer6 const *pVer6 = reinterpret_cast(pParams);
 for (int i = 0; i < 6; ++i)
 aDefBrcs[i] = WW8_BRCVer9(WW8_BRC(pVer6[i]));
@@ -1415,11 +1420,23 @@ void WW8TabBandDesc::ProcessSprmTTableBorders(int 
nBrcVer, const sal_uInt8* pPar
 else if ( nBrcVer == 8 )
 {
 static_assert(sizeof (WW8_BRC) == 4, "this has to match the msword 
size");
+if (nParamsLen < sizeof(WW8_BRC) * 6)
+{
+SAL_WARN("sw.ww8", "table border property is too short");
+return;
+}
 for( int i = 0; i < 6; ++i )
 aDefBrcs[i] = WW8_BRCVer9(reinterpret_cast(pParams)[i]);
 }
 else
+{
+if (nParamsLen < sizeof( aDefBrcs ))
+{
+SAL_WARN("sw.ww8", "table border property is too short");
+return;
+}
 memcpy( aDefBrcs, pParams, sizeof( aDefBrcs ) );
+}
 }
 
 void WW8TabBandDesc::ProcessSprmTDxaCol(const sal_uInt8* pParamsTDxaCol)
@@ -1900,7 +1917,9 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP 
nStartCp) :
 const sal_uInt8* pShadeSprm = nullptr;
 const sal_uInt8* pNewShadeSprm = nullptr;
 const sal_uInt8* pTableBorders = nullptr;
+sal_uInt16 nTableBordersLen = 0;
 const sal_uInt8* pTableBorders90 = nullptr;
+sal_uInt16 nTableBorders90Len = 0;
 std::vector aTSetBrcs, aTSetBrc90s;
 WW8_TablePos *pTabPos  = nullptr;
 
@@ -1956,9 +1975,11 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP 
nStartCp) :
 break;
 case sprmTTableBorders:
 pTableBorders = pParams; // process at end
+nTableBordersLen = nLen;
 break;
 case sprmTTableBorders90:
 pTableBorders90 = pParams; // process at end
+nTableBorders90Len = nLen;
 break;
 case sprmTTableHeader:
 // tdf#105570
@@ -2049,10 +2070,10 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, 
WW8_CP nStartCp) :
 if (pNewShadeSprm)
 pNewBand->ReadNewShd(pNewShadeSprm, bOldVer);
 if (pTableBorders90)
-pNewBand->ProcessSprmTTableBorders(9, pTableBorders90);
+pNewBand->ProcessSprmTTableBorders(9, pTableBorders90, 
nTableBorders90Len);
 else if (pTableBorders)
 pNewBand->ProcessSprmTTableBorders(bOldVer ? 6 : 8,
-pTableBorders);
+pTableBorders, nTableBordersLen);
 std::vector::const_iterator iter;
 for (iter = aTSetBrcs.begin(); iter != aTSetBrcs.end(); ++iter)
 pNewBand->ProcessSprmTSetBRC(bOldVer ? 6 : 8, *iter);
___

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-27 Thread Armin Le Grand
 sw/source/core/doc/notxtfrm.cxx |   28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

New commits:
commit e4d0e964b5be550c88c8c6693beca483c2ca1a1b
Author: Armin Le Grand 
Date:   Mon Feb 26 15:13:06 2018 +0100

tdf#114076: Expand ClipRange to next PixelBound

Do this by going to basegfx::B2DRange, adding a
single pixel size and using floor/ceil to go to
full integer (as needed for pixels). Also need
to go back to basegfx::B2DPolyPolygon for the
creation of the needed MaskPrimitive2D.
The general problem is that Writer is scrolling
using blitting the unchanged parts, this forces
this part of the scroll to pixel coordinate steps,
while the ViewTransformation for paint nowadays has
a sub-pixel precision. This results in an offset
up to one pixel in radius. To solve this for now,
we need to expand to the next outer pixel bound.
Hopefully in the future we will someday be able to
stay on the full available precision, but this
will need a change in the repaint/scroll paradigm.

Change-Id: Idb4a596bc298d1b80aab6f36ad4204afe94d54f7
Reviewed-on: https://gerrit.libreoffice.org/50369
Tested-by: Jenkins 
Reviewed-by: Armin Le Grand 
(cherry picked from commit c1230cede19ae3633e51c7ca780cb34d9dbaa20f)
Reviewed-on: https://gerrit.libreoffice.org/50410
Tested-by: Samuel Mehrbrodt 

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 1ff730d580fb..4a5176d50e6b 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -79,6 +79,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -1022,8 +1023,33 @@ void paintGraphicUsingPrimitivesHelper(
 
 if(0 != aClip.count())
 {
+// tdf#114076: Expand ClipRange to next PixelBound
+// Do this by going to basegfx::B2DRange, adding a
+// single pixel size and using floor/ceil to go to
+// full integer (as needed for pixels). Also need
+// to go back to basegfx::B2DPolyPolygon for the
+// creation of the needed MaskPrimitive2D.
+// The general problem is that Writer is scrolling
+// using blitting the unchanged parts, this forces
+// this part of the scroll to pixel coordinate steps,
+// while the ViewTransformation for paint nowadays has
+// a sub-pixel precision. This results in an offset
+// up to one pixel in radius. To solve this for now,
+// we need to expand to the next outer pixel bound.
+// Hopefully in the future we will someday be able to
+// stay on the full available precision, but this
+// will need a change in the repaint/scroll paradigm.
+const basegfx::B2DRange aClipRange(aClip.getB2DRange());
+const basegfx::B2DVector 
aSinglePixelXY(rOutputDevice.GetInverseViewTransformation() * 
basegfx::B2DVector(1.0, 1.0));
+const basegfx::B2DRange aExpandedClipRange(
+floor(aClipRange.getMinX() - aSinglePixelXY.getX()),
+floor(aClipRange.getMinY() - aSinglePixelXY.getY()),
+ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()),
+ceil(aClipRange.getMaxY() + aSinglePixelXY.getY()));
+
 aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D(
-aClip,
+basegfx::B2DPolyPolygon(
+
basegfx::utils::createPolygonFromRect(aExpandedClipRange)),
 aContent);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-26 Thread Rico Tzschichholz
 sw/source/core/txtnode/txatbase.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 4c9f01179be9325486047f02d9978d18c592afaa
Author: Rico Tzschichholz 
Date:   Mon Feb 26 09:12:48 2018 +0100

sw: Fix build with older boost::optional like 1.54

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

diff --git a/sw/source/core/txtnode/txatbase.cxx 
b/sw/source/core/txtnode/txatbase.cxx
index 5c53ba78faca..82015ad57df2 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -100,21 +100,21 @@ void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
 pWhich = "character format";
 if (SwCharFormat* pCharFormat = GetCharFormat().GetCharFormat())
-oValue = "name: " + OUStringToOString(pCharFormat->GetName(), 
RTL_TEXTENCODING_UTF8);
+oValue = OString("name: " + 
OUStringToOString(pCharFormat->GetName(), RTL_TEXTENCODING_UTF8));
 break;
 }
 case RES_TXTATR_INETFMT:
 {
 pWhich = "inet format";
 const SwFormatINetFormat& rFormat = GetINetFormat();
-oValue = "url: " + rFormat.GetValue().toUtf8();
+oValue = OString("url: " + rFormat.GetValue().toUtf8());
 break;
 }
 case RES_TXTATR_CJK_RUBY:
 {
 pWhich = "ruby";
 const SwFormatRuby& rFormat = GetRuby();
-oValue = "rubytext: " + rFormat.GetText().toUtf8();
+oValue = OString("rubytext: " + rFormat.GetText().toUtf8());
 break;
 }
 case RES_TXTATR_META:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-21 Thread Ashod Nakashian
 sw/source/core/edit/edfcol.cxx |   29 +++--
 1 file changed, 23 insertions(+), 6 deletions(-)

New commits:
commit 292e9861adba78303eb43bbb84fae57f2bb5d15b
Author: Ashod Nakashian 
Date:   Wed Feb 14 07:35:44 2018 -0500

tdf#115569 don't sign or validate text in tables

Both undoing signatures and updating the metafield
are causing seg-faults. Clearly more work is needed
to support paragraph signing within tables, so
disabled for now.

Change-Id: Ia20c8b07069689b0e8b7d11a634a2a48ef1f0fa3
Reviewed-on: https://gerrit.libreoffice.org/49722
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 48fd0d45288bd8501f14c993cf613fe7743fabcd)
Reviewed-on: https://gerrit.libreoffice.org/50045

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index d679a4105acd..1ec98d87bb0f 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -480,12 +480,20 @@ bool lcl_DoUpdateParagraphSignatureField(SwDoc* pDoc,
 pDoc->GetIDocumentUndoRedo().DoUndo(isUndoEnabled);
 });
 
-uno::Reference xText(xField, uno::UNO_QUERY);
-const OUString curText = xText->getString();
-if (curText != sDisplayText)
+try
+{
+uno::Reference xText(xField, uno::UNO_QUERY);
+const OUString curText = xText->getString();
+if (curText != sDisplayText)
+{
+xText->setString(sDisplayText);
+return true;
+}
+}
+catch (const uno::Exception& ex)
 {
-xText->setString(sDisplayText);
-return true;
+// We failed; avoid crashing.
+SAL_WARN("sw.uno", "Failed to update paragraph signature: " << ex);
 }
 
 return false;
@@ -1734,6 +1742,10 @@ void SwEditShell::SignParagraph()
 if (!pNode)
 return;
 
+// Table text signing is not supported.
+if (pNode->FindTableNode() != nullptr)
+return;
+
 // 1. Get the text (without fields).
 const uno::Reference xParagraph = 
SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
 const OString utf8Text = lcl_getParagraphBodyText(xParagraph);
@@ -1808,7 +1820,12 @@ void 
SwEditShell::ValidateCurrentParagraphSignatures(bool updateDontRemove)
 SetParagraphSignatureValidation(bOldValidationFlag);
 });
 
-lcl_ValidateParagraphSignatures(GetDoc(), 
SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode), updateDontRemove);
+// Table text signing is not supported.
+if (pNode->FindTableNode() != nullptr)
+return;
+
+uno::Reference xParentText = 
SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
+lcl_ValidateParagraphSignatures(GetDoc(), xParentText, updateDontRemove);
 }
 
 void SwEditShell::ValidateAllParagraphSignatures(bool updateDontRemove)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-21 Thread ekuiitr
 sw/source/ui/envelp/label1.cxx |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit c4aa77b3a90102d6987e2eb31438c03d03e69157
Author: ekuiitr 
Date:   Tue Feb 6 22:49:11 2018 +0530

tdf#88802 disable arrow if database or table or field not selected

Change-Id: I5a29b58f6e8981ee3de73ccaa83ed04e4ee71dc6
Reviewed-on: https://gerrit.libreoffice.org/49314
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 
(cherry picked from commit 9cb54f6973406faec7fa46038cd9332c6d76db70)
Reviewed-on: https://gerrit.libreoffice.org/49948
Reviewed-by: Heiko Tietze 

diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index f4fa9edfdc72..3f8daf71e599 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -265,7 +265,11 @@ SwLabPage::SwLabPage(vcl::Window* pParent, const 
SfxItemSet& rSet)
 m_pAddrBox->SetClickHdl (LINK(this, SwLabPage, AddrHdl ));
 m_pDatabaseLB->SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl ));
 m_pTableLB->SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl ));
+m_pDBFieldLB->SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl ));
 m_pInsertBT->SetClickHdl (LINK(this, SwLabPage, FieldHdl));
+// Disable insert button first,
+// it'll be enabled if m_pDatabaseLB, m_pTableLB and m_pInsertBT are filled
+m_pInsertBT->Disable();
 m_pContButton->SetClickHdl (LINK(this, SwLabPage, PageHdl ));
 m_pSheetButton->SetClickHdl (LINK(this, SwLabPage, PageHdl ));
 m_pMakeBox->SetSelectHdl(LINK(this, SwLabPage, MakeHdl ));
@@ -342,7 +346,14 @@ IMPL_LINK( SwLabPage, DatabaseHdl, ListBox&, rListBox, 
void )
 if ( == m_pDatabaseLB)
 GetDBManager()->GetTableNames(m_pTableLB, sActDBName);
 
-GetDBManager()->GetColumnNames(m_pDBFieldLB, sActDBName, 
m_pTableLB->GetSelectedEntry());
+if ( == m_pDatabaseLB ||  == m_pTableLB)
+GetDBManager()->GetColumnNames(m_pDBFieldLB, sActDBName, 
m_pTableLB->GetSelectedEntry());
+
+if (!m_pDatabaseLB->GetSelectedEntry().isEmpty() && 
!m_pTableLB->GetSelectedEntry().isEmpty()
+&& !m_pDBFieldLB->GetSelectedEntry().isEmpty())
+m_pInsertBT->Enable(true);
+else
+m_pInsertBT->Enable(false);
 }
 
 IMPL_LINK_NOARG(SwLabPage, FieldHdl, Button*, void)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-19 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par.hxx  |2 +-
 sw/source/filter/ww8/ww8par2.cxx |9 -
 2 files changed, 5 insertions(+), 6 deletions(-)

New commits:
commit e853558b86a28e50bc64e95768843371fd99398d
Author: Caolán McNamara 
Date:   Sun Feb 18 21:16:06 2018 +

ofz#6450 use the rule name, not the rule itself

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

diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 968edc8eb73c..b0af113b8194 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -974,7 +974,7 @@ struct ANLDRuleMap
 OUString msOutlineNumRule;// WinWord 6 numbering, variant 1
 OUString msNumberingNumRule;  // WinWord 6 numbering, variant 2
 SwNumRule* GetNumRule(const SwDoc& rDoc, sal_uInt8 nNumType);
-void SetNumRule(const SwNumRule*, sal_uInt8 nNumType);
+void SetNumRule(const OUString& rNumRule, sal_uInt8 nNumType);
 };
 
 struct SprmReadInfo;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 54498ea7cc04..43320f9efb2e 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -1021,13 +1021,12 @@ SwNumRule *ANLDRuleMap::GetNumRule(const SwDoc& rDoc, 
sal_uInt8 nNumType)
 return rDoc.FindNumRulePtr(rNumRule);
 }
 
-void ANLDRuleMap::SetNumRule(const SwNumRule *pRule, sal_uInt8 nNumType)
+void ANLDRuleMap::SetNumRule(const OUString& rNumRule, sal_uInt8 nNumType)
 {
-OUString sNumRule = pRule ? pRule->GetName() : OUString();
 if (WW8_Numbering == nNumType)
-msNumberingNumRule = sNumRule;
+msNumberingNumRule = rNumRule;
 else
-msOutlineNumRule = sNumRule;
+msOutlineNumRule = rNumRule;
 }
 
 // StartAnl is called at the beginning of a row area that contains
@@ -1099,7 +1098,7 @@ void SwWW8ImplReader::StartAnl(const sal_uInt8* pSprm13)
 m_xCtrlStck->NewAttr(*m_pPaM->GetPoint(),
 SfxStringItem(RES_FLTR_NUMRULE, sNumRule));
 
-m_aANLDRules.SetNumRule(pNumRule, m_nWwNumType);
+m_aANLDRules.SetNumRule(sNumRule, m_nWwNumType);
 }
 
 // NextAnlLine() is called once for every row of a
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-15 Thread Miklos Vajna
 sw/source/core/layout/anchoredobject.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 819767ec0ed65992f3a8e02e0d57ea06e7f7a8a3
Author: Miklos Vajna 
Date:   Tue Feb 13 11:44:36 2018 +0100

sw: work around what seems to be a gcc-4.8 compiler bug

Thread 1 "soffice.bin" received signal SIGSEGV, Segmentation fault.
(anonymous namespace)::print_type<15> (ctx=..., 
info=0x7fff7f90, unknown_name=...) at 
../../../../../libstdc++-v3/src/c++11/debug.cc:641
641 ../../../../../libstdc++-v3/src/c++11/debug.cc: No such 
file or directory.
(gdb) up
#1  0x76abb008 in (anonymous namespace)::print_description 
(ctx=..., inst=...) at ../../../../../libstdc++-v3/src/c++11/debug.cc:817
817 in ../../../../../libstdc++-v3/src/c++11/debug.cc
(gdb)
#2  0x76abc7aa in (anonymous namespace)::print_description 
(param=..., ctx=...) at ../../../../../libstdc++-v3/src/c++11/debug.cc:835
835 in ../../../../../libstdc++-v3/src/c++11/debug.cc
(gdb)
#3  __gnu_debug::_Error_formatter::_M_error (this=0x7fff7af0) 
at ../../../../../libstdc++-v3/src/c++11/debug.cc:1061
1061in ../../../../../libstdc++-v3/src/c++11/debug.cc
(gdb)
#4  0x7fffca2b6313 in 
__gnu_debug::operator!=<__gnu_cxx::__normal_iterator > 
>, std::__debug::vector > 
> (__lhs=0x0, __rhs=invalid iterator) at 
/usr/include/c++/4.8/debug/safe_iterator.h:535
535   _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! 
__rhs._M_singular(),
(gdb)
#5  0x7fffca7f3de2 in SwAnchoredObject::UpdateObjInSortedList 
(this=0x1fa6fd8) at 
/git/libreoffice/master/sw/source/core/layout/anchoredobject.cxx:629
629 for (SwAnchoredObject* pAnchoredObj : 
*pObjs)

Given that valgrind doesn't point out anything and the old and the new code 
is
meant to be the same, my only guess is that the baseline gcc has some 
codegen
bug. This happens reasonably frequently, current bugdoc was a DOCX file
with 4 shapes anchored to the same paragraph, affecting only dbgutil
builds, it seems.

The tdf#115719 bugdoc is a reproducer for the crash.

(cherry picked from commit d34dcde1d0ccee2d78eea08185f12949f53ceae3)

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

diff --git a/sw/source/core/layout/anchoredobject.cxx 
b/sw/source/core/layout/anchoredobject.cxx
index 7562791510f5..a88d36eba220 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -625,8 +625,9 @@ void SwAnchoredObject::UpdateObjInSortedList()
 {
 const SwSortedObjs* pObjs = GetAnchorFrame()->GetDrawObjs();
 // determine start index
-for (SwAnchoredObject* pAnchoredObj : *pObjs)
+for (auto it = pObjs->begin(); it != pObjs->end(); ++it)
 {
+SwAnchoredObject* pAnchoredObj = *it;
 if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
 
pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence();
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-14 Thread Justin Luth
 sw/source/core/crsr/findtxt.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 5054456a6ed8ef7cd2a05fb09e1954eb02eaf0f7
Author: Justin Luth 
Date:   Wed Feb 7 20:17:31 2018 +0300

tdf#102374: regex allow ReplaceBackReferences for $ search

Since searching for $ spans nodes, and normal searches don't find it
(see bChkParaEnd and bChkEmptyPara), all "replace" items were
being used verbatim instead of being transformed. So, a similar
"just make it work" hack is needed here.

This patch allows proper replacement for \[\&$t] as well as
& and $0.

Change-Id: I59d760e27acacff679decdcb7fcf337f3b4a1fa1
Reviewed-on: https://gerrit.libreoffice.org/49387
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-by: Michael Stahl 
(cherry picked from commit 9bb369edf5471d0b29b5cea86d7203831f93d529)
Reviewed-on: https://gerrit.libreoffice.org/49679

diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index d63d66cbf41d..7d5842b883b4 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -758,15 +758,25 @@ OUString *ReplaceBackReferences( const 
i18nutil::SearchOptions2& rSearchOpt, SwP
 SearchAlgorithms2::REGEXP == rSearchOpt.AlgorithmType2 )
 {
 const SwContentNode* pTextNode = pPam->GetContentNode();
-if( pTextNode && pTextNode->IsTextNode() && pTextNode == 
pPam->GetContentNode( false ) )
+const bool bParaEnd = rSearchOpt.searchString == "$" || 
rSearchOpt.searchString == "^$" || rSearchOpt.searchString == "$^";
+if ( pTextNode && pTextNode->IsTextNode() && (bParaEnd || pTextNode == 
pPam->GetContentNode( false )) )
 {
 utl::TextSearch aSText( utl::TextSearch::UpgradeToSearchOptions2( 
rSearchOpt) );
-const OUString& rStr = pTextNode->GetTextNode()->GetText();
+OUString rStr = pTextNode->GetTextNode()->GetText();
 sal_Int32 nStart = pPam->Start()->nContent.GetIndex();
 sal_Int32 nEnd = pPam->End()->nContent.GetIndex();
 SearchResult aResult;
-if( aSText.SearchForward( rStr, , ,  ) )
+if ( bParaEnd || aSText.SearchForward( rStr, , , 
 ) )
 {
+if ( bParaEnd )
+{
+rStr = "\\n";
+aResult.subRegExpressions = 1;
+aResult.startOffset.realloc(1);
+aResult.endOffset.realloc(1);
+aResult.startOffset[0] = 0;
+aResult.endOffset[0] = rStr.getLength();
+}
 OUString aReplaceStr( rSearchOpt.replaceString );
 aSText.ReplaceBackReferences( aReplaceStr, rStr, aResult );
 pRet = new OUString( aReplaceStr );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-13 Thread Jim Raykowski
 sw/source/uibase/shells/basesh.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 55b37cc3ade30257858515b1a062ff9130488a5f
Author: Jim Raykowski 
Date:   Tue Feb 6 22:50:02 2018 -0900

tdf#108227 Set table style so it is highlighted in Sidebar styles list

Change-Id: I930085839c9ab7297e492c1463b54d41c087361c
Reviewed-on: https://gerrit.libreoffice.org/49338
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit d1b13f486eacc60c9b71ec9f1b29cde2f4504d4e)
Reviewed-on: https://gerrit.libreoffice.org/49658
Reviewed-by: Katarina Behrens 

diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index 9d907536b750..b938767159bb 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2710,6 +2710,8 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
 
 if( pTAFormat == nullptr )
 rSh.SetTableStyle( SwStyleNameMapper::GetUIName( 
RES_POOLTABSTYLE_DEFAULT, OUString() ) );
+else
+rSh.SetTableStyle( aAutoName );
 
 rSh.EndAllAction();
 rTempView.AutoCaption(TABLE_CAP);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-10 Thread Julien Nabet
 sw/source/ui/config/optload.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 821c5a97049c55fe14b0cb8cb280fe77281d91a5
Author: Julien Nabet 
Date:   Wed Jan 17 15:58:10 2018 +0100

tdf#115032: Above as default position for Autocaption pref

Change-Id: Idcd4e4a409476fe269340ac9d8f3ceacc6fbd7f3
(cherry picked from commit 48c47db6e7e79f0accb3221a34ec03202e8fa413)
Reviewed-on: https://gerrit.libreoffice.org/49529
Tested-by: Jenkins 
Reviewed-by: Heiko Tietze 

diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 544aa7e7fe20..4bcee49414b5 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -777,9 +777,11 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl, 
SvTreeListBox*, void)
 m_pPosBox->InsertEntry(m_sEnd);
 break;
 }
-m_pPosBox->SelectEntryPos(pOpt->GetPos());
 m_pPosBox->Enable( m_pPosBox->IsEnabled() );
-m_pPosBox->SelectEntryPos(pOpt->GetPos());
+if (m_pPosBox->IsEnabled())
+m_pPosBox->SelectEntryPos(pOpt->GetPos());
+else
+m_pPosBox->SelectEntryPos(0);
 
 sal_Int32 nLevelPos = ( pOpt->GetLevel() < MAXLEVEL ) ? 
pOpt->GetLevel() + 1 : 0;
 m_pLbLevel->SelectEntryPos( nLevelPos );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-09 Thread Caolán McNamara
 sw/source/filter/ww8/ww8toolbar.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 1e9c954ffb1bca7f07509331802dd4ac85a7b11b
Author: Caolán McNamara 
Date:   Fri Feb 9 10:49:39 2018 +

ofz#6173 check index before use

Change-Id: I09d15ab324af0a8b3566f11868eb3266a68c4afe
Reviewed-on: https://gerrit.libreoffice.org/49499
Tested-by: Jenkins 
Reviewed-by: David Tardon 

diff --git a/sw/source/filter/ww8/ww8toolbar.cxx 
b/sw/source/filter/ww8/ww8toolbar.cxx
index d5d4857baf92..08332085c3e3 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -164,7 +164,9 @@ bool SwCTBWrapper::Read( SvStream& rS )
 std::vector< sal_Int16 >::iterator it_end = dropDownMenuIndices.end();
 for ( std::vector< sal_Int16 >::iterator it = dropDownMenuIndices.begin(); 
it != it_end; ++it )
 {
-rCustomizations[ *it ].bIsDroppedMenuTB = true;
+if (*it < 0 || static_cast(*it) >= rCustomizations.size())
+continue;
+rCustomizations[*it].bIsDroppedMenuTB = true;
 }
 return rS.good();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-07 Thread Manfred Blume
 sw/source/core/layout/tabfrm.cxx |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit f00070deee9ff550d6ee370eae1402af71928265
Author: Manfred Blume 
Date:   Wed Jan 31 16:37:55 2018 +0100

tdf#114306 fix crash caused by special document 2

Regression from 18765b9fa739337d2d891513f6e2fb7c3ce23b50

Change-Id: Ic4205777077e4e3d93bdddf743c51abba8950eaf
Reviewed-on: https://gerrit.libreoffice.org/49031
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit d30eefb677b446886f7b5bab6de93d489ba63529)
Reviewed-on: https://gerrit.libreoffice.org/49310
Reviewed-by: Katarina Behrens 

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
old mode 100644
new mode 100755
index ca245b65599d..911ab3380da2
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -173,7 +173,7 @@ void SwTabFrame::RegistFlys()
 }
 
 void SwInvalidateAll( SwFrame *pFrame, long nBottom );
-static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom );
+static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom );
 static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva );
 // #i26945# - add parameter <_bOnlyRowsAndCells> to control
 // that only row and cell frames are formatted.
@@ -1565,7 +1565,8 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame,
 return bRet;
 }
 
-static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
+// returns false if pRow is invalid
+static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
 {
 // FME 2007-08-30 #i81146# new loop control
 int nLoopControlRuns_1 = 0;
@@ -1623,7 +1624,7 @@ static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom 
)
 if (!bRowStillExists)
 {
 SAL_WARN("sw.layout", "no row anymore at " << pRow);
-return;
+return false;
 }
 
 // NEW TABLES
@@ -1667,7 +1668,8 @@ static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom 
)
 }
 }
 break;
-} while( true );
+} while (true);
+return true;
 }
 
 static void lcl_RecalcTable( SwTabFrame& rTab,
@@ -2354,7 +2356,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 
 // 1. Try: bTryToSplit = true  => Try to split the row.
 // 2. Try: bTryToSplit = false => Split the table between the rows.
-if ( pFirstNonHeadlineRow->GetNext() || bTryToSplit )
+if ((pFirstNonHeadlineRow && pFirstNonHeadlineRow->GetNext()) || 
bTryToSplit )
 {
 SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper());
 if( IsInSct() || GetUpper()->IsInTab() ) // TABLE IN TABLE)
@@ -2363,7 +2365,11 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 
 {
 SetInRecalcLowerRow( true );
-::lcl_RecalcRow( static_cast(Lower()), 
nDeadLine );
+SwRowFrame* pRow = static_cast(Lower());
+if (!lcl_RecalcRow(pRow, nDeadLine))
+{
+pFirstNonHeadlineRow = GetFirstNonHeadlineRow();
+}
 SetInRecalcLowerRow( false );
 }
 m_bLowersFormatted = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-02-06 Thread Michael Stahl
 sw/source/core/bastyp/swcache.cxx |   32 +---
 1 file changed, 25 insertions(+), 7 deletions(-)

New commits:
commit 578f679bb5e5601bc7b8f16cb7166d623c9255ce
Author: Michael Stahl 
Date:   Fri Feb 2 15:11:25 2018 +0100

ofz#5435 sw: fix SwCache::Insert() stale pointers

If SwCache::Insert() happens to delete the object that m_pFirst or
m_pRealFirst point to, which is unlikely as it means every other object
is locked, then these pointers must be updated.

This sometimes happens in the bugdoc after scrolling around for some
time.

Change-Id: I13f04d28c37969469efa4e1109c7f5b751ceba96
Reviewed-on: https://gerrit.libreoffice.org/49151
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit 269d6d3366eea8541d965181dfdda1fdc5ef2d00)
Reviewed-on: https://gerrit.libreoffice.org/49159
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/bastyp/swcache.cxx 
b/sw/source/core/bastyp/swcache.cxx
index 200c8f59f4ab..1bf45c0d1fdc 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -367,16 +367,34 @@ bool SwCache::Insert( SwCacheObj *pNew )
 
 nPos = pObj->GetCachePos();
 if ( pObj == m_pLast )
-{ OSL_ENSURE( pObj->GetPrev(), "Last but no Prev" );
+{
 m_pLast = pObj->GetPrev();
-m_pLast->SetNext( nullptr );
+assert(m_pLast); // must have capacity > 1
 }
-else
+if (pObj == m_pFirst)
 {
-if ( pObj->GetPrev() )
-pObj->GetPrev()->SetNext( pObj->GetNext() );
-if ( pObj->GetNext() )
-pObj->GetNext()->SetPrev( pObj->GetPrev() );
+if (pObj->GetNext())
+{
+m_pFirst = pObj->GetNext();
+}
+else
+{
+m_pFirst = pObj->GetPrev();
+}
+assert(m_pFirst); // must have capacity > 1
+}
+if (pObj == m_pRealFirst)
+{
+m_pRealFirst = pObj->GetNext();
+assert(m_pRealFirst); // must have capacity > 1
+}
+if (pObj->GetPrev())
+{
+pObj->GetPrev()->SetNext( pObj->GetNext() );
+}
+if (pObj->GetNext())
+{
+pObj->GetNext()->SetPrev( pObj->GetPrev() );
 }
 delete pObj;
 m_aCacheObjects[nPos] = pNew;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-30 Thread Noel Grandin
 sw/source/core/view/vnew.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 9e7344ae5776117e94684713767fae1b0afbb6b9
Author: Noel Grandin 
Date:   Fri Jan 26 10:29:43 2018 +0200

tdf#115221 crash in printing and comment

not wonderfully happy with this fix, because we're changing the delete
ordering here, but the origin of this bug was

commit a754294ac7a902fe96fbbd6b8b6824a360d6b248
use rtl::Reference in SwDocFac instead of manual acquire/releas

and

commit  cc483d0470dbf0d01e4da818b148ff0b851c5187 (patch)
tdf#112292 - fix memory leak and use more auto ref counting in sw

so the delete ordering was obviously messed up in those already, and we
have such a morass of callbacks here, I can't see where else to fix it.

I tried to add a couple more "getDoc() != nullptr" checks, but we still
ended up crashing with an SwViewShell that had a bad pLayoutAccess
pointer.

Change-Id: I4aa39d58ae25bed41e3fd2c32c6d53659012ec10
Reviewed-on: https://gerrit.libreoffice.org/48658
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
(cherry picked from commit de9bcd167b059e00818304626c0cadaa330738a4)
Reviewed-on: https://gerrit.libreoffice.org/48748
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 2998ffb131f8..4c74acecdd09 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -324,9 +324,7 @@ SwViewShell::~SwViewShell()
 
 if ( mxDoc.get() )
 {
-auto x = mxDoc->getReferenceCount();
-mxDoc.clear();
-if( x > 1 )
+if( mxDoc->getReferenceCount() > 1 )
 GetLayout()->ResetNewLayout();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-27 Thread Tamás Zolnai
 sw/source/filter/ascii/parasc.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 960c96eabb15577b52f626cb0a3c8932757911b6
Author: Tamás Zolnai 
Date:   Thu Jan 18 13:57:22 2018 +0100

tdf#115088: Pasting multi-line text from external source behaves strangely

Regression from:
e68b6e349c31ac1376e90218013e1e7612f2b522

AppendTextNode might be sufficient for import (when there is no
content in the document), but for clipboard operations better to
use the original SplitNode method.

Change-Id: I7de3e9bc9c5356acb0b4cc43927a0d39079522b2
Reviewed-on: https://gerrit.libreoffice.org/48124
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 
(cherry picked from commit 657da4697379274295e9fd32d3abc1334ebd50d2)
Reviewed-on: https://gerrit.libreoffice.org/48200
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/filter/ascii/parasc.cxx 
b/sw/source/filter/ascii/parasc.cxx
index 60f5e02759f6..9c038e776fec 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -472,7 +472,10 @@ ErrCode SwASCIIParser::ReadChars()
 {
 // We found a CR/LF, thus save the text
 InsertText( OUString( pLastStt ));
-pDoc->getIDocumentContentOperations().AppendTextNode( 
*pPam->GetPoint() );
+if(bNewDoc)
+pDoc->getIDocumentContentOperations().AppendTextNode( 
*pPam->GetPoint() );
+else
+pDoc->getIDocumentContentOperations().SplitNode( 
*pPam->GetPoint(), false );
 pLastStt = pStt;
 nLineLen = 0;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-26 Thread Fyodor Yemelyanenko
 sw/source/core/undo/untblk.cxx |   73 +++--
 1 file changed, 56 insertions(+), 17 deletions(-)

New commits:
commit b9d14fbad622a05320eb90211ae2ba89edfb8148
Author: Fyodor Yemelyanenko 
Date:   Thu Nov 16 17:06:28 2017 +1000

tdf#94225 - Writer crashes on Undo N times
when document contains flys anchored to paragraph.

Change-Id: I628ef10b1e7817b554afee5e3c8733c1a128b201
Reviewed-on: https://gerrit.libreoffice.org/44800
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 
(cherry picked from commit 70483089425d5bb22e036867290e06a6fc8d99fb)
Reviewed-on: https://gerrit.libreoffice.org/48697
Tested-by: Jenkins 

diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 9b44e00522ea..d00210353875 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -49,22 +49,24 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const 
SwPaM& rPam )
 if( pTextNd->HasSwAttrSet() )
 pHistory->CopyFormatAttr( *pTextNd->GetpSwAttrSet(), nSttNode );
 
-if( !nSttContent )// than take the Flys along
+// We may have some flys anchored to paragraph where we inserting.
+// These flys will be saved in pFrameFormats array (only flys which 
exist BEFORE insertion!)
+// Then in SwUndoInserts::SetInsertRange the flys saved in 
pFrameFormats will NOT create Undos.
+// m_FlyUndos will only be filled with newly inserted flys.
+
+const size_t nArrLen = pDoc->GetSpzFrameFormats()->size();
+for( size_t n = 0; n < nArrLen; ++n )
 {
-const size_t nArrLen = pDoc->GetSpzFrameFormats()->size();
-for( size_t n = 0; n < nArrLen; ++n )
+SwFrameFormat* pFormat = (*pDoc->GetSpzFrameFormats())[n];
+SwFormatAnchor const*const  pAnchor = >GetAnchor();
+const SwPosition* pAPos = pAnchor->GetContentAnchor();
+if (pAPos &&
+(pAnchor->GetAnchorId() == RndStdIds::FLY_AT_PARA) &&
+ nSttNode == pAPos->nNode.GetIndex() )
 {
-SwFrameFormat* pFormat = (*pDoc->GetSpzFrameFormats())[n];
-SwFormatAnchor const*const  pAnchor = >GetAnchor();
-const SwPosition* pAPos = pAnchor->GetContentAnchor();
-if (pAPos &&
-(pAnchor->GetAnchorId() == RndStdIds::FLY_AT_PARA) &&
- nSttNode == pAPos->nNode.GetIndex() )
-{
-if( !pFrameFormats )
-pFrameFormats = new std::vector;
-pFrameFormats->push_back( pFormat );
-}
+if( !pFrameFormats )
+pFrameFormats = new std::vector;
+pFrameFormats->push_back( pFormat );
 }
 }
 }
@@ -76,7 +78,18 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& 
rPam )
 }
 }
 
-// set destination after reading input
+// This method does two things:
+// 1. Adjusts SwUndoRng members, required for Undo.
+//  Members are:
+//  SwUndoRng::nSttNode - all nodes starting from this node will be deleted 
during Undo (in SwUndoInserts::UndoImpl)
+//  SwUndoRng::nSttContent - corresponding content index in SwUndoRng::nSttNode
+//  SwUndoRng::nEndNode - end node for deletion
+//  SwUndoRng::nEndContent - end content index
+// All these members are filled in during construction of SwUndoInserts 
instance, and can be adjusted using this method
+//
+// 2. Fills in m_FlyUndos array with flys anchored ONLY to first and last 
paragraphs (first == rPam.Start(), last == rPam.End())
+//  Flys, anchored to any paragraph, but not first and last, are handled by 
DelContentIndex (see SwUndoInserts::UndoImpl) and are not stored in m_FlyUndos.
+
 void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys,
 bool bSttIsTextNd )
 {
@@ -100,7 +113,9 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool 
bScanFlys,
 }
 }
 
-if( bScanFlys && !nSttContent )
+// Fill m_FlyUndos with flys anchored to first and last paragraphs
+
+if( bScanFlys)
 {
 // than collect all new Flys
 SwDoc* pDoc = rPam.GetDoc();
@@ -112,7 +127,7 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool 
bScanFlys,
 SwPosition const*const pAPos = pAnchor->GetContentAnchor();
 if (pAPos &&
 (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_PARA) &&
-nSttNode == pAPos->nNode.GetIndex() )
+(nSttNode == pAPos->nNode.GetIndex() || nEndNode == 
pAPos->nNode.GetIndex()))
 {
 std::vector::iterator it;
 if( !pFrameFormats ||
@@ -145,6 +160,27 @@ SwUndoInserts::~SwUndoInserts()
  

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-25 Thread Michael Stahl
 sw/source/filter/html/htmltab.cxx |3 +++
 sw/source/filter/html/swhtml.cxx  |   31 +++
 sw/source/filter/html/swhtml.hxx  |1 +
 3 files changed, 23 insertions(+), 12 deletions(-)

New commits:
commit d76fc1a87a31bf513f844be933996334ea85446c
Author: Michael Stahl 
Date:   Mon Jan 22 19:48:06 2018 +0100

ofz#5566 sw: HTML import: ignore  in table structure elements

Looking at the HTML4 DTD https://www.w3.org/TR/html4/sgml/dtd.html,
inside TABLE only various elements defining the structure of the table
allowed, except inside cells (TD and TH elements).

DIV in a table but outside cells may cause cursor positions to go
off the rails, so better ignore such invalid DIV tags.

Reviewed-on: https://gerrit.libreoffice.org/48359
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 8b1a83bffe35ae0e71735569512c1586bcb37b25)

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

diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index b6e1d5db18bf..b3f7ca1e663f 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3307,6 +3308,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, 
bool bReadOptions,
 if( !IsParserWorking() && !m_pPendStack )
 return;
 
+::comphelper::FlagRestorationGuard g(m_isInTableStructure, false);
 CellSaveStruct* pSaveStruct;
 
 HtmlTokenId nToken = HtmlTokenId::NONE;
@@ -4972,6 +4974,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust 
eParentAdjust,
 if( !IsParserWorking() && !m_pPendStack )
 return nullptr;
 
+::comphelper::FlagRestorationGuard g(m_isInTableStructure, true);
 HtmlTokenId nToken = HtmlTokenId::NONE;
 bool bPending = false;
 TableSaveStruct* pSaveStruct;
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 3b18ef33328a..e483f926ee04 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -298,6 +298,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, 
SvStream& rIn,
 m_bRemoveHidden( false ),
 m_bBodySeen( false ),
 m_bReadingHeaderOrFooter( false ),
+m_isInTableStructure(false),
 m_pTempViewFrame(nullptr)
 {
 m_nEventId = nullptr;
@@ -1544,26 +1545,32 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken )
 // divisions
 case HtmlTokenId::DIVISION_ON:
 case HtmlTokenId::CENTER_ON:
-if( m_nOpenParaToken != HtmlTokenId::NONE )
+if (!m_isInTableStructure)
 {
-if( IsReadPRE() )
-m_nOpenParaToken = HtmlTokenId::NONE;
-else
-EndPara();
+if (m_nOpenParaToken != HtmlTokenId::NONE)
+{
+if (IsReadPRE())
+m_nOpenParaToken = HtmlTokenId::NONE;
+else
+EndPara();
+}
+NewDivision( nToken );
 }
-NewDivision( nToken );
 break;
 
 case HtmlTokenId::DIVISION_OFF:
 case HtmlTokenId::CENTER_OFF:
-if( m_nOpenParaToken != HtmlTokenId::NONE )
+if (!m_isInTableStructure)
 {
-if( IsReadPRE() )
-m_nOpenParaToken = HtmlTokenId::NONE;
-else
-EndPara();
+if (m_nOpenParaToken != HtmlTokenId::NONE)
+{
+if (IsReadPRE())
+m_nOpenParaToken = HtmlTokenId::NONE;
+else
+EndPara();
+}
+EndDivision();
 }
-EndDivision();
 break;
 
 case HtmlTokenId::MULTICOL_ON:
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 450f7ddbde56..6e84380cdfe1 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -480,6 +480,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
 
 bool m_bBodySeen : 1;
 bool m_bReadingHeaderOrFooter : 1;
+bool m_isInTableStructure;
 
 /// the names corresponding to the DOCINFO field subtypes INFO[1-4]
 OUString m_InfoNames[4];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-24 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par3.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d8fcf54fae9af7afbde16cceffbcf936ff58fa8d
Author: Caolán McNamara 
Date:   Wed Jan 24 15:39:28 2018 +

ofz: check nLevel against maParaSprms size

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

diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 8dc161d582d4..c00f7f09a916 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1414,7 +1414,8 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, 
SwWW8ImplReader& rReader_)
 aLFOLVL.bFormat = true;
 // if bStartup is true, replace Startup-Level
 // with the LVLF that is saved in the LVL
-bLVLOk = ReadLVL(aNumFormat, aItemSet[nLevel],
+bLVLOk = nLevel < rLFOInfo.maParaSprms.size() &&
+ReadLVL(aNumFormat, aItemSet[nLevel],
 pParentListInfo->aIdSty[nLevel],
 aLFOLVL.bStartAt, aNotReallyThere, nLevel,
 rLFOInfo.maParaSprms[nLevel]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-23 Thread Caolán McNamara
 sw/source/filter/html/htmlsect.cxx |7 ++-
 sw/source/filter/html/swhtml.cxx   |1 +
 sw/source/filter/html/swhtml.hxx   |   11 +--
 3 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 6fde78f1904243a4121c75f7c96711ed54cf787f
Author: Caolán McNamara 
Date:   Tue Jan 2 17:19:32 2018 +

ofz: assert on trying to insert footer when already inserting the footer

Reviewed-on: https://gerrit.libreoffice.org/47272
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 834cebd153573eea3cc321eca5bcb572b4776dec)

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

diff --git a/sw/source/filter/html/htmlsect.cxx 
b/sw/source/filter/html/htmlsect.cxx
index 436508a5e377..a63b788137fb 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -138,8 +138,11 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
 }
 }
 
-if( !bPositioned && (bHeader || bFooter) && IsNewDoc() )
+if (!bPositioned && (bHeader || bFooter) && IsNewDoc() && 
!m_bReadingHeaderOrFooter)
 {
+m_bReadingHeaderOrFooter = true;
+pCntxt->SetHeaderOrFooter(true);
+
 SwPageDesc *pPageDesc = m_pCSS1Parser->GetMasterPageDesc();
 SwFrameFormat& rPageFormat = pPageDesc->GetMaster();
 
@@ -402,6 +405,8 @@ void SwHTMLParser::EndDivision()
 // close attribute
 EndContext( pCntxt );
 SetAttr();  // set paragraph attributes really fast because of 
JavaScript
+if (pCntxt->IsHeaderOrFooter())
+m_bReadingHeaderOrFooter = false;
 
 delete pCntxt;
 }
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 057dc3ad4c04..3b18ef33328a 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -297,6 +297,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, 
SvStream& rIn,
 m_bIgnoreHTMLComments( bNoHTMLComments ),
 m_bRemoveHidden( false ),
 m_bBodySeen( false ),
+m_bReadingHeaderOrFooter( false ),
 m_pTempViewFrame(nullptr)
 {
 m_nEventId = nullptr;
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 66f7837704ae..450f7ddbde56 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -225,6 +225,7 @@ class HTMLAttrContext
 boolbRestartPRE : 1;
 boolbRestartXMP : 1;
 boolbRestartListing : 1;
+boolbHeaderOrFooter : 1;
 
 public:
 void ClearSaveDocContext();
@@ -249,7 +250,8 @@ public:
 bFinishPREListingXMP( false ),
 bRestartPRE( false ),
 bRestartXMP( false ),
-bRestartListing( false )
+bRestartListing( false ),
+bHeaderOrFooter( false )
 {}
 
 explicit HTMLAttrContext( HtmlTokenId nTokn ) :
@@ -270,7 +272,8 @@ public:
 bFinishPREListingXMP( false ),
 bRestartPRE( false ),
 bRestartXMP( false ),
-bRestartListing( false )
+bRestartListing( false ),
+bHeaderOrFooter( false )
 {}
 
 ~HTMLAttrContext() { ClearSaveDocContext(); }
@@ -320,6 +323,9 @@ public:
 void SetRestartListing( bool bSet ) { bRestartListing = bSet; }
 bool IsRestartListing() const { return bRestartListing; }
 
+void SetHeaderOrFooter( bool bSet ) { bHeaderOrFooter = bSet; }
+bool IsHeaderOrFooter() const { return bHeaderOrFooter; }
+
 void SetAppendMode( SwHTMLAppendMode eMode ) { eAppend = eMode; }
 SwHTMLAppendMode GetAppendMode() const { return eAppend; }
 };
@@ -473,6 +479,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
 bool m_bRemoveHidden : 1; // the filter implementation might set the 
hidden flag
 
 bool m_bBodySeen : 1;
+bool m_bReadingHeaderOrFooter : 1;
 
 /// the names corresponding to the DOCINFO field subtypes INFO[1-4]
 OUString m_InfoNames[4];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-23 Thread Michael Stahl
 sw/source/filter/html/htmlctxt.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit ee1ff57f901b976a1be12c57c800ca78a8427b81
Author: Michael Stahl 
Date:   Thu Jan 18 17:31:22 2018 +0100

ofz#4754 sw: HTML import: fix invalid tables being created

This 75-byte horror creates 2 nested tables, where one SwTableBox is in
the SwTableLine of the inner SwTable but in the SwSortBoxes of the outer
table, which is of course invalid.

The root cause is that in SwHTMLParser::SplitAttrTab(), we move the
m_pPam backward once and forward twice, moving it ouside the inner
table.

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

diff --git a/sw/source/filter/html/htmlctxt.cxx 
b/sw/source/filter/html/htmlctxt.cxx
index f93e5ffee1d0..e501ca63d00f 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -163,6 +163,7 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos )
 {
 m_pPam->Move( fnMoveForward );
 nOldEndCnt = m_pPam->GetPoint()->nContent.GetIndex();
+bMoveBack = false;
 }
 
 if( (RES_PARATR_BEGIN <= nWhich && bMoveBack) ||
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-18 Thread Caolán McNamara
 sw/source/filter/ww8/ww8scan.cxx |   17 +
 sw/source/filter/ww8/ww8scan.hxx |9 -
 2 files changed, 21 insertions(+), 5 deletions(-)

New commits:
commit 2f61eb08b38561f01b59586771469af4384080b6
Author: Caolán McNamara 
Date:   Wed Jan 17 11:03:20 2018 +

ofz#5447 on plcf save force current Fkp to stick in cache

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

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index a92a61efb8f0..6a90d83e8e3c 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2551,8 +2551,8 @@ void 
WW8PLCFx_Fc_FKP::WW8Fkp::FillEntry(WW8PLCFx_Fc_FKP::WW8Fkp::Entry ,
 WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(const WW8Fib& rFib, SvStream* pSt,
 SvStream* pDataSt, long _nFilePos, long nItemSiz, ePLCFT ePl,
 WW8_FC nStartFc)
-: nItemSize(nItemSiz), nFilePos(_nFilePos),  mnIdx(0), ePLCF(ePl)
-, maSprmParser(rFib)
+: nItemSize(nItemSiz), nFilePos(_nFilePos), mnIdx(0), ePLCF(ePl)
+, mnMustRemainCached(0), maSprmParser(rFib)
 {
 memset(maRawData, 0, 512);
 
@@ -3020,8 +3020,12 @@ bool WW8PLCFx_Fc_FKP::NewFkp()
 
 if (maFkpCache.size() > eMaxCache)
 {
-delete maFkpCache.front();
-maFkpCache.pop_front();
+WW8Fkp* pCachedFkp = maFkpCache.front();
+if (!pCachedFkp->IsMustRemainCache())
+{
+delete pCachedFkp;
+maFkpCache.pop_front();
+}
 }
 }
 }
@@ -5513,6 +5517,8 @@ void WW8PLCFx_Cp_FKP::SetIdx2(sal_uInt32 nIdx)
 
 void WW8PLCFx_Cp_FKP::Save( WW8PLCFxSave1& rSave ) const
 {
+if (pFkp)
+pFkp->IncMustRemainCache();
 WW8PLCFx::Save( rSave );
 
 rSave.nAttrStart = nAttrStart;
@@ -5527,6 +5533,9 @@ void WW8PLCFx_Cp_FKP::Restore( const WW8PLCFxSave1& rSave 
)
 nAttrStart = rSave.nAttrStart;
 nAttrEnd   = rSave.nAttrEnd;
 bLineEnd   = rSave.bLineEnd;
+
+if (pFkp)
+pFkp->DecMustRemainCache();
 }
 
 void WW8PLCFxDesc::Save( WW8PLCFxSave1& rSave ) const
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 4dbaaebc49e8..ff2246155899 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -533,6 +533,7 @@ public:
 sal_uInt8 mnIdx; // Pos marker
 ePLCFT ePLCF;
 sal_uInt8 mnIMax; // number of entries
+int mnMustRemainCached;  // after SaveAllPLCFx, before RestoreAllPLCFx
 
 wwSprmParser maSprmParser;
 
@@ -573,13 +574,19 @@ public:
 void HasSprm(sal_uInt16 nId, std::vector );
 
 const wwSprmParser () const { return maSprmParser; }
+
+void IncMustRemainCache() { ++mnMustRemainCached; }
+bool IsMustRemainCache() const { return mnMustRemainCached > 0; }
+void DecMustRemainCache() { --mnMustRemainCached; }
 };
 
 private:
 SvStream* pFKPStrm; // input file
 SvStream* pDataStrm;// input file
 WW8PLCF* pPLCF;
+protected:
 WW8Fkp* pFkp;
+private:
 
 /*
 Keep a cache of eMaxCache entries of previously seen pFkps, which
@@ -595,7 +602,7 @@ private:
 */
 typedef std::list::iterator myiter;
 std::list maFkpCache;
-enum Limits {eMaxCache = 5};
+enum Limits {eMaxCache = 5};
 
 bool NewFkp();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-11 Thread Armin Le Grand
 sw/source/core/layout/flylay.cxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit 353a736b719167ce1caac9cb20a607e3aeda6dca
Author: Armin Le Grand 
Date:   Wed Jan 10 18:28:34 2018 +0100

RotateFlyFrameFix: Disable AutoContour for rotated Flys

As long as it is not clear when, how and why we should offer
this feature and if ODF needs to be adapted to it, disable
the feature for now. Discussion about how to support is ongoing.

Change-Id: I8ecd91ef9aefb6f49840a4f6108f5d5a17072af0
Reviewed-on: https://gerrit.libreoffice.org/47731
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
Reviewed-by: Armin Le Grand 

diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 8a3af6c27006..51d79c88 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -299,6 +299,17 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* 
/*pRenderContext*/)
 
 bool SwFlyFreeFrame::supportsAutoContour() const
 {
+static bool bOverrideHandleContourToAlwaysOff(true);
+
+// RotateFlyFrameFix: For LO6.0 we need to deactivate the AutoContour 
feature again, it is simply
+// not clear how/if to use and save/load it in ODF. This has to be 
discussed.
+// The reason not to remove is that this may be used as-is now, using a 
new switch.
+// Even when not, the detection if it is possible will be needed in any 
case later.
+if(bOverrideHandleContourToAlwaysOff)
+{
+return false;
+}
+
 if(!isTransformableSwFrame())
 {
 // support only when transformed, else there is no free space
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-09 Thread Caolán McNamara
 sw/source/ui/index/swuiidxmrk.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 513a21c1d635ea5b830f6b075b2a951ca1c94eff
Author: Caolán McNamara 
Date:   Mon Jan 8 12:20:11 2018 +

Resolves: tdf#114728 wrong entries in bibliographic entry dialog

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

diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index 61249f585796..6c2561065cff 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1502,7 +1502,8 @@ 
SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent,
 {
 pTypeListBox = VclPtr::Create(bLeft ? pLeft : pRight, 
WB_DROPDOWN|WB_BORDER|WB_VCENTER);
 for (int j = 0; j < AUTH_TYPE_END; j++)
-pTypeListBox->InsertEntry(SwResId(STR_AUTH_FIELD_ARY[j]));
+
pTypeListBox->InsertEntry(SwAuthorityFieldType::GetAuthTypeName(static_cast(j)));
+pTypeListBox->EnableAutoSize(true);
 if(!pFields[aCurInfo.nToxField].isEmpty())
 {
 
pTypeListBox->SelectEntryPos(pFields[aCurInfo.nToxField].toInt32());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-09 Thread Michael Meeks
 sw/source/core/layout/paintfrm.cxx |   41 -
 1 file changed, 32 insertions(+), 9 deletions(-)

New commits:
commit 195ad7f4a780320f47f68b8a7dc381f8e2d492cc
Author: Michael Meeks 
Date:   Tue Jan 9 10:14:21 2018 +

tdf#114480 - Revert "Writer page shadow - avoid scaling ..."

Unfortunately, when rendering tiles this gives garbage borders in
odd places unexpectedly.

This reverts commit 268d019c4b05f37e99e1da85472dc9255f186a27.

Change-Id: I0071d05469cf8b7859b79c035c4239e4089b2de2
Reviewed-on: https://gerrit.libreoffice.org/47642
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index e2187a1da863..4024f341defc 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5876,6 +5876,7 @@ bool SwPageFrame::IsLeftShadowNeeded() const
 }
 
 enum PaintArea {LEFT, RIGHT, TOP, BOTTOM};
+#define BORDER_TILE_SIZE 512
 
 /// Wrapper around pOut->DrawBitmapEx.
 static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& 
aPoint, const Size& aSize, const BitmapEx& rBitmapEx, PaintArea eArea)
@@ -5897,14 +5898,24 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 pOut->SetLineColor();
 pOut->DrawRect(pOut->PixelToLogic(aRect));
 
-Size aOutSize = pOut->PixelToLogic(aSize);
-Point aOutPoint = pOut->PixelToLogic(aPoint);
+// Tiled render if necessary
+tools::Rectangle aComplete(aPoint, aSize);
+Size aTileSize(BORDER_TILE_SIZE, BORDER_TILE_SIZE);
+
+long iterX = eArea != RIGHT && eArea != LEFT ? BORDER_TILE_SIZE : 0;
+long iterY = eArea == RIGHT || eArea == LEFT ? BORDER_TILE_SIZE : 0;
+
+for (tools::Rectangle aTile = tools::Rectangle(aPoint, aTileSize); true; 
aTile.Move(iterX, iterY))
+{
+tools::Rectangle aRender = aComplete.GetIntersection(aTile);
+if (aRender.IsEmpty())
+break;
+pOut->DrawBitmapEx(pOut->PixelToLogic(aRender.TopLeft()),
+   pOut->PixelToLogic(aRender.GetSize()),
+   Point(0, 0), aRender.GetSize(),
+   rBitmapEx);
+}
 
-pOut->DrawTransformedBitmapEx(
-basegfx::utils::createScaleTranslateB2DHomMatrix(
-aOutSize.Width(), aOutSize.Height(),
-aOutPoint.X(), aOutPoint.Y()),
-rBitmapEx);
 }
 
 /**
@@ -6016,6 +6027,9 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 {
 const long nWidth = aPageRightShadow.GetSizePixel().Width();
 const long nHeight = aPagePxRect.Height() - 2 * (mnShadowPxWidth - 
1);
+if (aPageRightShadow.GetSizePixel().Height() < BORDER_TILE_SIZE)
+aPageRightShadow.Scale(Size(nWidth, BORDER_TILE_SIZE), 
BmpScaleFlag::Fast);
+
 lcl_paintBitmapExToRect(pOut,
 Point(aPaintRect.Right() + mnShadowPxWidth, 
aPagePxRect.Top() + mnShadowPxWidth - 1),
 Size(nWidth, nHeight),
@@ -6034,6 +6048,9 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 {
 const long nWidth = aPageLeftShadow.GetSizePixel().Width();
 const long nHeight = aPagePxRect.Height() - 2 * (mnShadowPxWidth - 
1);
+if (aPageLeftShadow.GetSizePixel().Height() < BORDER_TILE_SIZE)
+aPageLeftShadow.Scale(Size(nWidth, BORDER_TILE_SIZE), 
BmpScaleFlag::Fast);
+
 lcl_paintBitmapExToRect(pOut,
 Point(lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1),
 Size(nWidth, nHeight),
@@ -6043,16 +6060,22 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 
 // Bottom shadow
 const long nBottomHeight = aPageBottomShadow.GetSizePixel().Height();
+if (aPageBottomShadow.GetSizePixel().Width() < BORDER_TILE_SIZE)
+aPageBottomShadow.Scale(Size(BORDER_TILE_SIZE, nBottomHeight), 
BmpScaleFlag::Fast);
+
 lcl_paintBitmapExToRect(pOut,
 Point(aPaintRect.Left(), aPagePxRect.Bottom() + 2),
-Size(aPaintRect.Width() - 1, nBottomHeight),
+Size(aPaintRect.Width(), nBottomHeight),
 aPageBottomShadow, BOTTOM);
 
 // Top shadow
 const long nTopHeight = aPageTopShadow.GetSizePixel().Height();
+if (aPageTopShadow.GetSizePixel().Width() < BORDER_TILE_SIZE)
+aPageTopShadow.Scale(Size(BORDER_TILE_SIZE, nTopHeight), 
BmpScaleFlag::Fast);
+
 lcl_paintBitmapExToRect(pOut,
 Point(aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth),
-Size(aPaintRect.Width() - 1, nTopHeight),
+Size(aPaintRect.Width(), nTopHeight),
 aPageTopShadow, TOP);
 }
 
___

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-09 Thread Mike Kaganski
 sw/source/core/doc/doc.cxx |  105 -
 1 file changed, 56 insertions(+), 49 deletions(-)

New commits:
commit f73df3fa98258fb5208a1295c0ae5c56d3c0b315
Author: Mike Kaganski 
Date:   Sun Dec 24 00:28:30 2017 +0300

tdf#114663: consider left/right page numbers when not printing blanks

Commit 3c1a343f6936f1dcefdf79a677f8c26ce29676e6 made it possible
to use document pages' sequential number (unaffected by automatically
inserted blank pages) in Pages input box when not printing blank
pages. But the implementation didn't take into account the case when
only left/right pages were printed. In this case, it treated the
unprinted right/left pages same way as automatic blanks, i.e.,
excluded they from page numbering, so that e.g. when user entered
10-20 (when selected even pages), actually printed 11 pages from
tenth even page (#20 in original document) till twenteeth even page
(#40). Expected result (familiar from other applications, and worked
before the commit) is to print 6 pages with even numbers, that are
in the pages range 10-20 of original document (10,12,14,16,18,20).

Now we consistently use StringRangeEnumerator::getRangesFromString
after converting user input with page numbers conditionally referring
either physical pages, or pages without blanks, to equivalent range
string referring physical pages. This preprocessing of range string
also ensures correct enumerating later (when StringRangeEnumerator
is created based on this string, e.g., for processing of PostIts).

Change-Id: I2381699bc4c37841bf9ce789cdad03141dd72255
Reviewed-on: https://gerrit.libreoffice.org/47030
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
(cherry picked from commit 230d3d6602e80fad0ceb700da35fc0c1db28f110)
Reviewed-on: https://gerrit.libreoffice.org/47053
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 2d45bac285f0..e9cdbc8b1174 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -640,6 +640,46 @@ static sal_Int32 lcl_GetPaperBin( const SwPageFrame 
*pStartFrame )
 return nRes;
 }
 
+namespace
+{
+// tdf#:114663 Translates a range string from user input (with page numbering 
possibly not
+// taking blank pages into account) to equivalent string which references 
physical page numbers.
+// rUIPages2PhyPagesMap must contain a contiguous sequence of UI page numbers
+OUString UIPages2PhyPages(const OUString& rUIPageRange, const std::map< 
sal_Int32, sal_Int32 >& rUIPages2PhyPagesMap)
+{
+if (rUIPages2PhyPagesMap.empty())
+return OUString();
+auto iMin = rUIPages2PhyPagesMap.begin();
+const sal_Int32 nUIPageMin = iMin->first, nPhyPageMin = iMin->second;
+auto iMax = rUIPages2PhyPagesMap.rbegin();
+const sal_Int32 nUIPageMax = iMax->first, nPhyPageMax = iMax->second;
+OUStringBuffer aOut(rUIPageRange.getLength());
+OUStringBuffer aNumber(16);
+const sal_Unicode* pInput = rUIPageRange.getStr();
+while (*pInput)
+{
+while (*pInput >= '0' && *pInput <= '9')
+aNumber.append(*pInput++);
+if (!aNumber.isEmpty())
+{
+sal_Int32 nNumber = aNumber.makeStringAndClear().toInt32();
+if (nNumber < nUIPageMin)
+nNumber = nPhyPageMin-1;
+else if (nNumber > nUIPageMax)
+nNumber = nPhyPageMax+1;
+else
+nNumber = rUIPages2PhyPagesMap.at(nNumber);
+aOut.append(nNumber);
+}
+
+while (*pInput && (*pInput < '0' || *pInput > '9'))
+aOut.append(*pInput++);
+}
+
+return aOut.makeStringAndClear();
+}
+}
+
 void SwDoc::CalculatePagesForPrinting(
 const SwRootFrame& rLayout,
 /* out */ SwRenderData ,
@@ -659,16 +699,19 @@ void SwDoc::CalculatePagesForPrinting(
 
 std::map< sal_Int32, sal_Int32 >  = 
rData.GetPrinterPaperTrays();
 std::set< sal_Int32 >  = rData.GetValidPagesSet();
+// Map page numbers from user input (possibly ignoring blanks) to physical 
page numbers
+std::map< sal_Int32, sal_Int32 > aUIPages2PhyPagesMap;
 rValidPages.clear();
 
-sal_Int32 nPageNum = 1;
+sal_Int32 nPageNum = 1, nUIPageNum = 1;
 const SwPageFrame *pStPage = dynamic_cast( 
rLayout.Lower() );
 while (pStPage && nPageNum <= nDocPageCount)
 {
+const bool bNonEmptyPage = pStPage->getFrameArea().Height() != 0;
 const bool bPrintThisPage =
 ( (bPrintRightPages && pStPage->OnRightPage()) ||
   (bPrintLeftPages && !pStPage->OnRightPage()) ) &&
-( bPrintEmptyPages || pStPage->getFrameArea().Height() );
+( bPrintEmptyPages || bNonEmptyPage );
 
 if (bPrintThisPage)
 {
@@ -676,6 +719,10 @@ void 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-03 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par2.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit da866f69a19c0afac0dd202d854b0030d02deb3d
Author: Caolán McNamara 
Date:   Wed Jan 3 15:59:42 2018 +

ofz#4921 limit column check to max legal column index

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

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index a517dffe03ea..54498ea7cc04 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2970,7 +2970,7 @@ bool WW8TabDesc::InFirstParaInCell() const
 void WW8TabDesc::StartMiserableHackForUnsupportedDirection(short nWwCol)
 {
 OSL_ENSURE(m_pActBand, "Impossible");
-if (m_pActBand && m_pActBand->maDirections[nWwCol] == 3)
+if (m_pActBand && nWwCol <= MAX_COL && m_pActBand->maDirections[nWwCol] == 
3)
 {
 m_pIo->m_xCtrlStck->NewAttr(*m_pIo->m_pPaM->GetPoint(),
 SvxCharRotateItem(900, false, RES_CHRATR_ROTATE));
@@ -2980,7 +2980,7 @@ void 
WW8TabDesc::StartMiserableHackForUnsupportedDirection(short nWwCol)
 void WW8TabDesc::EndMiserableHackForUnsupportedDirection(short nWwCol)
 {
 OSL_ENSURE(m_pActBand, "Impossible");
-if (m_pActBand && m_pActBand->maDirections[nWwCol] == 3)
+if (m_pActBand && nWwCol <= MAX_COL && m_pActBand->maDirections[nWwCol] == 
3)
 m_pIo->m_xCtrlStck->SetAttr(*m_pIo->m_pPaM->GetPoint(), 
RES_CHRATR_ROTATE);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-03 Thread Maxim Monastirsky
 sw/source/uibase/docvw/edtwin.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 612a613a6bad3574f4750b27a3638064963baf14
Author: Maxim Monastirsky 
Date:   Sat Dec 23 22:13:55 2017 +0200

tdf#114670 Make sure to dispose the menu

Change-Id: I30612a0b3cfef7d19ff6a5180db76a8002186bd5
Reviewed-on: https://gerrit.libreoffice.org/47025
Tested-by: Jenkins 
Reviewed-by: Maxim Monastirsky 
(cherry picked from commit baccbd4508a375090f4d95a2dab02c8b5d404ee2)
Reviewed-on: https://gerrit.libreoffice.org/47031
Reviewed-by: Noel Grandin 
Reviewed-by: Xisco Faulí 
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index da86a7d49149..bfc5c3dc8585 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5287,7 +5287,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
 aEvent.SourceWindow = VCLUnoHelper::GetInterface( this 
);
 aEvent.ExecutePosition.X = aPixPos.X();
 aEvent.ExecutePosition.Y = aPixPos.Y();
-VclPtr pMenu;
+ScopedVclPtr pMenu;
 if 
(GetView().TryContextMenuInterception(aROPopup.GetMenu(), 
"private:resource/ReadonlyContextMenu", pMenu, aEvent))
 {
 if ( pMenu )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-03 Thread Caolán McNamara
 sw/source/ui/frmdlg/wrap.cxx   |   29 +++
 sw/source/ui/table/tabledlg.cxx|   71 ++---
 sw/source/uibase/inc/prcntfld.hxx  |4 +-
 sw/source/uibase/inc/wrap.hxx  |3 +
 sw/source/uibase/table/tablepg.hxx |7 ++-
 5 files changed, 92 insertions(+), 22 deletions(-)

New commits:
commit ccce3d15fdb28786166f9c96cdc12a185c3c078e
Author: Caolán McNamara 
Date:   Fri Dec 22 10:35:31 2017 +

Resolves: tdf#114572 immediate update of value while typing unwanted

Revert "connect to modified instead of up/down/focus-lost"

This reverts commit 44bfe8fad4f7c263dc713a65fb2ab0e2f9afcf99

Revert "listening to modify is sufficient to get all changes"

This reverts commit 5c0bb1088a678d36309866c4eee43e58901f6b7b

we probably need to distinguish a modify vs update signal to
get what I wanted here. Back to the original mode for now.

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

diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index 5a9db97e8cee..21f07d980816 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -90,11 +90,23 @@ SwWrapTabPage::SwWrapTabPage(vcl::Window *pParent, const 
SfxItemSet )
 
 SetExchangeSupport();
 
-Link aLk = LINK(this, SwWrapTabPage, RangeModifyHdl);
-m_pLeftMarginED->SetModifyHdl(aLk);
-m_pRightMarginED->SetModifyHdl(aLk);
-m_pTopMarginED->SetModifyHdl(aLk);
-m_pBottomMarginED->SetModifyHdl(aLk);
+Link aLk = LINK(this, SwWrapTabPage, RangeModifyHdl);
+Link aLk3 = LINK(this, SwWrapTabPage, RangeLoseFocusHdl);
+m_pLeftMarginED->SetUpHdl(aLk);
+m_pLeftMarginED->SetDownHdl(aLk);
+m_pLeftMarginED->SetLoseFocusHdl(aLk3);
+
+m_pRightMarginED->SetUpHdl(aLk);
+m_pRightMarginED->SetDownHdl(aLk);
+m_pRightMarginED->SetLoseFocusHdl(aLk3);
+
+m_pTopMarginED->SetUpHdl(aLk);
+m_pTopMarginED->SetDownHdl(aLk);
+m_pTopMarginED->SetLoseFocusHdl(aLk3);
+
+m_pBottomMarginED->SetUpHdl(aLk);
+m_pBottomMarginED->SetDownHdl(aLk);
+m_pBottomMarginED->SetLoseFocusHdl(aLk3);
 
 Link aLk2 = LINK(this, SwWrapTabPage, WrapTypeHdl);
 m_pNoWrapRB->SetClickHdl(aLk2);
@@ -552,7 +564,12 @@ DeactivateRC SwWrapTabPage::DeactivatePage(SfxItemSet* 
_pSet)
 return DeactivateRC::LeavePage;
 }
 
-IMPL_LINK( SwWrapTabPage, RangeModifyHdl, Edit&, rSpin, void )
+// range check
+IMPL_LINK( SwWrapTabPage, RangeLoseFocusHdl, Control&, rControl, void )
+{
+RangeModifyHdl( static_cast(rControl) );
+}
+IMPL_LINK( SwWrapTabPage, RangeModifyHdl, SpinField&, rSpin, void )
 {
 MetricField& rEdit = static_cast(rSpin);
 sal_Int64 nValue = rEdit.GetValue();
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 1dd146377a8a..9186b9a48642 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -143,12 +143,25 @@ void  SwFormatTablePage::Init()
 m_pRightBtn->SetClickHdl( aLk2 );
 m_pCenterBtn->SetClickHdl( aLk2 );
 
-Link aLk = LINK(this, SwFormatTablePage, UpDownHdl);
-m_pTopMF->SetModifyHdl(aLk);
-m_pBottomMF->SetModifyHdl(aLk);
-m_aRightMF.SetModifyHdl(aLk);
-m_aLeftMF.SetModifyHdl(aLk);
-m_aWidthMF.SetModifyHdl(aLk);
+Link aLk = LINK( this, SwFormatTablePage, UpDownHdl );
+m_pTopMF->SetUpHdl( aLk );
+m_pBottomMF->SetUpHdl( aLk );
+m_aRightMF.SetUpHdl( aLk );
+m_aLeftMF.SetUpHdl( aLk );
+m_aWidthMF.SetUpHdl( aLk );
+
+m_pTopMF->SetDownHdl( aLk );
+m_pBottomMF->SetDownHdl( aLk );
+m_aRightMF.SetDownHdl( aLk );
+m_aLeftMF.SetDownHdl( aLk );
+m_aWidthMF.SetDownHdl( aLk );
+
+Link aLk3 = LINK( this, SwFormatTablePage, LoseFocusHdl );
+m_pTopMF->SetLoseFocusHdl( aLk3 );
+m_pBottomMF->SetLoseFocusHdl( aLk3 );
+m_aRightMF.SetLoseFocusHdl( aLk3 );
+m_aLeftMF.SetLoseFocusHdl( aLk3 );
+m_aWidthMF.SetLoseFocusHdl( aLk3 );
 
 m_pRelWidthCB->SetClickHdl(LINK( this, SwFormatTablePage, RelWidthClickHdl 
));
 }
@@ -269,7 +282,11 @@ void SwFormatTablePage::RightModify()
 }
 }
 
-IMPL_LINK( SwFormatTablePage, UpDownHdl, Edit&, rEdit, void )
+IMPL_LINK( SwFormatTablePage, LoseFocusHdl, Control&, rControl, void )
+{
+UpDownHdl(static_cast(rControl));
+}
+IMPL_LINK( SwFormatTablePage, UpDownHdl, SpinField&, rEdit, void )
 {
 if( m_aRightMF.get() == )
 RightModify();
@@ -572,6 +589,7 @@ void  SwFormatTablePage::Reset( const SfxItemSet* )
 m_aRightMF.SetMax( m_aRightMF.NormalizePercent( pTableData->GetSpace() ), 
FUNIT_TWIP );
 m_aLeftMF.SetMax( m_aLeftMF.NormalizePercent( pTableData->GetSpace() ), 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2018-01-03 Thread Caolán McNamara
 sw/source/filter/html/swhtml.cxx |   41 ++-
 sw/source/filter/html/swhtml.hxx |2 +
 2 files changed, 26 insertions(+), 17 deletions(-)

New commits:
commit ef3d75d90724b29c6367f6b0dc4502cfb417ac84
Author: Caolán McNamara 
Date:   Thu Dec 28 22:28:08 2017 +

ofz#4817 Chaos with multiple body tags

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

diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 7a6d70b612d1..057dc3ad4c04 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -296,6 +296,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, 
SvStream& rIn,
 m_bInFootEndNoteSymbol( false ),
 m_bIgnoreHTMLComments( bNoHTMLComments ),
 m_bRemoveHidden( false ),
+m_bBodySeen( false ),
 m_pTempViewFrame(nullptr)
 {
 m_nEventId = nullptr;
@@ -1245,25 +1246,31 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken )
 switch( nToken )
 {
 case HtmlTokenId::BODY_ON:
-if( !m_aStyleSource.isEmpty() )
-{
-m_pCSS1Parser->ParseStyleSheet( m_aStyleSource );
-m_aStyleSource.clear();
-}
-if( IsNewDoc() )
+if (m_bBodySeen)
+eState = SvParserState::Error;
+else
 {
-InsertBodyOptions();
-// If there is a template for the first or the right page,
-// it is set here.
-const SwPageDesc *pPageDesc = nullptr;
-if( m_pCSS1Parser->IsSetFirstPageDesc() )
-pPageDesc = m_pCSS1Parser->GetFirstPageDesc();
-else if( m_pCSS1Parser->IsSetRightPageDesc() )
-pPageDesc = m_pCSS1Parser->GetRightPageDesc();
-
-if( pPageDesc )
+m_bBodySeen = true;
+if( !m_aStyleSource.isEmpty() )
 {
-m_xDoc->getIDocumentContentOperations().InsertPoolItem( 
*m_pPam, SwFormatPageDesc( pPageDesc ) );
+m_pCSS1Parser->ParseStyleSheet( m_aStyleSource );
+m_aStyleSource.clear();
+}
+if( IsNewDoc() )
+{
+InsertBodyOptions();
+// If there is a template for the first or the right page,
+// it is set here.
+const SwPageDesc *pPageDesc = nullptr;
+if( m_pCSS1Parser->IsSetFirstPageDesc() )
+pPageDesc = m_pCSS1Parser->GetFirstPageDesc();
+else if( m_pCSS1Parser->IsSetRightPageDesc() )
+pPageDesc = m_pCSS1Parser->GetRightPageDesc();
+
+if( pPageDesc )
+{
+m_xDoc->getIDocumentContentOperations().InsertPoolItem( 
*m_pPam, SwFormatPageDesc( pPageDesc ) );
+}
 }
 }
 break;
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 98b380dbb13c..66f7837704ae 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -472,6 +472,8 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
 bool m_bIgnoreHTMLComments : 1;
 bool m_bRemoveHidden : 1; // the filter implementation might set the 
hidden flag
 
+bool m_bBodySeen : 1;
+
 /// the names corresponding to the DOCINFO field subtypes INFO[1-4]
 OUString m_InfoNames[4];
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-27 Thread Jim Raykowski
 sw/source/ui/table/tautofmt.cxx|   20 +---
 sw/source/uibase/shells/basesh.cxx |9 -
 2 files changed, 21 insertions(+), 8 deletions(-)

New commits:
commit 203b913155812706e9be14c5fe2b8f543cc4fdc7
Author: Jim Raykowski 
Date:   Tue Oct 31 15:48:07 2017 -0800

tdf#107555 Apply 'Default Style' table style to newly inserted tables

Change-Id: Iac32542bdefc32b07c63cc41cf0f693cc2ca799d
Reviewed-on: https://gerrit.libreoffice.org/44147
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 416f7578d6332b5b5a4445f26307d73925188e41)
Reviewed-on: https://gerrit.libreoffice.org/46842
Reviewed-by: Yousuf Philips 

diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index a4e9080be0ed..7c2a2d66e602 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -262,6 +262,16 @@ void SwAutoFormatDlg::UpdateChecks( const 
SwTableAutoFormat& rFormat, bool bEnab
 m_pBtnAlignment->Check( rFormat.IsJustify() );
 }
 
+static void lcl_SetProperties( SwTableAutoFormat* pTableAutoFormat, bool bVal )
+{
+pTableAutoFormat->SetFont( bVal );
+pTableAutoFormat->SetJustify( bVal );
+pTableAutoFormat->SetFrame( bVal );
+pTableAutoFormat->SetBackground( bVal );
+pTableAutoFormat->SetValueFormat( bVal );
+pTableAutoFormat->SetWidthHeight( bVal );
+}
+
 void SwAutoFormatDlg::FillAutoFormatOfIndex( SwTableAutoFormat*& rToFill ) 
const
 {
 if( 255 != nIndex )
@@ -274,7 +284,8 @@ void SwAutoFormatDlg::FillAutoFormatOfIndex( 
SwTableAutoFormat*& rToFill ) const
 else
 {
 delete rToFill;
-rToFill = nullptr;
+rToFill = new SwTableAutoFormat( SwViewShell::GetShellRes()->aStrNone 
);
+lcl_SetProperties( rToFill, false );
 }
 }
 
@@ -482,12 +493,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFormatHdl, ListBox&, 
void)
 nIndex = 255;
 
 SwTableAutoFormat aTmp( SwViewShell::GetShellRes()->aStrNone );
-aTmp.SetFont( false );
-aTmp.SetJustify( false );
-aTmp.SetFrame( false );
-aTmp.SetBackground( false );
-aTmp.SetValueFormat( false );
-aTmp.SetWidthHeight( false );
+lcl_SetProperties( , false );
 
 if( nOldIdx != nIndex )
 m_pWndPreview->NotifyChange( aTmp );
diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index 58ee634b334b..9d907536b750 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -107,6 +107,10 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;
 
 // These variables keep the state of Gallery (slot SID_GALLERY_BG_BRUSH)
@@ -2684,7 +2688,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
 {
 // record before shell change
 _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, 
aTableName ) );
-if ( !aAutoName.isEmpty() )
+if ( !aAutoName.isEmpty() && aAutoName != 
SwViewShell::GetShellRes()->aStrNone )
 _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoName 
) );
 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, 
nCols ) );
 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows 
) );
@@ -2704,6 +2708,9 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
 if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) )
 rSh.GetTableFormat()->SetName( aTableName );
 
+if( pTAFormat == nullptr )
+rSh.SetTableStyle( SwStyleNameMapper::GetUIName( 
RES_POOLTABSTYLE_DEFAULT, OUString() ) );
+
 rSh.EndAllAction();
 rTempView.AutoCaption(TABLE_CAP);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-18 Thread Michael Stahl
 sw/source/uibase/index/toxmgr.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 4d4dfeac7cf8cd14efa15a2c5204afc9af4f680c
Author: Michael Stahl 
Date:   Thu Dec 14 18:52:15 2017 +0100

tdf#100635 sw: fix crash in SwTOXMgr::UpdateOrInsertTOX()

GetAuthBrackets() returns an empty string if the user selects
[None], in that case apparently 0 bytes are used, multiple places
check for that.

Change-Id: I8375621fa553bc780db343ed8a0bd7ecb3c832dc
(cherry picked from commit 2993bb634dc9ea66af90671a55a4503843338746)
Reviewed-on: https://gerrit.libreoffice.org/46568
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/uibase/index/toxmgr.cxx 
b/sw/source/uibase/index/toxmgr.cxx
index bbd2b293628d..b5b8b31e9198 100644
--- a/sw/source/uibase/index/toxmgr.cxx
+++ b/sw/source/uibase/index/toxmgr.cxx
@@ -355,8 +355,16 @@ bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& 
rDesc,
 pFType = static_cast(
 pSh->InsertFieldType(type));
 }
-pFType->SetPreSuffix(rDesc.GetAuthBrackets()[0],
-rDesc.GetAuthBrackets()[1]);
+OUString const& rBrackets(rDesc.GetAuthBrackets());
+if (rBrackets.isEmpty())
+{
+pFType->SetPreSuffix('\0', '\0');
+}
+else
+{
+assert(rBrackets.getLength() == 2);
+pFType->SetPreSuffix(rBrackets[0], rBrackets[1]);
+}
 pFType->SetSequence(rDesc.IsAuthSequence());
 SwTOXSortKey rArr[3];
 rArr[0] = rDesc.GetSortKey1();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-13 Thread Michael Stahl
 sw/source/core/layout/atrfrm.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 0c8a30ba47c6ed64c45063a060356e61e82a789f
Author: Michael Stahl 
Date:   Tue Dec 12 22:47:15 2017 +0100

tdf#114396 sw: overly strict assertions in SwFrameFormat::Modify()

It's only a problem if the style contains an anchor position;
the anchor type by itself is fine, and the wrong assertion is
particularly stupid considering that
DocumentStylePoolManager::GetFormatFromPool() inits various
built-in styles with anchor types.

(regression from eed046433a847d3005e52c38963fb883322a39e6)

Change-Id: If8ac000b7f888686725d6bf0ef8e5fb38198c889
(cherry picked from commit 1e70464c380ecc0756ea29098632c503a60aec71)
Reviewed-on: https://gerrit.libreoffice.org/46358
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 37a3b2bd44ae..118f551cbf4c 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2623,8 +2623,9 @@ void SwFrameFormat::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem* pNew )
 static_cast< const SwAttrSetChg* >(pNew)->GetChgSet()->GetItemState( 
RES_ANCHOR, false,  );
 if( tmp )
 {
-assert(static_cast(pNew)->GetTheChgdSet() == 
_aSet); // must not be style's set!
 newAnchorPosition = static_cast< const SwFormatAnchor* >( tmp 
)->GetContentAnchor();
+assert(newAnchorPosition == nullptr || // style's set must not 
contain position!
+static_cast(pNew)->GetTheChgdSet() == 
_aSet);
 }
 }
 if( pNew && pNew->Which() == RES_ANCHOR )
@@ -2635,8 +2636,9 @@ void SwFrameFormat::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem* pNew )
 static_cast< const SwAttrSetChg* >(pOld)->GetChgSet()->GetItemState( 
RES_ANCHOR, false,  );
 if( tmp )
 {
-assert(static_cast(pOld)->GetTheChgdSet() == 
_aSet); // must not be style's set!
 oldAnchorPosition = static_cast< const SwFormatAnchor* >( tmp 
)->GetContentAnchor();
+assert(oldAnchorPosition == nullptr || // style's set must not 
contain position!
+static_cast(pOld)->GetTheChgdSet() == 
_aSet);
 }
 }
 if( pOld && pOld->Which() == RES_ANCHOR )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-12 Thread Xisco Fauli
 sw/source/uibase/shells/basesh.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit cc77f3cff1d5926c460fd6418397bd6295497c1f
Author: Xisco Fauli 
Date:   Mon Dec 4 19:03:45 2017 +0100

tdf#114219: Show Edit dialog entry in link section

Change-Id: I35c34d427cc5440994fc16ed7e4d307bc95bc533
Reviewed-on: https://gerrit.libreoffice.org/45817
Tested-by: Jenkins 
Reviewed-by: Gülşah Köse 
(cherry picked from commit 2eae1d741ebdc1e2ce1e512960e8152e178e0150)
Reviewed-on: https://gerrit.libreoffice.org/45930
Reviewed-by: Xisco Faulí 

diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index 0b2ef68570cf..58ee634b334b 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1400,7 +1400,8 @@ void SwBaseShell::GetState( SfxItemSet  )
 case FN_EDIT_CURRENT_REGION:
 //tdf#112808 if cursor is in an index, don't show the edit 
section.
 if( !rSh.GetCurrSection() ||
-rSh.GetCurrSection()->GetType() != CONTENT_SECTION )
+(rSh.GetCurrSection()->GetType() != CONTENT_SECTION &&
+rSh.GetCurrSection()->GetType() != FILE_LINK_SECTION ))
 {
 rSet.DisableItem(nWhich);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-09 Thread Szymon Kłos
 sw/source/core/edit/edfcol.cxx |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 0622e5db4e330de000f1318540c85e3223f45b40
Author: Szymon Kłos 
Date:   Fri Dec 8 22:15:21 2017 +0100

tdf#114338 don't crash on watermark insert w/ existing header

Change-Id: I63abaf48c33d6660f1829b7d503de295e4a57f9c
Reviewed-on: https://gerrit.libreoffice.org/46126
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 
(cherry picked from commit d4a54ec92674773bc0f9358a3d9090915a3c8fb0)
Reviewed-on: https://gerrit.libreoffice.org/46140

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 60bba7d3c3d7..d679a4105acd 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -169,8 +169,10 @@ bool lcl_hasField(const uno::Reference& 
xText, const OUString& rSer
 }
 
 /// Search for a frame with WATERMARK_NAME in name of type rServiceName in 
xText. Returns found name in rShapeName.
-uno::Reference lcl_getWatermark(const 
uno::Reference& xText, const OUString& rServiceName, OUString& 
rShapeName)
+uno::Reference lcl_getWatermark(const 
uno::Reference& xText,
+const OUString& rServiceName, OUString& rShapeName, bool& bSuccess)
 {
+bSuccess = false;
 uno::Reference 
xParagraphEnumerationAccess(xText, uno::UNO_QUERY);
 uno::Reference xParagraphs = 
xParagraphEnumerationAccess->createEnumeration();
 while (xParagraphs->hasMoreElements())
@@ -179,6 +181,8 @@ uno::Reference lcl_getWatermark(const 
uno::Reference xTextPortions = 
xTextPortionEnumerationAccess->createEnumeration();
 while (xTextPortions->hasMoreElements())
 {
@@ -1382,7 +1386,8 @@ SfxWatermarkItem SwEditShell::GetWatermark()
 
 OUString aShapeServiceName = "com.sun.star.drawing.CustomShape";
 OUString sWatermark = "";
-uno::Reference xWatermark = 
lcl_getWatermark(xHeaderText, aShapeServiceName, sWatermark);
+bool bSuccess = false;
+uno::Reference xWatermark = 
lcl_getWatermark(xHeaderText, aShapeServiceName, sWatermark, bSuccess);
 
 if (xWatermark.is())
 {
@@ -1416,10 +1421,14 @@ void lcl_placeWatermarkInHeader(const SfxWatermarkItem& 
rWatermark,
 const uno::Reference& 
xPageStyle,
 const uno::Reference& xHeaderText)
 {
+if (!xHeaderText.is())
+return;
+
 uno::Reference xMultiServiceFactory(xModel, 
uno::UNO_QUERY);
 OUString aShapeServiceName = "com.sun.star.drawing.CustomShape";
 OUString sWatermark = WATERMARK_NAME;
-uno::Reference xWatermark = lcl_getWatermark(xHeaderText, 
aShapeServiceName, sWatermark);
+bool bSuccess = false;
+uno::Reference xWatermark = lcl_getWatermark(xHeaderText, 
aShapeServiceName, sWatermark, bSuccess);
 
 bool bDeleteWatermark = rWatermark.GetText().isEmpty();
 if (xWatermark.is())
@@ -1453,7 +1462,7 @@ void lcl_placeWatermarkInHeader(const SfxWatermarkItem& 
rWatermark,
 }
 }
 
-if (xWatermark.is() || bDeleteWatermark)
+if (!bSuccess || xWatermark.is() || bDeleteWatermark)
 return;
 
 OUString sFont = rWatermark.GetFont();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-07 Thread Caolán McNamara
 sw/source/core/tox/ToxTextGenerator.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c4973602128209b8e39e26462c9e73a3bafe9ec1
Author: Caolán McNamara 
Date:   Wed Dec 6 17:05:24 2017 +

table of objects crashes on first update with object in document

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

diff --git a/sw/source/core/tox/ToxTextGenerator.cxx 
b/sw/source/core/tox/ToxTextGenerator.cxx
index 61b664e70c09..3742fd1e3cd0 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -303,8 +303,8 @@ ToxTextGenerator::HandleTextToken(const SwTOXSortTabBase& 
source, SwAttrPool& po
 if( source.aTOXSources.empty() )
 return result;
 
-const SwTextNode* pSrc = source.aTOXSources.at(0).pNd->GetTextNode();
-if (!pSrc->HasHints()) {
+const SwTextNode* pSrc = source.aTOXSources.front().pNd->GetTextNode();
+if (!pSrc || !pSrc->HasHints()) {
 return result;
 }
 const SwpHints& hints = pSrc->GetSwpHints();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-06 Thread Bernhard Widl
 sw/source/uibase/docvw/edtwin.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 72172b4568fb74669fd2269ef29176527363f024
Author: Bernhard Widl 
Date:   Wed Dec 6 10:46:29 2017 +0100

tdf#114093 fixing regression when clicking on fields

Change-Id: I6e5c7e644f26ca85a6c55ec5456add46a7b05404
Reviewed-on: https://gerrit.libreoffice.org/45927
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 1c41d4e229deb5ae9d5d06df6c8d2585619bc102)
Reviewed-on: https://gerrit.libreoffice.org/45953

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index f4c8de1812b6..da86a7d49149 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3371,8 +3371,12 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 case TYP_AUTHORITY :
 
pVFrame->GetBindings().Execute(FN_EDIT_AUTH_ENTRY_DLG);
 break;
-default:
+case TYP_INPUTFLD:
+case TYP_DROPDOWN:
 
pVFrame->GetBindings().Execute(FN_UPDATE_INPUTFIELDS);
+break;
+default:
+
pVFrame->GetBindings().Execute(FN_EDIT_FIELD);
 }
 }
 return;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-04 Thread Samuel Mehrbrodt
 sw/source/core/graphic/ndgrf.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 4e8f20a5c2731f3aecffa515dc73a3fc071af6d6
Author: Samuel Mehrbrodt 
Date:   Fri Dec 1 15:16:18 2017 +0100

Related tdf#72966 Provide replacement graphic also for metafiles

In 6b3cc69fd2b2de5ace68f2739eb383267d66f76f this was done for draw images,
this patch also implements this for Writer images.

Change-Id: I54f8142c3d22e1a356aedbcf2daf9d7a9b049423
Reviewed-on: https://gerrit.libreoffice.org/45673
Tested-by: Jenkins 
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 2d3023c9713c4c7cac732a6831c69dec581a7751)
Reviewed-on: https://gerrit.libreoffice.org/45800

diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 7ef061715ba8..412122fb4da9 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -403,9 +403,10 @@ const GraphicObject* SwGrfNode::GetReplacementGrfObj() 
const
 {
 const_cast< SwGrfNode* >(this)->mpReplacementGraphic = new 
GraphicObject(rVectorGraphicDataPtr->getReplacement());
 }
-else if (GetGrfObj().GetGraphic().getPdfData().hasElements())
+else if (GetGrfObj().GetGraphic().getPdfData().hasElements()
+ || GetGrfObj().GetGraphic().GetType() == 
GraphicType::GdiMetafile)
 {
-// This returns the bitmap, without the pdf data.
+// Replacement graphic for PDF and metafiles is just the bitmap.
 const_cast(this)->mpReplacementGraphic = new 
GraphicObject(GetGrfObj().GetGraphic().GetBitmapEx());
 }
 if (mpReplacementGraphic)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-02 Thread Eike Rathke
 sw/source/core/table/swtable.cxx |   27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

New commits:
commit fd2cdd325cd59eb1f967136170503145b1d75936
Author: Eike Rathke 
Date:   Fri Dec 1 19:46:45 2017 +0100

Resolves: tdf#106322 keep original cell content when assigning number format

... and content can't be parsed as number. Instead of converting 0.

Change-Id: Ief0c0a0284762fc0e801d6cc598720a97d733e31
(cherry picked from commit acf7e4c0a3dc0cca986bf4d4b7a65bafe7e70abc)
Reviewed-on: https://gerrit.libreoffice.org/45695
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 1312f5dce36a..dc3c749fd802 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2268,6 +2268,8 @@ void SwTableBoxFormat::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem* pNew
 
 if( (!bNewIsTextFormat && nOldFormat != nNewFormat) || 
pNewFormula )
 {
+bool bIsNumFormat = false;
+OUString aOrigText;
 bool bChgText = true;
 double fVal = 0;
 if( !pNewVal && SfxItemState::SET != GetItemState(
@@ -2280,6 +2282,7 @@ void SwTableBoxFormat::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem* pNew
 sal_uInt32 nTmpFormatIdx = nNewFormat;
 OUString aText( GetDoc()->GetNodes()[ nNdPos ]
 
->GetTextNode()->GetRedlineText());
+aOrigText = aText;
 if( aText.isEmpty() )
 bChgText = false;
 else
@@ -2289,7 +2292,6 @@ void SwTableBoxFormat::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem* pNew
 
 // JP 22.04.98: Bug 49659 -
 //  Special casing for percent
-bool bIsNumFormat = false;
 if( css::util::NumberFormat::PERCENT ==
 pNumFormatr->GetType( nNewFormat ))
 {
@@ -2322,7 +2324,10 @@ void SwTableBoxFormat::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem* pNew
 }
 }
 else
+{
 fVal = pNewVal->GetValue();
+bIsNumFormat = true;
+}
 
 // format contents with the new value assigned and 
write to paragraph
 Color* pCol = nullptr;
@@ -2333,7 +2338,25 @@ void SwTableBoxFormat::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem* pNew
 }
 else
 {
-pNumFormatr->GetOutputString( fVal, nNewFormat, 
sNewText,  );
+if (bIsNumFormat)
+pNumFormatr->GetOutputString( fVal, 
nNewFormat, sNewText,  );
+else
+{
+// Original text could not be parsed as
+// number/date/time/..., so keep the text.
+#if 0
+// Actually the text should be formatted
+// according to the format, which may include
+// additional text from the format, for example
+// in {0;-0;"BAD: "@}. But other places when
+// entering a new value or changing text or
+// changing to a different format of type Text
+// don't do this (yet?).
+pNumFormatr->GetOutputString( aOrigText, 
nNewFormat, sNewText,  );
+#else
+sNewText = aOrigText;
+#endif
+}
 
 if( !bChgText )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-02 Thread Michael Meeks
 sw/source/core/layout/paintfrm.cxx |   41 -
 1 file changed, 9 insertions(+), 32 deletions(-)

New commits:
commit 4ec42ad9976698d09afb8f9f3f5ec232b48dfca0
Author: Michael Meeks 
Date:   Wed Nov 29 21:22:51 2017 +

Writer page shadow - avoid scaling stored bitmaps at all.

Follow-on improvement from previous leak fix.

Change-Id: Iad18da20c3ee03cbafd191ddd722f58bd45911be
Reviewed-on: https://gerrit.libreoffice.org/45538
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 
(cherry picked from commit 268d019c4b05f37e99e1da85472dc9255f186a27)
Reviewed-on: https://gerrit.libreoffice.org/45661

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 4024f341defc..e2187a1da863 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5876,7 +5876,6 @@ bool SwPageFrame::IsLeftShadowNeeded() const
 }
 
 enum PaintArea {LEFT, RIGHT, TOP, BOTTOM};
-#define BORDER_TILE_SIZE 512
 
 /// Wrapper around pOut->DrawBitmapEx.
 static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& 
aPoint, const Size& aSize, const BitmapEx& rBitmapEx, PaintArea eArea)
@@ -5898,24 +5897,14 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 pOut->SetLineColor();
 pOut->DrawRect(pOut->PixelToLogic(aRect));
 
-// Tiled render if necessary
-tools::Rectangle aComplete(aPoint, aSize);
-Size aTileSize(BORDER_TILE_SIZE, BORDER_TILE_SIZE);
-
-long iterX = eArea != RIGHT && eArea != LEFT ? BORDER_TILE_SIZE : 0;
-long iterY = eArea == RIGHT || eArea == LEFT ? BORDER_TILE_SIZE : 0;
-
-for (tools::Rectangle aTile = tools::Rectangle(aPoint, aTileSize); true; 
aTile.Move(iterX, iterY))
-{
-tools::Rectangle aRender = aComplete.GetIntersection(aTile);
-if (aRender.IsEmpty())
-break;
-pOut->DrawBitmapEx(pOut->PixelToLogic(aRender.TopLeft()),
-   pOut->PixelToLogic(aRender.GetSize()),
-   Point(0, 0), aRender.GetSize(),
-   rBitmapEx);
-}
+Size aOutSize = pOut->PixelToLogic(aSize);
+Point aOutPoint = pOut->PixelToLogic(aPoint);
 
+pOut->DrawTransformedBitmapEx(
+basegfx::utils::createScaleTranslateB2DHomMatrix(
+aOutSize.Width(), aOutSize.Height(),
+aOutPoint.X(), aOutPoint.Y()),
+rBitmapEx);
 }
 
 /**
@@ -6027,9 +6016,6 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 {
 const long nWidth = aPageRightShadow.GetSizePixel().Width();
 const long nHeight = aPagePxRect.Height() - 2 * (mnShadowPxWidth - 
1);
-if (aPageRightShadow.GetSizePixel().Height() < BORDER_TILE_SIZE)
-aPageRightShadow.Scale(Size(nWidth, BORDER_TILE_SIZE), 
BmpScaleFlag::Fast);
-
 lcl_paintBitmapExToRect(pOut,
 Point(aPaintRect.Right() + mnShadowPxWidth, 
aPagePxRect.Top() + mnShadowPxWidth - 1),
 Size(nWidth, nHeight),
@@ -6048,9 +6034,6 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 {
 const long nWidth = aPageLeftShadow.GetSizePixel().Width();
 const long nHeight = aPagePxRect.Height() - 2 * (mnShadowPxWidth - 
1);
-if (aPageLeftShadow.GetSizePixel().Height() < BORDER_TILE_SIZE)
-aPageLeftShadow.Scale(Size(nWidth, BORDER_TILE_SIZE), 
BmpScaleFlag::Fast);
-
 lcl_paintBitmapExToRect(pOut,
 Point(lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1),
 Size(nWidth, nHeight),
@@ -6060,22 +6043,16 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 
 // Bottom shadow
 const long nBottomHeight = aPageBottomShadow.GetSizePixel().Height();
-if (aPageBottomShadow.GetSizePixel().Width() < BORDER_TILE_SIZE)
-aPageBottomShadow.Scale(Size(BORDER_TILE_SIZE, nBottomHeight), 
BmpScaleFlag::Fast);
-
 lcl_paintBitmapExToRect(pOut,
 Point(aPaintRect.Left(), aPagePxRect.Bottom() + 2),
-Size(aPaintRect.Width(), nBottomHeight),
+Size(aPaintRect.Width() - 1, nBottomHeight),
 aPageBottomShadow, BOTTOM);
 
 // Top shadow
 const long nTopHeight = aPageTopShadow.GetSizePixel().Height();
-if (aPageTopShadow.GetSizePixel().Width() < BORDER_TILE_SIZE)
-aPageTopShadow.Scale(Size(BORDER_TILE_SIZE, nTopHeight), 
BmpScaleFlag::Fast);
-
 lcl_paintBitmapExToRect(pOut,
 Point(aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth),
-Size(aPaintRect.Width(), nTopHeight),
+Size(aPaintRect.Width() - 1, nTopHeight),
 aPageTopShadow, 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-12-01 Thread Caolán McNamara
 sw/source/ui/fldui/fldvar.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 0471edee5f47c6bca74895b7b9f8968a922cb954
Author: Caolán McNamara 
Date:   Thu Nov 30 16:19:26 2017 +

Resolves: tdf#114112 sort 'select' list

Change-Id: I0b80b2f7e8377f92a397b6557d2c3fad3e63f16a
Reviewed-on: https://gerrit.libreoffice.org/45607
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index 46fd6eb88802..cf3434c42e80 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -48,6 +48,7 @@ SwFieldVarPage::SwFieldVarPage(vcl::Window* pParent, const 
SfxItemSet *const pCo
 get(m_pTypeLB, "type");
 get(m_pSelection, "selectframe");
 get(m_pSelectionLB, "select");
+m_pSelectionLB->SetStyle(m_pSelectionLB->GetStyle() | WB_SORT);
 get(m_pFormat, "formatframe");
 get(m_pChapterFrame, "chapterframe");
 get(m_pNameFT, "nameft");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-11-30 Thread Caolán McNamara
 sw/source/core/table/swnewtable.cxx |   32 
 1 file changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 9cf42b259dadd55380c39c4ba8c2aa6eeba3de31
Author: Caolán McNamara 
Date:   Mon Nov 27 17:07:25 2017 +

ofz: fix mem leak

Change-Id: I97b6ad9b0e873ac75a8791c731a1a8a862ef01af
Reviewed-on: https://gerrit.libreoffice.org/45365
Reviewed-by: Michael Stahl 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index 9a2a7372ddd8..cc0a5fd403d0 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -60,11 +60,11 @@
 class SwBoxSelection
 {
 public:
-std::vector aBoxes;
+std::vector maBoxes;
 long mnMergeWidth;
 SwBoxSelection() : mnMergeWidth(0) {}
-bool isEmpty() const { return aBoxes.empty(); }
-void insertBoxes( const SwSelBoxes* pNew ){ aBoxes.insert( aBoxes.end(), 
pNew ); }
+bool isEmpty() const { return maBoxes.empty(); }
+void push_back(const SwSelBoxes& rNew) { maBoxes.push_back(rNew); }
 };
 
 /** NewMerge(..) removes the superfluous cells after cell merge
@@ -381,7 +381,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& 
rPam ) const
 {
 SwTableLine* pLine = m_aLines[nRow];
 OSL_ENSURE( pLine, "Missing table line" );
-SwSelBoxes *pBoxes = new SwSelBoxes;
+SwSelBoxes aBoxes;
 long nRight = 0;
 const size_t nCount = pLine->GetTabBoxes().size();
 for( size_t nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
@@ -408,7 +408,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& 
rPam ) const
 {
 if( nCurrBox )
 {
-pBoxes->insert( pBox );
+aBoxes.insert(pBox);
 pInnerBox = pBox;
 pLeftBox = pLine->GetTabBoxes()[nCurrBox-1];
 nDiff = nMin - nLeft;
@@ -439,7 +439,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& 
rPam ) const
 }
 else if( nRight <= nMax )
 {
-pBoxes->insert( pBox );
+aBoxes.insert(pBox);
 if( nRow == nTop && nRowSpan < 0 )
 {
 bOkay = false;
@@ -458,7 +458,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& 
rPam ) const
 {
 if( nCurrBox+1 < nCount )
 {
-pBoxes->insert( pBox );
+aBoxes.insert(pBox);
 pInnerBox = pBox;
 pRightBox = pLine->GetTabBoxes()[nCurrBox+1];
 nDiff = nRight - nMax;
@@ -558,7 +558,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& 
rPam ) const
 --nLeftSpanCnt;
 if( nRightSpanCnt )
 --nRightSpanCnt;
-pRet->insertBoxes( pBoxes );
+pRet->push_back(aBoxes);
 }
 pRet->mnMergeWidth = nMax - nMin;
 if( nCheckBottom > nBottom )
@@ -822,7 +822,7 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& 
rBoxes,
 // i.e. contiguous cells in contiguous rows
 bool bMerge = false; // will be set if any content is transferred from
 // a "not already overlapped" cell into the new master cell.
-SwTableBox *pMergeBox = (*pSel->aBoxes[0])[0]; // the master cell box
+SwTableBox *pMergeBox = pSel->maBoxes[0][0]; // the master cell box
 if( !pMergeBox )
 return false;
 (*ppMergeBox) = pMergeBox;
@@ -837,7 +837,7 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& 
rBoxes,
 SwPosition aInsPos( *pMergeBox->GetSttNd()->EndOfSectionNode() );
 SwPaM aChkPam( aInsPos );
 // The number of lines in the selection rectangle: nLineCount
-const size_t nLineCount = pSel->aBoxes.size();
+const size_t nLineCount = pSel->maBoxes.size();
 // BTW: nLineCount is the rowspan of the new master cell
 long nRowSpan = static_cast(nLineCount);
 // We will need the first and last line of the selection
@@ -848,12 +848,12 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, 
SwSelBoxes& rBoxes,
 for( size_t nCurrLine = 0; nCurrLine < nLineCount; ++nCurrLine )
 {
 // The selected boxes in the current line
-const SwSelBoxes* pBoxes = pSel->aBoxes[ nCurrLine ];
-size_t nColCount = pBoxes->size();
+const SwSelBoxes& rLineBoxes = pSel->maBoxes[nCurrLine];
+size_t nColCount = rLineBoxes.size();
 // Iteration over the selected cell in the current row
 for (size_t nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol)
 {
-SwTableBox* pBox = (*pBoxes)[nCurrCol];
+SwTableBox* pBox = rLineBoxes[nCurrCol];
 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-11-30 Thread Michael Meeks
 sw/source/core/layout/paintfrm.cxx |   40 +
 1 file changed, 28 insertions(+), 12 deletions(-)

New commits:
commit 28fba41403d80c224c744cdf477acbab326b01c0
Author: Michael Meeks 
Date:   Mon Nov 27 20:53:48 2017 +

Tile the writer surround rendering to avoid large image scaling.

This also fixes a potentially large memory leak depending on zoom,
and particularly with non-paginated rendering.

Change-Id: Ia24e0b7baea725020f000a369708b0be3fc20c95
Reviewed-on: https://gerrit.libreoffice.org/45414
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Reviewed-on: https://gerrit.libreoffice.org/45466
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 51370b19b021..4024f341defc 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5876,6 +5876,7 @@ bool SwPageFrame::IsLeftShadowNeeded() const
 }
 
 enum PaintArea {LEFT, RIGHT, TOP, BOTTOM};
+#define BORDER_TILE_SIZE 512
 
 /// Wrapper around pOut->DrawBitmapEx.
 static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& 
aPoint, const Size& aSize, const BitmapEx& rBitmapEx, PaintArea eArea)
@@ -5893,13 +5894,28 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 case BOTTOM: aRect.Bottom() = aRect.Top() + 1; break;
 }
 
-pOut->SetFillColor( SwViewOption::GetAppBackgroundColor());
+pOut->SetFillColor(SwViewOption::GetAppBackgroundColor());
 pOut->SetLineColor();
 pOut->DrawRect(pOut->PixelToLogic(aRect));
 
-pOut->DrawBitmapEx(pOut->PixelToLogic(aPoint), pOut->PixelToLogic(aSize),
-Point(0, 0), aSize,
-rBitmapEx);
+// Tiled render if necessary
+tools::Rectangle aComplete(aPoint, aSize);
+Size aTileSize(BORDER_TILE_SIZE, BORDER_TILE_SIZE);
+
+long iterX = eArea != RIGHT && eArea != LEFT ? BORDER_TILE_SIZE : 0;
+long iterY = eArea == RIGHT || eArea == LEFT ? BORDER_TILE_SIZE : 0;
+
+for (tools::Rectangle aTile = tools::Rectangle(aPoint, aTileSize); true; 
aTile.Move(iterX, iterY))
+{
+tools::Rectangle aRender = aComplete.GetIntersection(aTile);
+if (aRender.IsEmpty())
+break;
+pOut->DrawBitmapEx(pOut->PixelToLogic(aRender.TopLeft()),
+   pOut->PixelToLogic(aRender.GetSize()),
+   Point(0, 0), aRender.GetSize(),
+   rBitmapEx);
+}
+
 }
 
 /**
@@ -6011,8 +6027,8 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 {
 const long nWidth = aPageRightShadow.GetSizePixel().Width();
 const long nHeight = aPagePxRect.Height() - 2 * (mnShadowPxWidth - 
1);
-if (aPageRightShadow.GetSizePixel().Height() < nHeight)
-aPageRightShadow.Scale(Size(nWidth, nHeight), 
BmpScaleFlag::Fast);
+if (aPageRightShadow.GetSizePixel().Height() < BORDER_TILE_SIZE)
+aPageRightShadow.Scale(Size(nWidth, BORDER_TILE_SIZE), 
BmpScaleFlag::Fast);
 
 lcl_paintBitmapExToRect(pOut,
 Point(aPaintRect.Right() + mnShadowPxWidth, 
aPagePxRect.Top() + mnShadowPxWidth - 1),
@@ -6032,8 +6048,8 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 {
 const long nWidth = aPageLeftShadow.GetSizePixel().Width();
 const long nHeight = aPagePxRect.Height() - 2 * (mnShadowPxWidth - 
1);
-if (aPageLeftShadow.GetSizePixel().Height() < nHeight)
-aPageLeftShadow.Scale(Size(nWidth, nHeight), 
BmpScaleFlag::Fast);
+if (aPageLeftShadow.GetSizePixel().Height() < BORDER_TILE_SIZE)
+aPageLeftShadow.Scale(Size(nWidth, BORDER_TILE_SIZE), 
BmpScaleFlag::Fast);
 
 lcl_paintBitmapExToRect(pOut,
 Point(lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1),
@@ -6044,8 +6060,8 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 
 // Bottom shadow
 const long nBottomHeight = aPageBottomShadow.GetSizePixel().Height();
-if (aPageBottomShadow.GetSizePixel().Width() < aPaintRect.Width())
-aPageBottomShadow.Scale(Size(aPaintRect.Width(), nBottomHeight), 
BmpScaleFlag::Fast);
+if (aPageBottomShadow.GetSizePixel().Width() < BORDER_TILE_SIZE)
+aPageBottomShadow.Scale(Size(BORDER_TILE_SIZE, nBottomHeight), 
BmpScaleFlag::Fast);
 
 lcl_paintBitmapExToRect(pOut,
 Point(aPaintRect.Left(), aPagePxRect.Bottom() + 2),
@@ -6054,8 +6070,8 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
 
 // Top shadow
 const long nTopHeight = 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/source

2017-11-28 Thread Caolán McNamara
 sw/source/filter/ww8/ww8par6.cxx |   13 +++--
 sw/source/filter/ww8/ww8scan.cxx |9 -
 2 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit f3c4dd743c026d9e987656d0abd4979df6f11b30
Author: Caolán McNamara 
Date:   Tue Nov 28 10:55:39 2017 +

ofz: check sprm bounds

and don't reuse results of previous search

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

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index f6bf8446ecbc..3678807b542f 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -1266,24 +1266,25 @@ static sal_uInt8 lcl_ReadBorders(bool bVer67, 
WW8_BRCVer9* brc, WW8PLCFx_Cp_FKP*
 {
 if( !bVer67 )
 {
-SprmResult aSprm[4];
-
+SprmResult a8Sprm[4];
 if (pSep->Find4Sprms(
 NS_sprm::sprmSBrcTop80, NS_sprm::sprmSBrcLeft80,
 NS_sprm::sprmSBrcBottom80, NS_sprm::sprmSBrcRight80,
-aSprm[0], aSprm[1], aSprm[2], aSprm[3]))
+a8Sprm[0], a8Sprm[1], a8Sprm[2], a8Sprm[3]))
 {
 for( int i = 0; i < 4; ++i )
-nBorder |= int(SetWW8_BRC(8, brc[i], aSprm[i].pSprm, 
aSprm[i].nRemainingData))<Find4Sprms(
 NS_sprm::sprmSBrcTop, NS_sprm::sprmSBrcLeft,
 NS_sprm::sprmSBrcBottom, NS_sprm::sprmSBrcRight,
-aSprm[0], aSprm[1], aSprm[2], aSprm[3]))
+a9Sprm[0], a9Sprm[1], a9Sprm[2], a9Sprm[3]))
 {
 for( int i = 0; i < 4; ++i )
-nBorder |= int(SetWW8_BRC(9, brc[i], aSprm[i].pSprm, 
aSprm[i].nRemainingData))<