[PATCH 3/3] Give Macro recorder separate option, apart from Experimental features

Cor Nouws oolst at nouenoff.nl
Sun Jun 10 14:00:36 PDT 2012


Change-Id: I9dbf5d510ebaff8448a152d75a006a183303bd81
---
 cui/source/options/optgdlg.cxx                     |   18 ++++++++---
 cui/source/options/optgdlg.hrc                     |    3 ++
 cui/source/options/optgdlg.hxx                     |    1 +
 cui/source/options/optgdlg.src                     |    6 ++++
 .../schema/org/openoffice/Office/Common.xcs        |   10 ++++++
 sfx2/source/view/viewfrm.cxx                       |    4 +--
 svtools/inc/svtools/miscopt.hxx                    |    3 ++
 svtools/source/config/miscopt.cxx                  |   34 +++++++++++++++++++-
 8 files changed, 72 insertions(+), 7 deletions(-)

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 762ec3d..b8cc40f 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -215,7 +215,8 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
     aInterpretFT        ( this, CUI_RES( FT_INTERPRET ) ),
     aYearValueField     ( this, CUI_RES( NF_YEARVALUE ) ),
     aToYearFT           ( this, CUI_RES( FT_TOYEAR ) ),
-    aExperimentalCB     ( this, CUI_RES( CB_EXPERIMENTAL ) )
+    aExperimentalCB     ( this, CUI_RES( CB_EXPERIMENTAL ) ),
+    aMacroRecorderCB    ( this, CUI_RES( CB_MACRORECORDER ) )
 {
     FreeResource();
 
@@ -250,7 +251,7 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
         Window* pWins[] =
         {
             &aPrintDlgFL, &aPrintDlgCB, &aDocStatusFL, &aDocStatusCB, &aSaveAlwaysCB,
-            &aTwoFigureFL, &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalCB
+            &aTwoFigureFL, &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalCB, &aMacroRecorderCB
         };
         Window** pCurrent = pWins;
         const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
@@ -271,7 +272,7 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
         Window* pWins[] =
         {
             &aPrintDlgFL, &aPrintDlgCB, &aDocStatusFL, &aDocStatusCB, &aSaveAlwaysCB,
-            &aTwoFigureFL, &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalCB
+            &aTwoFigureFL, &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalCB, &aMacroRecorderCB
         };
         Window** pCurrent = pWins;
         const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
@@ -297,7 +298,7 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
         Window* pWins[] =
         {
             &aDocStatusFL, &aDocStatusCB, &aSaveAlwaysCB, &aTwoFigureFL,
-            &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalCB
+            &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalCB, &aMacroRecorderCB
         };
         Window** pCurrent = pWins;
         const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
@@ -441,6 +442,13 @@ sal_Bool OfaMiscTabPage::FillItemSet( SfxItemSet& rSet )
         bModified = sal_True;
     }
 
+    if ( aMacroRecorderCB.IsChecked() != aMacroRecorderCB.GetSavedValue() )
+    {
+        SvtMiscOptions aMiscOpt;
+        aMiscOpt.SetMacroRecorderMode( aMacroRecorderCB.IsChecked() );
+        bModified = sal_True;
+    }
+
     const SfxUInt16Item* pUInt16Item =
         PTR_CAST( SfxUInt16Item, GetOldItem( rSet, SID_ATTR_YEAR2000 ) );
     sal_uInt16 nNum = (sal_uInt16)aYearValueField.GetText().ToInt32();
@@ -486,6 +494,8 @@ void OfaMiscTabPage::Reset( const SfxItemSet& rSet )
     aSaveAlwaysCB.SaveValue();
     aExperimentalCB.Check( aMiscOpt.IsExperimentalMode() );
     aExperimentalCB.SaveValue();
+    aMacroRecorderCB.Check( aMiscOpt.IsMacroRecorderMode() );
+    aMacroRecorderCB.SaveValue();
 
     aODMADlgCB.Check( aMiscOpt.TryODMADialog() );
     aODMADlgCB.SaveValue();
