update ooo310-m15
[ooovba.git] / applied_patches / 0475-oox-import-sheet-protect.diff
blob8e29e169fa6bfe1e97539d82d5f8aa3a0d0bed35
1 From 54ad71177ade90ba5b66b9d1a642927579ec9b9f Mon Sep 17 00:00:00 2001
2 From: Jan Nieuwenhuizen <janneke@gnu.org>
3 Date: Fri, 3 Apr 2009 13:05:43 +0200
4 Subject: [PATCH] OOXML: Set sheet's IsUndoEnabled before invoking protect. Fixes n#481317.
6 ScTableSheetObj::protect () [or actually ScDocFunc::Protect] only
7 works if UNDO is enabled, otherwise it's a no-op. Enabling undo
8 before calling xProtectable->protect () fixes this.
9 ---
10 oox/source/xls/worksheetsettings.cxx | 9 +++++++++
11 1 files changed, 9 insertions(+), 0 deletions(-)
13 diff --git oox/source/xls/worksheetsettings.cxx oox/source/xls/worksheetsettings.cxx
14 index d30106a..fc12fe7 100644
15 --- oox/source/xls/worksheetsettings.cxx
16 +++ oox/source/xls/worksheetsettings.cxx
17 @@ -29,8 +29,10 @@
18 ************************************************************************/
20 #include "oox/xls/worksheetsettings.hxx"
22 #include <com/sun/star/util/XProtectable.hpp>
23 #include "oox/helper/attributelist.hxx"
24 +#include "oox/helper/propertyset.hxx"
25 #include "oox/helper/recordinputstream.hxx"
26 #include "oox/xls/biffinputstream.hxx"
27 #include "oox/xls/pagesettings.hxx"
28 @@ -45,6 +47,8 @@ using ::com::sun::star::util::XProtectable;
29 namespace oox {
30 namespace xls {
32 +using namespace ::com::sun::star;
34 // ============================================================================
36 namespace {
37 @@ -314,7 +318,12 @@ void WorksheetSettings::finalizeImport()
39 Reference< XProtectable > xProtectable( getXSpreadsheet(), UNO_QUERY );
40 if( xProtectable.is() )
41 + {
42 + /* ScTableSheetObj::protect () [or actually ScDocFunc::Protect]
43 + only works if UNDO is enabled, otherwise it's a no-op. */
44 + PropertySet( getXSpreadsheet() ).setProperty( CREATE_OUSTRING( "IsUndoEnabled" ), uno::makeAny( true ) );
45 xProtectable->protect( OUString() );
46 + }
50 --
51 1.6.0.rc1.49.g98a8