RE: guidance to write a unit test for SetMacroSecurityLevel()

2014-11-28 Thread nicholas ferguson
 [nicholas ferguson]
 in sc/qa/.../qahelper.cxx 
 line 544
SfxItemSet* pSet = pSrcMed-GetItemSet();
pSet-Put(SfxUInt16Item(SID_MACROEXECMODE,::com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN));
 
and add include
#include com/sun/star/document/MacroExecMode.hdl
 This does work. But someone needs to write a CPP Unit test of opening up a 
 s/h, then dynamically changing MacroExecMode's and checking that they are ok.

[Bergmann]
] No idea what you mean with dynamically changing MacroExecMode's and 
checking that they are ok (the macro security settings are checked once, when 
the document is opened, if that is where you're heading).
[nicholas ferguson] 

It appears you don't code spreadsheets for computations. People who work with 
VB code in spreadsheets understand that enabling macros is essential.  
open up an excel with macros enabled.
open up an excel s.h ...macros were not enabled.  Enable them, without 
closing the s/h.

Tests like...
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: guidance to write a unit test for SetMacroSecurityLevel()

2014-11-28 Thread Michael Meeks

On Fri, 2014-11-28 at 09:04 -0500, nicholas ferguson wrote:
 People who work with VB code in spreadsheets understand that enabling macros 
 is essential.  
   open up an excel with macros enabled.
   open up an excel s.h ...macros were not enabled.  Enable them, without 
 closing the s/h.

This would be a really nice feature to have IMHO.

I'd love to have a notification at the top (as for the read-only thing)
- that said: macros are disabled, would you like to enable them for
this document or somesuch.

Then again, I guess that would also need to check that the macro
settings were not locked-down, and avoid showing itself unless there
were real macros, with real content available [ which is hardish to
detect ].

I imagine that we'd also want to make macro enablement more of a
transient per-document setting rather than an office-suite-wide one.

Either way, I'd love to use the feature personally =) do you need code
pointers ? [ I suspect you'd need more than just the ability to write a
unit test ;-].

I also imagine that enabling this post load would miss emitting a
number of the 'onLoad' type events that are necessary there = more
work.

ATB,

Michael.

-- 
 michael.me...@collabora.com  , Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: guidance to write a unit test for SetMacroSecurityLevel()

2014-11-27 Thread Stephan Bergmann

On 11/27/2014 01:54 AM, nicholas ferguson wrote:

I can do
Line 544
SfxItemSet* pSet = pSrcMed-GetItemSet();
pSet-Put(SfxUInt16Item(SID_MACROEXECMODE,::com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN));



and add include
#include com/sun/star/document/MacroExecMode.hdl



[nicholas ferguson]
This does work. But someone needs to write a CPP Unit test of opening up a s/h, 
then dynamically changing MacroExecMode's and checking that they are ok.


No idea what you mean with dynamically changing MacroExecMode's and 
checking that they are ok (the macro security settings are checked 
once, when the document is opened, if that is where you're heading).

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: guidance to write a unit test for SetMacroSecurityLevel()

2014-11-26 Thread Michael Stahl
On 18.11.2014 23:21, ad...@wingarch.xohost.com wrote:
 
 
  Hi,
  Can anyone send me how to access and change a level of the 
 MacroSecurityLevel?
  In 
   
  qa\xmlsecurity\qa\certext\SanCertExt.cxx  there is an example of security 
 for certificates?
   
  How do I write someting similar for chaning a Macro Security Level?

the MacroSecurityLevel is just a configuration entry, see
officecfg/registry/schema/org/openoffice/Office/Common.xcs.

there is already one unit test that sets the MacroSecurityLevel:

dbaccess/qa/complex/dbaccess/DatabaseDocument.java
(from JunitTest_dbaccess_complex)

it would of course be nice to test more scenarios, preferably in a C++
unit test.  you can access the configuration via the generated headers
like so officecfg::Office::Common::MacroSecurityLevel::get()
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: guidance to write a unit test for SetMacroSecurityLevel()

2014-11-26 Thread nicholas ferguson
]  the MacroSecurityLevel is just a configuration entry, see 
officecfg/registry/schema/org/openoffice/Office/Common.xcs.

]  there is already one unit test that sets the MacroSecurityLevel:

]  dbaccess/qa/complex/dbaccess/DatabaseDocument.java
(from JunitTest_dbaccess_complex)


[nicholas ferguson] 
I was looking more for a c++ unit test for calc.
in sc/qa/unit/helper/qahelper.cxx in load member function.

I can do
Line 544
SfxItemSet* pSet = pSrcMed-GetItemSet();
pSet-Put(SfxUInt16Item(SID_MACROEXECMODE,::com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN));

and add include
#include com/sun/star/document/MacroExecMode.hdl


I would like to see a c++ unit test for calc, which sets this dynamically?  It 
has some issues with the VB layer...still researching...
On/Off/On/Off

Does anyone have that kind of test already written?


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: guidance to write a unit test for SetMacroSecurityLevel()

2014-11-26 Thread nicholas ferguson

 I can do
 Line 544
 SfxItemSet* pSet = pSrcMed-GetItemSet();
 pSet-Put(SfxUInt16Item(SID_MACROEXECMODE,::com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN));

 and add include
 #include com/sun/star/document/MacroExecMode.hdl


[nicholas ferguson] 
This does work. But someone needs to write a CPP Unit test of opening up a s/h, 
then dynamically changing MacroExecMode's and checking that they are ok.




___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


guidance to write a unit test for SetMacroSecurityLevel()

2014-11-21 Thread admin


 Hi,
 Can anyone send me how to access and change a level of the MacroSecurityLevel?
 In 
  
 qa\xmlsecurity\qa\certext\SanCertExt.cxx  there is an example of security for 
certificates?
  
 How do I write someting similar for chaning a Macro Security Level?
  
  
  
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice