summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/column.hxx4
-rw-r--r--sc/inc/docoptio.hxx6
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/inc/globstr.hrc2
-rw-r--r--sc/inc/sc.hrc4
-rw-r--r--sc/inc/scmod.hxx5
-rw-r--r--sc/inc/table.hxx7
-rw-r--r--sc/inc/unonames.hxx1
-rwxr-xr-xsc/prj/build.lst1
-rw-r--r--sc/qa/unoapi/knownissues.xcl6
-rw-r--r--sc/source/core/data/column2.cxx12
-rw-r--r--sc/source/core/data/column3.cxx38
-rw-r--r--sc/source/core/data/documen4.cxx2
-rw-r--r--sc/source/core/data/dpsave.cxx2
-rw-r--r--sc/source/core/data/dpsdbtab.cxx9
-rwxr-xr-xsc/source/core/data/dpshttab.cxx6
-rw-r--r--sc/source/core/data/global.cxx15
-rw-r--r--sc/source/core/data/table1.cxx5
-rw-r--r--sc/source/core/data/table3.cxx4
-rw-r--r--sc/source/core/inc/interpre.hxx13
-rw-r--r--sc/source/core/inc/sctictac.hxx131
-rw-r--r--sc/source/core/tool/compiler.cxx2
-rw-r--r--sc/source/core/tool/docoptio.cxx2
-rw-r--r--sc/source/core/tool/interpr4.cxx289
-rw-r--r--sc/source/core/tool/makefile.mk1
-rw-r--r--sc/source/core/tool/sctictac.cxx551
-rw-r--r--sc/source/filter/html/htmlexp.cxx28
-rw-r--r--sc/source/filter/html/htmlpars.cxx19
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx30
-rw-r--r--sc/source/ui/app/inputhdl.cxx41
-rw-r--r--sc/source/ui/app/scmod.cxx22
-rw-r--r--sc/source/ui/docshell/docsh8.cxx2
-rw-r--r--sc/source/ui/docshell/tablink.cxx5
-rw-r--r--sc/source/ui/inc/inputhdl.hxx4
-rw-r--r--sc/source/ui/inc/optdlg.hrc1
-rw-r--r--sc/source/ui/inc/output.hxx23
-rw-r--r--sc/source/ui/inc/teamdlg.hxx53
-rw-r--r--sc/source/ui/inc/tpcalc.hxx1
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx4
-rw-r--r--sc/source/ui/miscdlgs/makefile.mk2
-rw-r--r--sc/source/ui/miscdlgs/teamdlg.cxx116
-rw-r--r--sc/source/ui/optdlg/tpcalc.cxx59
-rw-r--r--sc/source/ui/src/globstr.src4
-rw-r--r--sc/source/ui/src/miscdlgs.src17
-rw-r--r--sc/source/ui/src/optdlg.src38
-rw-r--r--sc/source/ui/unoobj/defltuno.cxx11
-rw-r--r--sc/source/ui/unoobj/docuno.cxx9
-rw-r--r--sc/source/ui/unoobj/filtuno.cxx4
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx2
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx27
-rwxr-xr-xsc/source/ui/view/dbfunc3.cxx171
-rw-r--r--sc/source/ui/view/drawview.cxx8
-rw-r--r--sc/source/ui/view/output2.cxx481
53 files changed, 710 insertions, 1596 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 7027b55259d0..c39d0deca0b7 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -397,8 +397,8 @@ public:
void CompileColRowNameFormula();
sal_Int32 GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
- xub_StrLen GetMaxNumberStringLen( USHORT& nPrecision,
- SCROW nRowStart, SCROW nRowEnd ) const;
+ xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision,
+ SCROW nRowStart, SCROW nRowEnd ) const;
private:
ScBaseCell* CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos);
diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx
index 9dd1057db67f..6f6d4c859a5c 100644
--- a/sc/inc/docoptio.hxx
+++ b/sc/inc/docoptio.hxx
@@ -38,7 +38,7 @@ class SC_DLLPUBLIC ScDocOptions
{
double fIterEps; // Epsilon-Wert dazu
USHORT nIterCount; // Anzahl
- USHORT nPrecStandardFormat; // Nachkommastellen Standard
+ sal_uInt16 nPrecStandardFormat; // precision for standard format
USHORT nDay; // Nulldatum:
USHORT nMonth;
USHORT nYear;
@@ -86,8 +86,8 @@ public:
inline int operator==( const ScDocOptions& rOpt ) const;
inline int operator!=( const ScDocOptions& rOpt ) const;
- USHORT GetStdPrecision() const { return nPrecStandardFormat; }
- void SetStdPrecision( USHORT n ) { nPrecStandardFormat = n; }
+ sal_uInt16 GetStdPrecision() const { return nPrecStandardFormat; }
+ void SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; }
BOOL IsCalcAsShown() const { return bCalcAsShown; }
void SetCalcAsShown( BOOL bVal ) { bCalcAsShown = bVal; }
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ad8f56600531..02c859723fa2 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1692,9 +1692,9 @@ public:
/** Maximum string length of numerical cells of a column, e.g. for dBase export.
@return String length in characters (!) including the decimal
separator, and the decimal precision needed. */
- xub_StrLen GetMaxNumberStringLen( USHORT& nPrecision,
- SCTAB nTab, SCCOL nCol,
- SCROW nRowStart, SCROW nRowEnd ) const;
+ xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision,
+ SCTAB nTab, SCCOL nCol,
+ SCROW nRowStart, SCROW nRowEnd ) const;
void KeyInput( const KeyEvent& rKEvt ); // TimerDelays etc.
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index bca93e7aa441..a9c1997f74f5 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -353,7 +353,7 @@
#define STR_SCATTR_PAGE_SCALETOPAGES 277
#define STR_NOREF_STR 278 /* moved to compiler.src, keep define! */
-#define STR_ODER_SO 279
+// unused: 279
#define STR_UNDO_CHARTDATA 280
#define STR_UNDO_ORIGINALSIZE 281
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index a7d05925957a..c2bf3e96ed5c 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1146,9 +1146,6 @@
#define RID_IMGLIST_INPUTWIN (SC_RESOURCE_START+22)
#define RID_ERRHDLSC (SC_RESOURCE_START+23)
#define RID_POPUP_GRAPHIC (SC_RESOURCE_START+24)
-#define RID_SCTEAMDLGBMP1 (SC_RESOURCE_START+25)
-#define RID_SCTEAMDLGBMP2 (SC_RESOURCE_START+26)
-#define RID_SCTEAMDLGBMP3 (SC_RESOURCE_START+27)
#define RID_POPUP_DRAWTEXT (SC_RESOURCE_START+29)
#define RID_MN_FORMAT_ALGN (SC_RESOURCE_START+30)
#define RID_MN_FORMAT_STYLE (SC_RESOURCE_START+31)
@@ -1530,7 +1527,6 @@
#define RID_SCDLG_NAMES_PASTE (SC_DIALOGS_START + 72)
#define RID_SCDLG_NAMES_CREATE (SC_DIALOGS_START + 73)
#define RID_SCDLG_NAMES_APPLY (SC_DIALOGS_START + 74) //NYI
-#define RID_SCDLG_TEAM (SC_DIALOGS_START + 75)
#define RID_SCDLG_CHAR (SC_DIALOGS_START + 76)
#define RID_SCDLG_PARAGRAPH (SC_DIALOGS_START + 77)
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index ee2c956e7742..984e36bec03e 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -74,7 +74,6 @@ class ScInputWindow;
class ScTabViewShell;
class ScFunctionDlg;
class ScArgDlgBase;
-class ScTeamDlg;
class ScEditFunctionDlg;
class ScMessagePool;
class EditFieldInfo;
@@ -126,7 +125,6 @@ class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener
ScMessagePool* pMessagePool;
// globalen InputHandler gibt's nicht mehr, jede View hat einen
ScInputHandler* pRefInputHandler;
- ScTeamDlg* pTeamDlg;
ScViewCfg* pViewCfg;
ScDocCfg* pDocCfg;
ScAppCfg* pAppCfg;
@@ -268,9 +266,6 @@ SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rO
BOOL IsFormulaMode();
BOOL IsRefDialogOpen();
BOOL IsTableLocked();
- void OpenTeamDlg();
- void SetTeamDlg( ScTeamDlg* pDlg ) { pTeamDlg = pDlg; }
- ScTeamDlg* GetTeamDlg() const { return pTeamDlg; }
void SetReference( const ScRange& rRef, ScDocument* pDoc,
const ScMarkData* pMarkData = NULL );
void AddRefEntry();
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 42fcbb063930..950f07565e19 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -654,11 +654,12 @@ public:
void DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
+
sal_Int32 GetMaxStringLen( SCCOL nCol,
SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
- xub_StrLen GetMaxNumberStringLen( USHORT& nPrecision,
- SCCOL nCol,
- SCROW nRowStart, SCROW nRowEnd ) const;
+ xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision,
+ SCCOL nCol,
+ SCROW nRowStart, SCROW nRowEnd ) const;
void FindConditionalFormat( ULONG nKey, ScRangeList& rRanges );
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 5bcc22ae72d3..330251742870 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -596,6 +596,7 @@
#define SC_UNONAME_PAGESIZE "PageSize"
#define SC_UNONAME_RENDERDEV "RenderDevice"
#define SC_UNONAME_SOURCERANGE "SourceRange"
+#define SC_UNONAME_INC_NP_AREA "PageIncludesNonprintableArea"
// CellValueBinding
#define SC_UNONAME_BOUNDCELL "BoundCell"
diff --git a/sc/prj/build.lst b/sc/prj/build.lst
index e32d8938afc4..115e92990f3c 100755
--- a/sc/prj/build.lst
+++ b/sc/prj/build.lst
@@ -48,4 +48,3 @@ sc sc\addin\datefunc nmake - all sc_addfu sc_add sc_sdi sc_inc NULL
sc sc\addin\rot13 nmake - all sc_adrot sc_add sc_sdi sc_inc NULL
sc sc\addin\util nmake - all sc_adutil sc_addfu sc_adrot sc_sdi sc_inc NULL
sc sc\util nmake - all sc_util sc_addfu sc_adrot sc_adutil sc_app sc_attr sc_cctrl sc_cosrc sc_data sc_dbgui sc_dif sc_docsh sc_drfnc sc_excel sc_form sc_html sc_lotus sc_qpro sc_misc sc_name sc_nvipi sc_opt sc_page sc_rtf sc_scalc sc_style sc_tool sc_uisrc sc_undo sc_unobj sc_view sc_xcl97 sc_xml sc_acc sc_ftools sc_inc sc_vba NULL
-sc sc\qa\unoapi nmake - all sc_qa_unoapi NULL
diff --git a/sc/qa/unoapi/knownissues.xcl b/sc/qa/unoapi/knownissues.xcl
index e6863cd75cab..205123fc0e48 100644
--- a/sc/qa/unoapi/knownissues.xcl
+++ b/sc/qa/unoapi/knownissues.xcl
@@ -191,3 +191,9 @@ sc.ScAnnotationShapeObj::com::sun::star::text::XTextRange
sc.ScAnnotationsObj::com::sun::star::container::XElementAccess
sc.ScCellObj::com::sun::star::sheet::XSheetAnnotationAnchor
sc.ScDataPilotFieldObj::com::sun::star::sheet::XDataPilotFieldGrouping
+
+### i110862 ###
+sc.ScDataPilotTableObj::com::sun::star::sheet::XDataPilotTable
+
+### i111032 ###
+sc.ScAccessibleCell::com::sun::star::accessibility::XAccessibleText
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 9e3ed1c7ef5e..4c8de67ba271 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -193,6 +193,7 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
double nPPT = bWidth ? nPPTX : nPPTY;
if (Search(nRow,nIndex))
{
+ ScBaseCell* pCell = pItems[nIndex].pCell;
const ScPatternAttr* pPattern = rOptions.pPattern;
if (!pPattern)
pPattern = pAttrArray->GetPattern( nRow );
@@ -233,22 +234,26 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
else
eHorJust = (SvxCellHorJustify)((const SvxHorJustifyItem&)
pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue();
- BOOL bBreak;
+ bool bBreak;
if ( eHorJust == SVX_HOR_JUSTIFY_BLOCK )
- bBreak = TRUE;
+ bBreak = true;
else if ( pCondSet &&
pCondSet->GetItemState(ATTR_LINEBREAK, TRUE, &pCondItem) == SFX_ITEM_SET)
bBreak = ((const SfxBoolItem*)pCondItem)->GetValue();
else
bBreak = ((const SfxBoolItem&)pPattern->GetItem(ATTR_LINEBREAK)).GetValue();
+ if (pCell->HasValueData())
+ // Cell has a value. Disable line break.
+ bBreak = false;
+
// get other attributes from pattern and conditional formatting
SvxCellOrientation eOrient = pPattern->GetCellOrientation( pCondSet );
BOOL bAsianVertical = ( eOrient == SVX_ORIENTATION_STACKED &&
((const SfxBoolItem&)pPattern->GetItem( ATTR_VERTICAL_ASIAN, pCondSet )).GetValue() );
if ( bAsianVertical )
- bBreak = FALSE;
+ bBreak = false;
if ( bWidth && bBreak ) // after determining bAsianVertical (bBreak may be reset)
return 0;
@@ -300,7 +305,6 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
nIndent = ((const SfxUInt16Item&)pPattern->GetItem(ATTR_INDENT)).GetValue();
}
- ScBaseCell* pCell = pItems[nIndex].pCell;
BYTE nScript = pDocument->GetScriptType( nCol, nRow, nTab, pCell );
if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 22b75b8d4a6a..be7211138c1d 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1249,7 +1249,7 @@ void ScColumn::StartListeningInArea( SCROW nRow1, SCROW nRow2 )
// TRUE = Zahlformat gesetzt
BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
formula::FormulaGrammar::AddressConvention eConv,
- SvNumberFormatter* pFormatter, bool bDetectNumberFormat )
+ SvNumberFormatter* pLangFormatter, bool bDetectNumberFormat )
{
BOOL bNumFmtSet = FALSE;
if (VALIDROW(nRow))
@@ -1261,8 +1261,11 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
double nVal;
sal_uInt32 nIndex, nOldIndex = 0;
sal_Unicode cFirstChar;
- if (!pFormatter)
- pFormatter = pDocument->GetFormatTable();
+ // #i110979# If a different NumberFormatter is passed in (pLangFormatter),
+ // its formats aren't valid in the document.
+ // Only use the language / LocaleDataWrapper from pLangFormatter,
+ // always the document's number formatter for IsNumberFormat.
+ SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
SfxObjectShell* pDocSh = pDocument->GetDocumentShell();
if ( pDocSh )
bIsLoading = pDocSh->IsLoading();
@@ -1337,9 +1340,23 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
if (bDetectNumberFormat)
{
+ if ( pLangFormatter )
+ {
+ // for number detection: valid format index for selected language
+ nIndex = pFormatter->GetStandardIndex( pLangFormatter->GetLanguage() );
+ }
+
if (!pFormatter->IsNumberFormat(rString, nIndex, nVal))
break;
+ if ( pLangFormatter )
+ {
+ // convert back to the original language if a built-in format was detected
+ const SvNumberformat* pOldFormat = pFormatter->GetEntry( nOldIndex );
+ if ( pOldFormat )
+ nIndex = pFormatter->GetFormatForLanguageIfBuiltIn( nIndex, pOldFormat->GetLanguage() );
+ }
+
pNewCell = new ScValueCell( nVal );
if ( nIndex != nOldIndex)
{
@@ -1378,7 +1395,8 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
else
{
// Only check if the string is a regular number.
- const LocaleDataWrapper* pLocale = pFormatter->GetLocaleData();
+ SvNumberFormatter* pLocaleSource = pLangFormatter ? pLangFormatter : pFormatter;
+ const LocaleDataWrapper* pLocale = pLocaleSource->GetLocaleData();
if (!pLocale)
break;
@@ -1920,11 +1938,15 @@ sal_Int32 ScColumn::GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCh
}
-xub_StrLen ScColumn::GetMaxNumberStringLen( USHORT& nPrecision,
- SCROW nRowStart, SCROW nRowEnd ) const
+xub_StrLen ScColumn::GetMaxNumberStringLen(
+ sal_uInt16& nPrecision, SCROW nRowStart, SCROW nRowEnd ) const
{
xub_StrLen nStringLen = 0;
nPrecision = pDocument->GetDocOptions().GetStdPrecision();
+ if ( nPrecision == SvNumberFormatter::UNLIMITED_PRECISION )
+ // In case of unlimited precision, use 2 instead.
+ nPrecision = 2;
+
if ( pItems )
{
String aString;
@@ -1947,8 +1969,8 @@ xub_StrLen ScColumn::GetMaxNumberStringLen( USHORT& nPrecision,
{
if ( nFormat )
{ // more decimals than standard?
- USHORT nPrec = pNumFmt->GetFormatPrecision( nFormat );
- if ( nPrec > nPrecision )
+ sal_uInt16 nPrec = pNumFmt->GetFormatPrecision( nFormat );
+ if ( nPrec != SvNumberFormatter::UNLIMITED_PRECISION && nPrec > nPrecision )
nPrecision = nPrec;
}
if ( nPrecision )
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index bb6b4cd295ce..148cc367534c 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -430,7 +430,7 @@ sal_Int32 ScDocument::GetMaxStringLen( SCTAB nTab, SCCOL nCol,
return 0;
}
-xub_StrLen ScDocument::GetMaxNumberStringLen( USHORT& nPrecision, SCTAB nTab,
+xub_StrLen ScDocument::GetMaxNumberStringLen( sal_uInt16& nPrecision, SCTAB nTab,
SCCOL nCol,
SCROW nRowStart, SCROW nRowEnd ) const
{
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 72cf15285310..dd493bb0df6c 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -1325,6 +1325,8 @@ void ScDPSaveData::Refresh( const uno::Reference<sheet::XDimensionsSupplier>& xS
pDim->Refresh( xSource, deletedDims );
}
+
+ mbDimensionMembersBuilt = false; // there may be new members
}
catch(uno::Exception&)
{
diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx
index aae5797211b0..b966d9d458ea 100644
--- a/sc/source/core/data/dpsdbtab.cxx
+++ b/sc/source/core/data/dpsdbtab.cxx
@@ -237,15 +237,6 @@ long ScDatabaseDPData::GetColumnCount()
// End Comments
-void lcl_Reset( const uno::Reference<sdbc::XRowSet>& xRowSet )
- throw(sdbc::SQLException, uno::RuntimeException)
-{
- // isBeforeFirst / beforeFirst is not always available
- //! query if it is allowed
-
- xRowSet->execute(); // restart
-}
-
String ScDatabaseDPData::getDimensionName(long nColumn)
{
if (getIsDataLayoutDimension(nColumn))
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index 6254e3861db5..a1fa9d2d60a6 100755
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -110,12 +110,6 @@ long ScSheetDPData::GetColumnCount()
return aCacheTable.getColSize();
}
-BOOL lcl_HasQuery( const ScQueryParam& rParam )
-{
- return rParam.GetEntryCount() > 0 &&
- rParam.GetEntry(0).bDoQuery;
-}
-
String ScSheetDPData::getDimensionName(long nColumn)
{
CreateCacheTable();
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 2081181b7537..48879bcdec93 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -144,15 +144,6 @@ long ScGlobal::nLastColWidthExtra = STD_EXTRA_WIDTH;
static USHORT nPPTZoom = 0; // ScreenZoom used to determine nScreenPPTX/Y
-// ... oder so?
-
-BOOL bOderSo;
-
-bool SC_DLLPUBLIC ScGetWriteTeamInfo()
-{
- return bOderSo;
-}
-
class SfxViewShell;
SfxViewShell* pScActiveViewShell = NULL; //! als Member !!!!!
USHORT nScClickMouseModifier = 0; //! dito
@@ -517,12 +508,6 @@ String ScGlobal::GetLongErrorString(USHORT nErrNumber)
break;
}
String aRes( GetRscString( nErrNumber ) );
- if( bOderSo )
- {
- String aOderSo( GetRscString( STR_ODER_SO ) );
- aOderSo.SearchAndReplace( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("%s")), aRes );
- aRes = aOderSo;
- }
return aRes;
}
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index f8cf1489f3aa..75b288272c1e 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -115,8 +115,6 @@
// STATIC DATA -----------------------------------------------------------
-extern BOOL bIsOlk, bOderSo;
-
// -----------------------------------------------------------------------
ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
@@ -231,9 +229,6 @@ void ScTable::GetName( String& rName ) const
void ScTable::SetName( const String& rNewName )
{
- String aMd( "D\344umling", RTL_TEXTENCODING_MS_1252 ); // ANSI
- if( rNewName == aMd )
- bIsOlk = bOderSo = TRUE;
aName = rNewName;
aUpperName.Erase(); // invalidated if the name is changed
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 90993367dde6..7d295b6286a8 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1913,8 +1913,8 @@ sal_Int32 ScTable::GetMaxStringLen( SCCOL nCol, SCROW nRowStart,
return 0;
}
-xub_StrLen ScTable::GetMaxNumberStringLen( USHORT& nPrecision, SCCOL nCol,
- SCROW nRowStart, SCROW nRowEnd ) const
+xub_StrLen ScTable::GetMaxNumberStringLen(
+ sal_uInt16& nPrecision, SCCOL nCol, SCROW nRowStart, SCROW nRowEnd ) const
{
if ( ValidCol(nCol) )
return aCol[nCol].GetMaxNumberStringLen( nPrecision, nRowStart, nRowEnd );
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 2075129e4f6e..edecaadb39f0 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -28,8 +28,6 @@
#ifndef SC_INTERPRE_HXX
#define SC_INTERPRE_HXX
-#define SC_SPEW_ENABLED 0
-
#include <math.h>
#include <rtl/math.hxx>
#include "formula/errorcodes.hxx"
@@ -38,10 +36,6 @@
#include "document.hxx"
#include "scmatrix.hxx"
-#if SC_SPEW_ENABLED
-#include "scspew.hxx"
-#endif
-
#include <math.h>
#include <map>
@@ -126,9 +120,6 @@ class ScInterpreter
public:
DECL_FIXEDMEMPOOL_NEWDEL( ScInterpreter )
-#if SC_SPEW_ENABLED
- static ScSpew theSpew;
-#endif
static void GlobalExit(); // aus ScGlobal::Clear() gerufen
@@ -540,11 +531,7 @@ void ScExternalRef();
void ScGetPivotData();
void ScHyperLink();
void ScBahtText();
-void ScCalcTeam();
-void ScAnswer();
void ScTTT();
-void ScSpewFunc();
-void ScGame();
//----------------Funktionen in interpr2.cxx---------------
diff --git a/sc/source/core/inc/sctictac.hxx b/sc/source/core/inc/sctictac.hxx
deleted file mode 100644
index 1c8242150369..000000000000
--- a/sc/source/core/inc/sctictac.hxx
+++ /dev/null
@@ -1,131 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_SCTICTAC_HXX
-#define SC_SCTICTAC_HXX
-
-//#define TICTACTOE_MAIN
-#ifdef TICTACTOE_MAIN
-#define TICTACTOE_STDOUT
-#else
-//#define TICTACTOE_STDOUT
-#endif
-#ifndef TICTACTOE_STDOUT
-#define TICTACTOE_SC
-#endif
-
-#ifdef TICTACTOE_SC
-class ScDocument;
-#include "global.hxx"
-#include "address.hxx"
-#else
-#include <tools/string.hxx>
-#endif
-
-static const int ScTicTacToe_Squares = 9;
-static const int ScTicTacToe_Possible_Wins = 8;
-typedef sal_Unicode Square_Type;
-typedef Square_Type Board_Type[ScTicTacToe_Squares];
-
-class ScTicTacToe
-{
-private:
- /* Structure to hold a move and its heuristic */
- typedef struct {
- int Square;
- int Heuristic;
- } Move_Heuristic_Type;
-
- static const Square_Type Empty;
- static const Square_Type Human;
- static const Square_Type Compi;
- static const int Infinity; /* Higher value than any score */
- static const int Maximum_Moves; /* Maximum moves in a game */
-
- Board_Type Board;
-#ifdef TICTACTOE_SC
- ScAddress aPos; // linke obere Ecke des Boards
- ScDocument* pDoc;
-#endif
- ByteString aStdOut;
- int Total_Nodes; /* Nodes searched with minimax */
- int nMove;
- Square_Type aPlayer;
- BOOL bInitialized;
-
- /* Array describing the eight combinations of three squares in a row */
- static const int Three_in_a_Row[ScTicTacToe_Possible_Wins][3];
-
- /* Array used in heuristic formula for each move. */
- static const int Heuristic_Array[4][4];
-
-
- Square_Type Winner();
- inline Square_Type Other( Square_Type Player );
- inline void Play( int Square, Square_Type Player );
- int Evaluate( Square_Type Player );
- int BestMove( Square_Type Player, int *Square,
- int Move_Nbr, int Alpha, int Beta );
- void Describe( int Score );
- void Move( int& Square );
- Square_Type TryMove( int& Square ); // return Winner()
- void PromptHuman();
-#ifdef TICTACTOE_SC
- // -1 == Fehler/Redraw, 0 == keine Aenderung, >0 == UserMoveSquare+1
- int GetStatus();
- void DrawBoard();
- void DrawPos( int nSquare, const String& rStr );
-#endif
-#ifdef TICTACTOE_STDOUT
- void Print();
-#endif
-
- ScTicTacToe( const ScTicTacToe& );
- ScTicTacToe& operator=( const ScTicTacToe& );
-
-public:
-#ifdef TICTACTOE_SC
- ScTicTacToe( ScDocument* pDoc, const ScAddress& );
-#else
- ScTicTacToe();
-#endif
- ~ScTicTacToe() {}
- void Initialize( BOOL bHumanFirst );
- Square_Type GetEmpty() { return Empty; }
-#ifdef TICTACTOE_SC
- Square_Type CalcMove(); // return Winner()
-#endif
-#ifdef TICTACTOE_STDOUT
- void Game();
- void GetOutput( ByteString& rStr );
-#else
- void GetOutput( String& rStr );
-#endif
-};
-
-#endif
-
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index d2b1963c544d..5f4b86b7cd18 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -121,7 +121,7 @@ enum ScanState
ssStop
};
-static const sal_Char* pInternal[ 5 ] = { "GAME", "SPEW", "TTT", "STARCALCTEAM", "ANTWORT" };
+static const sal_Char* pInternal[ 1 ] = { "TTT" };
using namespace ::com::sun::star::i18n;
diff --git a/sc/source/core/tool/docoptio.cxx b/sc/source/core/tool/docoptio.cxx
index a99b3c01dd1f..95ce357b3217 100644
--- a/sc/source/core/tool/docoptio.cxx
+++ b/sc/source/core/tool/docoptio.cxx
@@ -115,7 +115,7 @@ void ScDocOptions::ResetDocOptions()
bIsIter = FALSE;
nIterCount = 100;
fIterEps = 1.0E-3;
- nPrecStandardFormat = 2;
+ nPrecStandardFormat = SvNumberFormatter::UNLIMITED_PRECISION;
nDay = 30;
nMonth = 12;
nYear = 1899;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index c576cd5ca6c3..2bf6a5680613 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -80,18 +80,8 @@ using ::std::auto_ptr;
#define ADDIN_MAXSTRLEN 256
-// Implementiert in ui\miscdlgs\teamdlg.cxx
-
-extern void ShowTheTeam();
-
-extern BOOL bOderSo; // in GLOBAL.CXX
-
//-----------------------------static data -----------------
-#if SC_SPEW_ENABLED
-ScSpew ScInterpreter::theSpew;
-#endif
-
//-------------------------------------------------------------------------
// Funktionen fuer den Zugriff auf das Document
//-------------------------------------------------------------------------
@@ -3253,288 +3243,15 @@ void ScInterpreter::ScExternalRef()
// --- internals ------------------------------------------------------------
-void ScInterpreter::ScAnswer()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAnswer" );
- String aStr( GetString() );
- if( aStr.EqualsIgnoreCaseAscii( "Das Leben, das Universum und der ganze Rest" ) )
- {
- PushInt( 42 );
- bOderSo = TRUE;
- }
- else
- PushNoValue();
-}
-
-
-void ScInterpreter::ScCalcTeam()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCalcTeam" );
- static BOOL bShown = FALSE;
- if( !bShown )
- {
- ShowTheTeam();
- String aTeam( RTL_CONSTASCII_USTRINGPARAM( "Nebel, Benisch, Rentz, Rathke" ) );
- if ( (GetByte() == 1) && ::rtl::math::approxEqual( GetDouble(), 1996) )
- aTeam.AppendAscii( " (a word with 'B': -Olk, -Nietsch, -Daeumling)" );
- PushString( aTeam );
- bShown = TRUE;
- }
- else
- PushInt( 42 );
-}
-
-
-void ScInterpreter::ScSpewFunc()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSpewFunc" );
- BOOL bRefresh = FALSE;
- BOOL bClear = FALSE;
- // Stack aufraeumen
- BYTE nParamCount = GetByte();
- while ( nParamCount-- > 0)
- {
- switch ( GetStackType() )
- {
- case svString:
- case svSingleRef:
- case svDoubleRef:
- {
- const sal_Unicode ch = GetString().GetChar(0);
- if ( !bRefresh && ch < 256 )
- bRefresh = (tolower( (sal_uChar) ch ) == 'r');
- if ( !bClear && ch < 256 )
- bClear = (tolower( (sal_uChar) ch ) == 'c');
- }
- break;
- default:
- PopError();
- }
- }
- String aStr;
-#if SC_SPEW_ENABLED
- if ( bRefresh )
- theSpew.Clear(); // GetSpew liest SpewRulesFile neu
- theSpew.GetSpew( aStr );
- if ( bClear )
- theSpew.Clear(); // release Memory
- xub_StrLen nPos = 0;
- while ( (nPos = aStr.SearchAndReplace( '\n', ' ', nPos )) != STRING_NOTFOUND )
- nPos++;
-#else
- aStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "spitted out all spew :-(" ) );
-#endif
- PushString( aStr );
-}
-
-
-#include "sctictac.hxx"
-#include "scmod.hxx"
-
-//extern "C" { static void SAL_CALL thisModule() {} }
-
-void ScInterpreter::ScGame()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGame" );
- enum GameType {
- SC_GAME_NONE,
- SC_GAME_ONCE,
- SC_GAME_START,
- SC_GAME_TICTACTOE = SC_GAME_START,
- SC_GAME_STARWARS,
- SC_GAME_FROGGER,
- SC_GAME_COUNT
- };
- // ein grep im binary laeuft ins leere
- static sal_Char sGameNone[] = "\14\36\6\137\10\27\36\13\100";
- static sal_Char sGameOnce[] = "\20\27\137\21\20\123\137\21\20\13\137\36\30\36\26\21\136";
- static sal_Char sGameTicTacToe[] = "\53\26\34\53\36\34\53\20\32";
- static sal_Char sGameStarWars[] = "\54\13\36\15\50\36\15\14";
- static sal_Char sGameFrogger[] = "\71\15\20\30\30\26\32";
- sal_Char* const pGames[SC_GAME_COUNT] = {
- sGameNone,
- sGameOnce,
- sGameTicTacToe,
- sGameStarWars,
- sGameFrogger
- };
-#if 0
-say what?
-oh no, not again!
-TicTacToe
-StarWars
-Froggie
-// Routine um Datenblock zu erzeugen:
-#include <stdio.h>
-int main()
-{
- int b = 1;
- int c;
- while ( (c = getchar()) != EOF )
- {
- if ( b == 1 )
- {
- printf( "\"" );
- b = 0;
- }
- if ( c != 10 )
- {
- c ^= 0x7F;
- printf( "\\%o", c );
-
- }
- else
- {
- printf( "\";\n" );
- b = 1;
- }
- }
- return 0;
-}
-#endif
- static BOOL bRun[SC_GAME_COUNT] = { FALSE };
- static BOOL bFirst = TRUE;
- if ( bFirst )
- {
- bFirst = FALSE;
- for ( int j = SC_GAME_NONE; j < SC_GAME_COUNT; j++ )
- {
- sal_Char* p = pGames[j];
- while ( *p )
- *p++ ^= 0x7F;
- }
- }
- String aFuncResult;
- GameType eGame = SC_GAME_NONE;
- BYTE nParamCount = GetByte();
- if ( nParamCount >= 1 )
- {
- String aStr( GetString() );
- nParamCount--;
- for ( int j = SC_GAME_START; j < SC_GAME_COUNT; j++ )
- {
- if ( aStr.EqualsAscii( pGames[j] ) )
- {
- eGame = (GameType) j;
- break; // for
- }
- }
- if ( eGame != SC_GAME_NONE )
- {
- // jedes Game nur ein einziges Mal starten, um nicht durch Recalc
- // o.ae. mehrere Instanzen zu haben, ideal waere eine Abfrage an den
- // Games, ob sie bereits laufen ...
- if ( bRun[ eGame ] && eGame != SC_GAME_TICTACTOE )
- eGame = SC_GAME_ONCE;
- else
- {
- bRun[ eGame ] = TRUE;
- switch ( eGame )
- {
- case SC_GAME_TICTACTOE :
- {
- static ScTicTacToe* pTicTacToe = NULL;
- static ScRange aTTTrange;
- static BOOL bHumanFirst = FALSE;
- if ( nParamCount >= 1 )
- {
- if ( GetStackType() == svDoubleRef )
- {
- ScRange aRange;
- PopDoubleRef( aRange );
- nParamCount--;
- if ( aRange.aEnd.Col() - aRange.aStart.Col() == 2
- && aRange.aEnd.Row() - aRange.aStart.Row() == 2 )
- {
- BOOL bOk;
- if ( pTicTacToe )
- bOk = (aRange == aTTTrange);
- else
- {
- bOk =TRUE;
- aTTTrange = aRange;
- pTicTacToe = new ScTicTacToe( pDok,
- aRange.aStart );
- pTicTacToe->Initialize( bHumanFirst );
- }
- // nur einmal und das auf dem gleichen Range
- if ( !bOk )
- eGame = SC_GAME_ONCE;
- else
- {
- Square_Type aWinner = pTicTacToe->CalcMove();
- pTicTacToe->GetOutput( aFuncResult );
- if ( aWinner != pTicTacToe->GetEmpty() )
- {
- delete pTicTacToe;
- pTicTacToe = NULL;
- bRun[ eGame ] = FALSE;
- bHumanFirst = !bHumanFirst;
- }
- pDok->GetDocumentShell()->Broadcast(
- SfxSimpleHint( FID_DATACHANGED ) );
- pDok->ResetChanged( aRange );
- }
- }
- else
- SetError( errIllegalArgument );
- }
- else
- SetError( errIllegalParameter );
- }
- else
- SetError( errIllegalParameter );
- }
- break;
- default:
- {
- // added to avoid warnings
- }
- }
- }
- }
- }
- // Stack aufraeumen
- while ( nParamCount-- > 0)
- Pop();
- if ( !aFuncResult.Len() )
- PushString( String( pGames[ eGame ], RTL_TEXTENCODING_ASCII_US ) );
- else
- PushString( aFuncResult );
-}
-
void ScInterpreter::ScTTT()
{ // Temporaerer Test-Tanz, zum auspropieren von Funktionen etc.
- BOOL bOk = TRUE;
BYTE nParamCount = GetByte();
// do something, nParamCount bei Pops runterzaehlen!
- if ( bOk && nParamCount )
- {
- bOk = GetBool();
- --nParamCount;
- }
// Stack aufraeumen
while ( nParamCount-- > 0)
Pop();
- static const sal_Unicode __FAR_DATA sEyes[] = { ',',';',':','|','8','B', 0 };
- static const sal_Unicode __FAR_DATA sGoods[] = { ')',']','}', 0 };
- static const sal_Unicode __FAR_DATA sBads[] = { '(','[','{','/', 0 };
- sal_Unicode aFace[4];
- if ( bOk )
- {
- aFace[0] = sEyes[ rand() % ((sizeof( sEyes )/sizeof(sal_Unicode)) - 1) ];
- aFace[1] = '-';
- aFace[2] = sGoods[ rand() % ((sizeof( sGoods )/sizeof(sal_Unicode)) - 1) ];
- }
- else
- {
- aFace[0] = ':';
- aFace[1] = '-';
- aFace[2] = sBads[ rand() % ((sizeof( sBads )/sizeof(sal_Unicode)) - 1) ];
- }
- aFace[3] = 0;
- PushStringBuffer( aFace );
+ PushError(errNoValue);
}
// -------------------------------------------------------------------------
@@ -3983,11 +3700,7 @@ StackVar ScInterpreter::Interpret()
case ocAsc : ScAsc(); break;
case ocUnicode : ScUnicode(); break;
case ocUnichar : ScUnichar(); break;
- case ocAnswer : ScAnswer(); break;
- case ocTeam : ScCalcTeam(); break;
case ocTTT : ScTTT(); break;
- case ocSpew : ScSpewFunc(); break;
- case ocGame : ScGame(); break;
case ocNone : nFuncFmtType = NUMBERFORMAT_UNDEFINED; break;
default : PushError( errUnknownOpCode); break;
}
diff --git a/sc/source/core/tool/makefile.mk b/sc/source/core/tool/makefile.mk
index 6c730f3a1743..c0258e6f0575 100644
--- a/sc/source/core/tool/makefile.mk
+++ b/sc/source/core/tool/makefile.mk
@@ -104,7 +104,6 @@ SLOFILES = \
$(SLO)$/reftokenhelper.obj \
$(SLO)$/refupdat.obj \
$(SLO)$/scmatrix.obj \
- $(SLO)$/sctictac.obj \
$(SLO)$/stringutil.obj \
$(SLO)$/subtotal.obj \
$(SLO)$/token.obj \
diff --git a/sc/source/core/tool/sctictac.cxx b/sc/source/core/tool/sctictac.cxx
deleted file mode 100644
index d784f45deb87..000000000000
--- a/sc/source/core/tool/sctictac.cxx
+++ /dev/null
@@ -1,551 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-
-/* Tic-Tac-Toe program by Steve Chapel schapel@cs.ucsb.edu
- Uses alpha-beta pruning minimax search to play a "perfect" game.
- The alpha-beta pruning can be removed, but will increase search time.
- The heuristic and move ordering in BestMove() can also be removed with
- an increase in search time. */
-
-#include <stdio.h>
-#include <ctype.h>
-
-
-#include "sctictac.hxx"
-
-#ifdef TICTACTOE_SC
-#include "document.hxx"
-#include "cell.hxx"
-#endif
-
-const Square_Type ScTicTacToe::Empty = ' ';
-const Square_Type ScTicTacToe::Human = 'X';
-const Square_Type ScTicTacToe::Compi = 'O';
-const int ScTicTacToe::Infinity = 10; /* Higher value than any score */
-const int ScTicTacToe::Maximum_Moves = ScTicTacToe_Squares; /* Maximum moves in a game */
-
-/* Array describing the eight combinations of three squares in a row */
-const int ScTicTacToe::Three_in_a_Row[ScTicTacToe_Possible_Wins][3] = {
- { 0, 1, 2 },
- { 3, 4, 5 },
- { 6, 7, 8 },
- { 0, 3, 6 },
- { 1, 4, 7 },
- { 2, 5, 8 },
- { 0, 4, 8 },
- { 2, 4, 6 }
-};
-
-/* Array used in heuristic formula for each move. */
-const int ScTicTacToe::Heuristic_Array[4][4] = {
- { 0, -10, -100, -1000 },
- { 10, 0, 0, 0 },
- { 100, 0, 0, 0 },
- { 1000, 0, 0, 0 }
-};
-
-
-#ifdef TICTACTOE_SC
-ScTicTacToe::ScTicTacToe( ScDocument* pDocP, const ScAddress& rPos ) :
- aPos( rPos ),
- pDoc( pDocP ),
- aStdOut( "Computer plays O, you play X. " ),
- bInitialized( FALSE )
-{
-}
-#else
-ScTicTacToe::ScTicTacToe() :
- bInitialized( FALSE ),
- aStdOut( "Computer plays O, you play X. " )
-{
-}
-#endif
-
-
-/* Return the other player */
-inline Square_Type ScTicTacToe::Other(Square_Type Player)
-{
- return Player == Human ? Compi : Human;
-}
-
-
-/* Make a move on the board */
-inline void ScTicTacToe::Play(int Square, Square_Type Player)
-{
- Board[Square] = Player;
-}
-
-
-#ifdef TICTACTOE_STDOUT
-
-void ScTicTacToe::GetOutput( ByteString& rStr )
-{
- rStr = aStdOut;
- aStdOut.Erase();
-}
-
-#else // !TICTACTOE_STDOUT
-
-void ScTicTacToe::GetOutput( String& rStr )
-{
- rStr = String( aStdOut, gsl_getSystemTextEncoding() );
- aStdOut.Erase();
-}
-
-#endif // TICTACTOE_STDOUT
-
-
-/* Clear the board */
-void ScTicTacToe::Initialize( BOOL bHumanFirst )
-{
- bInitialized = TRUE;
- aPlayer = (bHumanFirst ? Human : Compi);
- nMove = 1;
- for (int i = 0; i < ScTicTacToe_Squares; i++)
- Board[i] = Empty;
-}
-
-
-/* If a player has won, return the winner. If the game is a tie,
- return 'C' (for cat). If the game is not over, return Empty. */
-Square_Type ScTicTacToe::Winner()
-{
- int i;
- for (i = 0; i < ScTicTacToe_Possible_Wins; i++)
- {
- Square_Type Possible_Winner = Board[Three_in_a_Row[i][0]];
- if (Possible_Winner != Empty &&
- Possible_Winner == Board[Three_in_a_Row[i][1]] &&
- Possible_Winner == Board[Three_in_a_Row[i][2]])
- return Possible_Winner;
- }
-
- for (i = 0; i < ScTicTacToe_Squares; i++)
- {
- if (Board[i] == Empty)
- return Empty;
- }
-
- return 'C';
-}
-
-
-/* Return a heuristic used to determine the order in which the
- children of a node are searched */
-int ScTicTacToe::Evaluate(Square_Type Player)
-{
- int i;
- int Heuristic = 0;
- for (i = 0; i < ScTicTacToe_Possible_Wins; i++)
- {
- int j;
- int Players = 0, Others = 0;
- for (j = 0; j < 3; j++)
- {
- Square_Type Piece = Board[Three_in_a_Row[i][j]];
- if (Piece == Player)
- Players++;
- else if (Piece == Other(Player))
- Others++;
- }
- Heuristic += Heuristic_Array[Players][Others];
- }
- return Heuristic;
-}
-
-
-/* Return the score of the best move found for a board
- The square to move to is returned in *Square */
-int ScTicTacToe::BestMove(Square_Type Player, int *Square,
- int Move_Nbr, int Alpha, int Beta)
-{
- int Best_Square = -1;
- int Moves = 0;
- int i;
- Move_Heuristic_Type Move_Heuristic[ScTicTacToe_Squares];
-
- Total_Nodes++;
-
- /* Find the heuristic for each move and sort moves in descending order */
- for (i = 0; i < ScTicTacToe_Squares; i++)
- {
- if (Board[i] == Empty)
- {
- int Heuristic;
- int j;
- Play(i, Player);
- Heuristic = Evaluate(Player);
- Play(i, Empty);
- for (j = Moves-1; j >= 0 &&
- Move_Heuristic[j].Heuristic < Heuristic; j--)
- {
- Move_Heuristic[j + 1].Heuristic = Move_Heuristic[j].Heuristic;
- Move_Heuristic[j + 1].Square = Move_Heuristic[j].Square;
- }
- Move_Heuristic[j + 1].Heuristic = Heuristic;
- Move_Heuristic[j + 1].Square = i;
- Moves++;
- }
- }
-
- for (i = 0; i < Moves; i++)
- {
- int Score;
- int Sq = Move_Heuristic[i].Square;
- Square_Type W;
-
- /* Make a move and get its score */
- Play(Sq, Player);
-
- W = Winner();
- if (W == Compi)
- Score = (Maximum_Moves + 1) - Move_Nbr;
- else if (W == Human)
- Score = Move_Nbr - (Maximum_Moves + 1);
- else if (W == 'C')
- Score = 0;
- else
- Score = BestMove(Other(Player), Square, Move_Nbr + 1,
- Alpha, Beta);
-
- Play(Sq, Empty);
-
- /* Perform alpha-beta pruning */
- if (Player == Compi)
- {
- if (Score >= Beta)
- {
- *Square = Sq;
- return Score;
- }
- else if (Score > Alpha)
- {
- Alpha = Score;
- Best_Square = Sq;
- }
- }
- else
- {
- if (Score <= Alpha)
- {
- *Square = Sq;
- return Score;
- }
- else if (Score < Beta)
- {
- Beta = Score;
- Best_Square = Sq;
- }
- }
- }
- *Square = Best_Square;
- if (Player == Compi)
- return Alpha;
- else
- return Beta;
-}
-
-
-/* Provide an English description of the score returned by BestMove */
-void ScTicTacToe::Describe(int Score)
-{
- if (Score < 0)
- aStdOut += "You have a guaranteed win. ";
- else if (Score == 0)
- aStdOut += "I can guarantee a tie. ";
- else
- {
- aStdOut += "I have a guaranteed win by move ";
- aStdOut += ByteString::CreateFromInt32( Maximum_Moves - Score + 1 );
- aStdOut += ". ";
- }
-}
-
-
-/* Have the human or the computer move */
-void ScTicTacToe::Move( int& Square )
-{
- if (aPlayer == Compi)
- {
- Total_Nodes = 0;
- Describe(BestMove(aPlayer, &Square, nMove, -Infinity, Infinity));
- aStdOut += ByteString::CreateFromInt32( Total_Nodes );
- aStdOut += " nodes examined. ";
- Play(Square, aPlayer);
- aStdOut += "Move #";
- aStdOut += ByteString::CreateFromInt32( nMove );
- aStdOut += " - O moves to ";
- aStdOut += ByteString::CreateFromInt32( Square + 1 );
- aStdOut += ". ";
- aPlayer = Other( aPlayer );
- nMove++;
- }
- else
- {
- if ( Square < 0 || Square >= ScTicTacToe_Squares
- || Board[Square] != Empty )
- Square = -1;
- else
- {
- Play(Square, aPlayer);
- aPlayer = Other( aPlayer );
- nMove++;
- }
- }
-}
-
-
-// Try a move
-Square_Type ScTicTacToe::TryMove( int& Square )
-{
- if ( !bInitialized )
- Initialize( FALSE );
-
- Square_Type W = Winner();
- if ( W == Empty )
- {
- Move( Square );
-#ifdef TICTACTOE_STDOUT
- if ( aStdOut.Len() )
- {
- puts( aStdOut.GetBuffer() );
- aStdOut.Erase();
- }
-#endif
- W = Winner();
- }
- if ( W == Empty )
- {
- if ( aPlayer == Human )
- PromptHuman();
- }
- else
- {
- if (W != 'C')
- {
- aStdOut += static_cast< char >(W);
- aStdOut += " wins!";
- }
- else
- aStdOut += "It's a tie.";
- }
- return W;
-}
-
-
-void ScTicTacToe::PromptHuman()
-{
- aStdOut += "Move #";
- aStdOut += ByteString::CreateFromInt32( nMove );
- aStdOut += " - What is X's move?";
-}
-
-
-#ifdef TICTACTOE_SC
-
-void ScTicTacToe::DrawPos( int nSquare, const String& rStr )
-{
- pDoc->SetString( sal::static_int_cast<SCCOL>( aPos.Col()+(nSquare%3) ),
- sal::static_int_cast<SCROW>( aPos.Row()+(nSquare/3) ), aPos.Tab(), rStr );
-}
-
-
-void ScTicTacToe::DrawBoard()
-{
- String aStr;
- for ( USHORT j = 0; j < ScTicTacToe_Squares; j++ )
- {
- aStr = Board[j];
- DrawPos( j, aStr );
- }
-}
-
-
-// -1 == Fehler/Redraw, 0 == keine Aenderung, >0 == UserMoveSquare+1
-int ScTicTacToe::GetStatus()
-{
- SCCOL nCol;
- SCROW nRow;
- SCTAB nTab;
- nCol = aPos.Col();
- nRow = aPos.Row();
- nTab = aPos.Tab();
- String aStr;
- int nDiffs = 0;
- int nSquare = 0;
- for ( USHORT j = 0; j < ScTicTacToe_Squares; j++ )
- {
- pDoc->GetString( nCol+(j%3), nRow+(j/3), nTab, aStr );
- if ( !aStr.Len() )
- {
- if ( Board[j] != Empty )
- return -1; // wo was sein muss muss was sein
- }
- else
- {
- aStr.ToUpperAscii();
- if ( aStr.GetChar(0) != Board[j] )
- {
- if ( Board[j] != Empty )
- return -1; // bestehendes ueberschrieben
- // bei erstem Move hat Human angefangen
- if ( ++nDiffs > 1 )
- return -1; // mehr als eine Aenderung
- nSquare = j;
- }
- }
- }
- if ( nDiffs == 1 )
- return nSquare + 1;
- return 0;
-}
-
-
-Square_Type ScTicTacToe::CalcMove()
-{
- Square_Type W = Winner();
- int nStat = GetStatus();
- if ( nStat || (W == Empty && aPlayer == Compi) )
- {
- if ( nStat == -1 || (nStat > 0 && aPlayer == Compi) )
- DrawBoard();
- if ( W == Empty && aPlayer == Human )
- {
- if ( nStat > 0 )
- {
- int nSquare = --nStat;
- W = TryMove( nStat );
- if ( nStat == -1 )
- DrawPos( nSquare, String( ' ' ) );
- else
- DrawPos( nStat, String( Human ) );
- }
- else
- PromptHuman();
- }
- if ( W == Empty && aPlayer == Compi )
- {
- W = TryMove( nStat ); // ComputerMove, nStat egal
- DrawPos( nStat, String( Compi ) );
- }
- }
- else if ( W == Empty && aPlayer == Human )
- PromptHuman();
- return W;
-}
-
-#endif // TICTACTOE_SC
-
-
-#ifdef TICTACTOE_STDOUT
-/* Print the board */
-void ScTicTacToe::Print()
-{
- int i;
- for (i = 0; i < ScTicTacToe_Squares; i += 3)
- {
- if (i > 0)
- printf("---+---+---\n");
- printf(" %c | %c | %c \n", Board[i], Board[i + 1], Board[i + 2]);
- }
- printf("\n");
-}
-
-
-/* Play a game of tic-tac-toe */
-void ScTicTacToe::Game()
-{
- if ( !bInitialized )
- Initialize( FALSE );
-
- int Square = (aPlayer == Compi ? 0 : -1);
- Square_Type W = Winner();
- while( W == Empty )
- {
- Print();
- W = TryMove( Square );
- if ( W == Empty )
- {
- if ( aPlayer == Human )
- {
- if ( Square != -1 )
- Print(); // empty board already printed if human moves first
- do
- {
- puts( aStdOut.GetBuffer() );
- aStdOut.Erase();
- scanf("%d", &Square);
- Square--;
- W = TryMove( Square );
- } while ( Square == -1 );
- }
- }
- }
- Print();
- puts( aStdOut.GetBuffer() );
- aStdOut.Erase();
-}
-#endif // TICTACTOE_STDOUT
-
-
-#ifdef TICTACTOE_MAIN
-int main()
-{
- char Answer[80];
-
- printf("Welcome to Tic-Tac-Toe!\n\n");
- printf("Here is the board numbering:\n");
- printf(" 1 | 2 | 3\n");
- printf("---+---+---\n");
- printf(" 4 | 5 | 6\n");
- printf("---+---+---\n");
- printf(" 7 | 8 | 9\n");
- printf("\n");
-// printf("Computer plays X, you play O.\n");
-
- ScTicTacToe aTTT;
- ByteString aStr;
- aTTT.GetOutput( aStr );
- puts( aStr.GetBuffer() );
-
- do
- {
- printf("\nDo you want to move first? ");
- scanf("%s", Answer);
- aTTT.Initialize( toupper(Answer[0]) == 'Y' );
- aTTT.Game();
- printf("\nDo you want to play again? ");
- scanf("%s", Answer);
- } while (toupper(Answer[0]) == 'Y');
-
- return 0;
-}
-#endif // TICTACTOE_MAIN
-
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index e8c71d20af11..0ab97170621e 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -148,8 +148,6 @@ const sal_Char __FAR_DATA ScHTMLExport::sIndentSource[nIndentMax+1] =
#define OUT_SP_CSTR_ASS( s ) rStrm << ' ' << s << '='
#define APPEND_SPACE( s ) s.AppendAscii(" ")
-extern BOOL bOderSo;
-
#define GLOBSTR(id) ScGlobal::GetRscString( id )
@@ -234,30 +232,6 @@ void lcl_AppendHTMLColorTripel( ByteString& rStr, const Color& rColor )
}
*/
-bool SC_DLLPUBLIC ScGetWriteTeamInfo();
-
-void lcl_WriteTeamInfo( SvStream& rStrm, rtl_TextEncoding eDestEnc )
-{
- if ( !ScGetWriteTeamInfo() ) return;
- lcl_OUT_LF();
- lcl_OUT_COMMENT( CREATE_STRING( "Sascha Ballach " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Michael Daeumling (aka Bitsau) " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Michael Hagen " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Roland Jakobs " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Andreas Krebs " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "John Marmion " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Niklas Nebel " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Jacques Nietsch " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Marcus Olk " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Eike Rathke " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Daniel Rentz " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Stephan Templin " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "Gunnar Timm " ) );
- lcl_OUT_COMMENT( CREATE_STRING( "*** Man kann nicht ALLES haben! ***" ) );
- lcl_OUT_LF();
-}
-
-
//////////////////////////////////////////////////////////////////////////////
ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& rBaseURL, ScDocument* pDocP,
@@ -416,8 +390,6 @@ void ScHTMLExport::WriteHeader()
OUT_COMMENT( aStrOut );
}
//----------------------------------------------------------
-
- lcl_WriteTeamInfo( rStrm, eDestEnc );
}
OUT_LF();
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 7b0652e7cce9..85e77fc3124b 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -2424,12 +2424,15 @@ void ScHTMLTable::InsertNewCell( const ScHTMLSize& rSpanSize )
{
ScRange* pRange;
- // find an unused cell
- while( (pRange = maVMergedCells.Find( maCurrCell.MakeAddr() )) != 0 )
+ /* Find an unused cell by skipping all merged ranges that cover the
+ current cell position stored in maCurrCell. */
+ while( ((pRange = maVMergedCells.Find( maCurrCell.MakeAddr() )) != 0) || ((pRange = maHMergedCells.Find( maCurrCell.MakeAddr() )) != 0) )
maCurrCell.mnCol = pRange->aEnd.Col() + 1;
mpCurrEntryList = &maEntryMap[ maCurrCell ];
- // try to find collisions, shrink existing ranges
+ /* If the new cell is merged horizontally, try to find collisions with
+ other vertically merged ranges. In this case, shrink existing
+ vertically merged ranges (do not shrink the new cell). */
SCCOL nColEnd = maCurrCell.mnCol + rSpanSize.mnCols;
for( ScAddress aAddr( maCurrCell.MakeAddr() ); aAddr.Col() < nColEnd; aAddr.IncCol() )
if( (pRange = maVMergedCells.Find( aAddr )) != 0 )
@@ -2438,14 +2441,19 @@ void ScHTMLTable::InsertNewCell( const ScHTMLSize& rSpanSize )
// insert the new range into the cell lists
ScRange aNewRange( maCurrCell.MakeAddr() );
aNewRange.aEnd.Move( rSpanSize.mnCols - 1, rSpanSize.mnRows - 1, 0 );
- if( rSpanSize.mnCols > 1 )
+ if( rSpanSize.mnRows > 1 )
{
maVMergedCells.Append( aNewRange );
+ /* Do not insert vertically merged ranges into maUsedCells yet,
+ because they may be shrunken (see above). The final vertically
+ merged ranges are inserted in FillEmptyCells(). */
}
else
{
- if( rSpanSize.mnRows > 1 )
+ if( rSpanSize.mnCols > 1 )
maHMergedCells.Append( aNewRange );
+ /* Insert horizontally merged ranges and single cells into
+ maUsedCells, they will not be changed anymore. */
maUsedCells.Join( aNewRange );
}
@@ -2592,6 +2600,7 @@ void ScHTMLTable::FillEmptyCells()
for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
aIter->FillEmptyCells();
+ // insert the final vertically merged ranges into maUsedCells
for( const ScRange* pRange = maVMergedCells.First(); pRange; pRange = maVMergedCells.Next() )
maUsedCells.Join( *pRange );
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index d53f26a5e887..0b620e1d47d8 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2618,13 +2618,20 @@ void ScXMLExport::_ExportAutoStyles()
GetShapeExport()->exportAutoStyles();
GetFormExport()->exportAutoStyles( );
+ if (pDoc)
{
- // Special table style for the external ref cache tables.
- AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sExternalRefTabStyleName);
- AddAttribute(XML_NAMESPACE_STYLE, XML_FAMILY, XML_TABLE);
- SvXMLElementExport aElemStyle(*this, XML_NAMESPACE_STYLE, XML_STYLE, sal_True, sal_True);
- AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY, XML_FALSE);
- SvXMLElementExport aElemStyleTabProps(*this, XML_NAMESPACE_STYLE, XML_TABLE_PROPERTIES, sal_True, sal_True);
+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
+ // #i100879# write the table style for cached tables only if there are cached tables
+ // (same logic as in ExportExternalRefCacheStyles)
+ if (pRefMgr->hasExternalData())
+ {
+ // Special table style for the external ref cache tables.
+ AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sExternalRefTabStyleName);
+ AddAttribute(XML_NAMESPACE_STYLE, XML_FAMILY, XML_TABLE);
+ SvXMLElementExport aElemStyle(*this, XML_NAMESPACE_STYLE, XML_STYLE, sal_True, sal_True);
+ AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY, XML_FALSE);
+ SvXMLElementExport aElemStyleTabProps(*this, XML_NAMESPACE_STYLE, XML_TABLE_PROPERTIES, sal_True, sal_True);
+ }
}
}
if (getExportFlags() & EXPORT_MASTERSTYLES)
@@ -3237,6 +3244,7 @@ void ScXMLExport::WriteAreaLink( const ScMyCell& rMyCell )
{
const ScMyAreaLink& rAreaLink = rMyCell.aAreaLink;
AddAttribute( XML_NAMESPACE_TABLE, XML_NAME, rAreaLink.sSourceStr );
+ AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, GetRelativeReference(rAreaLink.sURL) );
AddAttribute( XML_NAMESPACE_TABLE, XML_FILTER_NAME, rAreaLink.sFilter );
if( rAreaLink.sFilterOptions.getLength() )
@@ -3720,6 +3728,7 @@ void ScXMLExport::WriteTableSource()
xLinkProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_REFDELAY))) >>= nRefresh;
if (sLink.getLength())
{
+ AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE);
AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetRelativeReference(sLink));
if (sTableName.getLength())
AddAttribute(XML_NAMESPACE_TABLE, XML_TABLE_NAME, sTableName);
@@ -3958,6 +3967,7 @@ void ScXMLExport::WriteExternalRefCaches()
aRelUrl = pExtFileData->maRelativeName;
else
aRelUrl = GetRelativeReference(pExtFileData->maRelativeName);
+ AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE);
AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aRelUrl);
AddAttribute(XML_NAMESPACE_TABLE, XML_TABLE_NAME, *itr);
if (pExtFileData->maFilterName.Len())
@@ -3987,6 +3997,14 @@ void ScXMLExport::WriteExternalRefCaches()
}
}
+ // Column definitions have to be present to make a valid file
+ {
+ if (nMaxColsUsed > 1)
+ AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED,
+ OUString::valueOf(static_cast<sal_Int32>(nMaxColsUsed)));
+ SvXMLElementExport aElemColumn(*this, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True);
+ }
+
// Write cache content for this table.
SCROW nLastRow = 0;
bool bFirstRow = true;
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 40b65ce401ad..28f178565da0 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -429,7 +429,9 @@ ScInputHandler::ScInputHandler()
pColumnData( NULL ),
pFormulaData( NULL ),
pFormulaDataPara( NULL ),
+ pTipVisibleParent( NULL ),
nTipVisible( 0 ),
+ pTipVisibleSecParent( NULL ),
nTipVisibleSec( 0 ),
nAutoPos( SCPOS_INVALID ),
bUseTab( FALSE ),
@@ -691,12 +693,29 @@ void ScInputHandler::GetFormulaData()
}
}
+IMPL_LINK( ScInputHandler, ShowHideTipVisibleParentListener, VclWindowEvent*, pEvent )
+{
+ if( pEvent->GetId() == VCLEVENT_OBJECT_DYING || pEvent->GetId() == VCLEVENT_WINDOW_HIDE )
+ HideTip();
+ return 0;
+}
+
+IMPL_LINK( ScInputHandler, ShowHideTipVisibleSecParentListener, VclWindowEvent*, pEvent )
+{
+ if( pEvent->GetId() == VCLEVENT_OBJECT_DYING || pEvent->GetId() == VCLEVENT_WINDOW_HIDE )
+ HideTipBelow();
+ return 0;
+}
+
void ScInputHandler::HideTip()
{
if ( nTipVisible )
{
+ if (pTipVisibleParent)
+ pTipVisibleParent->RemoveEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) );
Help::HideTip( nTipVisible );
nTipVisible = 0;
+ pTipVisibleParent = NULL;
}
aManualTip.Erase();
}
@@ -704,8 +723,11 @@ void ScInputHandler::HideTipBelow()
{
if ( nTipVisibleSec )
{
+ if (pTipVisibleSecParent)
+ pTipVisibleSecParent->RemoveEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) );
Help::HideTip( nTipVisibleSec );
nTipVisibleSec = 0;
+ pTipVisibleSecParent = NULL;
}
aManualTip.Erase();
}
@@ -897,15 +919,16 @@ void ScInputHandler::ShowTip( const String& rText )
if (pActiveView)
{
Point aPos;
- Window* pWin = pActiveView->GetWindow();
+ pTipVisibleParent = pActiveView->GetWindow();
Cursor* pCur = pActiveView->GetCursor();
if (pCur)
- aPos = pWin->LogicToPixel( pCur->GetPos() );
- aPos = pWin->OutputToScreenPixel( aPos );
+ aPos = pTipVisibleParent->LogicToPixel( pCur->GetPos() );
+ aPos = pTipVisibleParent->OutputToScreenPixel( aPos );
Rectangle aRect( aPos, aPos );
USHORT nAlign = QUICKHELP_LEFT|QUICKHELP_BOTTOM;
- nTipVisible = Help::ShowTip(pWin, aRect, rText, nAlign);
+ nTipVisible = Help::ShowTip(pTipVisibleParent, aRect, rText, nAlign);
+ pTipVisibleParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) );
}
}
@@ -917,18 +940,19 @@ void ScInputHandler::ShowTipBelow( const String& rText )
if ( pActiveView )
{
Point aPos;
- Window* pWin = pActiveView->GetWindow();
+ pTipVisibleSecParent = pActiveView->GetWindow();
Cursor* pCur = pActiveView->GetCursor();
if ( pCur )
{
Point aLogicPos = pCur->GetPos();
aLogicPos.Y() += pCur->GetHeight();
- aPos = pWin->LogicToPixel( aLogicPos );
+ aPos = pTipVisibleSecParent->LogicToPixel( aLogicPos );
}
- aPos = pWin->OutputToScreenPixel( aPos );
+ aPos = pTipVisibleSecParent->OutputToScreenPixel( aPos );
Rectangle aRect( aPos, aPos );
USHORT nAlign = QUICKHELP_LEFT | QUICKHELP_TOP;
- nTipVisibleSec = Help::ShowTip(pWin, aRect, rText, nAlign);
+ nTipVisibleSec = Help::ShowTip(pTipVisibleSecParent, aRect, rText, nAlign);
+ pTipVisibleSecParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) );
}
}
@@ -2690,6 +2714,7 @@ void ScInputHandler::EnterHandler( BYTE nBlockMode )
delete pObject;
HideTip();
+ HideTipBelow();
nFormSelStart = nFormSelEnd = 0;
aFormText.Erase();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index dc5d1010dfc8..94e18def8a11 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -98,7 +98,6 @@
#include "msgpool.hxx"
#include "scresid.hxx"
#include "anyrefdg.hxx"
-#include "teamdlg.hxx"
#include "dwfunctr.hxx"
#include "formdata.hxx"
//CHINA001 #include "tpview.hxx"
@@ -142,7 +141,6 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
pSelTransfer( NULL ),
pMessagePool( NULL ),
pRefInputHandler( NULL ),
- pTeamDlg( NULL ),
pViewCfg( NULL ),
pDocCfg( NULL ),
pAppCfg( NULL ),
@@ -1507,11 +1505,6 @@ void ScModule::ViewShellGone( ScTabViewShell* pViewSh )
ScInputHandler* pHdl = GetInputHdl();
if (pHdl)
pHdl->ViewShellGone( pViewSh );
-
- // Team dialog is opened with the window from a view as parent
- // -> close it if any view is closed
- if (pTeamDlg)
- pTeamDlg->Close(); // resets variable pTeamDlg
}
void ScModule::SetRefInputHdl( ScInputHandler* pNew )
@@ -1635,21 +1628,6 @@ void ScModule::SetRefDialog( USHORT nId, BOOL bVis, SfxViewFrame* pViewFrm )
}
}
-void ScModule::OpenTeamDlg()
-{
- if ( !pTeamDlg )
- {
- // team dialog needs an existing parent window
- // -> use window from active view (dialog is closed in ViewShellGone)
-
- ScTabViewShell* pShell = ScTabViewShell::GetActiveViewShell();
- if (pShell)
- pTeamDlg = new ScTeamDlg( pShell->GetActiveWin() );
- }
- else
- pTeamDlg->Center();
-}
-
SfxChildWindow* lcl_GetChildWinFromAnyView( USHORT nId )
{
// first try the current view
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index b761dd75d9df..cb9d625da70c 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -597,7 +597,7 @@ void lcl_GetColumnTypes( ScDocShell& rDocShell,
else if ( nDbType == sdbc::DataType::DECIMAL )
{ // maximale Feldbreite und Nachkommastellen bestimmen
xub_StrLen nLen;
- USHORT nPrec;
+ sal_uInt16 nPrec;
nLen = pDoc->GetMaxNumberStringLen( nPrec, nTab, nCol,
nFirstDataRow, nLastRow );
// dBaseIII Limit Nachkommastellen: 15
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 4d18f9f18c37..697b39052b9f 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -485,6 +485,11 @@ BOOL ScDocumentLoader::GetFilterName( const String& rFileName,
pDocSh = SfxObjectShell::GetNext( *pDocSh, &aScType );
}
+ INetURLObject aUrl( rFileName );
+ INetProtocol eProt = aUrl.GetProtocol();
+ if ( eProt == INET_PROT_NOT_VALID ) // invalid URL?
+ return FALSE; // abort without creating a medium
+
// Filter-Detection
const SfxFilter* pSfxFilter = NULL;
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index bcc5ba0dd396..61974cf7464d 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -68,7 +68,9 @@ private:
TypedScStrCollection* pColumnData;
TypedScStrCollection* pFormulaData;
TypedScStrCollection* pFormulaDataPara;
+ Window* pTipVisibleParent;
ULONG nTipVisible;
+ Window* pTipVisibleSecParent;
ULONG nTipVisibleSec;
String aManualTip;
String aAutoSearch;
@@ -149,6 +151,8 @@ private:
BOOL CursorAtClosingPar();
void SkipClosingPar();
DECL_LINK( ModifyHdl, void* );
+ DECL_LINK( ShowHideTipVisibleParentListener, VclWindowEvent* );
+ DECL_LINK( ShowHideTipVisibleSecParentListener, VclWindowEvent* );
#endif
public:
diff --git a/sc/source/ui/inc/optdlg.hrc b/sc/source/ui/inc/optdlg.hrc
index 00cfdb2c6d5a..27b8976e3541 100644
--- a/sc/source/ui/inc/optdlg.hrc
+++ b/sc/source/ui/inc/optdlg.hrc
@@ -70,6 +70,7 @@
#define BTN_MATCH 18
#define BTN_LOOKUP 19
#define BTN_REGEX 20
+#define BTN_GENERAL_PREC 21
// TP_VIEW:
#define BTN_VSCROLL 1
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index 8d512898afd3..42844513af92 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -73,6 +73,15 @@ class ScOutputData
{
friend class ScDrawStringsVars;
private:
+ struct OutputAreaParam
+ {
+ Rectangle maAlignRect;
+ Rectangle maClipRect;
+ long mnColWidth;
+ bool mbLeftClip;
+ bool mbRightClip;
+ };
+
OutputDevice* pDev; // Device
OutputDevice* pRefDevice; // printer if used for preview
OutputDevice* pFmtDevice; // reference for text formatting
@@ -152,19 +161,19 @@ private:
void GetVisibleCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell );
BOOL IsAvailable( SCCOL nX, SCROW nY );
+
void GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY,
- SCCOL nCellX, SCROW nCellY, long nNeeded,
- const ScPatternAttr& rPattern,
- USHORT nHorJustify, BOOL bCellIsValue,
- BOOL bBreak, BOOL bOverwrite,
- Rectangle& rAlignRect, Rectangle& rClipRect,
- BOOL& rLeftClip, BOOL& rRightClip );
+ SCCOL nCellX, SCROW nCellY, long nNeeded,
+ const ScPatternAttr& rPattern,
+ USHORT nHorJustify, bool bCellIsValue,
+ bool bBreak, bool bOverwrite,
+ OutputAreaParam& rParam );
void ShrinkEditEngine( EditEngine& rEngine, const Rectangle& rAlignRect,
long nLeftM, long nTopM, long nRightM, long nBottomM,
BOOL bWidth, USHORT nOrient, long nAttrRotate, BOOL bPixelToLogic,
long& rEngineWidth, long& rEngineHeight, long& rNeededPixel,
- BOOL& rLeftClip, BOOL& rRightClip );
+ bool& rLeftClip, bool& rRightClip );
void SetSyntaxColor( Font* pFont, ScBaseCell* pCell );
void SetEditSyntaxColor( EditEngine& rEngine, ScBaseCell* pCell );
diff --git a/sc/source/ui/inc/teamdlg.hxx b/sc/source/ui/inc/teamdlg.hxx
deleted file mode 100644
index 9f44f06c4b12..000000000000
--- a/sc/source/ui/inc/teamdlg.hxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_TEAMDLG_HXX
-#define SC_TEAMDLG_HXX
-
-
-#include <vcl/floatwin.hxx>
-#include <vcl/fixed.hxx>
-
-
-//========================================================================
-
-class ScTeamDlg : public FloatingWindow
-{
-public:
- ScTeamDlg( Window* pParent );
- ~ScTeamDlg();
-
- virtual BOOL Close();
- void Center();
-
-private:
- FixedBitmap aBmpTeam;
-};
-
-
-#endif
-
diff --git a/sc/source/ui/inc/tpcalc.hxx b/sc/source/ui/inc/tpcalc.hxx
index ea9e53a23ee4..31f2c9458c83 100644
--- a/sc/source/ui/inc/tpcalc.hxx
+++ b/sc/source/ui/inc/tpcalc.hxx
@@ -76,6 +76,7 @@ private:
CheckBox aBtnMatch;
CheckBox aBtnRegex;
CheckBox aBtnLookUp;
+ CheckBox aBtnGeneralPrec;
FixedText aFtPrec;
NumericField aEdPrec;
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 940856775c07..6ce65ab914be 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -68,8 +68,6 @@
#define FRAME_OFFSET 4
-BOOL bIsOlk = FALSE;
-
//CHINA001 //========================================================================
//CHINA001 // AutoFormat-Dialog:
@@ -508,8 +506,6 @@ ScAutoFmtPreview::ScAutoFmtPreview( Window* pParent, const ResId& rRes, ScDocume
pNumFmt ( new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), ScGlobal::eLnge ) )
{
Init();
- if( bIsOlk )
- ((String&)aStrMar).AssignAscii(RTL_CONSTASCII_STRINGPARAM( "Olk" ));
}
//------------------------------------------------------------------------
diff --git a/sc/source/ui/miscdlgs/makefile.mk b/sc/source/ui/miscdlgs/makefile.mk
index 9f5bb1dbc498..ac210bcfaa83 100644
--- a/sc/source/ui/miscdlgs/makefile.mk
+++ b/sc/source/ui/miscdlgs/makefile.mk
@@ -60,7 +60,6 @@ SLOFILES = \
$(SLO)$/crdlg.obj \
$(SLO)$/namecrea.obj \
$(SLO)$/namepast.obj \
- $(SLO)$/teamdlg.obj \
$(SLO)$/textdlgs.obj \
$(SLO)$/anyrefdg.obj \
$(SLO)$/crnrdlg.obj \
@@ -109,7 +108,6 @@ LIB1OBJFILES = \
$(SLO)$/solveroptions.obj \
$(SLO)$/solverutil.obj \
$(SLO)$/tabopdlg.obj \
- $(SLO)$/teamdlg.obj \
$(SLO)$/anyrefdg.obj \
$(SLO)$/crnrdlg.obj \
$(SLO)$/acredlin.obj \
diff --git a/sc/source/ui/miscdlgs/teamdlg.cxx b/sc/source/ui/miscdlgs/teamdlg.cxx
deleted file mode 100644
index a9f1bf2a17cf..000000000000
--- a/sc/source/ui/miscdlgs/teamdlg.cxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-
-
-
-//------------------------------------------------------------------
-
-#include <tools/shl.hxx>
-
-#include "teamdlg.hxx"
-#include "scmod.hxx"
-#include "scresid.hxx"
-#include "sc.hrc"
-
-
-//------------------------------------------------------------------
-
-void ShowTheTeam()
-{
- SC_MOD()->OpenTeamDlg();
-}
-
-//========================================================================
-// ScTeamDlg
-//========================================================================
-
-ScTeamDlg::ScTeamDlg( Window* pParent )
- : FloatingWindow( pParent, ScResId( RID_SCDLG_TEAM ) ),
- aBmpTeam ( this, ScResId( 1 ) )
-{
- FreeResource();
- SC_MOD()->SetTeamDlg( this );
-
- Bitmap aBmp( ScResId( RID_SCTEAMDLGBMP1 ) );
-
- Size aSize = aBmp.GetSizePixel();
- USHORT nOff = (USHORT)aBmpTeam.GetPosPixel().X();
-
- aBmpTeam.SetSizePixel( aSize );
- aBmpTeam.SetBitmap( aBmp );
- aSize.Width() += (2*nOff);
- aSize.Height() += (2*nOff);
- SetOutputSizePixel( aSize );
- Center();
- Point aPos = GetPosPixel();
- if (aPos.Y() < 0)
- {
- // #87164# title bar must be visible
- aPos.Y() = 0;
- SetPosPixel(aPos);
- }
- Show();
-}
-
-//------------------------------------------------------------------------
-
-__EXPORT ScTeamDlg::~ScTeamDlg()
-{
-}
-
-//------------------------------------------------------------------------
-
-BOOL __EXPORT ScTeamDlg::Close()
-{
- BOOL bReturn = FloatingWindow::Close();
-
- SC_MOD()->SetTeamDlg( NULL );
- delete this;
-
- return bReturn;
-}
-
-//------------------------------------------------------------------------
-
-void ScTeamDlg::Center()
-{
- if ( IsRollUp() ) RollDown();
-
- Size aSizeDesktop = GetParent()->GetSizePixel();
- Size aSize = GetSizePixel();
- Point aNewPos;
-
- aNewPos.X() = (aSizeDesktop.Width() - aSize.Width()) / 2;
- aNewPos.Y() = (aSizeDesktop.Height() - aSize.Height()) / 2;
- SetPosPixel( aNewPos );
-}
-
-
-
diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx
index c6423ea73b23..5b5920e904fc 100644
--- a/sc/source/ui/optdlg/tpcalc.cxx
+++ b/sc/source/ui/optdlg/tpcalc.cxx
@@ -88,6 +88,7 @@ ScTpCalcOptions::ScTpCalcOptions( Window* pParent,
aBtnMatch ( this, ScResId( BTN_MATCH ) ),
aBtnRegex ( this, ScResId( BTN_REGEX ) ),
aBtnLookUp ( this, ScResId( BTN_LOOKUP ) ),
+ aBtnGeneralPrec ( this, ScResId( BTN_GENERAL_PREC ) ),
aFtPrec ( this, ScResId( FT_PREC ) ),
aEdPrec ( this, ScResId( ED_PREC ) ),
pOldOptions ( new ScDocOptions(
@@ -116,6 +117,7 @@ __EXPORT ScTpCalcOptions::~ScTpCalcOptions()
void ScTpCalcOptions::Init()
{
aBtnIterate .SetClickHdl( LINK( this, ScTpCalcOptions, CheckClickHdl ) );
+ aBtnGeneralPrec.SetClickHdl( LINK(this, ScTpCalcOptions, CheckClickHdl) );
aBtnDateStd .SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
aBtnDateSc10.SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
aBtnDate1904.SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) );
@@ -150,7 +152,6 @@ void __EXPORT ScTpCalcOptions::Reset( const SfxItemSet& /* rCoreAttrs */ )
aBtnLookUp .Check( pLocalOptions->IsLookUpColRowNames() );
aBtnIterate.Check( pLocalOptions->IsIter() );
aEdSteps .SetValue( pLocalOptions->GetIterCount() );
- aEdPrec .SetValue( pLocalOptions->GetStdPrecision() );
aEdEps .SetValue( pLocalOptions->GetIterEps(), 6 );
pLocalOptions->GetDate( d, m, y );
@@ -168,6 +169,21 @@ void __EXPORT ScTpCalcOptions::Reset( const SfxItemSet& /* rCoreAttrs */ )
break;
}
+ sal_uInt16 nPrec = pLocalOptions->GetStdPrecision();
+ if (nPrec == SvNumberFormatter::UNLIMITED_PRECISION)
+ {
+ aFtPrec.Disable();
+ aEdPrec.Disable();
+ aBtnGeneralPrec.Check(false);
+ }
+ else
+ {
+ aBtnGeneralPrec.Check();
+ aFtPrec.Enable();
+ aEdPrec.Enable();
+ aEdPrec.SetValue(nPrec);
+ }
+
CheckClickHdl( &aBtnIterate );
}
@@ -178,13 +194,18 @@ BOOL __EXPORT ScTpCalcOptions::FillItemSet( SfxItemSet& rCoreAttrs )
{
// alle weiteren Optionen werden in den Handlern aktualisiert
pLocalOptions->SetIterCount( (USHORT)aEdSteps.GetValue() );
- pLocalOptions->SetStdPrecision( (USHORT)aEdPrec.GetValue() );
pLocalOptions->SetIgnoreCase( !aBtnCase.IsChecked() );
pLocalOptions->SetCalcAsShown( aBtnCalc.IsChecked() );
pLocalOptions->SetMatchWholeCell( aBtnMatch.IsChecked() );
pLocalOptions->SetFormulaRegexEnabled( aBtnRegex.IsChecked() );
pLocalOptions->SetLookUpColRowNames( aBtnLookUp.IsChecked() );
+ if (aBtnGeneralPrec.IsChecked())
+ pLocalOptions->SetStdPrecision(
+ static_cast<sal_uInt16>(aEdPrec.GetValue()) );
+ else
+ pLocalOptions->SetStdPrecision( SvNumberFormatter::UNLIMITED_PRECISION );
+
if ( *pLocalOptions != *pOldOptions )
{
rCoreAttrs.Put( ScTpCalcItem( nWhichCalc, *pLocalOptions ) );
@@ -245,19 +266,35 @@ IMPL_LINK( ScTpCalcOptions, RadioClickHdl, RadioButton*, pBtn )
//-----------------------------------------------------------------------
-IMPL_LINK( ScTpCalcOptions, CheckClickHdl, CheckBox*, pBtn )
+IMPL_LINK( ScTpCalcOptions, CheckClickHdl, CheckBox*, pBtn )
{
- if ( pBtn->IsChecked() )
+ if (pBtn == &aBtnGeneralPrec)
{
- pLocalOptions->SetIter( TRUE );
- aFtSteps.Enable(); aEdSteps.Enable();
- aFtEps .Enable(); aEdEps .Enable();
+ if (pBtn->IsChecked())
+ {
+ aEdPrec.Enable();
+ aFtPrec.Enable();
+ }
+ else
+ {
+ aEdPrec.Disable();
+ aFtPrec.Disable();
+ }
}
- else
+ else if (pBtn == &aBtnIterate)
{
- pLocalOptions->SetIter( FALSE );
- aFtSteps.Disable(); aEdSteps.Disable();
- aFtEps .Disable(); aEdEps .Disable();
+ if ( pBtn->IsChecked() )
+ {
+ pLocalOptions->SetIter( TRUE );
+ aFtSteps.Enable(); aEdSteps.Enable();
+ aFtEps .Enable(); aEdEps .Enable();
+ }
+ else
+ {
+ pLocalOptions->SetIter( FALSE );
+ aFtSteps.Disable(); aEdSteps.Disable();
+ aFtEps .Disable(); aEdEps .Disable();
+ }
}
return 0;
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 1cc66ca13af6..bbf20c436065 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -927,10 +927,6 @@ Resource RID_GLOBSTR
/* END error constants and error strings. */
- String STR_ODER_SO
- {
- Text [ en-US ] = "%s or similar" ;
- };
String STR_GRIDCOLOR
{
Text [ en-US ] = "Grid color" ;
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index 8c9279a602c1..06a19af7a8a7 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -154,11 +154,6 @@ ModalDialog RID_SCDLG_INSCELL
};
};
-Bitmap RID_SCTEAMDLGBMP1
-{
- File = "calcteam.bmp";
-};
-
ModalDialog RID_SCDLG_DELCONT
{
OutputSize = TRUE ;
@@ -1331,18 +1326,6 @@ ModalDialog RID_SCDLG_NAMES_PASTE
Text [ en-US ] = "Insert Name" ;
};
-FloatingWindow RID_SCDLG_TEAM
-{
- Hide = TRUE ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Zoomable = TRUE ;
- FixedBitmap 1 { Pos = MAP_APPFONT ( 1 , 1 ) ; };
- Text [ en-US ] = "The %PRODUCTNAME Calc Team" ;
-};
-
ModalDialog RID_SCDLG_CHARTCOLROW
{
OutputSize = TRUE ;
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index 856463e27e40..ea7cabf7716d 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -119,22 +119,6 @@ TabPage RID_SCPAGE_CALC
Pos = MAP_APPFONT ( 6 , 64 ) ;
Size = MAP_APPFONT ( 248 , 8 ) ;
};
- FixedText FT_PREC
- {
- Pos = MAP_APPFONT ( 150 , 77 ) ;
- Size = MAP_APPFONT ( 72 , 8 ) ;
- Text [ en-US ] = "~Decimal places" ;
- Right = TRUE ;
- };
- NumericField ED_PREC
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 226 , 75 ) ;
- Size = MAP_APPFONT ( 25 , 12 ) ;
- Maximum = 20 ;
- Spin = TRUE ;
- Repeat = TRUE ;
- };
CheckBox BTN_CASE
{
Pos = MAP_APPFONT ( 12 , 77 ) ;
@@ -165,6 +149,28 @@ TabPage RID_SCPAGE_CALC
Size = MAP_APPFONT ( 239 , 10 ) ;
Text [ en-US ] = "~Automatically find column and row labels " ;
};
+ CheckBox BTN_GENERAL_PREC
+ {
+ Pos = MAP_APPFONT ( 12 , 147 ) ;
+ Size = MAP_APPFONT ( 136 , 10 ) ;
+ Text [ en-US ] = "Limit decimals for general number format" ;
+ };
+ FixedText FT_PREC
+ {
+ Pos = MAP_APPFONT ( 150 , 148 ) ;
+ Size = MAP_APPFONT ( 72 , 8 ) ;
+ Text [ en-US ] = "~Decimal places" ;
+ Right = TRUE ;
+ };
+ NumericField ED_PREC
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 226 , 146 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ Maximum = 20 ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
};
/**************************************************************************/
diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx
index 141a7d0abb73..f3f76685e5cb 100644
--- a/sc/source/ui/unoobj/defltuno.cxx
+++ b/sc/source/ui/unoobj/defltuno.cxx
@@ -46,6 +46,8 @@
#include "unonames.hxx"
#include "docoptio.hxx"
+#include <limits>
+
using namespace ::com::sun::star;
//------------------------------------------------------------------------
@@ -157,7 +159,7 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
sal_Int16 nValue = 0;
if (aValue >>= nValue)
{
- aDocOpt.SetStdPrecision(static_cast<sal_uInt8> (nValue));
+ aDocOpt.SetStdPrecision(static_cast<sal_uInt16> (nValue));
pDoc->SetDocOptions(aDocOpt);
}
}
@@ -250,7 +252,12 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyValue( const rtl::OUString& aProp
if (pDoc)
{
const ScDocOptions& aDocOpt = pDoc->GetDocOptions();
- aRet <<= static_cast<sal_Int16> (aDocOpt.GetStdPrecision());
+ sal_uInt16 nPrec = aDocOpt.GetStdPrecision();
+ // the max value of unsigned 16-bit integer is used as the flag
+ // value for unlimited precision, c.f.
+ // SvNumberFormatter::UNLIMITED_PRECISION.
+ if (nPrec <= ::std::numeric_limits<sal_Int16>::max())
+ aRet <<= static_cast<sal_Int16> (nPrec);
}
else
throw uno::RuntimeException();
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index e67103cf75e5..d9fb4d53e634 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1040,18 +1040,21 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
Size aTwips = aFunc.GetPageSize();
awt::Size aPageSize( TwipsToHMM( aTwips.Width() ), TwipsToHMM( aTwips.Height() ) );
- long nPropCount = bWasCellRange ? 2 : 1;
+ long nPropCount = bWasCellRange ? 3 : 2;
uno::Sequence<beans::PropertyValue> aSequence(nPropCount);
beans::PropertyValue* pArray = aSequence.getArray();
pArray[0].Name = rtl::OUString::createFromAscii( SC_UNONAME_PAGESIZE );
pArray[0].Value <<= aPageSize;
+ // #i111158# all positions are relative to the whole page, including non-printable area
+ pArray[1].Name = rtl::OUString::createFromAscii( SC_UNONAME_INC_NP_AREA );
+ pArray[1].Value = uno::makeAny( sal_True );
if ( bWasCellRange )
{
table::CellRangeAddress aRangeAddress( nTab,
aCellRange.aStart.Col(), aCellRange.aStart.Row(),
aCellRange.aEnd.Col(), aCellRange.aEnd.Row() );
- pArray[1].Name = rtl::OUString::createFromAscii( SC_UNONAME_SOURCERANGE );
- pArray[1].Value <<= aRangeAddress;
+ pArray[2].Name = rtl::OUString::createFromAscii( SC_UNONAME_SOURCERANGE );
+ pArray[2].Value <<= aRangeAddress;
}
#if 0
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index 8591f2fc0801..efe804784a40 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -185,7 +185,9 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
}
else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() )
{
- if (!bExport)
+ if (bExport)
+ nRet = ui::dialogs::ExecutableDialogResults::OK; // export HTML without dialog
+ else
{
// HTML import.
::std::auto_ptr<AbstractScTextImportOptionsDlg> pDlg(
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 474d07764127..75686df460d6 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -340,7 +340,7 @@ uno::Reference<table::XCellRange> SAL_CALL ScNamedRangeObj::getReferredCells()
ScUnoGuard aGuard;
ScRange aRange;
ScRangeData* pData = GetRangeData_Impl();
- if ( pData && pData->IsReference( aRange ) )
+ if ( pData && pData->IsValidReference( aRange ) )
{
//! static Funktion um ScCellObj/ScCellRangeObj zu erzeugen am ScCellRangeObj ???
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index cded62efa3a8..80cb88595b11 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -256,6 +256,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
sal_Int32 nIndexOfReadOnlyFlag = -1;
sal_Int32 nIndexOfTemplateFlag = -1;
sal_Int32 nIndexOfDocumentTitle = -1;
+ bool bFakeXLS = false;
for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
{
@@ -436,8 +437,11 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
}
else
{
+ bool bIsXLS = false;
SvStream* pStream = aMedium.GetInStream();
const SfxFilter* pPreselectedFilter = pFilter;
+ if ( pPreselectedFilter && pPreselectedFilter->GetName().SearchAscii("Excel") != STRING_NOTFOUND )
+ bIsXLS = true;
pFilter = 0;
if ( pStream )
{
@@ -718,7 +722,8 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
// further checks for filters only if they are preselected: ASCII, HTML, RTF, DBase
// without the preselection other filters (Writer) take precedence
// DBase can't be detected reliably, so it also needs preselection
- if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && lcl_MayBeAscii( rStr ) )
+ bool bMaybeText = lcl_MayBeAscii( rStr );
+ if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && bMaybeText )
{
// Text filter is accepted if preselected
pFilter = pPreselectedFilter;
@@ -747,8 +752,15 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
else
{
pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterHtmlWeb) );
+ if ( bIsXLS )
+ bFakeXLS = true;
}
}
+ else if ( bIsXLS && bMaybeText )
+ {
+ pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterAscii) );
+ bFakeXLS = true;
+ }
else if ( aHeader.CompareTo( "{\\rtf", 5 ) == COMPARE_EQUAL )
{
// test for RTF
@@ -834,6 +846,19 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
lDescriptor[nIndexOfDocumentTitle].Value <<= aDocumentTitle;
}
+ if ( bFakeXLS )
+ {
+ if ( nIndexOfFilterName == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("FilterName");
+ lDescriptor[nPropertyCount].Value <<= rtl::OUString(pFilter->GetName());
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfFilterName].Value <<= rtl::OUString(pFilter->GetName());
+ }
+
if ( pFilter )
aTypeName = pFilter->GetTypeName();
else
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 406fdab9c824..35befa8f7a36 100755
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1739,6 +1739,18 @@ void lcl_MoveToEnd( ScDPSaveDimension& rDim, const String& rItemName )
// puts it to the end of the list even if it was in the list before.
}
+struct ScOUStringCollate
+{
+ CollatorWrapper* mpCollator;
+
+ ScOUStringCollate(CollatorWrapper* pColl) : mpCollator(pColl) {}
+
+ bool operator()(const rtl::OUString& rStr1, const rtl::OUString& rStr2) const
+ {
+ return ( mpCollator->compareString(rStr1, rStr2) < 0 );
+ }
+};
+
bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16* pUserListId )
{
ScDocument* pDoc = GetViewData()->GetDocument();
@@ -1747,7 +1759,8 @@ bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16
return false;
// We need to run this to get all members later.
- pDPObj->BuildAllDimensionMembers();
+ if ( pUserListId )
+ pDPObj->BuildAllDimensionMembers();
USHORT nOrientation;
long nDimIndex = pDPObj->GetHeaderDim(rPos, nOrientation);
@@ -1766,97 +1779,111 @@ bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16
if (!pSaveDim)
return false;
- typedef ScDPSaveDimension::MemberList MemList;
- const MemList& rDimMembers = pSaveDim->GetMembers();
- list<OUString> aMembers;
- hash_set<OUString, ::rtl::OUStringHash> aMemberSet;
- size_t nMemberCount = 0;
- for (MemList::const_iterator itr = rDimMembers.begin(), itrEnd = rDimMembers.end();
- itr != itrEnd; ++itr)
+ // manual evaluation of sort order is only needed if a user list id is given
+ if ( pUserListId )
{
- ScDPSaveMember* pMem = *itr;
- aMembers.push_back(pMem->GetName());
- aMemberSet.insert(pMem->GetName());
- ++nMemberCount;
- }
-
- // Sort the member list in ascending order.
- aMembers.sort();
+ typedef ScDPSaveDimension::MemberList MemList;
+ const MemList& rDimMembers = pSaveDim->GetMembers();
+ list<OUString> aMembers;
+ hash_set<OUString, ::rtl::OUStringHash> aMemberSet;
+ size_t nMemberCount = 0;
+ for (MemList::const_iterator itr = rDimMembers.begin(), itrEnd = rDimMembers.end();
+ itr != itrEnd; ++itr)
+ {
+ ScDPSaveMember* pMem = *itr;
+ aMembers.push_back(pMem->GetName());
+ aMemberSet.insert(pMem->GetName());
+ ++nMemberCount;
+ }
- // Collect and rank those custom sort strings that also exist in the member name list.
+ // Sort the member list in ascending order.
+ ScOUStringCollate aCollate( ScGlobal::GetCollator() );
+ aMembers.sort(aCollate);
- typedef hash_map<OUString, sal_uInt16, OUStringHash> UserSortMap;
- UserSortMap aSubStrs;
- sal_uInt16 nSubCount = 0;
- if (pUserListId)
- {
- ScUserList* pUserList = ScGlobal::GetUserList();
- if (!pUserList)
- return false;
+ // Collect and rank those custom sort strings that also exist in the member name list.
+ typedef hash_map<OUString, sal_uInt16, OUStringHash> UserSortMap;
+ UserSortMap aSubStrs;
+ sal_uInt16 nSubCount = 0;
+ if (pUserListId)
{
- sal_uInt16 n = pUserList->GetCount();
- if (!n || *pUserListId >= n)
+ ScUserList* pUserList = ScGlobal::GetUserList();
+ if (!pUserList)
return false;
- }
- ScUserListData* pData = static_cast<ScUserListData*>((*pUserList)[*pUserListId]);
- if (pData)
- {
- sal_uInt16 n = pData->GetSubCount();
- for (sal_uInt16 i = 0; i < n; ++i)
{
- OUString aSub = pData->GetSubStr(i);
- if (!aMemberSet.count(aSub))
- // This string doesn't exist in the member name set. Don't add this.
- continue;
+ sal_uInt16 n = pUserList->GetCount();
+ if (!n || *pUserListId >= n)
+ return false;
+ }
+
+ ScUserListData* pData = static_cast<ScUserListData*>((*pUserList)[*pUserListId]);
+ if (pData)
+ {
+ sal_uInt16 n = pData->GetSubCount();
+ for (sal_uInt16 i = 0; i < n; ++i)
+ {
+ OUString aSub = pData->GetSubStr(i);
+ if (!aMemberSet.count(aSub))
+ // This string doesn't exist in the member name set. Don't add this.
+ continue;
- aSubStrs.insert(UserSortMap::value_type(aSub, nSubCount++));
+ aSubStrs.insert(UserSortMap::value_type(aSub, nSubCount++));
+ }
}
}
- }
- // Rank all members.
+ // Rank all members.
- vector<OUString> aRankedNames(nMemberCount);
- sal_uInt16 nCurStrId = 0;
- for (list<OUString>::const_iterator itr = aMembers.begin(), itrEnd = aMembers.end();
- itr != itrEnd; ++itr)
- {
- OUString aName = *itr;
- sal_uInt16 nRank = 0;
- UserSortMap::const_iterator itrSub = aSubStrs.find(aName);
- if (itrSub == aSubStrs.end())
- nRank = nSubCount + nCurStrId++;
- else
- nRank = itrSub->second;
+ vector<OUString> aRankedNames(nMemberCount);
+ sal_uInt16 nCurStrId = 0;
+ for (list<OUString>::const_iterator itr = aMembers.begin(), itrEnd = aMembers.end();
+ itr != itrEnd; ++itr)
+ {
+ OUString aName = *itr;
+ sal_uInt16 nRank = 0;
+ UserSortMap::const_iterator itrSub = aSubStrs.find(aName);
+ if (itrSub == aSubStrs.end())
+ nRank = nSubCount + nCurStrId++;
+ else
+ nRank = itrSub->second;
- if (!bAscending)
- nRank = static_cast< sal_uInt16 >( nMemberCount - nRank - 1 );
+ if (!bAscending)
+ nRank = static_cast< sal_uInt16 >( nMemberCount - nRank - 1 );
- aRankedNames[nRank] = aName;
- }
+ aRankedNames[nRank] = aName;
+ }
- // Re-order ScDPSaveMember instances with the new ranks.
+ // Re-order ScDPSaveMember instances with the new ranks.
- for (vector<OUString>::const_iterator itr = aRankedNames.begin(), itrEnd = aRankedNames.end();
- itr != itrEnd; ++itr)
- {
- const ScDPSaveMember* pOldMem = pSaveDim->GetExistingMemberByName(*itr);
- if (!pOldMem)
- // All members are supposed to be present.
- continue;
+ for (vector<OUString>::const_iterator itr = aRankedNames.begin(), itrEnd = aRankedNames.end();
+ itr != itrEnd; ++itr)
+ {
+ const ScDPSaveMember* pOldMem = pSaveDim->GetExistingMemberByName(*itr);
+ if (!pOldMem)
+ // All members are supposed to be present.
+ continue;
- ScDPSaveMember* pNewMem = new ScDPSaveMember(*pOldMem);
- pSaveDim->AddMember(pNewMem);
- }
+ ScDPSaveMember* pNewMem = new ScDPSaveMember(*pOldMem);
+ pSaveDim->AddMember(pNewMem);
+ }
- // Set the sorting mode to manual for now. We may introduce a new sorting
- // mode later on.
+ // Set the sorting mode to manual for now. We may introduce a new sorting
+ // mode later on.
- sheet::DataPilotFieldSortInfo aSortInfo;
- aSortInfo.Mode = sheet::DataPilotFieldSortMode::MANUAL;
- pSaveDim->SetSortInfo(&aSortInfo);
+ sheet::DataPilotFieldSortInfo aSortInfo;
+ aSortInfo.Mode = sheet::DataPilotFieldSortMode::MANUAL;
+ pSaveDim->SetSortInfo(&aSortInfo);
+ }
+ else
+ {
+ // without user list id, just apply sorting mode
+
+ sheet::DataPilotFieldSortInfo aSortInfo;
+ aSortInfo.Mode = sheet::DataPilotFieldSortMode::NAME;
+ aSortInfo.IsAscending = bAscending;
+ pSaveDim->SetSortInfo(&aSortInfo);
+ }
// Update the datapilot with the newly sorted field members.
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 311bcf8c24b2..cc09722530ad 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -397,13 +397,13 @@ void ScDrawView::MarkListHasChanged()
ScTabViewShell* pViewSh = pViewData->GetViewShell();
- if (!bInConstruct) // nicht wenn die View gerade angelegt wird
+ // #i110829# remove the cell selection only if drawing objects are selected
+ if ( !bInConstruct && GetMarkedObjectList().GetMarkCount() )
{
- pViewSh->Unmark(); // Selektion auff'm Doc entfernen
+ pViewSh->Unmark(); // remove cell selection
// #65379# end cell edit mode if drawing objects are selected
- if ( GetMarkedObjectList().GetMarkCount() )
- SC_MOD()->InputEnterHandler();
+ SC_MOD()->InputEnterHandler();
}
// IP deaktivieren
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 53851f0e3cf0..5a48d0d310d5 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -53,6 +53,7 @@
#include <editeng/udlnitem.hxx>
#include <editeng/unolingu.hxx>
#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
#include <vcl/svapp.hxx>
#include <vcl/metric.hxx>
#include <vcl/outdev.hxx>
@@ -74,6 +75,8 @@
#include "scmod.hxx"
#include "fillinfo.hxx"
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <math.h>
//! Autofilter-Breite mit column.cxx zusammenfassen
@@ -108,6 +111,9 @@ class ScDrawStringsVars
String aString; // Inhalte
Size aTextSize;
long nOriginalWidth;
+ long nMaxDigitWidth;
+ long nSignWidth;
+ long nDotWidth;
ScBaseCell* pLastCell;
ULONG nValueFormat;
@@ -132,7 +138,7 @@ public:
void SetPatternSimple( const ScPatternAttr* pNew, const SfxItemSet* pSet );
BOOL SetText( ScBaseCell* pCell ); // TRUE -> pOldPattern vergessen
- void SetHashText();
+ void SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth );
void SetAutoText( const String& rAutoText );
const ScPatternAttr* GetPattern() const { return pPattern; }
@@ -161,6 +167,14 @@ public:
pCondSet->GetItemState( ATTR_FONT_HEIGHT, TRUE ); }
BOOL HasEditCharacters() const;
+
+private:
+ void SetHashText();
+ long GetMaxDigitWidth();
+ long GetSignWidth();
+ long GetDotWidth();
+ void TextChanged();
+ long ConvertWidthLogicToPixel( long nWidth ) const;
};
//==================================================================
@@ -176,6 +190,9 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, BOOL bPTL) :
nIndent ( 0 ),
bRotated ( FALSE ),
nOriginalWidth( 0 ),
+ nMaxDigitWidth( 0 ),
+ nSignWidth( 0 ),
+ nDotWidth( 0 ),
pLastCell ( NULL ),
nValueFormat( 0 ),
bLineBreak ( FALSE ),
@@ -242,6 +259,10 @@ void ScDrawStringsVars::SetShrinkScale( long nScale, BYTE nScript )
void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet* pSet,
ScBaseCell* pCell, BYTE nScript )
{
+ nMaxDigitWidth = 0;
+ nSignWidth = 0;
+ nDotWidth = 0;
+
pPattern = pNew;
pCondSet = pSet;
@@ -393,6 +414,9 @@ void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet*
void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxItemSet* pSet )
{
+ nMaxDigitWidth = 0;
+ nSignWidth = 0;
+ nDotWidth = 0;
// wird gerufen, wenn sich die Font-Variablen nicht aendern (!StringDiffer)
pPattern = pNew;
@@ -467,28 +491,7 @@ BOOL ScDrawStringsVars::SetText( ScBaseCell* pCell )
pLastCell = NULL; // naechstes Mal wieder hierherkommen
}
- OutputDevice* pRefDevice = pOutput->pRefDevice;
- OutputDevice* pFmtDevice = pOutput->pFmtDevice;
- aTextSize.Width() = pFmtDevice->GetTextWidth( aString );
- aTextSize.Height() = pFmtDevice->GetTextHeight();
-
- if ( !pRefDevice->GetConnectMetaFile() || pRefDevice->GetOutDevType() == OUTDEV_PRINTER )
- {
- double fMul = pOutput->GetStretch();
- aTextSize.Width() = (long)(aTextSize.Width() / fMul + 0.5);
- }
-
- aTextSize.Height() = aMetric.GetAscent() + aMetric.GetDescent();
- if ( GetOrient() != SVX_ORIENTATION_STANDARD )
- {
- long nTemp = aTextSize.Height();
- aTextSize.Height() = aTextSize.Width();
- aTextSize.Width() = nTemp;
- }
-
- nOriginalWidth = aTextSize.Width();
- if ( bPixelToLogic )
- aTextSize = pRefDevice->LogicToPixel( aTextSize );
+ TextChanged();
}
// sonst String/Groesse behalten
}
@@ -508,6 +511,82 @@ void ScDrawStringsVars::SetHashText()
SetAutoText( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("###")) );
}
+void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
+{
+ if (!pCell)
+ return;
+
+ CellType eType = pCell->GetCellType();
+ if (eType != CELLTYPE_VALUE && eType != CELLTYPE_FORMULA)
+ // must be a value or formula cell.
+ return;
+
+ if (eType == CELLTYPE_FORMULA && !static_cast<ScFormulaCell*>(pCell)->IsValue())
+ // If it's formula, the result must be a value.
+ return;
+
+ ULONG nFormat = GetValueFormat();
+ if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0)
+ {
+ // Not 'General' number format. Set hash text and bail out.
+ SetHashText();
+ return;
+ }
+
+ double fVal = (eType == CELLTYPE_VALUE) ?
+ static_cast<ScValueCell*>(pCell)->GetValue() : static_cast<ScFormulaCell*>(pCell)->GetValue();
+
+ const SvNumberformat* pNumFormat = pOutput->pDoc->GetFormatTable()->GetEntry(nFormat);
+ if (!pNumFormat)
+ return;
+
+ long nMaxDigit = GetMaxDigitWidth();
+ sal_uInt16 nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit);
+
+ if (!pNumFormat->GetOutputString(fVal, nNumDigits, aString))
+ // Failed to get output string. Bail out.
+ return;
+
+ sal_uInt8 nSignCount = 0, nDecimalCount = 0;
+ xub_StrLen nLen = aString.Len();
+ sal_Unicode cDecSep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator.getStr()[0];
+ for (xub_StrLen i = 0; i < nLen; ++i)
+ {
+ sal_Unicode c = aString.GetChar(i);
+ if (c == sal_Unicode('-'))
+ ++nSignCount;
+ else if (c == cDecSep)
+ ++nDecimalCount;
+ }
+ if (nDecimalCount)
+ nWidth += (nMaxDigit - GetDotWidth()) * nDecimalCount;
+ if (nSignCount)
+ nWidth += (nMaxDigit - GetSignWidth()) * nSignCount;
+
+ if (nDecimalCount || nSignCount)
+ {
+ // Re-calculate.
+ nNumDigits = static_cast<sal_uInt16>(nWidth / nMaxDigit);
+ if (!pNumFormat->GetOutputString(fVal, nNumDigits, aString))
+ // Failed to get output string. Bail out.
+ return;
+ }
+
+ long nActualTextWidth = pOutput->pFmtDevice->GetTextWidth(aString);
+
+ if (bPixelToLogic)
+ nActualTextWidth = ConvertWidthLogicToPixel(nActualTextWidth);
+
+ if (nActualTextWidth > nWidth)
+ {
+ // Even after the decimal adjustment the text doesn't fit. Give up.
+ SetHashText();
+ return;
+ }
+
+ TextChanged();
+}
+
void ScDrawStringsVars::SetAutoText( const String& rAutoText )
{
aString = rAutoText;
@@ -538,6 +617,80 @@ void ScDrawStringsVars::SetAutoText( const String& rAutoText )
pLastCell = NULL; // derselbe Text kann in der naechsten Zelle wieder passen
}
+long ScDrawStringsVars::GetMaxDigitWidth()
+{
+ if (nMaxDigitWidth > 0)
+ return nMaxDigitWidth;
+
+ sal_Char cZero = '0';
+ for (int i = 0; i < 10; ++i)
+ {
+ sal_Char cDigit = cZero + i;
+ long n = pOutput->pFmtDevice->GetTextWidth(String(cDigit));
+ nMaxDigitWidth = ::std::max(nMaxDigitWidth, n);
+ }
+
+ if (bPixelToLogic)
+ nMaxDigitWidth = ConvertWidthLogicToPixel(nMaxDigitWidth);
+ return nMaxDigitWidth;
+}
+
+long ScDrawStringsVars::GetSignWidth()
+{
+ if (nSignWidth > 0)
+ return nSignWidth;
+
+ nSignWidth = pOutput->pFmtDevice->GetTextWidth(String('-'));
+ if (bPixelToLogic)
+ nSignWidth = ConvertWidthLogicToPixel(nSignWidth);
+ return nSignWidth;
+}
+
+long ScDrawStringsVars::GetDotWidth()
+{
+ if (nDotWidth > 0)
+ return nDotWidth;
+
+ const ::rtl::OUString& sep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator;
+ nDotWidth = pOutput->pFmtDevice->GetTextWidth(sep);
+ if (bPixelToLogic)
+ nDotWidth = ConvertWidthLogicToPixel(nDotWidth);
+ return nDotWidth;
+}
+
+void ScDrawStringsVars::TextChanged()
+{
+ OutputDevice* pRefDevice = pOutput->pRefDevice;
+ OutputDevice* pFmtDevice = pOutput->pFmtDevice;
+ aTextSize.Width() = pFmtDevice->GetTextWidth( aString );
+ aTextSize.Height() = pFmtDevice->GetTextHeight();
+
+ if ( !pRefDevice->GetConnectMetaFile() || pRefDevice->GetOutDevType() == OUTDEV_PRINTER )
+ {
+ double fMul = pOutput->GetStretch();
+ aTextSize.Width() = (long)(aTextSize.Width() / fMul + 0.5);
+ }
+
+ aTextSize.Height() = aMetric.GetAscent() + aMetric.GetDescent();
+ if ( GetOrient() != SVX_ORIENTATION_STANDARD )
+ {
+ long nTemp = aTextSize.Height();
+ aTextSize.Height() = aTextSize.Width();
+ aTextSize.Width() = nTemp;
+ }
+
+ nOriginalWidth = aTextSize.Width();
+ if ( bPixelToLogic )
+ aTextSize = pRefDevice->LogicToPixel( aTextSize );
+}
+
+long ScDrawStringsVars::ConvertWidthLogicToPixel( long nWidth ) const
+{
+ Size aSize(nWidth, pOutput->pFmtDevice->GetTextHeight());
+ aSize = pOutput->pRefDevice->LogicToPixel(aSize);
+ return aSize.Width();
+}
+
BOOL ScDrawStringsVars::HasEditCharacters() const
{
static const sal_Unicode pChars[] =
@@ -919,18 +1072,14 @@ BOOL ScOutputData::IsAvailable( SCCOL nX, SCROW nY )
// bCellIsValue: if set, don't extend into empty cells
// bBreak: if set, don't extend, and don't set clip marks (but rLeftClip/rRightClip is set)
// bOverwrite: if set, also extend into non-empty cells (for rotated text)
-// rAlignRect: output: single or merged cell, used for alignment (visual rectangle)
-// rClipRect: output: total output area, for clipping (visual)
-// rLeftClip: output: need to clip at rClipRect left (visual) edge
-// rRightClip: output: same for right
+// rParam output: various area parameters.
void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY,
- SCCOL nCellX, SCROW nCellY, long nNeeded,
- const ScPatternAttr& rPattern,
- USHORT nHorJustify, BOOL bCellIsValue,
- BOOL bBreak, BOOL bOverwrite,
- Rectangle& rAlignRect, Rectangle& rClipRect,
- BOOL& rLeftClip, BOOL& rRightClip )
+ SCCOL nCellX, SCROW nCellY, long nNeeded,
+ const ScPatternAttr& rPattern,
+ USHORT nHorJustify, bool bCellIsValue,
+ bool bBreak, bool bOverwrite,
+ OutputAreaParam& rParam )
{
// rThisRowInfo may be for a different row than nCellY, is still used for clip marks
RowInfo& rThisRowInfo = pRowInfo[nArrY];
@@ -1009,21 +1158,23 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
--nMergeSizeX; // leave out the grid horizontally, also for alignment (align between grid lines)
+ rParam.mnColWidth = nMergeSizeX; // store the actual column width.
+
//
// construct the rectangles using logical left/right values (justify is called at the end)
//
// rAlignRect is the single cell or merged area, used for alignment.
- rAlignRect.Left() = nCellPosX;
- rAlignRect.Right() = nCellPosX + ( nMergeSizeX - 1 ) * nLayoutSign;
- rAlignRect.Top() = nCellPosY;
- rAlignRect.Bottom() = nCellPosY + nMergeSizeY - 1;
+ rParam.maAlignRect.Left() = nCellPosX;
+ rParam.maAlignRect.Right() = nCellPosX + ( nMergeSizeX - 1 ) * nLayoutSign;
+ rParam.maAlignRect.Top() = nCellPosY;
+ rParam.maAlignRect.Bottom() = nCellPosY + nMergeSizeY - 1;
// rClipRect is all cells that are used for output.
// For merged cells this is the same as rAlignRect, otherwise neighboring cells can also be used.
- rClipRect = rAlignRect;
+ rParam.maClipRect = rParam.maAlignRect;
if ( nNeeded > nMergeSizeX )
{
SvxCellHorJustify eHorJust = (SvxCellHorJustify)nHorJustify;
@@ -1064,7 +1215,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
++nRightX;
long nAdd = (long) ( pDoc->GetColWidth( nRightX, nTab ) * nPPTX );
nRightMissing -= nAdd;
- rClipRect.Right() += nAdd * nLayoutSign;
+ rParam.maClipRect.Right() += nAdd * nLayoutSign;
if ( rThisRowInfo.nRowNo == nCellY && nRightX >= nX1 && nRightX <= nX2 )
rThisRowInfo.pCellInfo[nRightX].bHideGrid = TRUE;
@@ -1078,7 +1229,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
--nLeftX;
long nAdd = (long) ( pDoc->GetColWidth( nLeftX, nTab ) * nPPTX );
nLeftMissing -= nAdd;
- rClipRect.Left() -= nAdd * nLayoutSign;
+ rParam.maClipRect.Left() -= nAdd * nLayoutSign;
}
}
@@ -1089,22 +1240,22 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
rThisRowInfo.pCellInfo[nRightX+1].nClipMark |= SC_CLIPMARK_RIGHT;
bAnyClipped = TRUE;
long nMarkPixel = (long)( SC_CLIPMARK_SIZE * nPPTX );
- rClipRect.Right() -= nMarkPixel * nLayoutSign;
+ rParam.maClipRect.Right() -= nMarkPixel * nLayoutSign;
}
if ( nLeftMissing > 0 && bMarkClipped && nLeftX >= nX1 && nLeftX <= nX2 && !bBreak && !bCellIsValue )
{
rThisRowInfo.pCellInfo[nLeftX+1].nClipMark |= SC_CLIPMARK_LEFT;
bAnyClipped = TRUE;
long nMarkPixel = (long)( SC_CLIPMARK_SIZE * nPPTX );
- rClipRect.Left() += nMarkPixel * nLayoutSign;
+ rParam.maClipRect.Left() += nMarkPixel * nLayoutSign;
}
- rLeftClip = ( nLeftMissing > 0 );
- rRightClip = ( nRightMissing > 0 );
+ rParam.mbLeftClip = ( nLeftMissing > 0 );
+ rParam.mbRightClip = ( nRightMissing > 0 );
}
else
{
- rLeftClip = rRightClip = FALSE;
+ rParam.mbLeftClip = rParam.mbRightClip = FALSE;
// leave space for AutoFilter on screen
// (for automatic line break: only if not formatting for printer, as in ScColumn::GetNeededSize)
@@ -1120,30 +1271,30 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
// content fits even in the remaining area without the filter button
// -> align within that remaining area
- rAlignRect.Right() -= nFilter * nLayoutSign;
- rClipRect.Right() -= nFilter * nLayoutSign;
+ rParam.maAlignRect.Right() -= nFilter * nLayoutSign;
+ rParam.maClipRect.Right() -= nFilter * nLayoutSign;
// if a number doesn't fit, don't hide part of the number behind the button
// -> set clip flags, so "###" replacement is used (but also within the smaller area)
if ( !bFit )
- rLeftClip = rRightClip = TRUE;
+ rParam.mbLeftClip = rParam.mbRightClip = TRUE;
}
}
}
// justify both rectangles for alignment calculation, use with DrawText etc.
- rAlignRect.Justify();
- rClipRect.Justify();
+ rParam.maAlignRect.Justify();
+ rParam.maClipRect.Justify();
#if 0
//! Test !!!
pDev->Push();
pDev->SetLineColor();
pDev->SetFillColor( COL_LIGHTGREEN );
- pDev->DrawRect( pDev->PixelToLogic(rClipRect) );
- pDev->DrawRect( rClipRect ); // print preview
+ pDev->DrawRect( pDev->PixelToLogic(rParam.maClipRect) );
+ pDev->DrawRect( rParam.maClipRect ); // print preview
pDev->Pop();
//! Test !!!
#endif
@@ -1164,10 +1315,6 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
ScDrawStringsVars aVars( this, bPixelToLogic );
- const ScPatternAttr* pOldPattern = NULL;
- const SfxItemSet* pOldCondSet = NULL;
- BYTE nOldScript = 0;
-
BOOL bProgress = FALSE;
long nInitPosX = nScrX;
@@ -1184,15 +1331,19 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
--nLoopStartX; // start before nX1 for rest of long text to the left
// variables for GetOutputArea
+ OutputAreaParam aAreaParam;
BOOL bCellIsValue = FALSE;
- BOOL bLeftClip = FALSE;
- BOOL bRightClip = FALSE;
long nNeededWidth = 0;
- Rectangle aAlignRect;
- Rectangle aClipRect;
SvxCellHorJustify eOutHorJust = SVX_HOR_JUSTIFY_STANDARD;
const ScPatternAttr* pPattern = NULL;
const SfxItemSet* pCondSet = NULL;
+ const ScPatternAttr* pOldPattern = NULL;
+ const SfxItemSet* pOldCondSet = NULL;
+ BYTE nOldScript = 0;
+
+ // alternative pattern instances in case we need to modify the pattern
+ // before processing the cell value.
+ ::boost::ptr_vector<ScPatternAttr> aAltPatterns;
long nPosY = nScrY;
for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
@@ -1330,6 +1481,18 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
pCondSet = pDoc->GetCondResult( nCellX, nCellY, nTab );
}
+ if (pCell->HasValueData() &&
+ static_cast<const SfxBoolItem&>(
+ pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue())
+ {
+ // Disable line break when the cell content is numeric.
+ aAltPatterns.push_back(new ScPatternAttr(*pPattern));
+ ScPatternAttr* pAltPattern = &aAltPatterns.back();
+ SfxBoolItem aLineBreak(ATTR_LINEBREAK, false);
+ pAltPattern->GetItemSet().Put(aLineBreak);
+ pPattern = pAltPattern;
+ }
+
BYTE nScript = GetScriptType( pDoc, pCell, pPattern, pCondSet );
if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
if ( pPattern != pOldPattern || pCondSet != pOldCondSet ||
@@ -1360,6 +1523,7 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
bNeedEdit = aVars.HasEditCharacters() ||
(bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult());
}
+ long nTotalMargin = 0;
if (bDoCell && !bNeedEdit)
{
CellType eCellType = pCell->GetCellType();
@@ -1381,14 +1545,17 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
BOOL bRepeat = aVars.IsRepeat() && !bBreak;
BOOL bShrink = aVars.IsShrink() && !bBreak && !bRepeat;
- long nTotalMargin = (long) ( aVars.GetLeftTotal() * nPPTX ) +
- (long) ( aVars.GetMargin()->GetRightMargin() * nPPTX );
+ nTotalMargin =
+ static_cast<long>(aVars.GetLeftTotal() * nPPTX) +
+ static_cast<long>(aVars.GetMargin()->GetRightMargin() * nPPTX);
+
nNeededWidth = aVars.GetTextSize().Width() + nTotalMargin;
+
// GetOutputArea gives justfied rectangles
GetOutputArea( nX, nArrY, nPosX, nPosY, nCellX, nCellY, nNeededWidth,
- *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
- bCellIsValue || bRepeat || bShrink, bBreak, FALSE,
- aAlignRect, aClipRect, bLeftClip, bRightClip );
+ *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
+ bCellIsValue || bRepeat || bShrink, bBreak, FALSE,
+ aAreaParam );
if ( bShrink )
{
@@ -1398,9 +1565,9 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
// DrawEdit is used to vertically scale 90 deg rotated text.
bNeedEdit = TRUE;
}
- else if ( bLeftClip || bRightClip ) // horizontal
+ else if ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip ) // horizontal
{
- long nAvailable = aAlignRect.GetWidth() - nTotalMargin;
+ long nAvailable = aAreaParam.maAlignRect.GetWidth() - nTotalMargin;
long nScaleSize = aVars.GetTextSize().Width(); // without margin
if ( nScaleSize > 0 ) // 0 if the text is empty (formulas, number formats)
@@ -1424,16 +1591,16 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
// If even at half the size the font still isn't rendered smaller,
// fall back to normal clipping (showing ### for numbers).
if ( nNewSize <= nAvailable )
- bLeftClip = bRightClip = FALSE;
+ aAreaParam.mbLeftClip = aAreaParam.mbRightClip = FALSE;
pOldPattern = NULL;
}
}
}
- if ( bRepeat && !bLeftClip && !bRightClip )
+ if ( bRepeat && !aAreaParam.mbLeftClip && !aAreaParam.mbRightClip )
{
- long nAvailable = aAlignRect.GetWidth() - nTotalMargin;
+ long nAvailable = aAreaParam.maAlignRect.GetWidth() - nTotalMargin;
long nRepeatSize = aVars.GetTextSize().Width(); // without margin
// When formatting for the printer, the text sizes don't always add up.
// Round down (too few repetitions) rather than exceeding the cell size then:
@@ -1457,13 +1624,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
if ( bBreak )
{
if ( aVars.GetOrient() == SVX_ORIENTATION_STANDARD )
- bNeedEdit = ( bLeftClip || bRightClip );
+ bNeedEdit = ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip );
else
{
long nHeight = aVars.GetTextSize().Height() +
(long)(aVars.GetMargin()->GetTopMargin()*nPPTY) +
(long)(aVars.GetMargin()->GetBottomMargin()*nPPTY);
- bNeedEdit = ( nHeight > aClipRect.GetHeight() );
+ bNeedEdit = ( nHeight > aAreaParam.maClipRect.GetHeight() );
}
}
}
@@ -1479,48 +1646,49 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
}
if ( bDoCell )
{
- if ( bCellIsValue && ( bLeftClip || bRightClip ) )
+ if ( bCellIsValue && ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip ) )
{
- aVars.SetHashText();
+ // Adjust the decimals to fit the available column width.
+ aVars.SetTextToWidthOrHash(pCell, aAreaParam.mnColWidth - nTotalMargin);
nNeededWidth = aVars.GetTextSize().Width() +
(long) ( aVars.GetLeftTotal() * nPPTX ) +
(long) ( aVars.GetMargin()->GetRightMargin() * nPPTX );
- if ( nNeededWidth <= aClipRect.GetWidth() )
- bLeftClip = bRightClip = FALSE;
+ if ( nNeededWidth <= aAreaParam.maClipRect.GetWidth() )
+ aAreaParam.mbLeftClip = aAreaParam.mbRightClip = FALSE;
// If the "###" replacement doesn't fit into the cells, no clip marks
// are shown, as the "###" already denotes too little space.
// The rectangles from the first GetOutputArea call remain valid.
}
- long nJustPosX = aAlignRect.Left(); // "justified" - effect of alignment will be added
- long nJustPosY = aAlignRect.Top();
- long nAvailWidth = aAlignRect.GetWidth();
- long nOutHeight = aAlignRect.GetHeight();
+ long nJustPosX = aAreaParam.maAlignRect.Left(); // "justified" - effect of alignment will be added
+ long nJustPosY = aAreaParam.maAlignRect.Top();
+ long nAvailWidth = aAreaParam.maAlignRect.GetWidth();
+ long nOutHeight = aAreaParam.maAlignRect.GetHeight();
- BOOL bOutside = ( aClipRect.Right() < nScrX || aClipRect.Left() >= nScrX + nScrW );
- if ( aClipRect.Left() < nScrX )
+ BOOL bOutside = ( aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW );
+ if ( aAreaParam.maClipRect.Left() < nScrX )
{
- aClipRect.Left() = nScrX;
- bLeftClip = TRUE;
+ aAreaParam.maClipRect.Left() = nScrX;
+ aAreaParam.mbLeftClip = TRUE;
}
- if ( aClipRect.Right() > nScrX + nScrW )
+ if ( aAreaParam.maClipRect.Right() > nScrX + nScrW )
{
- aClipRect.Right() = nScrX + nScrW; //! minus one?
- bRightClip = TRUE;
+ aAreaParam.maClipRect.Right() = nScrX + nScrW; //! minus one?
+ aAreaParam.mbRightClip = TRUE;
}
- BOOL bHClip = bLeftClip || bRightClip;
+ BOOL bHClip = aAreaParam.mbLeftClip || aAreaParam.mbRightClip;
BOOL bVClip = FALSE;
- if ( aClipRect.Top() < nScrY )
+ if ( aAreaParam.maClipRect.Top() < nScrY )
{
- aClipRect.Top() = nScrY;
+ aAreaParam.maClipRect.Top() = nScrY;
bVClip = TRUE;
}
- if ( aClipRect.Bottom() > nScrY + nScrH )
+ if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrH )
{
- aClipRect.Bottom() = nScrY + nScrH; //! minus one?
+ aAreaParam.maClipRect.Bottom() = nScrY + nScrH; //! minus one?
bVClip = TRUE;
}
@@ -1603,27 +1771,27 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
if (!bHClip)
{
- aClipRect.Left() = nScrX;
- aClipRect.Right() = nScrX+nScrW;
+ aAreaParam.maClipRect.Left() = nScrX;
+ aAreaParam.maClipRect.Right() = nScrX+nScrW;
}
if (!bVClip)
{
- aClipRect.Top() = nScrY;
- aClipRect.Bottom() = nScrY+nScrH;
+ aAreaParam.maClipRect.Top() = nScrY;
+ aAreaParam.maClipRect.Bottom() = nScrY+nScrH;
}
// aClipRect is not used after SetClipRegion/IntersectClipRegion,
// so it can be modified here
if (bPixelToLogic)
- aClipRect = pRefDevice->PixelToLogic( aClipRect );
+ aAreaParam.maClipRect = pRefDevice->PixelToLogic( aAreaParam.maClipRect );
if (bMetaFile)
{
pDev->Push();
- pDev->IntersectClipRegion( aClipRect );
+ pDev->IntersectClipRegion( aAreaParam.maClipRect );
}
else
- pDev->SetClipRegion( Region( aClipRect ) );
+ pDev->SetClipRegion( Region( aAreaParam.maClipRect ) );
}
Point aURLStart( nJustPosX, nJustPosY ); // copy before modifying for orientation
@@ -1827,7 +1995,7 @@ long lcl_GetEditSize( EditEngine& rEngine, BOOL bWidth, BOOL bSwap, long nAttrRo
void ScOutputData::ShrinkEditEngine( EditEngine& rEngine, const Rectangle& rAlignRect,
long nLeftM, long nTopM, long nRightM, long nBottomM,
BOOL bWidth, USHORT nOrient, long nAttrRotate, BOOL bPixelToLogic,
- long& rEngineWidth, long& rEngineHeight, long& rNeededPixel, BOOL& rLeftClip, BOOL& rRightClip )
+ long& rEngineWidth, long& rEngineHeight, long& rNeededPixel, bool& rLeftClip, bool& rRightClip )
{
if ( !bWidth )
{
@@ -2149,10 +2317,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
nPosY = nScrY;
}
- Rectangle aAlignRect;
- Rectangle aClipRect;
- BOOL bLeftClip = FALSE;
- BOOL bRightClip = FALSE;
+ OutputAreaParam aAreaParam;
//
// Initial page size - large for normal text, cell size for automatic line breaks
@@ -2167,27 +2332,39 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
//! handle nArrY == 0
GetOutputArea( nXForPos, nArrYForPos, nPosX, nPosY, nCellX, nCellY, 0,
- *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
- bCellIsValue, TRUE, FALSE,
- aAlignRect, aClipRect, bLeftClip, bRightClip );
+ *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
+ bCellIsValue, true, false, aAreaParam );
//! special ScEditUtil handling if formatting for printer
if ( eOrient == SVX_ORIENTATION_TOPBOTTOM || eOrient == SVX_ORIENTATION_BOTTOMTOP )
- aPaperSize.Width() = aAlignRect.GetHeight() - nTopM - nBottomM;
+ aPaperSize.Width() = aAreaParam.maAlignRect.GetHeight() - nTopM - nBottomM;
else
- aPaperSize.Width() = aAlignRect.GetWidth() - nLeftM - nRightM;
+ aPaperSize.Width() = aAreaParam.maAlignRect.GetWidth() - nLeftM - nRightM;
if (bAsianVertical && bBreak)
{
// add some extra height (default margin value) for safety
// as long as GetEditArea isn't used below
long nExtraHeight = (long)( 20 * nPPTY );
- aPaperSize.Height() = aAlignRect.GetHeight() - nTopM - nBottomM + nExtraHeight;
+ aPaperSize.Height() = aAreaParam.maAlignRect.GetHeight() - nTopM - nBottomM + nExtraHeight;
}
}
if (bPixelToLogic)
- pEngine->SetPaperSize(pRefDevice->PixelToLogic(aPaperSize));
+ {
+ Size aLogicSize = pRefDevice->PixelToLogic(aPaperSize);
+ if ( bBreak && !bAsianVertical && pRefDevice != pFmtDevice )
+ {
+ // #i85342# screen display and formatting for printer,
+ // use same GetEditArea call as in ScViewData::SetEditEngine
+
+ Fraction aFract(1,1);
+ Rectangle aUtilRect = ScEditUtil( pDoc, nCellX, nCellY, nTab, Point(0,0), pFmtDevice,
+ HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( pPattern, FALSE );
+ aLogicSize.Width() = aUtilRect.GetWidth();
+ }
+ pEngine->SetPaperSize(aLogicSize);
+ }
else
pEngine->SetPaperSize(aPaperSize);
@@ -2372,26 +2549,26 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
{
// for break, the first GetOutputArea call is sufficient
GetOutputArea( nXForPos, nArrYForPos, nPosX, nPosY, nCellX, nCellY, nNeededPixel,
- *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
- bCellIsValue || bRepeat || bShrink, FALSE, FALSE,
- aAlignRect, aClipRect, bLeftClip, bRightClip );
+ *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
+ bCellIsValue || bRepeat || bShrink, false, false, aAreaParam );
if ( bShrink )
{
BOOL bWidth = ( eOrient == SVX_ORIENTATION_STANDARD && !bAsianVertical );
- ShrinkEditEngine( *pEngine, aAlignRect,
+ ShrinkEditEngine( *pEngine, aAreaParam.maAlignRect,
nLeftM, nTopM, nRightM, nBottomM, bWidth,
sal::static_int_cast<USHORT>(eOrient), 0, bPixelToLogic,
- nEngineWidth, nEngineHeight, nNeededPixel, bLeftClip, bRightClip );
+ nEngineWidth, nEngineHeight, nNeededPixel,
+ aAreaParam.mbLeftClip, aAreaParam.mbRightClip );
}
- if ( bRepeat && !bLeftClip && !bRightClip && pEngine->GetParagraphCount() == 1 )
+ if ( bRepeat && !aAreaParam.mbLeftClip && !aAreaParam.mbRightClip && pEngine->GetParagraphCount() == 1 )
{
// First check if twice the space for the formatted text is available
// (otherwise just keep it unchanged).
long nFormatted = nNeededPixel - nLeftM - nRightM; // without margin
- long nAvailable = aAlignRect.GetWidth() - nLeftM - nRightM;
+ long nAvailable = aAreaParam.maAlignRect.GetWidth() - nLeftM - nRightM;
if ( nAvailable >= 2 * nFormatted )
{
// "repeat" is handled with unformatted text (for performance reasons)
@@ -2425,7 +2602,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
}
}
- if ( bCellIsValue && ( bLeftClip || bRightClip ) )
+ if ( bCellIsValue && ( aAreaParam.mbLeftClip || aAreaParam.mbRightClip ) )
{
pEngine->SetText( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("###")) );
nEngineWidth = (long) pEngine->CalcTextWidth();
@@ -2448,11 +2625,11 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
}
}
- long nStartX = aAlignRect.Left();
- long nStartY = aAlignRect.Top();
- long nCellWidth = aAlignRect.GetWidth();
+ long nStartX = aAreaParam.maAlignRect.Left();
+ long nStartY = aAreaParam.maAlignRect.Top();
+ long nCellWidth = aAreaParam.maAlignRect.GetWidth();
long nOutWidth = nCellWidth - 1 - nLeftM - nRightM;
- long nOutHeight = aAlignRect.GetHeight() - nTopM - nBottomM;
+ long nOutHeight = aAreaParam.maAlignRect.GetHeight() - nTopM - nBottomM;
if ( bBreak || eOrient != SVX_ORIENTATION_STANDARD || bAsianVertical )
{
@@ -2472,21 +2649,21 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
nStartX += nLeftM;
}
- BOOL bOutside = ( aClipRect.Right() < nScrX || aClipRect.Left() >= nScrX + nScrW );
- if ( aClipRect.Left() < nScrX )
+ BOOL bOutside = ( aAreaParam.maClipRect.Right() < nScrX || aAreaParam.maClipRect.Left() >= nScrX + nScrW );
+ if ( aAreaParam.maClipRect.Left() < nScrX )
{
- aClipRect.Left() = nScrX;
- bLeftClip = TRUE;
+ aAreaParam.maClipRect.Left() = nScrX;
+ aAreaParam.mbLeftClip = true;
}
- if ( aClipRect.Right() > nScrX + nScrW )
+ if ( aAreaParam.maClipRect.Right() > nScrX + nScrW )
{
- aClipRect.Right() = nScrX + nScrW; //! minus one?
- bRightClip = TRUE;
+ aAreaParam.maClipRect.Right() = nScrX + nScrW; //! minus one?
+ aAreaParam.mbRightClip = true;
}
if ( !bHidden && !bOutside )
{
- BOOL bClip = bLeftClip || bRightClip;
+ bool bClip = aAreaParam.mbLeftClip || aAreaParam.mbRightClip;
BOOL bSimClip = FALSE;
if ( bWrapFields )
@@ -2495,14 +2672,14 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
bClip = TRUE;
}
- if ( aClipRect.Top() < nScrY )
+ if ( aAreaParam.maClipRect.Top() < nScrY )
{
- aClipRect.Top() = nScrY;
+ aAreaParam.maClipRect.Top() = nScrY;
bClip = TRUE;
}
- if ( aClipRect.Bottom() > nScrY + nScrH )
+ if ( aAreaParam.maClipRect.Bottom() > nScrY + nScrH )
{
- aClipRect.Bottom() = nScrY + nScrH; //! minus one?
+ aAreaParam.maClipRect.Bottom() = nScrY + nScrH; //! minus one?
bClip = TRUE;
}
@@ -2554,8 +2731,8 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
bAnyClipped = TRUE;
long nMarkPixel = (long)( SC_CLIPMARK_SIZE * nPPTX );
- if ( aClipRect.Right() - nMarkPixel > aClipRect.Left() )
- aClipRect.Right() -= nMarkPixel;
+ if ( aAreaParam.maClipRect.Right() - nMarkPixel > aAreaParam.maClipRect.Left() )
+ aAreaParam.maClipRect.Right() -= nMarkPixel;
}
}
@@ -2579,9 +2756,9 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
// Clip marks are already handled in GetOutputArea
if (bPixelToLogic)
- aLogicClip = pRefDevice->PixelToLogic( aClipRect );
+ aLogicClip = pRefDevice->PixelToLogic( aAreaParam.maClipRect );
else
- aLogicClip = aClipRect;
+ aLogicClip = aAreaParam.maClipRect;
if (bClip) // bei bSimClip nur aClipRect initialisieren
{
@@ -3215,10 +3392,7 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
// use GetOutputArea to hide the grid
// (clip region is done manually below)
- BOOL bLeftClip = FALSE;
- BOOL bRightClip = FALSE;
- Rectangle aAlignRect;
- Rectangle aClipRect;
+ OutputAreaParam aAreaParam;
SCCOL nCellX = nX;
SCROW nCellY = nY;
@@ -3231,8 +3405,7 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
GetOutputArea( nX, nArrY, nCellStartX, nPosY, nCellX, nCellY, nNeededWidth,
*pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
- FALSE, FALSE, TRUE,
- aAlignRect, aClipRect, bLeftClip, bRightClip );
+ FALSE, FALSE, TRUE, aAreaParam );
if ( bShrink )
{
@@ -3240,19 +3413,19 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
pRefDevice->LogicToPixel(Size(nEngineWidth,0)).Width() : nEngineWidth;
long nNeededPixel = nPixelWidth + nLeftM + nRightM;
- bLeftClip = bRightClip = TRUE;
+ aAreaParam.mbLeftClip = aAreaParam.mbRightClip = TRUE;
// always do height
- ShrinkEditEngine( *pEngine, aAlignRect, nLeftM, nTopM, nRightM, nBottomM,
+ ShrinkEditEngine( *pEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM,
FALSE, sal::static_int_cast<USHORT>(eOrient), nAttrRotate, bPixelToLogic,
- nEngineWidth, nEngineHeight, nNeededPixel, bLeftClip, bRightClip );
+ nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip );
if ( eRotMode == SVX_ROTATE_MODE_STANDARD )
{
// do width only if rotating within the cell (standard mode)
- ShrinkEditEngine( *pEngine, aAlignRect, nLeftM, nTopM, nRightM, nBottomM,
+ ShrinkEditEngine( *pEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM,
TRUE, sal::static_int_cast<USHORT>(eOrient), nAttrRotate, bPixelToLogic,
- nEngineWidth, nEngineHeight, nNeededPixel, bLeftClip, bRightClip );
+ nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip );
}
// nEngineWidth/nEngineHeight is updated in ShrinkEditEngine
@@ -3306,19 +3479,19 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
}
if (bPixelToLogic)
- aClipRect = pRefDevice->PixelToLogic( Rectangle(
+ aAreaParam.maClipRect = pRefDevice->PixelToLogic( Rectangle(
Point(nClipStartX,nClipStartY), aClipSize ) );
else
- aClipRect = Rectangle(Point(nClipStartX, nClipStartY),
+ aAreaParam.maClipRect = Rectangle(Point(nClipStartX, nClipStartY),
aClipSize ); // Scale = 1
if (bMetaFile)
{
pDev->Push();
- pDev->IntersectClipRegion( aClipRect );
+ pDev->IntersectClipRegion( aAreaParam.maClipRect );
}
else
- pDev->SetClipRegion( Region( aClipRect ) );
+ pDev->SetClipRegion( Region( aAreaParam.maClipRect ) );
}
Point aLogicStart;