summaryrefslogtreecommitdiff
path: root/sc/source/ui/dbgui
diff options
context:
space:
mode:
authorFlorent Gallaire <fgallaire@gmail.com>2012-04-21 22:00:19 +0200
committerEike Rathke <erack@redhat.com>2012-04-25 14:19:23 +0200
commitc041db6f59888adc90ee8257eafe150d874c46c9 (patch)
treeefa5f611783883cfe470f3276a8d97672077533a /sc/source/ui/dbgui
parentd88493adfd549ec77f08ee919df609e645011b8b (diff)
fdo#45664 EasyHack: Add a "Save cell formulas" checkbox to the CSV Export panel.
Diffstat (limited to 'sc/source/ui/dbgui')
-rw-r--r--sc/source/ui/dbgui/asciiopt.cxx2
-rw-r--r--sc/source/ui/dbgui/imoptdlg.cxx5
-rw-r--r--sc/source/ui/dbgui/imoptdlg.hrc1
-rw-r--r--sc/source/ui/dbgui/imoptdlg.src7
-rw-r--r--sc/source/ui/dbgui/scuiimoptdlg.cxx18
5 files changed, 32 insertions, 1 deletions
diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx
index 0b6ce50e4527..5fd151035077 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 250768ecdbbf..c42d073013e9 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 236865e84bbf..df9db8d67539 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 f095705c9209..ce00740518c1 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 bdee0dfba1e3..245d68556977 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 )