[Libreoffice-commits] .: 2 commits - sc/source

Eike Rathke erack at kemper.freedesktop.org
Wed Apr 25 05:19:32 PDT 2012


 sc/source/ui/dbgui/asciiopt.cxx     |    2 ++
 sc/source/ui/dbgui/imoptdlg.cxx     |    5 +++++
 sc/source/ui/dbgui/imoptdlg.hrc     |    1 +
 sc/source/ui/dbgui/imoptdlg.src     |   28 ++++++++++++++++++----------
 sc/source/ui/dbgui/scuiimoptdlg.cxx |   14 ++++++++++++--
 sc/source/ui/docshell/docsh.cxx     |    6 +-----
 sc/source/ui/inc/imoptdlg.hxx       |   14 +++++++++-----
 sc/source/ui/inc/scuiimoptdlg.hxx   |    3 ++-
 8 files changed, 50 insertions(+), 23 deletions(-)

New commits:
commit 3cceb8a900cd1fe1ae9bdb0c2e532e82a1835861
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Apr 25 14:17:00 2012 +0200

    changes to fdo#45664 EasyHack
    
    * in dialog, placed "Save cell formulas" checkbox directly under "Save cell
      content as shown" as they are related and "Fixed column width" should be
      last
    * also reordered entries in .src file for overview
    * added HelpIDs, also to older "Quote all text cells" checkbox
    * reordered checkbox member variables for tab order
    * do not disable "Save cell content as shown" if "Save cell formulas" is
      checked, they are independent, content as shown still applies to value cells
      * changed label to "Save cell formulas instead of calculated values" for
        clarity
    * initialize "Save cell formulas" with view option that was removed from
      ScDocShell::AsciiSave()

diff --git a/sc/source/ui/dbgui/imoptdlg.src b/sc/source/ui/dbgui/imoptdlg.src
index ce00740..7ad67be 100644
--- a/sc/source/ui/dbgui/imoptdlg.src
+++ b/sc/source/ui/dbgui/imoptdlg.src
@@ -92,36 +92,37 @@ ModalDialog RID_SCDLG_IMPORTOPT
         Size = MAP_APPFONT ( 188 , 8 ) ;
         Text [ en-US ] = "Field options" ;
     };
-    CheckBox CB_FIXEDWIDTH
+    CheckBox CB_SAVESHOWN
     {
-        HelpID = "sc:CheckBox:RID_SCDLG_IMPORTOPT:CB_FIXEDWIDTH";
-        Pos = MAP_APPFONT( 12, 92 );
+        HelpID = "sc:CheckBox:RID_SCDLG_IMPORTOPT:CB_SAVESHOWN";
+        Pos = MAP_APPFONT( 12, 66 );
         Size = MAP_APPFONT( 172, 10 );
         Hide = TRUE;
-        Text [ en-US ] = "Fixed column ~width";
+        Text [ en-US ] = "Save cell content as ~shown";
     };
-    CheckBox CB_SAVESHOWN
+    CheckBox CB_FORMULAS
     {
-        Pos = MAP_APPFONT( 12, 66 );
+        HelpID = "sc:CheckBox:RID_SCDLG_IMPORTOPT:CB_FORMULAS";
+        Pos = MAP_APPFONT( 12, 79 );
         Size = MAP_APPFONT( 172, 10 );
-        TabStop = TRUE;
         Hide = TRUE;
-        Text [ en-US ] = "Save cell content as ~shown";
+        Text [ en-US ] = "Save cell fo~rmulas instead of calculated values";
     };
     CheckBox CB_QUOTEALL
     {
         HelpID = "sc:CheckBox:RID_SCDLG_IMPORTOPT:CB_QUOTEALL";
-        Pos = MAP_APPFONT( 12, 79 );
-        Size = MAP_APPFONT( 164, 10 );
+        Pos = MAP_APPFONT( 12, 92 );
+        Size = MAP_APPFONT( 172, 10 );
         Hide = TRUE;
         Text [ en-US ] = "~Quote all text cells";
     };