diff --git a/cui/source/options/optgdlg.hrc b/cui/source/options/optgdlg.hrc
index d870e29..a25d007 100644
--- a/cui/source/options/optgdlg.hrc
+++ b/cui/source/options/optgdlg.hrc
@@ -65,6 +65,7 @@
 #define ROW12                   (ROW11+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
 #define ROW13                   (ROW12+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
 #define ROW14                   (ROW13+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE+6)
+#define ROW15                   (ROW14+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
 
 #define DIFF(v1,v2)                     (v2-v1)
 #define OFFS_TEXTBOX_FIXEDTEXT(base)    (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
@@ -112,6 +113,8 @@
 #define LB_HELPFORMAT               16
 #define FT_EXPERIMENTAL             17
 #define CB_EXPERIMENTAL             18
+#define FT_MACRORECORDER            19
+#define CB_MACRORECORDER            20
 
 //#define FL_FILEDLG                 20
 //#define CB_FILEDLG                 21
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index e4c6672..4b7f571 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -73,6 +73,7 @@ private:
     String              aStrDateInfo;
 
     CheckBox            aExperimentalCB;
+    CheckBox            aMacroRecorderCB;
 
     DECL_LINK( TwoFigureHdl, NumericField* );
     DECL_LINK( TwoFigureConfigHdl, NumericField* );
diff --git a/cui/source/options/optgdlg.src b/cui/source/options/optgdlg.src
index 4319a95..75af383 100644
--- a/cui/source/options/optgdlg.src
+++ b/cui/source/options/optgdlg.src
@@ -192,6 +192,12 @@ TabPage OFA_TP_MISC
         Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
         Text [ en-US ] = "Enable experimental (unstable) features";
     };
+    CheckBox CB_MACRORECORDER
+    {
+        Pos = MAP_APPFONT( COL1, ROW15 );
+        Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+        Text [ en-US ] = "Enable macro recording (limited)";
+    };
 };
 
  //****************************************************************************
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 00036cd4..a0d672b 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6647,6 +6647,16 @@
         </info>
         <value>false</value>
       </prop>
