[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 96 commits - compilerplugins/clang connectivity/source cui/source desktop/qa desktop/source download.lst .editorconfig framework/source include/LibreOfficeKit include/sfx2 include/svl include/svx include/tools include/vcl libreofficekit/Executable_gtktiledviewer.mk libreofficekit/qa libreofficekit/source sal/osl sc/CppunitTest_sc_cond_format_merge.mk sc/inc sc/Module_sc.mk sc/qa sc/source sd/qa sd/source sfx2/sdi sfx2/source solenv/vs svl/source svx/source sw/qa sw/source tools/source vcl/headless vcl/inc vcl/Library_vcl.mk vcl/source writerfilter/source xmloff/source xmlsecurity/source
Marco Cecchetti
marco.cecchetti at collabora.com
Mon Mar 19 15:56:43 UTC 2018
.editorconfig | 6
compilerplugins/clang/badstatics.cxx | 1
connectivity/source/drivers/firebird/Blob.cxx | 2
connectivity/source/drivers/firebird/PreparedStatement.cxx | 64
cui/source/dialogs/iconcdlg.cxx | 4
cui/source/inc/iconcdlg.hxx | 3
desktop/qa/desktop_lib/test_desktop_lib.cxx | 2
desktop/source/lib/init.cxx | 332 +
download.lst | 1
framework/source/uielement/langselectionstatusbarcontroller.cxx | 27
include/LibreOfficeKit/LibreOfficeKit.h | 31
include/LibreOfficeKit/LibreOfficeKit.hxx | 73
include/LibreOfficeKit/LibreOfficeKitEnums.h | 12
include/sfx2/basedlgs.hxx | 3
include/sfx2/lokhelper.hxx | 6
include/sfx2/sfxsids.hrc | 2
include/sfx2/viewsh.hxx | 7
include/svl/hint.hxx | 1
include/svl/itemset.hxx | 2
include/svl/undo.hxx | 10
include/svx/sdrundomanager.hxx | 5
include/tools/gen.hxx | 1
include/vcl/IDialogRenderable.hxx | 38
include/vcl/ITiledRenderable.hxx | 13
include/vcl/cursor.hxx | 2
include/vcl/dialog.hxx | 23
include/vcl/floatwin.hxx | 2
include/vcl/window.hxx | 27
libreofficekit/Executable_gtktiledviewer.mk | 5
libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx | 68
libreofficekit/qa/gtktiledviewer/gtv-application-window.hxx | 8
libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx | 23
libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx | 256 -
libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx | 8
libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx | 111
libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.hxx | 1
libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx | 62
libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.hxx | 8
libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx | 35
libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx | 4
libreofficekit/qa/gtktiledviewer/gtv.ui | 49
libreofficekit/source/gtk/lokdocview.cxx | 63
sal/osl/unx/interlck.cxx | 26
sal/osl/w32/security.cxx | 4
sc/CppunitTest_sc_cond_format_merge.mk | 116
sc/Module_sc.mk | 1
sc/inc/clipdata.hxx | 24
sc/inc/colorscale.hxx | 6
sc/inc/conditio.hxx | 167
sc/inc/docuno.hxx | 5
sc/inc/scmod.hxx | 7
sc/inc/tokenarray.hxx | 3
sc/qa/extras/testdocuments/cond_format_merge.ods |binary
sc/qa/unit/cond_format_merge.cxx | 155
sc/qa/unit/helper/shared_test_impl.hxx | 6
sc/qa/unit/subsequent_filters-test.cxx | 16
sc/qa/unit/tiledrendering/data/empty.ods |binary
sc/qa/unit/tiledrendering/tiledrendering.cxx | 95
sc/source/core/data/colorscale.cxx | 12
sc/source/core/data/conditio.cxx | 199 -
sc/source/core/data/document.cxx | 5
sc/source/core/data/table2.cxx | 6
sc/source/core/tool/token.cxx | 17
sc/source/filter/excel/xecontent.cxx | 10
sc/source/filter/excel/xeextlst.cxx | 8
sc/source/filter/excel/xestyle.cxx | 6
sc/source/filter/inc/orcusinterface.hxx | 2
sc/source/filter/oox/extlstcontext.cxx | 2
sc/source/filter/orcus/interface.cxx | 24
sc/source/filter/xml/xmlcondformat.cxx | 234 +
sc/source/filter/xml/xmlcondformat.hxx | 25
sc/source/filter/xml/xmlexprt.cxx | 10
sc/source/ui/app/drwtrans.cxx | 28
sc/source/ui/app/scmod.cxx | 17
sc/source/ui/app/transobj.cxx | 37
sc/source/ui/condformat/condformatdlg.cxx | 10
sc/source/ui/condformat/condformathelper.cxx | 10
sc/source/ui/docshell/olinefun.cxx | 27
sc/source/ui/inc/dbfunc.hxx | 3
sc/source/ui/inc/drwtrans.hxx | 4
sc/source/ui/inc/printfun.hxx | 108
sc/source/ui/inc/tabvwsh.hxx | 10
sc/source/ui/inc/transobj.hxx | 1
sc/source/ui/undo/undoblk.cxx | 9
sc/source/ui/undo/undoblk2.cxx | 6
sc/source/ui/undo/undodat.cxx | 10
sc/source/ui/unoobj/condformatuno.cxx | 10
sc/source/ui/unoobj/docuno.cxx | 63
sc/source/ui/unoobj/fmtuno.cxx | 2
sc/source/ui/vba/excelvbahelper.cxx | 4
sc/source/ui/vba/vbarange.cxx | 6
sc/source/ui/view/cellsh.cxx | 33
sc/source/ui/view/cellsh1.cxx | 11
sc/source/ui/view/dbfunc3.cxx | 53
sc/source/ui/view/drawvie4.cxx | 1
sc/source/ui/view/gridwin.cxx | 14
sc/source/ui/view/printfun.cxx | 303 -
sc/source/ui/view/tabview.cxx | 222 +
sc/source/ui/view/tabvwshc.cxx | 38
sc/source/ui/view/viewfun3.cxx | 6
sc/source/ui/view/viewfun7.cxx | 3
sc/source/ui/view/viewfunc.cxx | 14
sd/qa/unit/tiledrendering/tiledrendering.cxx | 51
sd/source/ui/docshell/docshell.cxx | 5
sd/source/ui/func/fusel.cxx | 8
sfx2/sdi/docslots.sdi | 4
sfx2/sdi/sfx.sdi | 19
sfx2/source/control/unoctitm.cxx | 13
sfx2/source/dialog/basedlgs.cxx | 65
sfx2/source/dialog/tabdlg.cxx | 29
sfx2/source/doc/objserv.cxx | 9
sfx2/source/view/lokhelper.cxx | 26
sfx2/source/view/viewfrm.cxx | 6
sfx2/source/view/viewsh.cxx | 5
solenv/vs/LibreOffice.natvis | 3
svl/source/undo/undo.cxx | 39
svx/source/svdraw/sdrundomanager.cxx | 16
sw/qa/extras/tiledrendering/tiledrendering.cxx | 123
sw/source/core/inc/UndoManager.hxx | 3
sw/source/core/layout/tabfrm.cxx | 8
sw/source/core/txtnode/txtedt.cxx | 15
sw/source/core/undo/docundo.cxx | 8
sw/source/filter/ww8/sprmids.hxx | 165
sw/source/filter/ww8/wrtw8nds.cxx | 1211 +++---
sw/source/filter/ww8/wrtww8.cxx | 9
sw/source/filter/ww8/wrtww8.hxx | 4
sw/source/filter/ww8/ww8par6.cxx | 1837 ++++------
sw/source/filter/xml/xmlexp.cxx | 5
sw/source/uibase/shells/textsh1.cxx | 36
tools/source/generic/gen.cxx | 10
vcl/Library_vcl.mk | 1
vcl/headless/svpframe.cxx | 2
vcl/inc/window.h | 3
vcl/source/app/IDialogRenderable.cxx | 22
vcl/source/control/ctrl.cxx | 22
vcl/source/control/edit.cxx | 38
vcl/source/window/cursor.cxx | 39
vcl/source/window/dialog.cxx | 185 -
vcl/source/window/floatwin.cxx | 44
vcl/source/window/paint.cxx | 16
vcl/source/window/window.cxx | 129
vcl/source/window/winproc.cxx | 4
writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 3
xmloff/source/style/xmlstyle.cxx | 3
xmlsecurity/source/gpg/SEInitializer.cxx | 4
145 files changed, 5073 insertions(+), 2829 deletions(-)
New commits:
commit e82336f33b96ddffcd1a81cc08eb04b20739f0e0
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Sat Dec 2 17:42:54 2017 +0100
lok: calc: fix: the last col/row headers were not collected
Change-Id: I14b168dea9c1f1565dc973bf8ac07f3222b3eb9d
Reviewed-on: https://gerrit.libreoffice.org/45791
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
(cherry picked from commit 7802b2435bcbb92913f52481df3001aa83ef7a55)
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 39e822320ede..63fa14613382 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2581,9 +2581,9 @@ void lcl_getGroupIndexes(const ScOutlineArray& rArray, SCCOLROW nStart, SCCOLROW
{
if (rArray.GetCount(nLevel))
{
- // look for a group inside the [nStartRow+1, nEndRow-1] range
+ // look for a group inside the [nStartRow+1, nEndRow] range
size_t nIndex;
- bool bFound = rArray.GetEntryIndexInRange(nLevel, nStart + 1, nEnd - 1, nIndex);
+ bool bFound = rArray.GetEntryIndexInRange(nLevel, nStart + 1, nEnd, nIndex);
if (bFound)
{
if (nIndex > 0)
@@ -2603,8 +2603,8 @@ void lcl_getGroupIndexes(const ScOutlineArray& rArray, SCCOLROW nStart, SCCOLROW
bFound = rArray.GetEntryIndex(nLevel, nStart + 1, nIndex);
if (!bFound)
{
- // look for a group which contains nEndRow-1
- bFound = rArray.GetEntryIndex(nLevel, nEnd - 1, nIndex);
+ // look for a group which contains nEndRow
+ bFound = rArray.GetEntryIndex(nLevel, nEnd, nIndex);
}
}
@@ -2620,7 +2620,7 @@ void lcl_getGroupIndexes(const ScOutlineArray& rArray, SCCOLROW nStart, SCCOLROW
bFound = true;
break;
}
- if (pEntry && pEntry->GetStart() > nEnd - 1)
+ if (pEntry && pEntry->GetStart() > nEnd)
{
break;
}
@@ -2656,16 +2656,17 @@ void lcl_createGroupsData(
{
rGroupStartPositions[nLevel] = nTotalTwips - nSizePx * TWIPS_PER_PIXEL;
}
- else if (nHeaderIndex > pEntry->GetStart() && (nHeaderIndex < nEnd - 1 && nHeaderIndex < pEntry->GetEnd()))
+ else if (nHeaderIndex > pEntry->GetStart() && (nHeaderIndex < nEnd && nHeaderIndex < pEntry->GetEnd()))
{
// for handling group started before the current view range
if (rGroupStartPositions[nLevel] < 0)
rGroupStartPositions[nLevel] *= -TWIPS_PER_PIXEL;
break;
}
- if (nHeaderIndex == pEntry->GetEnd() || (nHeaderIndex == nEnd - 1 && rGroupStartPositions[nLevel] != -1))
+ if (nHeaderIndex == pEntry->GetEnd() || (nHeaderIndex == nEnd && rGroupStartPositions[nLevel] != -1))
{
- // nRow is the end row of a group or is the last row and a group started and not yet ended
+ // nHeaderIndex is the end col/row of a group or is the last col/row and a group started and not yet ended
+
// append a new group control data
if (rGroupsBuffer.endsWith("}"))
{
@@ -2842,7 +2843,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
aRowGroupsBuffer += "\"rowGroups\": [\n";
std::vector<long> aRowGroupStartPositions(nRowGroupDepth, -nTotalPixels);
long nPrevSizePx = -1;
- for (SCROW nRow = nStartRow + 1; nRow < nEndRow; ++nRow)
+ for (SCROW nRow = nStartRow + 1; nRow <= nEndRow; ++nRow)
{
// nSize will be 0 for hidden rows.
const long nSizePx = lcl_GetRowHeightPx(pDoc, nRow, nTab);
@@ -2855,7 +2856,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
*pRowArray, aRowGroupIndexes, aRowGroupStartPositions, aRowGroupsBuffer);
}
- if (nRow < nEndRow - 1 && nSizePx == nPrevSizePx)
+ if (nRow < nEndRow && nSizePx == nPrevSizePx)
continue;
nPrevSizePx = nSizePx;
@@ -2981,7 +2982,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
aColGroupsBuffer += "\"columnGroups\": [\n";
std::vector<long> aColGroupStartPositions(nColGroupDepth, -nTotalPixels);
nPrevSizePx = -1;
- for (SCCOL nCol = nStartCol + 1; nCol < nEndCol; ++nCol)
+ for (SCCOL nCol = nStartCol + 1; nCol <= nEndCol; ++nCol)
{
// nSize will be 0 for hidden columns.
const long nSizePx = lcl_GetColWidthPx(pDoc, nCol, nTab);
@@ -2994,7 +2995,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
*pColArray, aColGroupIndexes, aColGroupStartPositions, aColGroupsBuffer);
}
- if (nCol < nEndCol - 1 && nSizePx == nPrevSizePx)
+ if (nCol < nEndCol && nSizePx == nPrevSizePx)
continue;
nPrevSizePx = nSizePx;
commit 63b7f70f1bc227be9e0b7f99d8221b83e7711cf2
Author: Tor Lillqvist <tml at collabora.com>
Date: Fri Dec 8 14:47:48 2017 +0200
Bin two comments that say the same as the names of the functions they are for
Change-Id: I385e0ae6502eeab9e5cb536c34c64b7fa48442d0
Reviewed-on: https://gerrit.libreoffice.org/46138
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tor Lillqvist <tml at collabora.com>
(cherry picked from commit ce652a7f0d2745143a3e1078607a72695ce124f9)
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
index 9291fd430421..f24e67f9f248 100644
--- a/include/svl/itemset.hxx
+++ b/include/svl/itemset.hxx
@@ -174,10 +174,8 @@ public:
return nullptr;
}
- // Get Which-value of the item at position nPos
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const;
- // Get item-status
SfxItemState GetItemState( sal_uInt16 nWhich,
bool bSrchInParent = true,
const SfxPoolItem **ppItem = nullptr ) const;
commit c0a31a5ec47145b56b55c1af97565d6be4a00dd7
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Sat Dec 9 15:34:33 2017 +0100
Firebird: check isc_blob_info error
Change-Id: I398bf195a8cfebe081fd3034d6c539b02aaf6d73
Reviewed-on: https://gerrit.libreoffice.org/46148
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
(cherry picked from commit 8abda0217dcdfc45fc0f7e74a37d048c5fda395f)
diff --git a/connectivity/source/drivers/firebird/Blob.cxx b/connectivity/source/drivers/firebird/Blob.cxx
index 0cd5697992fd..d7e3ac40f016 100644
--- a/connectivity/source/drivers/firebird/Blob.cxx
+++ b/connectivity/source/drivers/firebird/Blob.cxx
@@ -74,7 +74,7 @@ void Blob::ensureBlobIsOpened()
};
char aResultBuffer[20];
- isc_blob_info(m_statusVector,
+ aErr = isc_blob_info(m_statusVector,
&m_blobHandle,
sizeof(aBlobItems),
aBlobItems,
commit 2465c979f229c2440e6440e90380b433384c0c83
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Sat Dec 9 13:38:39 2017 +0100
Firebird: Revert not closing cursor,..
..but suppress error of closing closed cursor
Change-Id: I58f96f02f3f600a089bde361ed3e46a03a4902d4
Reviewed-on: https://gerrit.libreoffice.org/46141
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
Tested-by: Tamás Bunth <btomi96 at gmail.com>
(cherry picked from commit 032a3e3713af3e308229bd8e1ada17d6d24072f3)
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 445a2b114b89..37441d5c6b1f 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -250,6 +250,21 @@ sal_Bool SAL_CALL OPreparedStatement::execute()
if (m_xResultSet.is()) // Checks whether we have already run the statement.
{
disposeResultSet();
+ // Closes the cursor from the last run.
+ // This doesn't actually free the statement -- using DSQL_close closes
+ // the cursor and keeps the statement, using DSQL_drop frees the statement
+ // (and associated cursors).
+ aErr = isc_dsql_free_statement(m_statusVector,
+ &m_aStatementHandle,
+ DSQL_close);
+ if (aErr)
+ {
+ // Do not throw error. Trying to close a closed cursor is not a
+ // critical mistake.
+ OUString sErrMsg = StatusVectorToString(m_statusVector,
+ "isc_dsql_free_statement: close cursor");
+ SAL_WARN("connectivity.firebird", sErrMsg);
+ }
}
aErr = isc_dsql_execute(m_statusVector,
commit 8eb9b0544fa36b15e9e70403da401dea9a858c83
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Fri Dec 8 20:09:44 2017 +0000
headless: improve popup menu background defaults.
Change-Id: Icda7df363827e1942486c961bf9eef9402aba96c
Reviewed-on: https://gerrit.libreoffice.org/46123
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
(cherry picked from commit 95a72981e572a961a1c4c03f81fd365c1cb23e9f)
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index fda5a213070c..640c84136da5 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -411,6 +411,8 @@ void SvpSalFrame::UpdateSettings( AllSettings& rSettings )
Color aBackgroundColor( 0xef, 0xef, 0xef );
aStyleSettings.BatchSetBackgrounds( aBackgroundColor, false );
+ aStyleSettings.SetMenuColor( aBackgroundColor );
+ aStyleSettings.SetMenuBarColor( aBackgroundColor );
if (comphelper::LibreOfficeKit::isActive()) // TODO: remove this.
{
commit 90c2bd7b1a79c7c802646217bc5407ce1e1e069f
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Fri Dec 8 23:38:36 2017 +0100
clean code at setObjectWithInfo
Change-Id: I8cb4eaebd71d8b06523230954da15d73325ac94b
Reviewed-on: https://gerrit.libreoffice.org/46130
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
Tested-by: Tamás Bunth <btomi96 at gmail.com>
(cherry picked from commit 907423a6ec5c2170dbf2ca445c0a1285e9a6adfc)
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 926810783e67..445a2b114b89 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -589,25 +589,25 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
if(sqlType == DataType::DECIMAL || sqlType == DataType::NUMERIC)
{
- double myDouble=0.0;
- OUString myString;
- if( x >>= myDouble )
+ double dbValue =0.0;
+ OUString sValue;
+ if( x >>= dbValue )
{
- myString = OUString::number( myDouble );
+ sValue = OUString::number( dbValue );
}
else
{
- x >>= myString;
+ x >>= sValue;
}
// fill in the number with nulls in fractional part.
// We need this because e.g. 0.450 != 0.045 despite
// their scale is equal
OUStringBuffer sBuffer(15);
- sBuffer.append(myString);
- if(myString.indexOf('.') != -1) // there is a dot
+ sBuffer.append(sValue);
+ if(sValue.indexOf('.') != -1) // there is a dot
{
- for(sal_Int32 i=myString.copy(myString.indexOf('.')+1).getLength(); i<scale;i++)
+ for(sal_Int32 i=sValue.copy(sValue.indexOf('.')+1).getLength(); i<scale;i++)
{
sBuffer.append('0');
}
@@ -619,30 +619,24 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
sBuffer.append('0');
}
}
- myString = sBuffer.makeStringAndClear();
- // set value depending on type
- sal_Int16 n16Value = 0;
- sal_Int32 n32Value = 0;
- sal_Int64 n64Value = 0;
+
+ sValue = sBuffer.makeStringAndClear();
switch(dType)
{
case SQL_SHORT:
- n16Value = (sal_Int16) toNumericWithoutDecimalPlace(myString);
setValue< sal_Int16 >(parameterIndex,
- n16Value,
+ static_cast<sal_Int16>( toNumericWithoutDecimalPlace(sValue) ),
dType);
break;
case SQL_LONG:
- case SQL_DOUBLE: // TODO FIXME 32 bits
- n32Value = (sal_Int32) toNumericWithoutDecimalPlace(myString);
+ case SQL_DOUBLE:
setValue< sal_Int32 >(parameterIndex,
- n32Value,
+ static_cast<sal_Int32>( toNumericWithoutDecimalPlace(sValue) ),
dType);
break;
case SQL_INT64:
- n64Value = toNumericWithoutDecimalPlace(myString);
setValue< sal_Int64 >(parameterIndex,
- n64Value,
+ toNumericWithoutDecimalPlace(sValue),
dType);
break;
default:
commit 5f19a29d3a2bf78ea39d9c759e15c2274235b012
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Sat Dec 9 00:47:13 2017 +0100
tdf#70425 do not close cursor explicitly
A cursor need only be closed in this manner if it was previously
opened and associated with stmt_handle by isc_dsql_set_cursor_name()
See Interbase API Guide: isc_dsql_free_statement
Reviewed-on: https://gerrit.libreoffice.org/46132
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
(cherry picked from commit 9585521c28b74dec36522a6501ca670b8e14c7ca)
Change-Id: Iadb0dcf83ee58b6196112c44d922528a3f56f7ea
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 74969278b16f..926810783e67 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -250,21 +250,6 @@ sal_Bool SAL_CALL OPreparedStatement::execute()
if (m_xResultSet.is()) // Checks whether we have already run the statement.
{
disposeResultSet();
- // Closes the cursor from the last run.
- // This doesn't actually free the statement -- using DSQL_close closes
- // the cursor and keeps the statement, using DSQL_drop frees the statement
- // (and associated cursors).
- aErr = isc_dsql_free_statement(m_statusVector,
- &m_aStatementHandle,
- DSQL_close);
- if (aErr)
- {
- // Do not throw error. Trying to close a closed cursor is not a
- // critical mistake.
- OUString sErrMsg = StatusVectorToString(m_statusVector,
- "isc_dsql_free_statement: close cursor");
- SAL_WARN("connectivity.firebird", sErrMsg);
- }
}
aErr = isc_dsql_execute(m_statusVector,
commit 5a5fce18871dac91cf485030b915d674948cd95e
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Fri Dec 8 22:08:45 2017 +0100
tdf#70425 Firebird: accept integers in setDouble
Change-Id: I471197a9c60ca28b93be0974956e5e1d90f843ca
Reviewed-on: https://gerrit.libreoffice.org/46125
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
(cherry picked from commit 9ccc1f59446bc4a16b6d090a3b556e184eb5f159)
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index d21037da74e5..74969278b16f 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -405,7 +405,35 @@ void SAL_CALL OPreparedStatement::setFloat(sal_Int32 nIndex, float nValue)
void SAL_CALL OPreparedStatement::setDouble(sal_Int32 nIndex, double nValue)
{
- setValue< double >(nIndex, nValue, SQL_DOUBLE); // TODO: SQL_D_FLOAT?
+ MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
+ ensurePrepared();
+
+ XSQLVAR* pVar = m_pInSqlda->sqlvar + (nIndex - 1);
+ int dType = (pVar->sqltype & ~1); // drop flag bit for now
+
+ // Caller might try to set an integer type here. It makes sense to convert
+ // it instead of throwing an error.
+ switch(dType)
+ {
+ case SQL_SHORT:
+ setValue< sal_Int16 >(nIndex,
+ static_cast<sal_Int16>(nValue),
+ dType);
+ break;
+ case SQL_LONG:
+ setValue< sal_Int32 >(nIndex,
+ static_cast<sal_Int32>(nValue),
+ dType);
+ break;
+ case SQL_INT64:
+ setValue< sal_Int64 >(nIndex,
+ static_cast<sal_Int64>(nValue),
+ dType);
+ break;
+ default:
+ setValue< double >(nIndex, nValue, SQL_DOUBLE); // TODO: SQL_D_FLOAT?
+ }
}
void SAL_CALL OPreparedStatement::setDate(sal_Int32 nIndex, const Date& rDate)
commit c0f0dbdb3620d69c230d2460949620f41a49bb0a
Author: Szymon Kłos <szymon.klos at collabora.com>
Date: Fri Dec 8 22:27:43 2017 +0100
Build fix
Change-Id: I33db5c70b579aa65c9659e9ddddad77a5ec12ecc
Reviewed-on: https://gerrit.libreoffice.org/46127
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
(cherry picked from commit df802d0c1b0d255bc88eac279cb8a72d7570ec3a)
diff --git a/include/vcl/cursor.hxx b/include/vcl/cursor.hxx
index be6dd45c56c4..725724ee8024 100644
--- a/include/vcl/cursor.hxx
+++ b/include/vcl/cursor.hxx
@@ -24,6 +24,7 @@
#include <tools/link.hxx>
#include <vcl/dllapi.h>
#include <vcl/vclptr.hxx>
+#include <rtl/ustring.hxx>
class Timer;
struct ImplCursorData;
commit b2a12e95971e165fce0934ea542fb8ed3db91da3
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Fri Dec 8 18:06:36 2017 +0530
Use ImplIsFloatingWindow instead of dynamic_cast
Change-Id: I09f351ae5d8d1b5c1a405d7aa8082be6014268b3
(cherry picked from commit 0898ced81a3129b4c36c08e0222f96c513f0fd77)
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b08aef4e0967..9b33354ee8e6 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3252,7 +3252,7 @@ void Window::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(comphelper::LibreOfficeKit::isActive());
- if (dynamic_cast<FloatingWindow*>(this) != nullptr)
+ if (ImplIsFloatingWindow())
ImplWindowFrameProc(ImplGetBorderWindow(), SalEvent::ExternalMouseButtonDown, &rMouseEvent);
else
ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonDown, &rMouseEvent);
@@ -3263,7 +3263,7 @@ void Window::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(comphelper::LibreOfficeKit::isActive());
- if (dynamic_cast<FloatingWindow*>(this) != nullptr)
+ if (ImplIsFloatingWindow())
ImplWindowFrameProc(ImplGetBorderWindow(), SalEvent::ExternalMouseButtonUp, &rMouseEvent);
else
ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonUp, &rMouseEvent);
@@ -3274,7 +3274,7 @@ void Window::LogicMouseMove(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(comphelper::LibreOfficeKit::isActive());
- if (dynamic_cast<FloatingWindow*>(this) != nullptr)
+ if (ImplIsFloatingWindow())
ImplWindowFrameProc(ImplGetBorderWindow(), SalEvent::ExternalMouseMove, &rMouseEvent);
else
ImplWindowFrameProc(this, SalEvent::ExternalMouseMove, &rMouseEvent);
commit c1674a2722f7a0d3c2e9181944fe9d3f7177d63b
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Fri Dec 8 16:23:45 2017 +0530
lokdialog: Move lok cursor invalidation callbacks to vcl::Cursor
Change-Id: I5cbb845259b6802fb2a0776f8d8f19f9680115ad
(cherry picked from commit 782f8be6d4076b0152442e6200426010c1f6704f)
diff --git a/include/vcl/cursor.hxx b/include/vcl/cursor.hxx
index 59cac2799a9f..be6dd45c56c4 100644
--- a/include/vcl/cursor.hxx
+++ b/include/vcl/cursor.hxx
@@ -95,6 +95,7 @@ public:
{ return !(Cursor::operator==( rCursor )); }
private:
+ void LOKNotify( vcl::Window* pWindow, const OUString& rAction );
void ImplRestore();
void ImplDoShow( bool bDrawDirect, bool bRestore );
bool ImplDoHide( bool bStop );
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 5fa5c8a73dc4..e0c72393201a 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1229,7 +1229,6 @@ public:
void LOKKeyInput(const KeyEvent& rKeyEvent);
void LOKKeyUp(const KeyEvent& rKeyEvent);
- void LOKCursor(const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload);
/** @name Accessibility
*/
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index add78c2f49b3..7560860de9de 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1145,23 +1145,6 @@ void Edit::ImplShowCursor( bool bOnlyIfVisible )
pCursor->SetPos( Point( nCursorPosX, nCursorPosY ) );
pCursor->SetSize( Size( nCursorWidth, nTextHeight ) );
pCursor->Show();
-
- if (comphelper::LibreOfficeKit::isActive())
- {
- const long X = GetOutOffXPixel() + pCursor->GetPos().X();
- const long Y = GetOutOffYPixel() + pCursor->GetPos().Y();
-
- if (nCursorWidth == 0)
- nCursorWidth = 2;
- const tools::Rectangle aRect(Point(X, Y), Size(nCursorWidth, pCursor->GetHeight()));
-
- std::vector<vcl::LOKPayloadItem> aPayload;
- aPayload.push_back(std::make_pair("rectangle", aRect.toString()));
-
- Dialog* pParentDlg = GetParentDialog();
- if (pParentDlg)
- pParentDlg->LOKCursor("cursor_invalidate", aPayload);
- }
}
}
@@ -1908,16 +1891,6 @@ void Edit::GetFocus()
SetInputContext( InputContext( GetFont(), !IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) );
}
- // notify dialog's cursor visible status
- if (comphelper::LibreOfficeKit::isActive())
- {
- std::vector<vcl::LOKPayloadItem> aPayload;
- aPayload.push_back(std::make_pair(OString("visible"), OString("true")));
- Dialog* pParentDlg = GetParentDialog();
- if (pParentDlg)
- pParentDlg->LOKCursor("cursor_visible", aPayload);
- }
-
Control::GetFocus();
}
@@ -1945,17 +1918,6 @@ void Edit::LoseFocus()
ImplInvalidateOrRepaint(); // paint the selection
}
-
- // notify dialog's cursor visible status
- if (comphelper::LibreOfficeKit::isActive())
- {
- std::vector<vcl::LOKPayloadItem> aPayload;
- aPayload.push_back(std::make_pair(OString("visible"), OString("false")));
- Dialog* pParentDlg = GetParentDialog();
- if (pParentDlg)
- pParentDlg->LOKCursor("cursor_visible", aPayload);
- }
-
Control::LoseFocus();
}
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index a4c0187097e6..9f4d4a872d07 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -18,6 +18,8 @@
*/
#include <memory>
+
+#include <comphelper/lok.hxx>
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
#include <vcl/settings.hxx>
@@ -187,6 +189,9 @@ void vcl::Cursor::ImplDoShow( bool bDrawDirect, bool bRestore )
mpData->mbCurVisible = false;
mpData->maTimer.SetInvokeHandler( LINK( this, Cursor, ImplTimerHdl ) );
mpData->maTimer.SetDebugName( "vcl ImplCursorData maTimer" );
+
+ // tell about "initial" coordinates
+ LOKNotify( pWindow, "cursor_invalidate" );
}
mpData->mpWindow = pWindow;
@@ -201,11 +206,43 @@ void vcl::Cursor::ImplDoShow( bool bDrawDirect, bool bRestore )
mpData->maTimer.Start();
else if ( !mpData->mbCurVisible )
ImplDraw();
+ LOKNotify( pWindow, "cursor_visible" );
}
}
}
}
+void vcl::Cursor::LOKNotify( vcl::Window* pWindow, const OUString& rAction )
+{
+ if (VclPtr<vcl::Window> pParent = pWindow->GetParentWithLOKNotifier())
+ {
+ assert(pWindow && "Cannot notify without a window");
+ assert(mpData && "Require ImplCursorData");
+ assert(comphelper::LibreOfficeKit::isActive());
+
+ if (comphelper::LibreOfficeKit::isDialogPainting())
+ return;
+
+ const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
+ std::vector<vcl::LOKPayloadItem> aItems;
+ if (rAction == "cursor_visible")
+ aItems.emplace_back("visible", mpData->mbCurVisible ? "true" : "false");
+ else if (rAction == "cursor_invalidate")
+ {
+ const long nX = pWindow->GetOutOffXPixel() + pWindow->LogicToPixel(GetPos()).X();
+ const long nY = pWindow->GetOutOffYPixel() + pWindow->LogicToPixel(GetPos()).Y();
+ Size aSize = pWindow->LogicToPixel(GetSize());
+ if (!aSize.Width())
+ aSize.Width() = pWindow->GetSettings().GetStyleSettings().GetCursorSize();
+
+ const tools::Rectangle aRect(Point(nX, nY), aSize);
+ aItems.emplace_back("rectangle", aRect.toString());
+ }
+
+ pNotifier->notifyWindow(pParent->GetLOKWindowId(), rAction, aItems);
+ }
+}
+
bool vcl::Cursor::ImplDoHide( bool bSuspend )
{
bool bWasCurVisible = false;
@@ -217,6 +254,7 @@ bool vcl::Cursor::ImplDoHide( bool bSuspend )
if ( !bSuspend )
{
+ LOKNotify( mpData->mpWindow, "cursor_visible" );
mpData->maTimer.Stop();
mpData->mpWindow = nullptr;
}
@@ -254,6 +292,7 @@ void vcl::Cursor::ImplNew()
ImplDraw();
if ( !mpWindow )
{
+ LOKNotify( mpData->mpWindow, "cursor_invalidate" );
if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
mpData->maTimer.Start();
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index eee2b209b442..b08aef4e0967 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3294,17 +3294,6 @@ void Window::LOKKeyUp(const KeyEvent& rKeyEvent)
ImplWindowFrameProc(this, SalEvent::ExternalKeyUp, &rKeyEvent);
}
-void Window::LOKCursor(const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload)
-{
- assert(comphelper::LibreOfficeKit::isActive());
-
- if (comphelper::LibreOfficeKit::isDialogPainting())
- return;
-
- if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
- pNotifier->notifyWindow(GetLOKWindowId(), rAction, rPayload);
-}
-
void Window::ImplCallDeactivateListeners( vcl::Window *pNew )
{
// no deactivation if the newly activated window is my child
commit aef0a7d2b63e92574a137b3d3bb70a5b7dedf385
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Dec 7 21:55:28 2017 +0530
lokdialog: Open floating window on InitShow only
Okay, my bad. InitShow happens after Visible. And InitShow also does
some layouting. Emitting the created callback on InitShow means sending
more accurate sizes, etc. The different in sizes is 0 for combo boxes,
but significant for custom controls like color picker, etc. So emit
created callback on InitShow to keep custom controls working.
Change-Id: I40b6a18b917dff0eebcfd4c273f3399f3bdc7456
(cherry picked from commit 42fae43d70d3d1b8fcc9fc6328b1060d6d72abfc)
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 39e837d9153f..ed95f9138b40 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -604,9 +604,9 @@ void FloatingWindow::StateChanged( StateChangedType nType )
SystemWindow::StateChanged( nType );
VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier();
- if (pParent && nType == StateChangedType::Visible)
+ if (pParent)
{
- if (IsVisible())
+ if (nType == StateChangedType::InitShow)
{
std::vector<vcl::LOKPayloadItem> aItems;
if (pParent == this)
@@ -626,7 +626,7 @@ void FloatingWindow::StateChanged( StateChangedType nType )
aItems.emplace_back(std::make_pair("position", mpImplData->maPos.toString()));
GetLOKNotifier()->notifyWindow(GetLOKWindowId(), "created", aItems);
}
- else if (!IsVisible())
+ else if (!IsVisible() && nType == StateChangedType::Visible)
{
assert(GetLOKNotifier());
GetLOKNotifier()->notifyWindow(GetLOKWindowId(), "close");
commit 0fc148092b552734a690020305905948d2fa81ea
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Jul 10 17:33:38 2017 -0400
sw lok: enable Page Header/Footer
Change-Id: I5e0d080c53079069a086f06c2a314b6372bf6391
Reviewed-on: https://gerrit.libreoffice.org/39782
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Henry Castro <hcastro at collabora.com>
(cherry picked from commit 3ba914c229adfed5c917d1ee23d35b9184b092c4)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 51bcd2e34afb..f5361bdb834a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1748,7 +1748,9 @@ static void doc_iniUnoCommands ()
OUString(".uno:ParagraphDialog"),
OUString(".uno:OutlineBullet"),
OUString(".uno:InsertIndexesEntry"),
- OUString(".uno:DocumentRepair")
+ OUString(".uno:DocumentRepair"),
+ OUString(".uno:InsertPageHeader"),
+ OUString(".uno:InsertPageFooter")
};
util::URL aCommandURL;
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 063aca8a8d78..af8142a12fcc 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1019,7 +1019,9 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c
aEvent.FeatureURL.Path == "AlignLeft" ||
aEvent.FeatureURL.Path == "AlignHorizontalCenter" ||
aEvent.FeatureURL.Path == "AlignRight" ||
- aEvent.FeatureURL.Path == "DocumentRepair")
+ aEvent.FeatureURL.Path == "DocumentRepair" ||
+ aEvent.FeatureURL.Path == "InsertPageHeader" ||
+ aEvent.FeatureURL.Path == "InsertPageFooter")
{
bool bTemp = false;
aEvent.State >>= bTemp;
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index d6f95df456e7..9c8f35dcc6d2 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -34,6 +34,7 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/lokhelper.hxx>
+#include <sfx2/dispatch.hxx>
#include <redline.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <vcl/scheduler.hxx>
@@ -96,6 +97,8 @@ public:
void testDisableUndoRepair();
void testAllTrackedChanges();
void testDocumentRepair();
+ void testPageHeader();
+ void testPageFooter();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -143,7 +146,8 @@ public:
CPPUNIT_TEST(testDisableUndoRepair);
CPPUNIT_TEST(testAllTrackedChanges);
CPPUNIT_TEST(testDocumentRepair);
-
+ CPPUNIT_TEST(testPageHeader);
+ CPPUNIT_TEST(testPageFooter);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1933,6 +1937,75 @@ void SwTiledRenderingTest::testDocumentRepair()
comphelper::LibreOfficeKit::setActive(false);
}
+namespace {
+
+void checkPageHeaderOrFooter(const SfxViewShell* pViewShell, sal_uInt16 nWhich, bool bValue)
+{
+ const SfxPoolItem* pState = nullptr;
+ pViewShell->GetDispatcher()->QueryState(nWhich, pState);
+ CPPUNIT_ASSERT(dynamic_cast< const SfxBoolItem * >(pState));
+ CPPUNIT_ASSERT_EQUAL(bValue, dynamic_cast< const SfxBoolItem * >(pState)->GetValue());
+};
+
+}
+
+void SwTiledRenderingTest::testPageHeader()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ createDoc("dummy.fodt");
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ // Check Page Header State
+ checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEHEADER, false);
+ // Insert Page Header
+ {
+ SfxBoolItem aItem(FN_PARAM_1, true);
+ pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEHEADER, SfxCallMode::SYNCHRON, {&aItem});
+ }
+ // Check Page Header State
+ checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEHEADER, true);
+
+ // Remove Page Header
+ {
+ SfxBoolItem aItem(FN_PARAM_1, false);
+ pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEHEADER, SfxCallMode::SYNCHRON, {&aItem});
+ }
+ // Check Page Header State
+ checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEHEADER, false);
+
+ mxComponent->dispose();
+ mxComponent.clear();
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
+void SwTiledRenderingTest::testPageFooter()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ createDoc("dummy.fodt");
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ // Check Page Footer State
+ checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEFOOTER, false);
+ // Insert Page Footer
+ {
+ SfxBoolItem aItem(FN_PARAM_1, true);
+ pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEFOOTER, SfxCallMode::SYNCHRON, {&aItem});
+ }
+ // Check Page Footer State
+ checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEFOOTER, true);
+
+ // Remove Page Footer
+ {
+ SfxBoolItem aItem(FN_PARAM_1, false);
+ pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEFOOTER, SfxCallMode::SYNCHRON, {&aItem});
+ }
+ // Check Footer State
+ checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEFOOTER, false);
+
+ mxComponent->dispose();
+ mxComponent.clear();
+ comphelper::LibreOfficeKit::setActive(false);
+}
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 4e210a2d2c84..e69bc47b629a 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -22,6 +22,7 @@
#include <hintids.hxx>
#include <cmdid.h>
#include <helpids.h>
+#include <comphelper/lok.hxx>
#include <i18nutil/unicode.hxx>
#include <i18nlangtag/languagetag.hxx>
@@ -94,6 +95,10 @@
#include <IDocumentStatistics.hxx>
#include <sfx2/sfxdlg.hxx>
#include <unotools/lingucfg.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <editeng/unolingu.hxx>
#include <unotools/syslocaleoptions.hxx>
@@ -115,6 +120,9 @@
#include <memory>
using namespace ::com::sun::star;
+using namespace com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace com::sun::star::style;
using namespace svx::sidebar;
void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq )
@@ -1268,7 +1276,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
bool bOn = true;
if( SfxItemState::SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem))
bOn = static_cast<const SfxBoolItem*>(pItem)->GetValue();
- rWrtSh.ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI());
+ rWrtSh.ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !comphelper::LibreOfficeKit::isActive() && !rReq.IsAPI());
rReq.Done();
}
break;
@@ -1612,6 +1620,32 @@ void SwTextShell::GetState( SfxItemSet &rSet )
case FN_INSERT_PAGEHEADER:
case FN_INSERT_PAGEFOOTER:
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ bool bState = false;
+ bool bIsPhysical = false;
+ uno::Reference< XStyleFamiliesSupplier > xSupplier(GetView().GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+ if (xSupplier.is())
+ {
+ uno::Reference< XNameContainer > xContainer;
+ uno::Reference< XNameAccess > xFamilies = xSupplier->getStyleFamilies();
+ if (xFamilies->getByName("PageStyles") >>= xContainer)
+ {
+ uno::Sequence< OUString > aSeqNames = xContainer->getElementNames();
+ for (sal_Int32 itNames = 0; itNames < aSeqNames.getLength(); itNames++)
+ {
+ uno::Reference< XPropertySet > xPropSet(xContainer->getByName(aSeqNames[itNames]), uno::UNO_QUERY);
+ if (xPropSet.is() && (xPropSet->getPropertyValue("IsPhysical") >>= bIsPhysical) && bIsPhysical)
+ {
+ if ((xPropSet->getPropertyValue(nWhich == FN_INSERT_PAGEHEADER ? OUString("HeaderIsOn") : OUString("FooterIsOn")) >>= bState) && bState)
+ break;
+ }
+ }
+ }
+ }
+ rSet.Put(SfxBoolItem(nWhich, bState));
+ }
+ else
{
rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
}
commit f462f13dc4e76e905761d79953f3e6ec1ba66a9e
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Fri Dec 8 17:51:54 2017 +0100
fix for empty paragraphs
Change-Id: I0a7432059d5e6f680d4fe2e3cac0f12062533511
Reviewed-on: https://gerrit.libreoffice.org/46100
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
Tested-by: Tamás Bunth <btomi96 at gmail.com>
(cherry picked from commit bde22bd6da4568e3a1fd35b5f822d6de06e477a4)
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index f54181585fb7..0355d420d697 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2281,7 +2281,9 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
do
{
sal_Int32 nAktPos = *aBreakIt;
- ++aBreakIt;
+
+ if( softBreakList.size() > 1 ) // not for empty paragpraph
+ ++aBreakIt;
AttrOutput().StartParagraph( pTextNodeInfo );
commit 7582a7e51a80d0465d84082473f8b5cf9dd5912b
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Fri Dec 1 14:58:17 2017 +0100
tdf#41650 DOCX export: split para on section break
Given two pages with entirely different style (resp. not plausible for a
single section) and a paragraph which starts on the first page and has a
follow on the second.
Those page styles are represented in doc/docx structure with sections.
Doc/Docx does not support having a paragraph in more than one sections.
Workaround is to split the paragraph into more paragraphs and put the
section break in between.
Change-Id: I4014c45f97e18132470d0d0647bce84831b2460a
Reviewed-on: https://gerrit.libreoffice.org/45666
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
Tested-by: Tamás Bunth <btomi96 at gmail.com>
(cherry picked from commit c1d58c46eec5081576979f584151c7e9a4f67fe0)
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index c2dbacad1f55..f54181585fb7 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2169,6 +2169,32 @@ void MSWordExportBase::GetSortedBookmarks( const SwTextNode& rNode, sal_Int32 nA
}
}
+bool MSWordExportBase::NeedSectionBreak( const SwNode& rNd ) const
+{
+ if ( m_bStyDef || m_bOutKF || m_bInWriteEscher || m_bOutPageDescs || m_pAktPageDesc == nullptr )
+ return false;
+
+ const SwPageDesc * pPageDesc = rNd.FindPageDesc()->GetFollow();
+
+ if (m_pAktPageDesc != pPageDesc)
+ {
+ if (!sw::util::IsPlausableSingleWordSection(m_pAktPageDesc->GetFirstMaster(), pPageDesc->GetMaster()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool MSWordExportBase::NeedTextNodeSplit( const SwTextNode& rNd, SwSoftPageBreakList& pList ) const
+{
+ rNd.fillSoftPageBreakList( pList );
+ pList.insert(0);
+ pList.insert( rNd.GetText().getLength() );
+ return pList.size() > 2 && NeedSectionBreak( rNd );
+}
+
void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
{
SAL_INFO( "sw.ww8", "<OutWW8_SwTextNode>" );
@@ -2190,7 +2216,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
SwWW8AttrIter aWatermarkAttrIter( *this, rNode );
if (( TXT_HDFT != m_nTextTyp) && aWatermarkAttrIter.IsWatermarkFrame())
{
- return;
+ return;
}
bool bFlyInTable = m_pParentFrame && IsInTable();
@@ -2246,741 +2272,768 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
}
}
- AttrOutput().StartParagraph( pTextNodeInfo );
+ SwSoftPageBreakList softBreakList;
+ // Let's decide if we need to split the paragraph because of a section break
+ bool bNeedParaSplit = NeedTextNodeSplit( rNode, softBreakList );
- const SwSection* pTOXSect = nullptr;
- if( m_bInWriteTOX )
+ auto aBreakIt = softBreakList.begin();
+ // iterate through portions on different pages
+ do
{
- // check for end of TOX
- SwNodeIndex aIdx( rNode, 1 );
- if( !aIdx.GetNode().IsTextNode() )
+ sal_Int32 nAktPos = *aBreakIt;
+ ++aBreakIt;
+
+ AttrOutput().StartParagraph( pTextNodeInfo );
+
+ const SwSection* pTOXSect = nullptr;
+ if( m_bInWriteTOX )
{
- const SwSectionNode* pTOXSectNd = rNode.FindSectionNode();
- if ( pTOXSectNd )
+ // check for end of TOX
+ SwNodeIndex aIdx( rNode, 1 );
+ if( !aIdx.GetNode().IsTextNode() )
{
- pTOXSect = &pTOXSectNd->GetSection();
+ const SwSectionNode* pTOXSectNd = rNode.FindSectionNode();
+ if ( pTOXSectNd )
+ {
+ pTOXSect = &pTOXSectNd->GetSection();
- const SwNode* pNxt = rNode.GetNodes().GoNext( &aIdx );
- if( pNxt && pNxt->FindSectionNode() == pTOXSectNd )
- pTOXSect = nullptr;
+ const SwNode* pNxt = rNode.GetNodes().GoNext( &aIdx );
+ if( pNxt && pNxt->FindSectionNode() == pTOXSectNd )
+ pTOXSect = nullptr;
+ }
}
}
- }
- if ( aAttrIter.RequiresImplicitBookmark() )
- {
- OUString sBkmkName = "_toc" + OUString::number( rNode.GetIndex() );
- // Add a bookmark converted to a Word name.
- AppendBookmark( BookmarkToWord( sBkmkName ) );
- }
+ if ( aAttrIter.RequiresImplicitBookmark() )
+ {
+ OUString sBkmkName = "_toc" + OUString::number( rNode.GetIndex() );
+ // Add a bookmark converted to a Word name.
+ AppendBookmark( BookmarkToWord( sBkmkName ) );
+ }
- // Call this before write out fields and runs
- AttrOutput().GenerateBookmarksForSequenceField(rNode, aAttrIter);
+ // Call this before write out fields and runs
+ AttrOutput().GenerateBookmarksForSequenceField(rNode, aAttrIter);
- const OUString& aStr( rNode.GetText() );
+ const OUString& aStr( rNode.GetText() );
- sal_Int32 nAktPos = 0;
- sal_Int32 const nEnd = aStr.getLength();
- bool bIncludeEndOfParaCRInRedlineProperties = false;
- sal_Int32 nOpenAttrWithRange = 0;
+ sal_Int32 const nEnd = aStr.getLength();
+ bool bIncludeEndOfParaCRInRedlineProperties = false;
+ sal_Int32 nOpenAttrWithRange = 0;
- ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner;
- if ( pTextNodeInfo.get() != nullptr )
- {
- pTextNodeInfoInner = pTextNodeInfo->getFirstInner();
- }
+ ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner;
+ if ( pTextNodeInfo.get() != nullptr )
+ {
+ pTextNodeInfoInner = pTextNodeInfo->getFirstInner();
+ }
- do {
+ do {
- const SwRedlineData* pRedlineData = aAttrIter.GetRunLevelRedline( nAktPos );
- FlyProcessingState nStateOfFlyFrame = FLY_PROCESSED;
- bool bPostponeWritingText = false ;
- OUString aSavedSnippet ;
+ const SwRedlineData* pRedlineData = aAttrIter.GetRunLevelRedline( nAktPos );
+ FlyProcessingState nStateOfFlyFrame = FLY_PROCESSED;
+ bool bPostponeWritingText = false ;
+ OUString aSavedSnippet ;
- sal_Int32 nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos );
+ sal_Int32 nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos );
- // Skip un-exportable attributes.
- if (!aAttrIter.IsExportableAttr(nAktPos))
- {
- nAktPos = nNextAttr;
- UpdatePosition(&aAttrIter, nAktPos);
- eChrSet = aAttrIter.GetCharSet();
- continue;
- }
+ // Skip un-exportable attributes.
+ if (!aAttrIter.IsExportableAttr(nAktPos))
+ {
+ nAktPos = nNextAttr;
+ UpdatePosition(&aAttrIter, nAktPos);
+ eChrSet = aAttrIter.GetCharSet();
+ continue;
+ }
- // Is this the only run in this paragraph and it's empty?
- bool bSingleEmptyRun = nAktPos == 0 && nNextAttr == 0;
- AttrOutput().StartRun( pRedlineData, nAktPos, bSingleEmptyRun );
+ // Is this the only run in this paragraph and it's empty?
+ bool bSingleEmptyRun = nAktPos == 0 && nNextAttr == 0;
+ AttrOutput().StartRun( pRedlineData, nAktPos, bSingleEmptyRun );
- if( nNextAttr > nEnd )
- nNextAttr = nEnd;
+ if( nNextAttr > nEnd )
+ nNextAttr = nEnd;
- if( m_nTextTyp == TXT_FTN || m_nTextTyp == TXT_EDN )
- {
- if( AttrOutput().FootnoteEndnoteRefTag() )
+ if( m_nTextTyp == TXT_FTN || m_nTextTyp == TXT_EDN )
{
- AttrOutput().EndRun( &rNode, nAktPos, nNextAttr == nEnd );
- AttrOutput().StartRun( pRedlineData, nAktPos, bSingleEmptyRun );
+ if( AttrOutput().FootnoteEndnoteRefTag() )
+ {
+ AttrOutput().EndRun( &rNode, nAktPos, nNextAttr == nEnd );
+ AttrOutput().StartRun( pRedlineData, nAktPos, bSingleEmptyRun );
+ }
}
- }
-
- /*
- 1) If there is a text node and an overlapping anchor, then write them in two different
- runs and not as part of the same run.
- 2) Ensure that it is a text node and not in a fly.
- 3) If the anchor is associated with a text node with empty text then we ignore.
- */
- if( rNode.IsTextNode()
- && aStr != "\001" && !aStr.isEmpty()
- && !rNode.GetFlyFormat()
- && !(IsInTable() && !AllowPostponedTextInTable())
- && aAttrIter.IsAnchorLinkedToThisNode(rNode.GetIndex()) )
- {
- bPostponeWritingText = true ;
- }
- nStateOfFlyFrame = aAttrIter.OutFlys( nAktPos );
- AttrOutput().SetStateOfFlyFrame( nStateOfFlyFrame );
- AttrOutput().SetAnchorIsLinkedToNode( bPostponeWritingText && (FLY_POSTPONED != nStateOfFlyFrame) );
- // Append bookmarks in this range after flys, exclusive of final
- // position of this range
- AppendBookmarks( rNode, nAktPos, nNextAttr - nAktPos );
- AppendAnnotationMarks( rNode, nAktPos, nNextAttr - nAktPos );
+ /*
+ 1) If there is a text node and an overlapping anchor, then write them in two different
+ runs and not as part of the same run.
+ 2) Ensure that it is a text node and not in a fly.
+ 3) If the anchor is associated with a text node with empty text then we ignore.
+ */
+ if( rNode.IsTextNode()
+ && aStr != "\001" && !aStr.isEmpty()
+ && !rNode.GetFlyFormat()
+ && !(IsInTable() && !AllowPostponedTextInTable())
+ && aAttrIter.IsAnchorLinkedToThisNode(rNode.GetIndex()) )
+ {
+ bPostponeWritingText = true ;
+ }
- // At the moment smarttags are only written for paragraphs, at the
- // beginning of the paragraph.
- if (nAktPos == 0)
- AppendSmartTags(rNode);
+ nStateOfFlyFrame = aAttrIter.OutFlys( nAktPos );
+ AttrOutput().SetStateOfFlyFrame( nStateOfFlyFrame );
+ AttrOutput().SetAnchorIsLinkedToNode( bPostponeWritingText && (FLY_POSTPONED != nStateOfFlyFrame) );
+ // Append bookmarks in this range after flys, exclusive of final
+ // position of this range
+ AppendBookmarks( rNode, nAktPos, nNextAttr - nAktPos );
+ AppendAnnotationMarks( rNode, nAktPos, nNextAttr - nAktPos );
- bool bTextAtr = aAttrIter.IsTextAttr( nAktPos );
- nOpenAttrWithRange += aAttrIter.OutAttrWithRange( rNode, nAktPos );
+ // At the moment smarttags are only written for paragraphs, at the
+ // beginning of the paragraph.
+ if (nAktPos == 0)
+ AppendSmartTags(rNode);
- sal_Int32 nLen = nNextAttr - nAktPos;
- if ( !bTextAtr && nLen )
- {
- sal_Unicode ch = aStr[nAktPos];
- const sal_Int32 ofs = ( ch == CH_TXT_ATR_FIELDSTART || ch == CH_TXT_ATR_FIELDEND || ch == CH_TXT_ATR_FORMELEMENT? 1 : 0 );
+ bool bTextAtr = aAttrIter.IsTextAttr( nAktPos );
+ nOpenAttrWithRange += aAttrIter.OutAttrWithRange( rNode, nAktPos );
- IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess();
- if ( ch == CH_TXT_ATR_FIELDSTART )
+ sal_Int32 nLen = nNextAttr - nAktPos;
+ if ( !bTextAtr && nLen )
{
- SwPosition aPosition( rNode, SwIndex( &rNode, nAktPos ) );
- ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
- OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
-
- if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT )
- AppendBookmark( pFieldmark->GetName() );
- ww::eField eFieldId = lcl_getFieldId( pFieldmark );
- OUString sCode = lcl_getFieldCode( pFieldmark );
- if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
+ sal_Unicode ch = aStr[nAktPos];
+ const sal_Int32 ofs = ( ch == CH_TXT_ATR_FIELDSTART || ch == CH_TXT_ATR_FIELDEND || ch == CH_TXT_ATR_FORMELEMENT? 1 : 0 );
+
+ IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess();
+ if ( ch == CH_TXT_ATR_FIELDSTART )
{
- IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( ODF_ID_PARAM );
- if ( it != pFieldmark->GetParameters()->end() )
+ SwPosition aPosition( rNode, SwIndex( &rNode, nAktPos ) );
+ ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
+ OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
+
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT )
+ AppendBookmark( pFieldmark->GetName() );
+ ww::eField eFieldId = lcl_getFieldId( pFieldmark );
+ OUString sCode = lcl_getFieldCode( pFieldmark );
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
{
- OUString sFieldId;
- it->second >>= sFieldId;
- eFieldId = (ww::eField)sFieldId.toInt32();
- }
+ IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( ODF_ID_PARAM );
+ if ( it != pFieldmark->GetParameters()->end() )
+ {
+ OUString sFieldId;
+ it->second >>= sFieldId;
+ eFieldId = (ww::eField)sFieldId.toInt32();
+ }
- it = pFieldmark->GetParameters()->find( ODF_CODE_PARAM );
- if ( it != pFieldmark->GetParameters()->end() )
- {
- it->second >>= sCode;
+ it = pFieldmark->GetParameters()->find( ODF_CODE_PARAM );
+ if ( it != pFieldmark->GetParameters()->end() )
+ {
+ it->second >>= sCode;
+ }
}
- }
- OutputField( nullptr, eFieldId, sCode, FieldFlags::Start | FieldFlags::CmdStart );
+ OutputField( nullptr, eFieldId, sCode, FieldFlags::Start | FieldFlags::CmdStart );
- if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_FORMTEXT )
- WriteFormData( *pFieldmark );
- else if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_HYPERLINK )
- WriteHyperlinkData( *pFieldmark );
- OutputField( nullptr, lcl_getFieldId( pFieldmark ), OUString(), FieldFlags::CmdEnd );
+ if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_FORMTEXT )
+ WriteFormData( *pFieldmark );
+ else if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_HYPERLINK )
+ WriteHyperlinkData( *pFieldmark );
+ OutputField( nullptr, lcl_getFieldId( pFieldmark ), OUString(), FieldFlags::CmdEnd );
- if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
- {
- // Check for the presence of a linked OLE object
- IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( ODF_OLE_PARAM );
- if ( it != pFieldmark->GetParameters()->end() )
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
{
- OUString sOleId;
- uno::Any aValue = it->second;
- aValue >>= sOleId;
- if ( !sOleId.isEmpty() )
- OutputLinkedOLE( sOleId );
+ // Check for the presence of a linked OLE object
+ IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( ODF_OLE_PARAM );
+ if ( it != pFieldmark->GetParameters()->end() )
+ {
+ OUString sOleId;
+ uno::Any aValue = it->second;
+ aValue >>= sOleId;
+ if ( !sOleId.isEmpty() )
+ OutputLinkedOLE( sOleId );
+ }
}
}
- }
- else if ( ch == CH_TXT_ATR_FIELDEND )
- {
- SwPosition aPosition( rNode, SwIndex( &rNode, nAktPos ) );
- ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
+ else if ( ch == CH_TXT_ATR_FIELDEND )
+ {
+ SwPosition aPosition( rNode, SwIndex( &rNode, nAktPos ) );
+ ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
- OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDEND??" );
+ OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDEND??" );
- ww::eField eFieldId = lcl_getFieldId( pFieldmark );
- if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
- {
- IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( ODF_ID_PARAM );
- if ( it != pFieldmark->GetParameters()->end() )
+ ww::eField eFieldId = lcl_getFieldId( pFieldmark );
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
{
- OUString sFieldId;
- it->second >>= sFieldId;
- eFieldId = (ww::eField)sFieldId.toInt32();
+ IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( ODF_ID_PARAM );
+ if ( it != pFieldmark->GetParameters()->end() )
+ {
+ OUString sFieldId;
+ it->second >>= sFieldId;
+ eFieldId = (ww::eField)sFieldId.toInt32();
+ }
}
+
+ OutputField( nullptr, eFieldId, OUString(), FieldFlags::Close );
+
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT )
+ AppendBookmark( pFieldmark->GetName() );
+ }
+ else if ( ch == CH_TXT_ATR_FORMELEMENT )
+ {
+ SwPosition aPosition( rNode, SwIndex( &rNode, nAktPos ) );
+ ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
+ OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
+
+ bool isDropdownOrCheckbox = pFieldmark && (pFieldmark->GetFieldname( ) == ODF_FORMDROPDOWN ||
+ pFieldmark->GetFieldname( ) == ODF_FORMCHECKBOX );
+
+ if ( isDropdownOrCheckbox )
+ AppendBookmark( pFieldmark->GetName() );
+ OutputField( nullptr, lcl_getFieldId( pFieldmark ),
+ lcl_getFieldCode( pFieldmark ),
+ FieldFlags::Start | FieldFlags::CmdStart );
+ if ( isDropdownOrCheckbox )
+ WriteFormData( *pFieldmark );
+ OutputField( nullptr, lcl_getFieldId( pFieldmark ), OUString(), FieldFlags::Close );
+ if ( isDropdownOrCheckbox )
+ AppendBookmark( pFieldmark->GetName() );
}
+ nLen -= ofs;
- OutputField( nullptr, eFieldId, OUString(), FieldFlags::Close );
+ // if paragraph needs to be split, write only until split postition
+ if( bNeedParaSplit && nAktPos + ofs + nLen > *aBreakIt)
+ nLen = *aBreakIt - nAktPos - ofs;
- if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT )
- AppendBookmark( pFieldmark->GetName() );
- }
- else if ( ch == CH_TXT_ATR_FORMELEMENT )
- {
- SwPosition aPosition( rNode, SwIndex( &rNode, nAktPos ) );
- ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
- OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
-
- bool isDropdownOrCheckbox = pFieldmark && (pFieldmark->GetFieldname( ) == ODF_FORMDROPDOWN ||
- pFieldmark->GetFieldname( ) == ODF_FORMCHECKBOX );
-
- if ( isDropdownOrCheckbox )
- AppendBookmark( pFieldmark->GetName() );
- OutputField( nullptr, lcl_getFieldId( pFieldmark ),
- lcl_getFieldCode( pFieldmark ),
- FieldFlags::Start | FieldFlags::CmdStart );
- if ( isDropdownOrCheckbox )
- WriteFormData( *pFieldmark );
- OutputField( nullptr, lcl_getFieldId( pFieldmark ), OUString(), FieldFlags::Close );
- if ( isDropdownOrCheckbox )
- AppendBookmark( pFieldmark->GetName() );
+ OUString aSnippet( aAttrIter.GetSnippet( aStr, nAktPos + ofs, nLen ) );
+ if ( ( m_nTextTyp == TXT_EDN || m_nTextTyp == TXT_FTN ) && nAktPos == 0 && nLen > 0 )
+ {
+ // Insert tab for aesthetic purposes #i24762#
+ if ( aSnippet[0] != 0x09 )
+ aSnippet = "\x09" + aSnippet;
+ }
+
+ if ( bPostponeWritingText && ( FLY_POSTPONED != nStateOfFlyFrame ) )
+ {
+ bPostponeWritingText = true ;
+ aSavedSnippet = aSnippet ;
+ }
+ else
+ {
+ bPostponeWritingText = false ;
+ AttrOutput().RunText( aSnippet, eChrSet );
+ }
}
- nLen -= ofs;
- OUString aSnippet( aAttrIter.GetSnippet( aStr, nAktPos + ofs, nLen ) );
- if ( ( m_nTextTyp == TXT_EDN || m_nTextTyp == TXT_FTN ) && nAktPos == 0 && nLen > 0 )
+ if ( aAttrIter.IsDropCap( nNextAttr ) )
+ AttrOutput().FormatDrop( rNode, aAttrIter.GetSwFormatDrop(), nStyle, pTextNodeInfo, pTextNodeInfoInner );
+
+ // Only output character attributes if this is not a postponed text run.
+ if (0 != nEnd && !(bPostponeWritingText && FLY_PROCESSED == nStateOfFlyFrame))
{
- // Insert tab for aesthetic purposes #i24762#
- if ( aSnippet[0] != 0x09 )
- aSnippet = "\x09" + aSnippet;
+ // Output the character attributes
+ // #i51277# do this before writing flys at end of paragraph
+ AttrOutput().StartRunProperties();
+ aAttrIter.OutAttr( nAktPos );
+ AttrOutput().EndRunProperties( pRedlineData );
}
- if ( bPostponeWritingText && ( FLY_POSTPONED != nStateOfFlyFrame ) )
+ // At the end of line, output the attributes until the CR.
+ // Exception: footnotes at the end of line
+ if ( nNextAttr == nEnd )
{
- bPostponeWritingText = true ;
- aSavedSnippet = aSnippet ;
+ OSL_ENSURE( nOpenAttrWithRange >= 0, "odd to see this happening, expected >= 0" );
+ if ( !bTextAtr && nOpenAttrWithRange <= 0 )
+ {
+ if ( aAttrIter.IncludeEndOfParaCRInRedlineProperties( nEnd ) )
+ bIncludeEndOfParaCRInRedlineProperties = true;
+ else
+ {
+ // insert final graphic anchors if any before CR
+ nStateOfFlyFrame = aAttrIter.OutFlys( nEnd );
+ // insert final bookmarks if any before CR and after flys
+ AppendBookmarks( rNode, nEnd, 1 );
+ AppendAnnotationMarks( rNode, nEnd, 1 );
+ if ( pTOXSect )
+ {
+ m_aCurrentCharPropStarts.pop();
+ AttrOutput().EndTOX( *pTOXSect ,false);
+ }
+ //For i120928,the position of the bullet's graphic is at end of doc
+ if (bLastCR && (!bExported))
+ {
+ ExportGrfBullet(rNode);
+ bExported = true;
+ }
+
+ WriteCR( pTextNodeInfoInner );
+ }
+ }
}
- else
+
+ if (0 == nEnd)
{
- bPostponeWritingText = false ;
- AttrOutput().RunText( aSnippet, eChrSet );
+ // Output the character attributes
+ // do it after WriteCR for an empty paragraph (otherwise
+ // WW8_WrFkp::Append throws SPRMs away...)
+ AttrOutput().StartRunProperties();
+ aAttrIter.OutAttr( nAktPos );
+ AttrOutput().EndRunProperties( pRedlineData );
}
- }
- if ( aAttrIter.IsDropCap( nNextAttr ) )
- AttrOutput().FormatDrop( rNode, aAttrIter.GetSwFormatDrop(), nStyle, pTextNodeInfo, pTextNodeInfoInner );
+ // Exception: footnotes at the end of line
+ if ( nNextAttr == nEnd )
+ {
+ OSL_ENSURE(nOpenAttrWithRange >= 0,
+ "odd to see this happening, expected >= 0");
+ bool bAttrWithRange = (nOpenAttrWithRange > 0);
+ if ( nAktPos != nEnd )
+ {
+ nOpenAttrWithRange += aAttrIter.OutAttrWithRange( rNode, nEnd );
+ OSL_ENSURE(nOpenAttrWithRange == 0,
+ "odd to see this happening, expected 0");
+ }
- // Only output character attributes if this is not a postponed text run.
- if (0 != nEnd && !(bPostponeWritingText && FLY_PROCESSED == nStateOfFlyFrame))
- {
- // Output the character attributes
- // #i51277# do this before writing flys at end of paragraph
- AttrOutput().StartRunProperties();
- aAttrIter.OutAttr( nAktPos );
- AttrOutput().EndRunProperties( pRedlineData );
- }
+ // !bIncludeEndOfParaCRInRedlineProperties implies we have just
+ // emitted a CR, in which case we want to pass force=true to
+ // OutputFKP to ensure that an FKP entry for direct character
+ // formatting is written even if empty, so that the next one will
+ // start after the CR.
+ AttrOutput().OutputFKP(!bIncludeEndOfParaCRInRedlineProperties);
- // At the end of line, output the attributes until the CR.
- // Exception: footnotes at the end of line
- if ( nNextAttr == nEnd )
- {
- OSL_ENSURE( nOpenAttrWithRange >= 0, "odd to see this happening, expected >= 0" );
- if ( !bTextAtr && nOpenAttrWithRange <= 0 )
- {
- if ( aAttrIter.IncludeEndOfParaCRInRedlineProperties( nEnd ) )
- bIncludeEndOfParaCRInRedlineProperties = true;
- else
+ if (bTextAtr || bAttrWithRange || bIncludeEndOfParaCRInRedlineProperties)
{
// insert final graphic anchors if any before CR
nStateOfFlyFrame = aAttrIter.OutFlys( nEnd );
// insert final bookmarks if any before CR and after flys
AppendBookmarks( rNode, nEnd, 1 );
AppendAnnotationMarks( rNode, nEnd, 1 );
- if ( pTOXSect )
- {
- m_aCurrentCharPropStarts.pop();
- AttrOutput().EndTOX( *pTOXSect ,false);
- }
- //For i120928,the position of the bullet's graphic is at end of doc
+ WriteCR( pTextNodeInfoInner );
+ // #i120928 - position of the bullet's graphic is at end of doc
if (bLastCR && (!bExported))
{
ExportGrfBullet(rNode);
bExported = true;
}
- WriteCR( pTextNodeInfoInner );
- }
- }
- }
-
- if (0 == nEnd)
- {
- // Output the character attributes
- // do it after WriteCR for an empty paragraph (otherwise
- // WW8_WrFkp::Append throws SPRMs away...)
- AttrOutput().StartRunProperties();
- aAttrIter.OutAttr( nAktPos );
- AttrOutput().EndRunProperties( pRedlineData );
- }
+ if ( pTOXSect )
+ {
+ m_aCurrentCharPropStarts.pop();
+ AttrOutput().EndTOX( *pTOXSect );
+ }
- // Exception: footnotes at the end of line
- if ( nNextAttr == nEnd )
- {
- OSL_ENSURE(nOpenAttrWithRange >= 0,
- "odd to see this happening, expected >= 0");
- bool bAttrWithRange = (nOpenAttrWithRange > 0);
- if ( nAktPos != nEnd )
- {
- nOpenAttrWithRange += aAttrIter.OutAttrWithRange( rNode, nEnd );
- OSL_ENSURE(nOpenAttrWithRange == 0,
- "odd to see this happening, expected 0");
+ if (bIncludeEndOfParaCRInRedlineProperties)
+ {
+ AttrOutput().Redline( aAttrIter.GetRunLevelRedline( nEnd ) );
+ //If there was no redline property emitted, force adding
+ //another entry for the CR so that in the case that this
+ //has no redline, but the next para does, then this one is
+ //not merged with the next
+ AttrOutput().OutputFKP(true);
+ }
+ }
}
- // !bIncludeEndOfParaCRInRedlineProperties implies we have just
- // emitted a CR, in which case we want to pass force=true to
- // OutputFKP to ensure that an FKP entry for direct character
- // formatting is written even if empty, so that the next one will
- // start after the CR.
- AttrOutput().OutputFKP(!bIncludeEndOfParaCRInRedlineProperties);
+ AttrOutput().WritePostitFieldReference();
- if (bTextAtr || bAttrWithRange || bIncludeEndOfParaCRInRedlineProperties)
+ if( bPostponeWritingText && FLY_PROCESSED == nStateOfFlyFrame )
{
- // insert final graphic anchors if any before CR
- nStateOfFlyFrame = aAttrIter.OutFlys( nEnd );
- // insert final bookmarks if any before CR and after flys
- AppendBookmarks( rNode, nEnd, 1 );
- AppendAnnotationMarks( rNode, nEnd, 1 );
- WriteCR( pTextNodeInfoInner );
- // #i120928 - position of the bullet's graphic is at end of doc
- if (bLastCR && (!bExported))
- {
- ExportGrfBullet(rNode);
- bExported = true;
- }
-
- if ( pTOXSect )
- {
- m_aCurrentCharPropStarts.pop();
- AttrOutput().EndTOX( *pTOXSect );
- }
-
- if (bIncludeEndOfParaCRInRedlineProperties)
+ AttrOutput().EndRun(&rNode, nAktPos, nNextAttr == nEnd);
+ //write the postponed text run
+ AttrOutput().StartRun( pRedlineData, nAktPos, bSingleEmptyRun );
+ AttrOutput().SetAnchorIsLinkedToNode( false );
+ AttrOutput().ResetFlyProcessingFlag();
+ if (0 != nEnd)
{
- AttrOutput().Redline( aAttrIter.GetRunLevelRedline( nEnd ) );
- //If there was no redline property emitted, force adding
- //another entry for the CR so that in the case that this
- //has no redline, but the next para does, then this one is
- //not merged with the next
- AttrOutput().OutputFKP(true);
+ AttrOutput().StartRunProperties();
+ aAttrIter.OutAttr( nAktPos );
+ AttrOutput().EndRunProperties( pRedlineData );
}
+ AttrOutput().RunText( aSavedSnippet, eChrSet );
+ AttrOutput().EndRun(&rNode, nAktPos, nNextAttr == nEnd);
}
- }
+ else if( bPostponeWritingText && !aSavedSnippet.isEmpty() )
+ {
+ //write the postponed text run
+ AttrOutput().RunText( aSavedSnippet, eChrSet );
+ AttrOutput().EndRun(&rNode, nAktPos, nNextAttr == nEnd);
+ }
+ else
+ AttrOutput().EndRun(&rNode, nAktPos, nNextAttr == nEnd);
- AttrOutput().WritePostitFieldReference();
+ nAktPos = nNextAttr;
+ UpdatePosition( &aAttrIter, nAktPos );
+ eChrSet = aAttrIter.GetCharSet();
+ }
+ while ( nAktPos < nEnd );
- if( bPostponeWritingText && FLY_PROCESSED == nStateOfFlyFrame )
+ // if paragraph is split, put the section break between the parts
+ // else check if section break needed after the paragraph
+ if( !bNeedParaSplit || *aBreakIt != rNode.GetText().getLength() )
{
- AttrOutput().EndRun(&rNode, nAktPos, nNextAttr == nEnd);
- //write the postponed text run
- AttrOutput().StartRun( pRedlineData, nAktPos, bSingleEmptyRun );
- AttrOutput().SetAnchorIsLinkedToNode( false );
- AttrOutput().ResetFlyProcessingFlag();
- if (0 != nEnd)
+ AttrOutput().SectionBreaks(rNode);
+ SwNodeIndex aNextIndex( rNode, 1 );
+ const SwNode& pNextNode = aNextIndex.GetNode();
+ if( pNextNode.IsTextNode() && bNeedParaSplit )
{
- AttrOutput().StartRunProperties();
- aAttrIter.OutAttr( nAktPos );
- AttrOutput().EndRunProperties( pRedlineData );
+ SectionBreaksAndFrames( *static_cast<SwTextNode*>(
+ &aNextIndex.GetNode() ));
}
- AttrOutput().RunText( aSavedSnippet, eChrSet );
- AttrOutput().EndRun(&rNode, nAktPos, nNextAttr == nEnd);
}
- else if( bPostponeWritingText && !aSavedSnippet.isEmpty() )
- {
- //write the postponed text run
- AttrOutput().RunText( aSavedSnippet, eChrSet );
- AttrOutput().EndRun(&rNode, nAktPos, nNextAttr == nEnd);
- }
- else
- AttrOutput().EndRun(&rNode, nAktPos, nNextAttr == nEnd);
-
- nAktPos = nNextAttr;
- UpdatePosition( &aAttrIter, nAktPos );
- eChrSet = aAttrIter.GetCharSet();
- }
- while ( nAktPos < nEnd );
-
- AttrOutput().SectionBreaks(rNode);
- AttrOutput().StartParagraphProperties();
+ AttrOutput().StartParagraphProperties();
- AttrOutput().ParagraphStyle( nStyle );
+ AttrOutput().ParagraphStyle( nStyle );
- if ( m_pParentFrame && IsInTable() ) // Fly-Attrs
- OutputFormat( m_pParentFrame->GetFrameFormat(), false, false, true );
+ if ( m_pParentFrame && IsInTable() ) // Fly-Attrs
+ OutputFormat( m_pParentFrame->GetFrameFormat(), false, false, true );
- if ( pTextNodeInfo.get() != nullptr )
- {
+ if ( pTextNodeInfo.get() != nullptr )
+ {
#ifdef DBG_UTIL
- SAL_INFO( "sw.ww8", pTextNodeInfo->toString());
+ SAL_INFO( "sw.ww8", pTextNodeInfo->toString());
#endif
- AttrOutput().TableInfoCell( pTextNodeInfoInner );
- if (pTextNodeInfoInner->isFirstInTable())
- {
- const SwTable * pTable = pTextNodeInfoInner->getTable();
-
- const SwTableFormat* pTabFormat = pTable->GetFrameFormat();
- if (pTabFormat != nullptr)
+ AttrOutput().TableInfoCell( pTextNodeInfoInner );
+ if (pTextNodeInfoInner->isFirstInTable())
{
- if (pTabFormat->GetBreak().GetBreak() == SvxBreak::PageBefore)
- AttrOutput().PageBreakBefore(true);
- }
- }
- }
+ const SwTable * pTable = pTextNodeInfoInner->getTable();
- if ( !bFlyInTable )
- {
- SfxItemSet* pTmpSet = nullptr;
- const sal_uInt8 nPrvNxtNd = rNode.HasPrevNextLayNode();
-
- if( (ND_HAS_PREV_LAYNODE|ND_HAS_NEXT_LAYNODE ) != nPrvNxtNd )
- {
- const SfxPoolItem* pItem;
- if( SfxItemState::SET == rNode.GetSwAttrSet().GetItemState(
- RES_UL_SPACE, true, &pItem ) &&
- ( ( !( ND_HAS_PREV_LAYNODE & nPrvNxtNd ) &&
- static_cast<const SvxULSpaceItem*>(pItem)->GetUpper()) ||
- ( !( ND_HAS_NEXT_LAYNODE & nPrvNxtNd ) &&
- static_cast<const SvxULSpaceItem*>(pItem)->GetLower()) ))
- {
- pTmpSet = new SfxItemSet( rNode.GetSwAttrSet() );
- SvxULSpaceItem aUL( *static_cast<const SvxULSpaceItem*>(pItem) );
- // #i25901#- consider compatibility option
- if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES))
+ const SwTableFormat* pTabFormat = pTable->GetFrameFormat();
+ if (pTabFormat != nullptr)
{
- if( !(ND_HAS_PREV_LAYNODE & nPrvNxtNd ))
- aUL.SetUpper( 0 );
+ if (pTabFormat->GetBreak().GetBreak() == SvxBreak::PageBefore)
+ AttrOutput().PageBreakBefore(true);
}
- // #i25901# - consider compatibility option
- if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS))
- {
- if( !(ND_HAS_NEXT_LAYNODE & nPrvNxtNd ))
- aUL.SetLower( 0 );
- }
- pTmpSet->Put( aUL );
}
}
- bool bParaRTL = aAttrIter.IsParaRTL();
-
- int nNumberLevel = -1;
- if (rNode.IsNumbered())
- nNumberLevel = rNode.GetActualListLevel();
- if (nNumberLevel >= 0 && nNumberLevel < MAXLEVEL)
+ if ( !bFlyInTable )
{
- const SwNumRule* pRule = rNode.GetNumRule();
- sal_uInt8 nLvl = static_cast< sal_uInt8 >(nNumberLevel);
- const SwNumFormat* pFormat = pRule->GetNumFormat( nLvl );
- if( !pFormat )
- pFormat = &pRule->Get( nLvl );
+ SfxItemSet* pTmpSet = nullptr;
+ const sal_uInt8 nPrvNxtNd = rNode.HasPrevNextLayNode();
- if( !pTmpSet )
- pTmpSet = new SfxItemSet( rNode.GetSwAttrSet() );
-
- SvxLRSpaceItem aLR(ItemGet<SvxLRSpaceItem>(*pTmpSet, RES_LR_SPACE));
- // #i86652#
- if ( pFormat->GetPositionAndSpaceMode() ==
- SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ if( (ND_HAS_PREV_LAYNODE|ND_HAS_NEXT_LAYNODE ) != nPrvNxtNd )
{
- aLR.SetTextLeft( aLR.GetTextLeft() + pFormat->GetAbsLSpace() );
+ const SfxPoolItem* pItem;
+ if( SfxItemState::SET == rNode.GetSwAttrSet().GetItemState(
+ RES_UL_SPACE, true, &pItem ) &&
+ ( ( !( ND_HAS_PREV_LAYNODE & nPrvNxtNd ) &&
+ static_cast<const SvxULSpaceItem*>(pItem)->GetUpper()) ||
+ ( !( ND_HAS_NEXT_LAYNODE & nPrvNxtNd ) &&
+ static_cast<const SvxULSpaceItem*>(pItem)->GetLower()) ))
+ {
+ pTmpSet = new SfxItemSet( rNode.GetSwAttrSet() );
+ SvxULSpaceItem aUL( *static_cast<const SvxULSpaceItem*>(pItem) );
+ // #i25901#- consider compatibility option
+ if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES))
+ {
+ if( !(ND_HAS_PREV_LAYNODE & nPrvNxtNd ))
+ aUL.SetUpper( 0 );
+ }
+ // #i25901# - consider compatibility option
+ if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS))
+ {
+ if( !(ND_HAS_NEXT_LAYNODE & nPrvNxtNd ))
+ aUL.SetLower( 0 );
+ }
+ pTmpSet->Put( aUL );
+ }
}
- if( rNode.IsNumbered() && rNode.IsCountedInList() )
+ bool bParaRTL = aAttrIter.IsParaRTL();
+
+ int nNumberLevel = -1;
+ if (rNode.IsNumbered())
+ nNumberLevel = rNode.GetActualListLevel();
+ if (nNumberLevel >= 0 && nNumberLevel < MAXLEVEL)
{
+ const SwNumRule* pRule = rNode.GetNumRule();
+ sal_uInt8 nLvl = static_cast< sal_uInt8 >(nNumberLevel);
+ const SwNumFormat* pFormat = pRule->GetNumFormat( nLvl );
+ if( !pFormat )
+ pFormat = &pRule->Get( nLvl );
+
+ if( !pTmpSet )
+ pTmpSet = new SfxItemSet( rNode.GetSwAttrSet() );
+
+ SvxLRSpaceItem aLR(ItemGet<SvxLRSpaceItem>(*pTmpSet, RES_LR_SPACE));
// #i86652#
if ( pFormat->GetPositionAndSpaceMode() ==
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
- if (bParaRTL)
- aLR.SetTextFirstLineOfstValue(pFormat->GetAbsLSpace() - pFormat->GetFirstLineOffset());
- else
- aLR.SetTextFirstLineOfst(GetWordFirstLineOffset(*pFormat));
+ aLR.SetTextLeft( aLR.GetTextLeft() + pFormat->GetAbsLSpace() );
}
- // correct fix for issue i94187
- if (SfxItemState::SET !=
- pTmpSet->GetItemState(RES_PARATR_NUMRULE, false) )
+ if( rNode.IsNumbered() && rNode.IsCountedInList() )
{
- // List style set via paragraph style - then put it into the itemset.
- // This is needed to get list level and list id exported for
- // the paragraph.
- pTmpSet->Put( SwNumRuleItem( pRule->GetName() ));
-
- // Put indent values into the itemset in case that the list
- // style is applied via paragraph style and the list level
- // indent values are not applicable.
+ // #i86652#
if ( pFormat->GetPositionAndSpaceMode() ==
- SvxNumberFormat::LABEL_ALIGNMENT &&
- !rNode.AreListLevelIndentsApplicable() )
+ SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ if (bParaRTL)
+ aLR.SetTextFirstLineOfstValue(pFormat->GetAbsLSpace() - pFormat->GetFirstLineOffset());
+ else
+ aLR.SetTextFirstLineOfst(GetWordFirstLineOffset(*pFormat));
+ }
+
+ // correct fix for issue i94187
+ if (SfxItemState::SET !=
+ pTmpSet->GetItemState(RES_PARATR_NUMRULE, false) )
{
- pTmpSet->Put( aLR );
+ // List style set via paragraph style - then put it into the itemset.
+ // This is needed to get list level and list id exported for
+ // the paragraph.
+ pTmpSet->Put( SwNumRuleItem( pRule->GetName() ));
+
+ // Put indent values into the itemset in case that the list
+ // style is applied via paragraph style and the list level
+ // indent values are not applicable.
+ if ( pFormat->GetPositionAndSpaceMode() ==
+ SvxNumberFormat::LABEL_ALIGNMENT &&
+ !rNode.AreListLevelIndentsApplicable() )
+ {
+ pTmpSet->Put( aLR );
+ }
}
}
- }
- else
- pTmpSet->ClearItem(RES_PARATR_NUMRULE);
+ else
+ pTmpSet->ClearItem(RES_PARATR_NUMRULE);
- // #i86652#
- if ( pFormat->GetPositionAndSpaceMode() ==
- SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
- {
- pTmpSet->Put(aLR);
+ // #i86652#
+ if ( pFormat->GetPositionAndSpaceMode() ==
+ SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ pTmpSet->Put(aLR);
- //#i21847#
- SvxTabStopItem aItem(
- ItemGet<SvxTabStopItem>(*pTmpSet, RES_PARATR_TABSTOP));
- SvxTabStop aTabStop(pFormat->GetAbsLSpace());
- aItem.Insert(aTabStop);
- pTmpSet->Put(aItem);
+ //#i21847#
+ SvxTabStopItem aItem(
+ ItemGet<SvxTabStopItem>(*pTmpSet, RES_PARATR_TABSTOP));
+ SvxTabStop aTabStop(pFormat->GetAbsLSpace());
+ aItem.Insert(aTabStop);
+ pTmpSet->Put(aItem);
- MSWordExportBase::CorrectTabStopInSet(*pTmpSet, pFormat->GetAbsLSpace());
+ MSWordExportBase::CorrectTabStopInSet(*pTmpSet, pFormat->GetAbsLSpace());
+ }
}
- }
- /*
- If a given para is using the SvxFrameDirection::Environment direction we
- cannot export that, if it's ltr then that's ok as that is word's
- default. Otherwise we must add a RTL attribute to our export list
- */
- const SvxFrameDirectionItem* pItem = static_cast<const SvxFrameDirectionItem*>(
- rNode.GetSwAttrSet().GetItem(RES_FRAMEDIR));
- if (
- (!pItem || pItem->GetValue() == SvxFrameDirection::Environment) &&
- aAttrIter.IsParaRTL()
- )
- {
- if ( !pTmpSet )
- pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
-
- pTmpSet->Put(SvxFrameDirectionItem(SvxFrameDirection::Horizontal_RL_TB, RES_FRAMEDIR));
- }
- // move code for handling of numbered,
- // but not counted paragraphs to this place. Otherwise, the paragraph
- // isn't exported as numbered, but not counted, if no other attribute
- // is found in <pTmpSet>
- // #i44815# adjust numbering/indents for numbered paragraphs
- // without number (NO_NUMLEVEL)
- // #i47013# need to check rNode.GetNumRule()!=NULL as well.
- if ( ! rNode.IsCountedInList() && rNode.GetNumRule()!=nullptr )
- {
- // WW8 does not know numbered paragraphs without number
- // (NO_NUMLEVEL). In WW8AttributeOutput::ParaNumRule(), we will export
- // the RES_PARATR_NUMRULE as list-id 0, which in WW8 means
- // no numbering. Here, we will adjust the indents to match
- // visually.
-
- if ( !pTmpSet )
- pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
-
- // create new LRSpace item, based on the current (if present)
- const SfxPoolItem* pPoolItem = nullptr;
- pTmpSet->GetItemState(RES_LR_SPACE, true, &pPoolItem);
- SvxLRSpaceItem aLRSpace(
- ( pPoolItem == nullptr )
- ? SvxLRSpaceItem(0, 0, 0, 0, RES_LR_SPACE)
- : *static_cast<const SvxLRSpaceItem*>( pPoolItem ) );
-
- // new left margin = old left + label space
- const SwNumRule* pRule = rNode.GetNumRule();
- int nLevel = rNode.GetActualListLevel();
-
- if (nLevel < 0)
- nLevel = 0;
-
- if (nLevel >= MAXLEVEL)
- nLevel = MAXLEVEL - 1;
-
- const SwNumFormat& rNumFormat = pRule->Get( static_cast< sal_uInt16 >(nLevel) );
-
- // #i86652#
- if ( rNumFormat.GetPositionAndSpaceMode() ==
- SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ /*
+ If a given para is using the SvxFrameDirection::Environment direction we
+ cannot export that, if it's ltr then that's ok as that is word's
+ default. Otherwise we must add a RTL attribute to our export list
+ */
+ const SvxFrameDirectionItem* pItem = static_cast<const SvxFrameDirectionItem*>(
+ rNode.GetSwAttrSet().GetItem(RES_FRAMEDIR));
+ if (
+ (!pItem || pItem->GetValue() == SvxFrameDirection::Environment) &&
+ aAttrIter.IsParaRTL()
+ )
{
- aLRSpace.SetTextLeft( aLRSpace.GetLeft() + rNumFormat.GetAbsLSpace() );
+ if ( !pTmpSet )
+ pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
+
+ pTmpSet->Put(SvxFrameDirectionItem(SvxFrameDirection::Horizontal_RL_TB, RES_FRAMEDIR));
}
- else
+ // move code for handling of numbered,
+ // but not counted paragraphs to this place. Otherwise, the paragraph
+ // isn't exported as numbered, but not counted, if no other attribute
+ // is found in <pTmpSet>
+ // #i44815# adjust numbering/indents for numbered paragraphs
+ // without number (NO_NUMLEVEL)
+ // #i47013# need to check rNode.GetNumRule()!=NULL as well.
+ if ( ! rNode.IsCountedInList() && rNode.GetNumRule()!=nullptr )
{
- aLRSpace.SetTextLeft( aLRSpace.GetLeft() + rNumFormat.GetIndentAt() );
- }
+ // WW8 does not know numbered paragraphs without number
+ // (NO_NUMLEVEL). In WW8AttributeOutput::ParaNumRule(), we will export
+ // the RES_PARATR_NUMRULE as list-id 0, which in WW8 means
+ // no numbering. Here, we will adjust the indents to match
+ // visually.
- // new first line indent = 0
- // (first line indent is ignored for NO_NUMLEVEL)
- if (!bParaRTL)
- aLRSpace.SetTextFirstLineOfst( 0 );
+ if ( !pTmpSet )
+ pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
- // put back the new item
- pTmpSet->Put( aLRSpace );
+ // create new LRSpace item, based on the current (if present)
+ const SfxPoolItem* pPoolItem = nullptr;
+ pTmpSet->GetItemState(RES_LR_SPACE, true, &pPoolItem);
+ SvxLRSpaceItem aLRSpace(
+ ( pPoolItem == nullptr )
+ ? SvxLRSpaceItem(0, 0, 0, 0, RES_LR_SPACE)
+ : *static_cast<const SvxLRSpaceItem*>( pPoolItem ) );
- // assure that numbering rule is in <pTmpSet>
- if (SfxItemState::SET != pTmpSet->GetItemState(RES_PARATR_NUMRULE, false) )
- {
- pTmpSet->Put( SwNumRuleItem( pRule->GetName() ));
+ // new left margin = old left + label space
+ const SwNumRule* pRule = rNode.GetNumRule();
+ int nLevel = rNode.GetActualListLevel();
+
+ if (nLevel < 0)
+ nLevel = 0;
+
+ if (nLevel >= MAXLEVEL)
+ nLevel = MAXLEVEL - 1;
+
+ const SwNumFormat& rNumFormat = pRule->Get( static_cast< sal_uInt16 >(nLevel) );
+
+ // #i86652#
+ if ( rNumFormat.GetPositionAndSpaceMode() ==
+ SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aLRSpace.SetTextLeft( aLRSpace.GetLeft() + rNumFormat.GetAbsLSpace() );
+ }
+ else
+ {
+ aLRSpace.SetTextLeft( aLRSpace.GetLeft() + rNumFormat.GetIndentAt() );
+ }
+
+ // new first line indent = 0
+ // (first line indent is ignored for NO_NUMLEVEL)
+ if (!bParaRTL)
+ aLRSpace.SetTextFirstLineOfst( 0 );
+
+ // put back the new item
+ pTmpSet->Put( aLRSpace );
+
+ // assure that numbering rule is in <pTmpSet>
+ if (SfxItemState::SET != pTmpSet->GetItemState(RES_PARATR_NUMRULE, false) )
+ {
+ pTmpSet->Put( SwNumRuleItem( pRule->GetName() ));
+ }
}
- }
- // #i75457#
- // Export page break after attribute from paragraph style.
- // If page break attribute at the text node exist, an existing page
- // break after at the paragraph style hasn't got to be considered.
- if ( !rNode.GetpSwAttrSet() ||
- SfxItemState::SET != rNode.GetpSwAttrSet()->GetItemState(RES_BREAK, false) )
- {
- const SvxFormatBreakItem* pBreakAtParaStyle =
- &(ItemGet<SvxFormatBreakItem>(rNode.GetSwAttrSet(), RES_BREAK));
- if ( pBreakAtParaStyle &&
- pBreakAtParaStyle->GetBreak() == SvxBreak::PageAfter )
+ // #i75457#
+ // Export page break after attribute from paragraph style.
+ // If page break attribute at the text node exist, an existing page
+ // break after at the paragraph style hasn't got to be considered.
+ if ( !rNode.GetpSwAttrSet() ||
+ SfxItemState::SET != rNode.GetpSwAttrSet()->GetItemState(RES_BREAK, false) )
{
- if ( !pTmpSet )
+ const SvxFormatBreakItem* pBreakAtParaStyle =
+ &(ItemGet<SvxFormatBreakItem>(rNode.GetSwAttrSet(), RES_BREAK));
+ if ( pBreakAtParaStyle &&
+ pBreakAtParaStyle->GetBreak() == SvxBreak::PageAfter )
{
- pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
+ if ( !pTmpSet )
+ {
+ pTmpSet = new SfxItemSet(rNode.GetSwAttrSet());
+ }
+ pTmpSet->Put( *pBreakAtParaStyle );
+ }
+ else if( pTmpSet )
+ { // Even a pagedesc item is set, the break item can be set 'NONE',
+ // this has to be overruled.
+ const SwFormatPageDesc& rPageDescAtParaStyle =
+ ItemGet<SwFormatPageDesc>( rNode, RES_PAGEDESC );
+ if( rPageDescAtParaStyle.KnowsPageDesc() )
+ pTmpSet->ClearItem( RES_BREAK );
}
- pTmpSet->Put( *pBreakAtParaStyle );
- }
- else if( pTmpSet )
- { // Even a pagedesc item is set, the break item can be set 'NONE',
- // this has to be overruled.
- const SwFormatPageDesc& rPageDescAtParaStyle =
- ItemGet<SwFormatPageDesc>( rNode, RES_PAGEDESC );
- if( rPageDescAtParaStyle.KnowsPageDesc() )
- pTmpSet->ClearItem( RES_BREAK );
}
- }
-
- // #i76520# Emulate non-splitting tables
- if ( IsInTable() )
- {
- const SwTableNode* pTableNode = rNode.FindTableNode();
- if ( pTableNode )
+ // #i76520# Emulate non-splitting tables
+ if ( IsInTable() )
{
- const SwTable& rTable = pTableNode->GetTable();
- const SvxFormatKeepItem& rKeep = rTable.GetFrameFormat()->GetKeep();
- const bool bKeep = rKeep.GetValue();
- const bool bDontSplit = !(bKeep ||
- rTable.GetFrameFormat()->GetLayoutSplit().GetValue());
+ const SwTableNode* pTableNode = rNode.FindTableNode();
- if ( bKeep || bDontSplit )
+ if ( pTableNode )
{
- // bKeep: set keep at first paragraphs in all lines
- // bDontSplit : set keep at first paragraphs in all lines except from last line
- // but only for non-complex tables
- const SwTableBox* pBox = rNode.GetTableBox();
- const SwTableLine* pLine = pBox ? pBox->GetUpper() : nullptr;
+ const SwTable& rTable = pTableNode->GetTable();
+ const SvxFormatKeepItem& rKeep = rTable.GetFrameFormat()->GetKeep();
+ const bool bKeep = rKeep.GetValue();
+ const bool bDontSplit = !(bKeep ||
+ rTable.GetFrameFormat()->GetLayoutSplit().GetValue());
- if ( pLine && !pLine->GetUpper() )
+ if ( bKeep || bDontSplit )
{
- // check if box is first in that line:
- if ( 0 == pLine->GetBoxPos( pBox ) && pBox->GetSttNd() )
+ // bKeep: set keep at first paragraphs in all lines
+ // bDontSplit : set keep at first paragraphs in all lines except from last line
+ // but only for non-complex tables
+ const SwTableBox* pBox = rNode.GetTableBox();
+ const SwTableLine* pLine = pBox ? pBox->GetUpper() : nullptr;
+
+ if ( pLine && !pLine->GetUpper() )
{
- // check if paragraph is first in that line:
- if ( 1 == ( rNode.GetIndex() - pBox->GetSttNd()->GetIndex() ) )
+ // check if box is first in that line:
+ if ( 0 == pLine->GetBoxPos( pBox ) && pBox->GetSttNd() )
{
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list