-    CheckBox CB_FORMULAS
+    CheckBox CB_FIXEDWIDTH
     {
+        HelpID = "sc:CheckBox:RID_SCDLG_IMPORTOPT:CB_FIXEDWIDTH";
         Pos = MAP_APPFONT( 12, 105 );
         Size = MAP_APPFONT( 172, 10 );
         Hide = TRUE;
-        Text [ en-US ] = "Save cell fo~rmulas";
+        Text [ en-US ] = "Fixed column ~width";
     };
     OKButton BTN_OK
     {
diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx
index 245d685..e6952d9 100644
--- a/sc/source/ui/dbgui/scuiimoptdlg.cxx
+++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx
@@ -32,6 +32,7 @@
 
 
 #include "scuiimoptdlg.hxx"
+#include "tabvwsh.hxx"
 #include "scresid.hxx"
 #include "imoptdlg.hrc"
 #include <comphelper/string.hxx>
@@ -133,10 +134,10 @@ ScImportOptionsDlg::ScImportOptionsDlg(
         aEdFieldSep ( this, ScResId( ED_FIELDSEP ) ),
         aFtTextSep  ( this, ScResId( FT_TEXTSEP ) ),
         aEdTextSep  ( this, ScResId( ED_TEXTSEP ) ),
-        aCbQuoteAll ( this, ScResId( CB_QUOTEALL ) ),
         aCbShown    ( this, ScResId( CB_SAVESHOWN ) ),
-        aCbFixed    ( this, ScResId( CB_FIXEDWIDTH ) ),
         aCbFormulas ( this, ScResId( CB_FORMULAS ) ),
+        aCbQuoteAll ( this, ScResId( CB_QUOTEALL ) ),
+        aCbFixed    ( this, ScResId( CB_FIXEDWIDTH ) ),
         aBtnOk      ( this, ScResId( BTN_OK ) ),
         aBtnCancel  ( this, ScResId( BTN_CANCEL ) ),
         aBtnHelp    ( this, ScResId( BTN_HELP ) )
@@ -208,7 +209,7 @@ ScImportOptionsDlg::ScImportOptionsDlg(
     if( bAscii )
     {
         Size aWinSize( GetSizePixel() );
-        aWinSize.Height() = aCbFormulas.GetPosPixel().Y() + aCbFormulas.GetSizePixel().Height();
+        aWinSize.Height() = aCbFixed.GetPosPixel().Y() + aCbFixed.GetSizePixel().Height();
         Size aDiffSize( LogicToPixel( Size( 0, 6 ), MapMode( MAP_APPFONT ) ) );
         aWinSize.Height() += aDiffSize.Height();
         SetSizePixel( aWinSize );
@@ -220,8 +221,11 @@ ScImportOptionsDlg::ScImportOptionsDlg(
         aCbQuoteAll.Show();
         aCbQuoteAll.Check( false );
         aCbFormulas.Show();
-        aCbFormulas.SetClickHdl( LINK( this, ScImportOptionsDlg, SaveFormulasHdl ) );
-        aCbFormulas.Check( false );
+        ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current());
+        bool bFormulas = (pViewSh ?
+                pViewSh->GetViewData()->GetOptions().GetOption( VOPT_FORMULAS) :
+                false);
+        aCbFormulas.Check( bFormulas );
     }
     else
     {
@@ -319,17 +323,7 @@ IMPL_LINK( ScImportOptionsDlg, FixedWidthHdl, CheckBox*, pCheckBox )
     return 0;
 }
 
-IMPL_LINK( ScImportOptionsDlg, SaveFormulasHdl, CheckBox*, pCheckBox )
-{
-    if( pCheckBox == &aCbFormulas )
-    {
-        sal_Bool bEnable = !aCbFormulas.IsChecked();
-        aCbShown.Enable( bEnable );
-    }
-    return 0;
-}
-
- IMPL_LINK( ScImportOptionsDlg, DoubleClickHdl, ListBox*, pLb )
+IMPL_LINK( ScImportOptionsDlg, DoubleClickHdl, ListBox*, pLb )
 {
     if ( pLb == &aLbFont )
     {
diff --git a/sc/source/ui/inc/scuiimoptdlg.hxx b/sc/source/ui/inc/scuiimoptdlg.hxx
index 3f45513..9103221 100644
--- a/sc/source/ui/inc/scuiimoptdlg.hxx
+++ b/sc/source/ui/inc/scuiimoptdlg.hxx
@@ -59,10 +59,10 @@ private:
     ComboBox            aEdFieldSep;
     FixedText           aFtTextSep;
     ComboBox            aEdTextSep;
-    CheckBox            aCbQuoteAll;
     CheckBox            aCbShown;
-    CheckBox            aCbFixed;
     CheckBox            aCbFormulas;
+    CheckBox            aCbQuoteAll;
+    CheckBox            aCbFixed;
     OKButton            aBtnOk;
     CancelButton        aBtnCancel;
     HelpButton          aBtnHelp;
@@ -74,7 +74,6 @@ private:
     sal_uInt16 GetCodeFromCombo( const ComboBox& rEd ) const;
 
     DECL_LINK( FixedWidthHdl, CheckBox* );
-    DECL_LINK( SaveFormulasHdl, CheckBox* );
     DECL_LINK( DoubleClickHdl, ListBox* );
 };
 
commit c041db6f59888adc90ee8257eafe150d874c46c9
Author: Florent Gallaire <fgallaire at gmail.com>
Date:   Sat Apr 21 22:00:19 2012 +0200

    fdo#45664 EasyHack: Add a "Save cell formulas" checkbox to the CSV Export panel.

diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx
index 0b6ce50..5fd1510 100644
--- a/sc/source/ui/dbgui/asciiopt.cxx
+++ b/sc/source/ui/dbgui/asciiopt.cxx
@@ -315,6 +315,7 @@ void ScAsciiOptions::ReadFromString( const String& rString )
         bDetectSpecialNumber = sal_True;    // default of versions that didn't add the parameter
 
     // 9th token is used for "Save as shown" in export options
+    // 10th token is used for "Save cell formulas" in export options
 }
 
 
@@ -403,6 +404,7 @@ String ScAsciiOptions::WriteToString() const
     aOutStr += String::CreateFromAscii(bDetectSpecialNumber ? "true" : "false");
 
     // 9th token is used for "Save as shown" in export options
+    // 10th token is used for "Save cell formulas" in export options
 
     return aOutStr;
 }
diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx
index 250768e..c42d073 100644
--- a/sc/source/ui/dbgui/imoptdlg.cxx
+++ b/sc/source/ui/dbgui/imoptdlg.cxx
@@ -54,6 +54,7 @@ ScImportOptions::ScImportOptions( const String& rStr )
     eCharSet = RTL_TEXTENCODING_DONTKNOW;
     bSaveAsShown = sal_True;    // "true" if not in string (after CSV import)
     bQuoteAllText = false;
+    bSaveFormulas = false;
     xub_StrLen nTokenCount = comphelper::string::getTokenCount(rStr, ',');
     if ( nTokenCount >= 3 )
     {
@@ -80,6 +81,8 @@ ScImportOptions::ScImportOptions( const String& rStr )
                 bQuoteAllText = rStr.GetToken(6, ',').EqualsAscii("true");
             if ( nTokenCount >= 9 )
                 bSaveAsShown = rStr.GetToken(8, ',').EqualsAscii("true");
+            if ( nTokenCount >= 10 )
+                bSaveFormulas = rStr.GetToken(9, ',').EqualsAscii("true");
         }
     }
 }
