[Libreoffice-commits] core.git: include/o3tl

2015-05-07 Thread Christoph Lutz
 include/o3tl/underlying_type.hxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 7ad4e562b462af22a1c29c955293238cdb30267b
Author: Christoph Lutz christoph.lutz...@cib.de
Date:   Thu May 7 13:47:35 2015 +0200

improve fallback behaviour of underlying_type for old gcc

The fix fbd85c25b is not sufficient to build with an old GCC 4.6.
The problem was, that underlying_type returned an int as default
value for GCC 4.6 and int allows negative values that are forbidden
in typed_flags_set.

Changed it to alternative solution suggested in

http://stackoverflow.com/questions/26148192/underlying-type-of-a-c-enum-in-c03

Change-Id: I20f44b8cef9c692efb583971bd251f1c34c289ab
Reviewed-on: https://gerrit.libreoffice.org/15663
Reviewed-by: Katarina Behrens katarina.behr...@cib.de
Tested-by: Katarina Behrens katarina.behr...@cib.de

diff --git a/include/o3tl/underlying_type.hxx b/include/o3tl/underlying_type.hxx
index 4b2e077..534e088 100644
--- a/include/o3tl/underlying_type.hxx
+++ b/include/o3tl/underlying_type.hxx
@@ -19,7 +19,11 @@ namespace o3tl {
 templatetypename T struct underlying_type {
 #if defined __GNUC__  __GNUC__ == 4  __GNUC_MINOR__ = 6  \
 !defined __clang__
-typedef int type;
+typedef typename std::conditional
+T( -1 )  T( 0 ),
+typename std::make_signed T ::type,
+typename std::make_unsigned T ::type
+::type type;
 #else
 typedef typename std::underlying_typeT::type type;
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-04-28 Thread Christoph Lutz
 sw/source/core/layout/frmtool.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4de83e2c322509c0fb1b989f7e4898728fc4a408
Author: Christoph Lutz christoph.lutz...@cib.de
Date:   Tue Apr 28 17:55:11 2015 +0200

tdf#89783: MM fixes potential endless loops with dbgutil build

Change-Id: I0eeb0decab588d89881a24983eb89727c3d9151b
Reviewed-on: https://gerrit.libreoffice.org/15561
Reviewed-by: Katarina Behrens katarina.behr...@cib.de
Tested-by: Katarina Behrens katarina.behr...@cib.de

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index f61907a..9cb3dae 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1006,7 +1006,7 @@ void AppendObjs( const SwFrmFmts *pTbl, sal_uLong nIndex,
 (void) pTbl;
 #if OSL_DEBUG_LEVEL  0
 std::listSwFrmFmt* checkFmts;
-for ( sal_uInt16 i = 0; i  pTbl-size(); ++i )
+for ( size_t i = 0; i  pTbl-size(); ++i )
 {
 SwFrmFmt *pFmt = (*pTbl)[i];
 const SwFmtAnchor rAnch = pFmt-GetAnchor();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-04-15 Thread Christoph Lutz
 sw/source/uibase/uno/unomailmerge.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit b092dfa9316212722b56b9e027c54eee91aba963
Author: Christoph Lutz christoph.lutz...@cib.de
Date:   Mon Mar 23 13:50:52 2015 +

tdf#90594: MM: Fix for broken translation between Bookmarks and row indizes

The datasets used in the unomailmerge service can be selected via a
property Selection. This property expects a sequence of sdbc::Bookmark
elements that need to be translated into row-inizes. This translation
was broken - the loop-pointer pTranslated was never incremented which
caused a wrong result selection in which only the first element was
changed.

Change-Id: I319131caa89e327b11406ab7d0c56a833385d433
Reviewed-on: https://gerrit.libreoffice.org/15289
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/sw/source/uibase/uno/unomailmerge.cxx 
b/sw/source/uibase/uno/unomailmerge.cxx
index 31cbc11..65d78e5 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -573,6 +573,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
 *pTranslated = xCurResultSet-getRow();
 else
 bEverythingsFine = false;
+++pTranslated;
 }
 if ( bEverythingsFine )
 bValid = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'private/jmux/libreoffice-4-1-6+all'

2015-04-13 Thread Christoph Lutz
New branch 'private/jmux/libreoffice-4-1-6+all' available with the following 
commits:
commit 32fbf5475594c22005f2e39d1f03e16def4d038b
Merge: ae4406f 0da5615
Author: Christoph Lutz christoph.lutz...@cib.de
Date:   Wed Apr 8 17:08:32 2015 +

Merge branch 'private/jmux/libreoffice-4-1-6+backports' into 
private/jmux/libreoffice-4-1-6+all

commit 0da561509c5fd5f359e7e0694cdf644b5cbb592e
Author: Christoph Lutz christoph.lutz...@cib.de
Date:   Wed Apr 8 14:57:28 2015 +

MM: fixed invalid UNO-Reference as return value of UNO MailMergeService

This fix is regarding 9835bb562 MM: export the SwDocShell mail merge via 
UNO:

In case of using the new output type MailMergeType.SHELL, the UNO
MailMergeService returned a XTextDocument instance that was not
correctly initialized. In particular after calling 
doc.getCurrentController()
(with doc = the returned instance) we recieved NULL. The reason was, that 
the
previous implementation used to create a new SwXTextDocument instance
instead of just returning the BaseModel that is already associated with
the internal SwDocShell. This is fixed in this patch.

I also tested this patch with the unit test sw/CppunitTest_sw_mailmerge
and everything seems to be fine now. doc.getCurrentController() no longer
returns NULL.

Change-Id: Ic116f8f25ab9686ef56950e97ba202a55ab81fb8
Reviewed-on: https://gerrit.libreoffice.org/15207
Tested-by: Michael Stahl mst...@redhat.com
Reviewed-by: Michael Stahl mst...@redhat.com
(cherry picked from commit 098d08d6af951afa4f20f6f7883f6c9d34e87e11)

Conflicts:

sw/source/uibase/uno/unomailmerge.cxx

commit ae4406f7c5fdebfbee49e2bba1c4b321f140dbb9
Merge: 3c39430 743966c
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Wed Mar 25 14:18:57 2015 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+backports' into 
private/jmux/libreoffice-4-1-6+all

commit 3c394300cffe07a850e41047edf374d6fcc5bb65
Merge: 1880810 6a568ab
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Mon Feb 23 14:37:31 2015 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+backports' into 
private/jmux/libreoffice-4-1-6+all

commit 1880810b68a872476f3c63eb9563e7b9a7dc0c0a
Merge: 1c40ae1 75055ee
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Wed Feb 18 18:36:59 2015 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+backports' into 
private/jmux/libreoffice-4-1-6+all

commit 1c40ae183a895325b7e9473efdac83f4c62ef00d
Merge: 9d31c1e 7bdab66
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Tue Feb 17 11:26:25 2015 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+lhm' into 
private/jmux/libreoffice-4-1-6+all

commit 7bdab66a4b413a586c9780248687ea213f88c0aa
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Tue Feb 17 11:25:23 2015 +0100

Update translations

Change-Id: Ie34c9be2159ae64e18776a27de8e2f791e51d1d3

commit 9d31c1e5857ebdf56da328be4af954237a702c9d
Merge: 6a34fb0 a0fbb74
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Tue Feb 17 11:02:48 2015 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+backports' into 
private/jmux/libreoffice-4-1-6+all

commit 6a34fb0fa12dcbe7dcc71bb973637a25a638c3b5
Merge: c92aa54 b30fb95
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Mon Feb 16 13:07:15 2015 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+backports' into 
private/jmux/libreoffice-4-1-6+all

commit c92aa542a0a52519cdcc7c6a478574670e9e4325
Merge: 2e585b0 936ab16
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Mon Feb 2 17:19:28 2015 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+backports' into 
private/jmux/libreoffice-4-1-6+all

commit 2e585b05bf3c667eb638b3e57ae1b8504cf1f789
Author: Andras Timar andras.ti...@collabora.com
Date:   Tue Jun 10 22:30:07 2014 +0200

openssl-0.9.8za -- fixes multiple CVEs

Change-Id: Id4a2d2af49518317511da194a582d3bb18c346f7
(cherry picked from commit 2f926a476b73a7c06a4579f422a4458ac3e789a1)

commit 5121a992d9db9b253757d1129ef898f77ee1b34d
Merge: 3413bc7 e7a5986
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Fri Dec 12 16:43:48 2014 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+build' into 
private/jmux/libreoffice-4-1-6+all-new2

commit 3413bc771307dceec16ce43df56faa4ebbac1213
Merge: 8f93a73 ec45c7a
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Fri Dec 12 16:43:40 2014 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+lhm' into 
private/jmux/libreoffice-4-1-6+all-new2

commit 8f93a737f358acf20ad63e33a5fa490f05f27a84
Merge: 505f1c9 f604b7a
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Fri Dec 12 16:43:26 2014 +0100

Merge branch 'private/jmux/libreoffice-4-1-6+sorted-vectors' into 
private/jmux/libreoffice-4-1-6+all-new2

commit 505f1c9ad4d02d59f44ec72c88b8d2a90db21f28
Merge: 8d1f528 1db2b31
Author: Jan-Marek Glogowski glo...@fbihome.de
Date:   Fri Dec 12 16:43:06 2014 +0100

Merge

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

2015-04-09 Thread Christoph Lutz
 sw/source/uibase/uno/unomailmerge.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 59ef67e03bcf5b87f3dda12e89a97dc9bdcd0bb6
Author: Christoph Lutz christoph.lutz...@cib.de
Date:   Wed Apr 8 14:57:28 2015 +

MM: fixed invalid UNO-Reference as return value of UNO MailMergeService

This fix is regarding 9835bb562 MM: export the SwDocShell mail merge via 
UNO:

In case of using the new output type MailMergeType.SHELL, the UNO
MailMergeService returned a XTextDocument instance that was not
correctly initialized. In particular after calling 
doc.getCurrentController()
(with doc = the returned instance) we recieved NULL. The reason was, that 
the
previous implementation used to create a new SwXTextDocument instance
instead of just returning the BaseModel that is already associated with
the internal SwDocShell. This is fixed in this patch.

I also tested this patch with the unit test sw/CppunitTest_sw_mailmerge
and everything seems to be fine now. doc.getCurrentController() no longer
returns NULL.

Change-Id: Ic116f8f25ab9686ef56950e97ba202a55ab81fb8
Reviewed-on: https://gerrit.libreoffice.org/15207
Tested-by: Michael Stahl mst...@redhat.com
Reviewed-by: Michael Stahl mst...@redhat.com
(cherry picked from commit 098d08d6af951afa4f20f6f7883f6c9d34e87e11)
Reviewed-on: https://gerrit.libreoffice.org/15209
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sw/source/uibase/uno/unomailmerge.cxx 
b/sw/source/uibase/uno/unomailmerge.cxx
index 4687312..dfd199f 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -826,8 +826,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
 
 if (DBMGR_MERGE_SHELL == nMergeType)
 {
-SwXTextDocument *xTextDoc = new SwXTextDocument( 
aMergeDesc.pMailMergeConfigItem-GetTargetView()-GetDocShell() );
-return makeAny( Reference XComponent ( xTextDoc-queryInterface( 
XComponent::static_type() ), css::uno::UNO_QUERY) );
+return makeAny( 
aMergeDesc.pMailMergeConfigItem-GetTargetView()-GetDocShell()-GetBaseModel() 
);
 }
 else
 return makeAny( true );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-04-08 Thread Christoph Lutz
 sw/source/uibase/uno/unomailmerge.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 098d08d6af951afa4f20f6f7883f6c9d34e87e11
Author: Christoph Lutz christoph.lutz...@cib.de
Date:   Wed Apr 8 14:57:28 2015 +

MM: fixed invalid UNO-Reference as return value of UNO MailMergeService

This fix is regarding 9835bb562 MM: export the SwDocShell mail merge via 
UNO:

In case of using the new output type MailMergeType.SHELL, the UNO
MailMergeService returned a XTextDocument instance that was not
correctly initialized. In particular after calling 
doc.getCurrentController()
(with doc = the returned instance) we recieved NULL. The reason was, that 
the
previous implementation used to create a new SwXTextDocument instance
instead of just returning the BaseModel that is already associated with
the internal SwDocShell. This is fixed in this patch.

I also tested this patch with the unit test sw/CppunitTest_sw_mailmerge
and everything seems to be fine now. doc.getCurrentController() no longer
returns NULL.

Change-Id: Ic116f8f25ab9686ef56950e97ba202a55ab81fb8
Reviewed-on: https://gerrit.libreoffice.org/15207
Tested-by: Michael Stahl mst...@redhat.com
Reviewed-by: Michael Stahl mst...@redhat.com

diff --git a/sw/source/uibase/uno/unomailmerge.cxx 
b/sw/source/uibase/uno/unomailmerge.cxx
index 3839011..626c374 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -827,8 +827,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
 
 if (DBMGR_MERGE_SHELL == nMergeType)
 {
-SwXTextDocument *xTextDoc = new SwXTextDocument( 
aMergeDesc.pMailMergeConfigItem-GetTargetView()-GetDocShell() );
-return makeAny( Reference XComponent ( xTextDoc-queryInterface( 
XComponent::static_type() ), css::uno::UNO_QUERY) );
+return makeAny( 
aMergeDesc.pMailMergeConfigItem-GetTargetView()-GetDocShell()-GetBaseModel() 
);
 }
 else
 return makeAny( true );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'private/jmux/libreoffice-4-1-6+backports' - 15 commits - config_host/config_cups.h.in configure.ac include/sfx2 include/vcl sc/source sfx2/source shell/Package_

2015-03-26 Thread Christoph Lutz
 config_host/config_cups.h.in   |6 
 configure.ac   |3 
 include/sfx2/viewsh.hxx|5 
 include/vcl/jobdata.hxx|6 
 include/vcl/print.hxx  |9 
 include/vcl/printerinfomanager.hxx |   10 
 sc/source/ui/src/optdlg.src|6 
 sfx2/source/view/viewprn.cxx   |   15 +
 shell/Package_scripts_kde.mk   |6 
 shell/source/unix/misc/kde4-open-url.sh|   22 +
 sw/inc/dbmgr.hxx   |2 
 sw/source/core/fields/dbfld.cxx|4 
 sw/source/core/fields/docufld.cxx  |3 
 sw/source/ui/dbui/dbmgr.cxx|  307 -
 sw/source/ui/inc/view.hxx  |   11 
 sw/source/ui/uno/unomailmerge.cxx  |2 
 vcl/inc/cupsmgr.hxx|   23 +
 vcl/inc/unx/salframe.h |1 
 vcl/source/filter/wmf/enhwmf.cxx   |   17 +
 vcl/source/filter/wmf/winmtf.cxx   |   11 
 vcl/source/filter/wmf/winmtf.hxx   |2 
 vcl/source/gdi/print3.cxx  |   73 +++--
 vcl/unx/generic/printer/cupsmgr.cxx|  113 +++--
 vcl/unx/generic/printer/jobdata.cxx|   18 +
 vcl/unx/generic/printer/printerinfomanager.cxx |   15 +
 vcl/unx/generic/window/salframe.cxx|  147 +--
 vcl/unx/kde4/KDE4FilePicker.cxx|   76 +++---
 vcl/unx/kde4/KDE4FilePicker.hxx|6 
 28 files changed, 682 insertions(+), 237 deletions(-)

New commits:
commit 743966cdf34a85c01f42c303a341ef9a9ce7288d
Author: Christoph Lutz christoph.lutz...@cib.de
Date:   Mon Mar 9 15:37:45 2015 +

Don't store temporary mail merge file if mail merge job was cancelled

If a mail merge to single file is canceled, the temporary file was still 
saved.
This needed a lot of time for large mail merge results (20s) which is not 
needed,
wanted and inteded. We want mail merge to return asap.

Reviewed-on: https://gerrit.libreoffice.org/14811
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com
(cherry picked from commit 86a547e33bab2a89513385c5af535a6099526616)

Conflicts:

sw/source/uibase/dbui/dbmgr.cxx

Change-Id: I74e9048c7eb483766e7e677dd21167b7d844a518

diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index ba5f075..c8c2572 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -1445,27 +1445,30 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* 
pSourceShell,
 {
 if( rMergeDescriptor.nMergeType != DBMGR_MERGE_PRINTER )
 {
-assert( aTempFile.get());
-INetURLObject aTempFileURL( 
rMergeDescriptor.bSubjectIsFilename ? sSubject : aTempFile-GetURL());
-SfxMedium* pDstMed = new SfxMedium(
-aTempFileURL.GetMainURL( INetURLObject::NO_DECODE ),
-STREAM_STD_READWRITE );
-pDstMed-SetFilter( pStoreToFilter );
-if(pDstMed-GetItemSet())
+if( !bCancel )
 {
-if(pStoreToFilterOptions )
-
pDstMed-GetItemSet()-Put(SfxStringItem(SID_FILE_FILTEROPTIONS, 
*pStoreToFilterOptions));
-if(rMergeDescriptor.aSaveToFilterData.getLength())
-
pDstMed-GetItemSet()-Put(SfxUsrAnyItem(SID_FILTER_DATA, 
makeAny(rMergeDescriptor.aSaveToFilterData)));
-}
+assert( aTempFile.get());
+INetURLObject aTempFileURL( 
rMergeDescriptor.bSubjectIsFilename ? sSubject : aTempFile-GetURL());
+SfxMedium* pDstMed = new SfxMedium(
+aTempFileURL.GetMainURL( INetURLObject::NO_DECODE 
),
+STREAM_STD_READWRITE );
+pDstMed-SetFilter( pStoreToFilter );
+if(pDstMed-GetItemSet())
+{
+if(pStoreToFilterOptions )
+
pDstMed-GetItemSet()-Put(SfxStringItem(SID_FILE_FILTEROPTIONS, 
*pStoreToFilterOptions));
+if(rMergeDescriptor.aSaveToFilterData.getLength())
+
pDstMed-GetItemSet()-Put(SfxUsrAnyItem(SID_FILTER_DATA, 
makeAny(rMergeDescriptor.aSaveToFilterData)));
+}
 
-xTargetDocShell-DoSaveAs(*pDstMed);
-xTargetDocShell-DoSaveCompleted(pDstMed);
-if( xTargetDocShell-GetError() )
-{
-// error message

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

2015-03-12 Thread Christoph Lutz
 sw/source/uibase/dbui/dbmgr.cxx |   41 +---
 1 file changed, 22 insertions(+), 19 deletions(-)

New commits:
commit 86a547e33bab2a89513385c5af535a6099526616
Author: Christoph Lutz christoph.lutz...@cib.de
Date:   Mon Mar 9 15:37:45 2015 +

Don't store temporary mail merge file if mail merge job was cancelled

If a mail merge to single file is canceled, the temporary file was still 
saved.
This needed a lot of time for large mail merge results (20s) which is not 
needed,
wanted and inteded. We want mail merge to return asap.

Change-Id: I74e9048c7eb483766e7e677dd21167b7d844a518
Reviewed-on: https://gerrit.libreoffice.org/14811
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 74ecf73..8f89438 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1421,27 +1421,30 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* 
pSourceShell,
 {
 if( rMergeDescriptor.nMergeType != DBMGR_MERGE_PRINTER )
 {
-assert( aTempFile.get());
-INetURLObject aTempFileURL( 
rMergeDescriptor.bSubjectIsFilename ? sSubject : aTempFile-GetURL());
-SfxMedium* pDstMed = new SfxMedium(
-aTempFileURL.GetMainURL( INetURLObject::NO_DECODE ),
-STREAM_STD_READWRITE );
-pDstMed-SetFilter( pStoreToFilter );
-if(pDstMed-GetItemSet())
+if( !bCancel )
 {
-if(pStoreToFilterOptions )
-
pDstMed-GetItemSet()-Put(SfxStringItem(SID_FILE_FILTEROPTIONS, 
*pStoreToFilterOptions));
-if(rMergeDescriptor.aSaveToFilterData.getLength())
-
pDstMed-GetItemSet()-Put(SfxUsrAnyItem(SID_FILTER_DATA, 
makeAny(rMergeDescriptor.aSaveToFilterData)));
-}
+assert( aTempFile.get());
+INetURLObject aTempFileURL( 
rMergeDescriptor.bSubjectIsFilename ? sSubject : aTempFile-GetURL());
+SfxMedium* pDstMed = new SfxMedium(
+aTempFileURL.GetMainURL( INetURLObject::NO_DECODE 
),
+STREAM_STD_READWRITE );
+pDstMed-SetFilter( pStoreToFilter );
+if(pDstMed-GetItemSet())
+{
+if(pStoreToFilterOptions )
+
pDstMed-GetItemSet()-Put(SfxStringItem(SID_FILE_FILTEROPTIONS, 
*pStoreToFilterOptions));
+if(rMergeDescriptor.aSaveToFilterData.getLength())
+
pDstMed-GetItemSet()-Put(SfxUsrAnyItem(SID_FILTER_DATA, 
makeAny(rMergeDescriptor.aSaveToFilterData)));
+}
 
-xTargetDocShell-DoSaveAs(*pDstMed);
-xTargetDocShell-DoSaveCompleted(pDstMed);
-if( xTargetDocShell-GetError() )
-{
-// error message ??
-ErrorHandler::HandleError( xTargetDocShell-GetError() 
);
-bNoError = false;
+xTargetDocShell-DoSaveAs(*pDstMed);
+xTargetDocShell-DoSaveCompleted(pDstMed);
+if( xTargetDocShell-GetError() )
+{
+// error message ??
+ErrorHandler::HandleError( 
xTargetDocShell-GetError() );
+bNoError = false;
+}
 }
 }
 else if( pTargetView ) // must be available!
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: [Libreoffice] Patch for MarkManager

2011-09-06 Thread Christoph Lutz
Hi Björn,

today I managed to improve the patch again. The patch now speeds up
our mailmerge-Szenario enormously and seems to eliminate the
exponential waste of cpu-cycles. Would you please have a look at it?

here some measurings:

MailMerge-Time (in ms) without patch for 10, 50, 100, 150 datasets:
2793, 11821, 28608, 64395
MailMerge-Time (in ms) with first patch for 10, 50, 100, 150 datasets:
2561, 11044, 26226, 55812
MailMerge-Time (in ms) with this patch for 10, 50, 100, 150 datasets:
1838, 7357, 14413, 21558

2011/9/6 Christoph Lutz chrl...@googlemail.com:
 2011/9/5 Bjoern Michaelsen bjoern.michael...@gmail.com:
 On Sun, 4 Sep 2011 15:05:32 +0200
 Christoph Lutz chrlutz-gM/ye1e23mwn+bqq9rb...@public.gmane.org wrote:

 this is a patch we wrote during the libreoffice hackfest 2011 for
 sw/source/core/inc/MarkManager.hxx and sw/source/core/doc/docbm.cxx
 which improves speed of mailmerge. Bjoern already knows details so he
 might be the one to review the patch... The patch could be applied
 under the lgpl.

 Patch looks good, Just to clarify before pushing, is it contributed
 under:
  MPL 1.1 / GPLv3+ / LGPLv3+
 as per http://wiki.documentfoundation.org/License_Policy ?


That's OK!

Best,
Christoph
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index b88de10..8eb3dd0 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -386,6 +386,7 @@ namespace sw { namespace mark
 pMarkBase-SetName(getUniqueMarkName(pMarkBase-GetName()));
 
 // register mark
+m_aMarkNamesSet.insert(pMarkBase-GetName());
 lcl_InsertMarkSorted(m_vMarks, pMark);
 switch(eType)
 {
@@ -480,8 +481,10 @@ namespace sw { namespace mark
  - Mark is not in my doc.);
 if(io_pMark-GetName() == rNewName)
 return true;
-if(findMark(rNewName) != getMarksEnd())
+if(hasMark(rNewName))
 return false;
+	m_aMarkNamesSet.erase(dynamic_cast ::sw::mark::MarkBase* (io_pMark)-GetName());
+	m_aMarkNamesSet.insert(rNewName);
 dynamic_cast ::sw::mark::MarkBase* (io_pMark)-SetName(rNewName);
 return true;
 }
@@ -733,6 +736,7 @@ namespace sw { namespace mark
 //it anymore.
 pMark_t xHoldPastErase = *aI;
 m_vMarks.erase(aI);
+m_aMarkNamesSet.erase(ppMark-get()-GetName());
 }
 
 void MarkManager::deleteMark(const IMark* const pMark)
@@ -766,6 +770,7 @@ namespace sw { namespace mark
 {
 m_vFieldmarks.clear();
 m_vBookmarks.clear();
+m_aMarkNamesSet.clear();
 #if OSL_DEBUG_LEVEL  1
 for(iterator_t pBkmk = m_vMarks.begin();
 pBkmk != m_vMarks.end();
@@ -827,14 +832,25 @@ namespace sw { namespace mark
 OSL_ENSURE(rName.getLength(),
 MarkManager::getUniqueMarkName(..)
  - a name should be proposed);
-if(findMark(rName) == getMarksEnd()) return rName;
+if(!hasMark(rName)) return rName;
 ::rtl::OUStringBuffer sBuf;
 ::rtl::OUString sTmp;
-for(sal_Int32 nCnt = 1; nCnt  SAL_MAX_INT32; nCnt++)
+
+// try the name rNameXXX (where XXX is a number starting from 1) unless there is
+// a unused name. Due to performance-reasons (especially in mailmerge-Szenarios) there
+// is a map m_aMarkBasenameMapUniqueOffset which holds the next possible offset (XXX) for
+// rName (so there is no need to test for nCnt-values smaller than the offset).
+sal_Int32 nCnt = 1;
+MarkBasenameMapUniqueOffset::iterator aIter = m_aMarkBasenameMapUniqueOffset.find(rName);
+if(aIter != m_aMarkBasenameMapUniqueOffset.end()) nCnt = aIter-second;
+while(nCnt  SAL_MAX_INT32)
 {
 sTmp = sBuf.append(rName).append(nCnt).makeStringAndClear();
-if(findMark(sTmp) == getMarksEnd()) break;
+nCnt++;
+if(!hasMark(sTmp)) break;
 }
+m_aMarkBasenameMapUniqueOffset[rName] = nCnt;
+
 return sTmp;
 }
 
@@ -845,6 +861,11 @@ namespace sw { namespace mark
 sort(m_vFieldmarks.begin(), m_vFieldmarks.end(), lcl_MarkOrderingByStart);
 }
 
+bool MarkManager::hasMark(const ::rtl::OUString rName) const
+{
+return (m_aMarkNamesSet.find(rName) != m_aMarkNamesSet.end());
+}
+
 }} // namespace ::sw::mark
 
 
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index 415b8e7..be3a1f2 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -31,9 +31,14 @@
 
 #include IMark.hxx
 #include IDocumentMarkAccess.hxx
+#include boost/unordered_set.hpp
+#include boost/unordered_map.hpp
 
 namespace sw { namespace mark
 {
+
+typedef boost::unordered_maprtl::OUString, sal_Int32, rtl::OUStringHash MarkBasenameMapUniqueOffset;
+
 class MarkManager
 : private ::boost::noncopyable
 , virtual public IDocumentMarkAccess
@@ -72,6 +77,7 @@ namespace sw

[Libreoffice] Patch for MarkManager

2011-09-04 Thread Christoph Lutz
Hi all,

this is a patch we wrote during the libreoffice hackfest 2011 for
sw/source/core/inc/MarkManager.hxx and sw/source/core/doc/docbm.cxx
which improves speed of mailmerge. Bjoern already knows details so he
might be the one to review the patch... The patch could be applied
under the lgpl.

bye,
Christoph Lutz, Landeshauptstadt München
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index b88de10..65afbdc 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -386,6 +386,7 @@ namespace sw { namespace mark
 pMarkBase-SetName(getUniqueMarkName(pMarkBase-GetName()));
 
 // register mark
+m_aMarkNamesSet.insert(pMarkBase-GetName());
 lcl_InsertMarkSorted(m_vMarks, pMark);
 switch(eType)
 {
@@ -480,8 +481,10 @@ namespace sw { namespace mark
  - Mark is not in my doc.);
 if(io_pMark-GetName() == rNewName)
 return true;
-if(findMark(rNewName) != getMarksEnd())
+if(hasMark(rNewName))
 return false;
+	m_aMarkNamesSet.erase(dynamic_cast ::sw::mark::MarkBase* (io_pMark)-GetName());
+	m_aMarkNamesSet.insert(rNewName);
 dynamic_cast ::sw::mark::MarkBase* (io_pMark)-SetName(rNewName);
 return true;
 }
@@ -733,6 +736,7 @@ namespace sw { namespace mark
 //it anymore.
 pMark_t xHoldPastErase = *aI;
 m_vMarks.erase(aI);
+m_aMarkNamesSet.erase(ppMark-get()-GetName());
 }
 
 void MarkManager::deleteMark(const IMark* const pMark)
@@ -766,6 +770,7 @@ namespace sw { namespace mark
 {
 m_vFieldmarks.clear();
 m_vBookmarks.clear();
+m_aMarkNamesSet.clear();
 #if OSL_DEBUG_LEVEL  1
 for(iterator_t pBkmk = m_vMarks.begin();
 pBkmk != m_vMarks.end();
@@ -827,13 +832,13 @@ namespace sw { namespace mark
 OSL_ENSURE(rName.getLength(),
 MarkManager::getUniqueMarkName(..)
  - a name should be proposed);
-if(findMark(rName) == getMarksEnd()) return rName;
+if(!hasMark(rName)) return rName;
 ::rtl::OUStringBuffer sBuf;
 ::rtl::OUString sTmp;
 for(sal_Int32 nCnt = 1; nCnt  SAL_MAX_INT32; nCnt++)
 {
 sTmp = sBuf.append(rName).append(nCnt).makeStringAndClear();
-if(findMark(sTmp) == getMarksEnd()) break;
+if(!hasMark(sTmp)) break;
 }
 return sTmp;
 }
@@ -845,6 +850,11 @@ namespace sw { namespace mark
 sort(m_vFieldmarks.begin(), m_vFieldmarks.end(), lcl_MarkOrderingByStart);
 }
 
+bool MarkManager::hasMark(const ::rtl::OUString rName) const
+{
+return (m_aMarkNamesSet.find(rName) != m_aMarkNamesSet.end());
+}
+
 }} // namespace ::sw::mark
 
 
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index 415b8e7..1b43ba4 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -31,6 +31,7 @@
 
 #include IMark.hxx
 #include IDocumentMarkAccess.hxx
+#include boost/unordered_set.hpp
 
 namespace sw { namespace mark
 {
@@ -72,6 +73,7 @@ namespace sw { namespace mark
 virtual const_iterator_t getMarksEnd() const;
 virtual sal_Int32 getMarksCount() const;
 virtual const_iterator_t findMark(const ::rtl::OUString rName) const;
+virtual bool hasMark(const ::rtl::OUString rName) const;
 
 // bookmarks
 virtual const_iterator_t getBookmarksBegin() const;
@@ -92,6 +94,7 @@ namespace sw { namespace mark
 container_t m_vMarks;
 container_t m_vBookmarks;
 container_t m_vFieldmarks;
+::boost::unordered_setrtl::OUString m_aMarkNamesSet;
 SwDoc * const m_pDoc;
 };
 }}
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice