diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2010-05-28 09:36:24 +0200 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2010-05-28 09:36:24 +0200 |
commit | a24ed4a9d146127a698669b23635ba565c0f2e2f (patch) | |
tree | 52cd45990c2f8f4c9c17339db29852ea64388f93 | |
parent | dd508f5004b7a26b085e6f6f51c8f4b4bc16c75c (diff) | |
parent | 284da3a62f12258617bcb998dde18e79213429db (diff) |
CWS-TOOLING: integrate CWS calc53
Notes
split repo tag: calc_ooo/DEV300_m80
36 files changed, 261 insertions, 1382 deletions
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/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/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 65076e7c529c..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; 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/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/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/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/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/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/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/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 102bb56463b6..5a48d0d310d5 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -2351,7 +2351,20 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic) } } 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); |