@@ -103,6 +106,8 @@ String ScImportOptions::BuildString() const
     aResult.AppendAscii(bQuoteAllText ? "true" : "false");  // same as "quoted field as text" in ScAsciiOptions
     aResult.AppendAscii( ",true," );                        // "detect special numbers"
     aResult.AppendAscii(bSaveAsShown ? "true" : "false");   // "save as shown": not in ScAsciiOptions
+    aResult.AppendAscii( "," );
+    aResult.AppendAscii(bSaveFormulas ? "true" : "false");  // "save formulas": not in ScAsciiOptions
 
     return aResult;
 }
diff --git a/sc/source/ui/dbgui/imoptdlg.hrc b/sc/source/ui/dbgui/imoptdlg.hrc
index 236865e..df9db8d 100644
--- a/sc/source/ui/dbgui/imoptdlg.hrc
+++ b/sc/source/ui/dbgui/imoptdlg.hrc
@@ -40,4 +40,5 @@
 #define CB_FIXEDWIDTH   12
 #define CB_SAVESHOWN    13
 #define CB_QUOTEALL     14
+#define CB_FORMULAS     15
 
diff --git a/sc/source/ui/dbgui/imoptdlg.src b/sc/source/ui/dbgui/imoptdlg.src
index f095705..ce00740 100644
--- a/sc/source/ui/dbgui/imoptdlg.src
+++ b/sc/source/ui/dbgui/imoptdlg.src
@@ -116,6 +116,13 @@ ModalDialog RID_SCDLG_IMPORTOPT
         Hide = TRUE;
         Text [ en-US ] = "~Quote all text cells";
     };