+      <prop
+          oor:name="MacroRecorderMode" oor:type="xs:boolean"
+          oor:nillable="false">
+        <info>
+          <author>cornouws</author>
+          <desc>Determins if the limited, and awkward code producing
+          macro recorder should be enabled in the user interface.</desc>
+        </info>
+        <value>false</value>
+      </prop>
       <prop oor:name="SymbolSet" oor:type="xs:short" oor:nillable="false">
         <!-- UIHints: Tools  Options General View -->
         <info>
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 09351f1..81e689e 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -3013,7 +3013,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet)
                 {
                     SvtMiscOptions aMiscOptions;
                     const char* pName = GetObjectShell()->GetFactory().GetShortName();
-                    if ( !aMiscOptions.IsExperimentalMode() ||
+                    if ( !aMiscOptions.IsMacroRecorderMode() ||
                          ( strcmp(pName,"swriter") && strcmp(pName,"scalc") ) )
                     {
                         rSet.DisableItem( nWhich );
@@ -3039,7 +3039,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet)
                 {
                     SvtMiscOptions aMiscOptions;
                     const char* pName = GetObjectShell()->GetFactory().GetShortName();
-                    if ( !aMiscOptions.IsExperimentalMode() ||
+                    if ( !aMiscOptions.IsMacroRecorderMode() ||
                          ( strcmp(pName,"swriter") && strcmp(pName,"scalc") ) )
                     {
                         rSet.DisableItem( nWhich );
diff --git a/svtools/inc/svtools/miscopt.hxx b/svtools/inc/svtools/miscopt.hxx
index 66eb0c1..2f89993 100644
--- a/svtools/inc/svtools/miscopt.hxx
+++ b/svtools/inc/svtools/miscopt.hxx
@@ -121,6 +121,9 @@ class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options
         void        SetExperimentalMode( sal_Bool bSet );
         sal_Bool    IsExperimentalMode() const;
 
+        void        SetMacroRecorderMode( sal_Bool bSet );
+        sal_Bool    IsMacroRecorderMode() const;
+
     private:
 
         /*-****************************************************************************************************//**
diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx
index 51d2ee7..74b9b61 100644
--- a/svtools/source/config/miscopt.cxx
+++ b/svtools/source/config/miscopt.cxx
@@ -74,6 +74,8 @@ using namespace ::com::sun::star;
 #define PROPERTYHANDLE_ALWAYSALLOWSAVE      9
 #define PROPERTYNAME_EXPERIMENTALMODE       ASCII_STR("ExperimentalMode")
 #define PROPERTYHANDLE_EXPERIMENTALMODE     10
+#define PROPERTYNAME_MACRORECORDERMODE       ASCII_STR("MacroRecorderMode")
+#define PROPERTYHANDLE_MACRORECORDERMODE    11
 
 #define VCL_TOOLBOX_STYLE_FLAT              ((sal_uInt16)0x0004) // from <vcl/toolbox.hxx>
 
@@ -99,6 +101,7 @@ class SvtMiscOptions_Impl : public ConfigItem
     sal_Bool    m_bDisableUICustomization;
     sal_Bool    m_bAlwaysAllowSave;
     sal_Bool    m_bExperimentalMode;
+    sal_Bool    m_bMacroRecorderMode;
 
     public:
 
@@ -179,6 +182,12 @@ class SvtMiscOptions_Impl : public ConfigItem
         inline sal_Bool IsExperimentalMode() const
         { return m_bExperimentalMode; }
 
+        inline void SetMacroRecorderMode( sal_Bool bSet )
+        { m_bMacroRecorderMode = bSet; SetModified(); }
+
+        inline sal_Bool IsMacroRecorderMode() const
+        { return m_bMacroRecorderMode; }
+
         inline sal_Bool IsPluginsEnabled() const
         { return m_bPluginsEnabled; }
 
@@ -287,6 +296,7 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
     , m_bIsShowLinkWarningDialogRO( sal_False )
     , m_bAlwaysAllowSave( sal_False )
     , m_bExperimentalMode( sal_False )
+    , m_bMacroRecorderMode( sal_False )
 
 {
     // Use our static list of configuration keys to get his values.
@@ -409,6 +419,12 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
                     OSL_FAIL("Wrong type of \"Misc\\ExperimentalMode\"!" );
                 break;
             }
+            case PROPERTYHANDLE_MACRORECORDERMODE :
+            {
+                if( !(seqValues[nProperty] >>= m_bMacroRecorderMode) )
+                    OSL_FAIL("Wrong type of \"Misc\\MacroRecorderMode\"!" );
+                break;
+            }
         }
     }
 
@@ -700,6 +716,11 @@ void SvtMiscOptions_Impl::Commit()
                 seqValues[nProperty] <<= m_bExperimentalMode;
                 break;
             }
+            case PROPERTYHANDLE_MACRORECORDERMODE :
+            {
+                seqValues[nProperty] <<= m_bMacroRecorderMode;
+                break;
+            }
         }
     }
     // Set properties in configuration.
@@ -724,7 +745,8 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
         PROPERTYNAME_SHOWLINKWARNINGDIALOG,
         PROPERTYNAME_DISABLEUICUSTOMIZATION,
         PROPERTYNAME_ALWAYSALLOWSAVE,
-        PROPERTYNAME_EXPERIMENTALMODE
+        PROPERTYNAME_EXPERIMENTALMODE,
+        PROPERTYNAME_MACRORECORDERMODE
     };
 
     // Initialize return sequence with these list ...
@@ -915,6 +937,16 @@ sal_Bool SvtMiscOptions::IsExperimentalMode() const
     return m_pDataContainer->IsExperimentalMode();
 }
 
+void SvtMiscOptions::SetMacroRecorderMode( sal_Bool bSet )
+{
+    m_pDataContainer->SetMacroRecorderMode( bSet );
+}
+
+sal_Bool SvtMiscOptions::IsMacroRecorderMode() const
+{
+    return m_pDataContainer->IsMacroRecorderMode();
+}
+
 namespace
 {
     class theSvtMiscOptionsMutex :
-- 
1.7.9.5


--------------050900090101030400070903--


More information about the LibreOffice mailing list