+    CheckBox CB_FORMULAS
+    {
+        Pos = MAP_APPFONT( 12, 105 );
+        Size = MAP_APPFONT( 172, 10 );
+        Hide = TRUE;
+        Text [ en-US ] = "Save cell fo~rmulas";
+    };
     OKButton BTN_OK
     {
         Pos = MAP_APPFONT ( 202 , 6 ) ;
diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx
index bdee0df..245d685 100644
--- a/sc/source/ui/dbgui/scuiimoptdlg.cxx
+++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx
@@ -136,6 +136,7 @@ ScImportOptionsDlg::ScImportOptionsDlg(
         aCbQuoteAll ( this, ScResId( CB_QUOTEALL ) ),
         aCbShown    ( this, ScResId( CB_SAVESHOWN ) ),
         aCbFixed    ( this, ScResId( CB_FIXEDWIDTH ) ),
+        aCbFormulas ( this, ScResId( CB_FORMULAS ) ),
         aBtnOk      ( this, ScResId( BTN_OK ) ),
         aBtnCancel  ( this, ScResId( BTN_CANCEL ) ),
         aBtnHelp    ( this, ScResId( BTN_HELP ) )
@@ -207,7 +208,7 @@ ScImportOptionsDlg::ScImportOptionsDlg(
     if( bAscii )
     {
         Size aWinSize( GetSizePixel() );
-        aWinSize.Height() = aCbFixed.GetPosPixel().Y() + aCbFixed.GetSizePixel().Height();
+        aWinSize.Height() = aCbFormulas.GetPosPixel().Y() + aCbFormulas.GetSizePixel().Height();
         Size aDiffSize( LogicToPixel( Size( 0, 6 ), MapMode( MAP_APPFONT ) ) );
         aWinSize.Height() += aDiffSize.Height();
         SetSizePixel( aWinSize );
@@ -218,6 +219,9 @@ ScImportOptionsDlg::ScImportOptionsDlg(
         aCbShown.Check( sal_True );
         aCbQuoteAll.Show();
         aCbQuoteAll.Check( false );
+        aCbFormulas.Show();
+        aCbFormulas.SetClickHdl( LINK( this, ScImportOptionsDlg, SaveFormulasHdl ) );
+        aCbFormulas.Check( false );
     }
     else
     {
@@ -230,6 +234,7 @@ ScImportOptionsDlg::ScImportOptionsDlg(
         aCbFixed.Hide();
         aCbShown.Hide();
         aCbQuoteAll.Hide();
+        aCbFormulas.Hide();
         aLbFont.GrabFocus();
         aLbFont.SetDoubleClickHdl( LINK( this, ScImportOptionsDlg, DoubleClickHdl ) );
     }
@@ -265,6 +270,7 @@ void ScImportOptionsDlg::GetImportOptions( ScImportOptions& rOptions ) const
         rOptions.bFixedWidth = aCbFixed.IsChecked();
         rOptions.bSaveAsShown = aCbShown.IsChecked();
         rOptions.bQuoteAllText = aCbQuoteAll.IsChecked();
+        rOptions.bSaveFormulas = aCbFormulas.IsChecked();
     }
 }
 
@@ -313,6 +319,16 @@ IMPL_LINK( ScImportOptionsDlg, FixedWidthHdl, CheckBox*, pCheckBox )
     return 0;
 }
 
+IMPL_LINK( ScImportOptionsDlg, SaveFormulasHdl, CheckBox*, pCheckBox )
+{
+    if( pCheckBox == &aCbFormulas )
+    {
+        sal_Bool bEnable = !aCbFormulas.IsChecked();
+        aCbShown.Enable( bEnable );
+    }
+    return 0;
+}
+
  IMPL_LINK( ScImportOptionsDlg, DoubleClickHdl, ListBox*, pLb )
 {
     if ( pLb == &aLbFont )
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 57e2ee4..a95d0a7 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1706,6 +1706,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
     CharSet eCharSet      = rAsciiOpt.eCharSet;
     bool bFixedWidth      = rAsciiOpt.bFixedWidth;
     bool bSaveAsShown     = rAsciiOpt.bSaveAsShown;
+    bool bShowFormulas    = rAsciiOpt.bSaveFormulas;
 
     CharSet eOldCharSet = rStream.GetStreamCharSet();
     rStream.SetStreamCharSet( eCharSet );
@@ -1752,11 +1753,6 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
 
     rtl::OUString aString;
 
-    ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
-    const ScViewOptions& rOpt = (pViewSh)
-                                ? pViewSh->GetViewData()->GetOptions()
-                                : aDocument.GetViewOptions();
-    bool bShowFormulas = rOpt.GetOption( VOPT_FORMULAS );
     bool bTabProtect = aDocument.IsTabProtected( nTab );
 
     SCCOL nCol;
diff --git a/sc/source/ui/inc/imoptdlg.hxx b/sc/source/ui/inc/imoptdlg.hxx
index 016b0e8..43bffde 100644
--- a/sc/source/ui/inc/imoptdlg.hxx
+++ b/sc/source/ui/inc/imoptdlg.hxx
@@ -46,18 +46,18 @@ public:
         ScImportOptions()
             : nFieldSepCode(0), nTextSepCode(0),
             eCharSet(RTL_TEXTENCODING_DONTKNOW), bFixedWidth(false),
-            bSaveAsShown(false), bQuoteAllText(false)
+            bSaveAsShown(false), bQuoteAllText(false), bSaveFormulas(false)
         {}
         ScImportOptions( const String& rStr );
 
         ScImportOptions( sal_Unicode nFieldSep, sal_Unicode nTextSep, const String& rStr )
             : nFieldSepCode(nFieldSep), nTextSepCode(nTextSep), aStrFont(rStr),
-            bFixedWidth(false), bSaveAsShown(false), bQuoteAllText(false)
+            bFixedWidth(false), bSaveAsShown(false), bQuoteAllText(false), bSaveFormulas(false)
         { eCharSet = ScGlobal::GetCharsetValue(aStrFont); }
 
         ScImportOptions( sal_Unicode nFieldSep, sal_Unicode nTextSep, rtl_TextEncoding nEnc )
             : nFieldSepCode(nFieldSep), nTextSepCode(nTextSep),
-            bFixedWidth(false), bSaveAsShown(false), bQuoteAllText(false)
+            bFixedWidth(false), bSaveAsShown(false), bQuoteAllText(false), bSaveFormulas(false)
         { SetTextEncoding( nEnc ); }
 
         ScImportOptions( const ScImportOptions& rCpy )
@@ -67,7 +67,8 @@ public:
               eCharSet          (rCpy.eCharSet),
               bFixedWidth       (rCpy.bFixedWidth),
               bSaveAsShown      (rCpy.bSaveAsShown),
-              bQuoteAllText     (rCpy.bQuoteAllText)
+              bQuoteAllText     (rCpy.bQuoteAllText),
+              bSaveFormulas     (rCpy.bSaveFormulas)
         {}
 
     ScImportOptions& operator=( const ScImportOptions& rCpy )
@@ -79,6 +80,7 @@ public:
                             bFixedWidth     = rCpy.bFixedWidth;
                             bSaveAsShown    = rCpy.bSaveAsShown;
                             bQuoteAllText   = rCpy.bQuoteAllText;
+                            bSaveFormulas   = rCpy.bSaveFormulas;
                             return *this;
                         }
 
@@ -91,7 +93,8 @@ public:
                                 && aStrFont         == rCmp.aStrFont
                                 && bFixedWidth      == rCmp.bFixedWidth
                                 && bSaveAsShown     == rCmp.bSaveAsShown
-                                && bQuoteAllText    == rCmp.bQuoteAllText;
+                                && bQuoteAllText    == rCmp.bQuoteAllText
+                                && bSaveFormulas    == rCmp.bSaveFormulas;
                         }
     String  BuildString() const;
 
@@ -104,6 +107,7 @@ public:
     sal_Bool    bFixedWidth;
     sal_Bool    bSaveAsShown;
     sal_Bool    bQuoteAllText;
+    sal_Bool    bSaveFormulas;
 };
 
 
diff --git a/sc/source/ui/inc/scuiimoptdlg.hxx b/sc/source/ui/inc/scuiimoptdlg.hxx
index 9a0de3c..3f45513 100644
--- a/sc/source/ui/inc/scuiimoptdlg.hxx
+++ b/sc/source/ui/inc/scuiimoptdlg.hxx
@@ -62,6 +62,7 @@ private:
     CheckBox            aCbQuoteAll;
     CheckBox            aCbShown;
     CheckBox            aCbFixed;
+    CheckBox            aCbFormulas;
     OKButton            aBtnOk;
     CancelButton        aBtnCancel;
     HelpButton          aBtnHelp;
@@ -73,6 +74,7 @@ private:
     sal_uInt16 GetCodeFromCombo( const ComboBox& rEd ) const;
 
     DECL_LINK( FixedWidthHdl, CheckBox* );
+    DECL_LINK( SaveFormulasHdl, CheckBox* );
     DECL_LINK( DoubleClickHdl, ListBox* );
 };
 


More information about the Libreoffice-commits mailing list