Index: sc/inc/dbcolect.hxx =================================================================== --- sc/inc/dbcolect.hxx (revision 1370673) +++ sc/inc/dbcolect.hxx (working copy) @@ -136,6 +136,8 @@ void GetArea(SCTAB& rTab, SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2) const; SC_DLLPUBLIC void GetArea(ScRange& rRange) const; void SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + //If the name of DBData is started with "unnamed", it will be recognized as build in DBData + sal_Bool IsBuildin(); void MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); sal_Bool IsByRow() const { return bByRow; } void SetByRow(sal_Bool bByR) { bByRow = bByR; } @@ -216,6 +218,7 @@ ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const; ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; ScDBData* GetFilterDBAtTable(SCTAB nTab) const; + ScDBData* GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const; sal_Bool SearchName( const String& rName, sal_uInt16& rIndex ) const; @@ -234,6 +237,8 @@ void SetRefreshHandler( const Link& rLink ) { aRefreshHandler = rLink; } const Link& GetRefreshHandler() const { return aRefreshHandler; } + String GetNewDefaultDBName(); + /*sal_Bool IsFiltered(SCTAB nTab, SCROW nRow);*/ }; #endif Index: sc/inc/document.hxx =================================================================== --- sc/inc/document.hxx (revision 1370673) +++ sc/inc/document.hxx (working copy) @@ -505,6 +505,7 @@ //UNUSED2008-05 ScRangeData* GetRangeAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, //UNUSED2008-05 sal_Bool bStartOnly = sal_False) const; SC_DLLPUBLIC ScRangeData* GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const; + ScDBData* GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const; SC_DLLPUBLIC ScDPCollection* GetDPCollection(); ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; @@ -955,6 +956,7 @@ SCROW& rEndRow, sal_Bool bNotes = sal_True ) const; void InvalidateTableArea(); SC_DLLPUBLIC sal_Bool GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const; Index: sc/inc/global.hxx =================================================================== --- sc/inc/global.hxx (revision 1370673) +++ sc/inc/global.hxx (working copy) @@ -1,886 +1,890 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SC_SCGLOB_HXX -#define SC_SCGLOB_HXX - -#include "address.hxx" -#include -#include -#include -#include -#include "scdllapi.h" - -#include - -class ImageList; -class Bitmap; -class SfxItemSet; -class Color; - -// Macro fuer den Call-Profiler unter WinNT -// mit S_CAP kann eine Messung gestarted, mit E_CAP wieder gestoppt werden -#if defined( WNT ) && defined( PROFILE ) - -extern "C" { - void StartCAP(); - void StopCAP(); - void DumpCAP(); -}; - -#define S_CAP StartCAP(); -#define E_CAP StopCAP(); DumpCAP(); - -#endif - -#if 0 -// I18N doesn't get this right, can't specify more than one to ignore -#define SC_COLLATOR_IGNORES ( \ - ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE | \ - ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_KANA | \ - ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_WIDTH ) -#else -#define SC_COLLATOR_IGNORES ( \ - ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ) -#endif -#if 0 -// #107998# Don't ignore Width and Kana. The issue was mainly with AutoInput, -// but affects also comparison of names in general. -#define SC_TRANSLITERATION_IGNORECASE ( \ - ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE | \ - ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \ - ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH ) -#define SC_TRANSLITERATION_CASESENSE ( \ - ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \ - ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH ) -#else -#define SC_TRANSLITERATION_IGNORECASE ( \ - ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE ) -#define SC_TRANSLITERATION_CASESENSE 0 -#endif - -//------------------------------------------------------------------------ - -// die 1000 Namen des Calc... -// Clipboard-Namen sind jetzt in so3/soapp.hxx -// STRING_SCAPP war "scalc3", "scalc4", jetzt nur noch "scalc" - -#define STRING_SCAPP "scalc" -#define STRING_SCSTREAM "StarCalcDocument" - -#define STRING_STANDARD "Standard" - -// characters ----------------------------------------------------------------- - -// '\r' geht auf'm Mac nicht... -#define CHAR_CR char(13) - -const sal_Unicode CHAR_NBSP = 0x00A0; -const sal_Unicode CHAR_SHY = 0x00AD; -const sal_Unicode CHAR_ZWSP = 0x200B; -const sal_Unicode CHAR_LRM = 0x200E; -const sal_Unicode CHAR_RLM = 0x200F; -const sal_Unicode CHAR_NBHY = 0x2011; -const sal_Unicode CHAR_ZWNBSP = 0x2060; - -// ---------------------------------------------------------------------------- - -#define MINDOUBLE 1.7e-307 -#define MAXDOUBLE 1.7e307 - -#define MINZOOM 20 -#define MAXZOOM 400 - -#ifdef SC_ROWLIMIT_TYPECONVERSION_NOCONVPASS -const size_t MAXSUBTOTAL = 3; -const size_t MAXQUERY = 8; -#else -const SCSIZE MAXSUBTOTAL = 3; -const SCSIZE MAXQUERY = 8; -#endif - -#define SC_START_INDEX_DB_COLL 50000 - // Oberhalb dieser Grenze liegen - // die Indizes fuer DBBereiche - -/* -#ifdef OS2 -#define PIXEL_PER_INCH 72.0 -#else -#define PIXEL_PER_INCH 96.0 -#endif -*/ - -#define PIXEL_PER_INCH 96.0 - -#define CM_PER_INCH 2.54 -#define POINTS_PER_INCH 72.27 -#define PIXEL_PER_POINT (PIXEL_PER_INCH / POINTS_PER_INCH) -#define INCHT_PER_CM (1.0 / CM_PER_INCH) -#define POINTS_PER_CM (POINTS_PER_INCH / CM_PER_INCH) -#define TWIPS_PER_POINT 20.0 -#define TWIPS_PER_INCH (TWIPS_PER_POINT * POINTS_PER_INCH) -#define TWIPS_PER_CM (TWIPS_PER_INCH / CM_PER_INCH) -#define CM_PER_TWIPS (CM_PER_INCH / TWIPS_PER_INCH) -#define TWIPS_PER_PIXEL (TWIPS_PER_INCH / PIXEL_PER_INCH) -#define TWIPS_PER_CHAR (TWIPS_PER_INCH / 13.6) -#define PIXEL_PER_TWIPS (PIXEL_PER_INCH / TWIPS_PER_INCH) -#define HMM_PER_TWIPS (CM_PER_TWIPS * 1000.0) - -#define STD_COL_WIDTH 1285 -#define STD_EXTRA_WIDTH 113 // 2mm Extra fuer optimale Breite - // Standard Zeilenhoehe: Text + Rand - STD_ROWHEIGHT_DIFF - - -#define MAX_EXTRA_WIDTH 23811 // 42cm in TWIPS -#define MAX_EXTRA_HEIGHT 23811 -#define MAX_COL_WIDTH 56693 // 1m in TWIPS -#define MAX_COL_HEIGHT 56693 - -#define STD_ROWHEIGHT_DIFF 23 -#define STD_FONT_HEIGHT 200 // entspricht 10 Punkt - -//! statt STD_ROW_HEIGHT ScGlobal::nStdRowHeight benutzen ! - -#define STD_ROW_HEIGHT (12.8 * TWIPS_PER_POINT) // 256 Twips, 0.45 cm - - // Standardgroesse als Ole-Server (Zellen) -#define OLE_STD_CELLS_X 4 -#define OLE_STD_CELLS_Y 5 - -#define SC_SIZE_OPTIMUM 0xFFFF - - // Update-Flags -#define UF_SCROLL_LEFT 1 -#define UF_SCROLL_RIGHT 2 -#define UF_SCROLL_UP 4 -#define UF_SCROLL_DOWN 8 -#define UF_ROW 16 -#define UF_VIEW 32 - - // Repaint-Flags (fuer Messages) -#define PAINT_GRID 1 -#define PAINT_TOP 2 -#define PAINT_LEFT 4 -#define PAINT_EXTRAS 8 -#define PAINT_INVERT 16 -#define PAINT_MARKS 32 -#define PAINT_OBJECTS 64 -#define PAINT_SIZE 128 -#define PAINT_ALL ( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE ) - - - // Flags fuer Spalten / Zeilen - // FILTERED immer zusammen mit HIDDEN - // FILTERED und MANUALSIZE nur fuer Zeilen moeglich -const sal_uInt8 CR_HIDDEN = 1; -//const sal_uInt8 CR_MARKED = 2; -//const sal_uInt8 CR_PAGEBREAK = 4; -const sal_uInt8 CR_MANUALBREAK = 8; -const sal_uInt8 CR_FILTERED = 16; -const sal_uInt8 CR_MANUALSIZE = 32; -const sal_uInt8 CR_ALL = (CR_HIDDEN | CR_MANUALBREAK | CR_FILTERED | CR_MANUALSIZE); - -typedef sal_uInt8 ScBreakType; -const ScBreakType BREAK_NONE = 0; -const ScBreakType BREAK_PAGE = 1; -const ScBreakType BREAK_MANUAL = 2; - -// Insert-/Delete-Flags -const sal_uInt16 IDF_NONE = 0x0000; -const sal_uInt16 IDF_VALUE = 0x0001; /// Numeric values (and numeric results if IDF_FORMULA is not set). -const sal_uInt16 IDF_DATETIME = 0x0002; /// Dates, times, datetime values. -const sal_uInt16 IDF_STRING = 0x0004; /// Strings (and string results if IDF_FORMULA is not set). -const sal_uInt16 IDF_NOTE = 0x0008; /// Cell notes. -const sal_uInt16 IDF_FORMULA = 0x0010; /// Formula cells. -const sal_uInt16 IDF_HARDATTR = 0x0020; /// Hard cell attributes. -const sal_uInt16 IDF_STYLES = 0x0040; /// Cell styles. -const sal_uInt16 IDF_OBJECTS = 0x0080; /// Drawing objects. -const sal_uInt16 IDF_EDITATTR = 0x0100; /// Rich-text attributes. -const sal_uInt16 IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES; -const sal_uInt16 IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA; -const sal_uInt16 IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS; -const sal_uInt16 IDF_NOCAPTIONS = 0x0200; /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes. -const sal_uInt16 IDF_ADDNOTES = 0x0400; /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes. - -/// Copy flags for auto/series fill functions: do not touch notes and drawing objects. -const sal_uInt16 IDF_AUTOFILL = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS); - -#define PASTE_NOFUNC 0 -#define PASTE_ADD 1 -#define PASTE_SUB 2 -#define PASTE_MUL 3 -#define PASTE_DIV 4 - -#define PASTE_NONEMPTY 5 - - // Bits fuer HasAttr -#define HASATTR_LINES 1 -#define HASATTR_MERGED 2 -#define HASATTR_OVERLAPPED 4 -#define HASATTR_PROTECTED 8 -#define HASATTR_SHADOW 16 -#define HASATTR_NEEDHEIGHT 32 -#define HASATTR_SHADOW_RIGHT 64 -#define HASATTR_SHADOW_DOWN 128 -#define HASATTR_AUTOFILTER 256 -#define HASATTR_CONDITIONAL 512 -#define HASATTR_ROTATE 1024 -#define HASATTR_NOTOVERLAPPED 2048 -#define HASATTR_RTL 4096 -#define HASATTR_RIGHTORCENTER 8192 // right or centered logical alignment - -#define HASATTR_PAINTEXT ( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL ) - - -#define EMPTY_STRING ScGlobal::GetEmptyString() - - // Layer-ID's fuer Drawing -#define SC_LAYER_FRONT 0 -#define SC_LAYER_BACK 1 -#define SC_LAYER_INTERN 2 -#define SC_LAYER_CONTROLS 3 -#define SC_LAYER_HIDDEN 4 - - // Tabellen linken -#define SC_LINK_NONE 0 -#define SC_LINK_NORMAL 1 -#define SC_LINK_VALUE 2 - - // Eingabe -#define SC_ENTER_NORMAL 0 -#define SC_ENTER_BLOCK 1 -#define SC_ENTER_MATRIX 2 - - // Step = 10pt, max. Einzug = 100 Schritte -#define SC_INDENT_STEP 200 -#define SC_MAX_INDENT 20000 - - // Szenario-Flags -#define SC_SCENARIO_COPYALL 1 -#define SC_SCENARIO_SHOWFRAME 2 -#define SC_SCENARIO_PRINTFRAME 4 -#define SC_SCENARIO_TWOWAY 8 -#define SC_SCENARIO_ATTRIB 16 -#define SC_SCENARIO_VALUE 32 -#define SC_SCENARIO_PROTECT 64 - - -#ifndef DELETEZ -#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; } -#endif - - // Ist Bit in Set gesetzt? -#define IS_SET(bit,set)(((set)&(bit))==(bit)) - -#define SEL_ALL -1 // Eingabezeile: alles Selektieren -#define RES_CANCEL 0 // Resultate der Funk.AutoPilot-Seiten -#define RES_BACKWARD 1 -#define RES_END 2 - -enum CellType - { - CELLTYPE_NONE, - CELLTYPE_VALUE, - CELLTYPE_STRING, - CELLTYPE_FORMULA, - CELLTYPE_NOTE, - CELLTYPE_EDIT, - CELLTYPE_SYMBOLS // fuer Laden/Speichern -#if DBG_UTIL - ,CELLTYPE_DESTROYED -#endif - }; - -enum DelCellCmd - { - DEL_CELLSUP, - DEL_CELLSLEFT, - DEL_DELROWS, - DEL_DELCOLS, - DEL_NONE - }; - -enum InsCellCmd - { - INS_CELLSDOWN, - INS_CELLSRIGHT, - INS_INSROWS, - INS_INSCOLS, - INS_NONE - }; - -enum UpdateRefMode - { - URM_INSDEL, - URM_COPY, - URM_MOVE, - URM_REORDER - }; - -enum FillDir - { - FILL_TO_BOTTOM, - FILL_TO_RIGHT, - FILL_TO_TOP, - FILL_TO_LEFT - }; - -enum FillCmd - { - FILL_SIMPLE, - FILL_LINEAR, - FILL_GROWTH, - FILL_DATE, - FILL_AUTO - }; - -enum FillDateCmd - { - FILL_DAY, - FILL_WEEKDAY, - FILL_MONTH, - FILL_YEAR - }; - -enum ScDirection - { - DIR_BOTTOM, - DIR_RIGHT, - DIR_TOP, - DIR_LEFT - }; - -enum ScSizeMode - { - SC_SIZE_DIRECT, // set size or hide if value is 0 - SC_SIZE_OPTIMAL, // set optimal size for everything - SC_SIZE_SHOW, // show with original size - SC_SIZE_VISOPT, // set optimal size only if visible - SC_SIZE_ORIGINAL // only set size, don't change visible flag - }; - -enum ScInputMode - { - SC_INPUT_NONE, - SC_INPUT_TYPE, // Eingabe, ohne im Inplace-Modus zu sein - SC_INPUT_TABLE, // Textcursor in der Tabelle - SC_INPUT_TOP // Textcursor in der Eingabezeile - }; - -enum ScVObjMode // Ausgabemodi von Objekten auf einer Seite -{ - VOBJ_MODE_SHOW, - VOBJ_MODE_HIDE - // #i80528# VOBJ_MODE_DUMMY removed, no longer supported -}; - -enum ScAnchorType // Verankerung eines Zeichenobjekts -{ - SCA_CELL, - SCA_PAGE, - SCA_DONTKNOW // bei Mehrfachselektion -}; - -enum ScGetDBMode -{ - SC_DB_MAKE, // wenn noetig, "unbenannt" anlegen - SC_DB_IMPORT, // wenn noetig, "Importx" anlegen - SC_DB_OLD // nicht neu anlegen -}; - -/// For ScDBFunc::GetDBData() -enum ScGetDBSelection -{ - /** Keep selection as is, expand to used data area if no selection. */ - SC_DBSEL_KEEP, - - /** Shrink selection to sheet's data area. */ - SC_DBSEL_SHRINK_TO_SHEET_DATA, - - /** Shrink selection to actually used data area within the selection. */ - SC_DBSEL_SHRINK_TO_USED_DATA, - - /** If only one row or portion thereof is selected, shrink row to used data - columns and select further rows down until end of data. If an area is - selected, shrink rows to actually used columns. Else, no selection, - expand to used data area. */ - SC_DBSEL_ROW_DOWN, - - /** Behave as if the range corresponding to a ScDBData area was selected, - for API use. */ - SC_DBSEL_FORCE_MARK -}; - -enum ScLkUpdMode -{ //Verknuepfungen - LM_ALWAYS, //immer aktualisieren - LM_NEVER, //niemals - LM_ON_DEMAND, //auf nachfrage - LM_UNKNOWN //Shit happens -}; - - -// ----------------------------------------------------------------------- - -//================================================================== - -// ----------------------------------------------------------------------- - -// enum with values equal to old DBObject enum from sdb -enum ScDBObject -{ - ScDbTable, - ScDbQuery -}; - -struct ScImportParam -{ - SCCOL nCol1; - SCROW nRow1; - SCCOL nCol2; - SCROW nRow2; - sal_Bool bImport; - String aDBName; // Alias der Datenbank - String aStatement; - sal_Bool bNative; - sal_Bool bSql; // Statement oder Name? - sal_uInt8 nType; // enum DBObject - - ScImportParam(); - ScImportParam( const ScImportParam& r ); - ~ScImportParam(); - - ScImportParam& operator= ( const ScImportParam& r ); - sal_Bool operator== ( const ScImportParam& r ) const; -//UNUSED2009-05 void Clear (); -}; - -struct ScStringHashCode -{ - size_t operator()( const String& rStr ) const - { - return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() ); - } -}; - -// ----------------------------------------------------------------------- - -class ScDocument; -class ScDocShell; -class ScDocShellRef; -class SvxSearchItem; -class ScAutoFormat; -class FuncCollection; -class ScUnoAddInCollection; -class ScUserList; -class SvxBrushItem; -class ScFunctionList; -class ScFunctionMgr; -class SfxItemPool; -class SdrModel; -class EditTextObject; -class SfxObjectShell; -class SvNumberFormatter; -class ScUnitConverter; -class CharClass; -class LocaleDataWrapper; -class SvtSysLocale; -class CalendarWrapper; -class CollatorWrapper; -class IntlWrapper; -class OutputDevice; - -namespace com { namespace sun { namespace star { - namespace lang { - struct Locale; - } - namespace i18n { - class XOrdinalSuffix; - } -}}} -namespace utl { - class TransliterationWrapper; -} - -#ifndef _SCALC_EXE -class ScGlobal -{ - static SvxSearchItem* pSearchItem; - static ScAutoFormat* pAutoFormat; - static FuncCollection* pFuncCollection; - static ScUnoAddInCollection* pAddInCollection; - static ScUserList* pUserList; - static String** ppRscString; - static String* pStrScDoc; - static String* pEmptyString; - static String* pStrClipDocName; - static SvxBrushItem* pEmptyBrushItem; - static SvxBrushItem* pButtonBrushItem; - static SvxBrushItem* pEmbeddedBrushItem; - static SvxBrushItem* pProtectedBrushItem; - - static ImageList* pOutlineBitmaps; - static ImageList* pOutlineBitmapsHC; - -// static Bitmap* pAnchorBitmap; -// static Bitmap* pGrayAnchorBitmap; - - static ScFunctionList* pStarCalcFunctionList; - static ScFunctionMgr* pStarCalcFunctionMgr; - - static ScUnitConverter* pUnitConverter; - - static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export - - static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix; - static CalendarWrapper* pCalendar; - static CollatorWrapper* pCaseCollator; - static CollatorWrapper* pCollator; - static ::utl::TransliterationWrapper* pTransliteration; - static ::utl::TransliterationWrapper* pCaseTransliteration; - static IntlWrapper* pScIntlWrapper; - static ::com::sun::star::lang::Locale* pLocale; - -public: - static SvtSysLocale* pSysLocale; - // for faster access a pointer to the single instance provided by SvtSysLocale - SC_DLLPUBLIC static const CharClass* pCharClass; - // for faster access a pointer to the single instance provided by SvtSysLocale - SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData; - SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData(); - - static CalendarWrapper* GetCalendar(); - SC_DLLPUBLIC static CollatorWrapper* GetCollator(); - static CollatorWrapper* GetCaseCollator(); - static IntlWrapper* GetScIntlWrapper(); - static ::com::sun::star::lang::Locale* GetLocale(); - - SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration(); //CHINA001 - static ::utl::TransliterationWrapper* GetCaseTransliteration(); - - SC_DLLPUBLIC static LanguageType eLnge; - static sal_Unicode cListDelimiter; - - static const String& GetClipDocName(); - static void SetClipDocName( const String& rNew ); - SC_DLLPUBLIC static const SvxSearchItem& GetSearchItem(); - SC_DLLPUBLIC static void SetSearchItem( const SvxSearchItem& rNew ); - SC_DLLPUBLIC static ScAutoFormat* GetAutoFormat(); - static void ClearAutoFormat(); //BugId 54209 - static FuncCollection* GetFuncCollection(); - SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection(); - SC_DLLPUBLIC static ScUserList* GetUserList(); - static void SetUserList( const ScUserList* pNewList ); - SC_DLLPUBLIC static const String& GetRscString( sal_uInt16 nIndex ); - static void OpenURL( const String& rURL, const String& rTarget ); - SC_DLLPUBLIC static String GetAbsDocName( const String& rFileName, - SfxObjectShell* pShell ); - SC_DLLPUBLIC static String GetDocTabName( const String& rFileName, - const String& rTabName ); - SC_DLLPUBLIC static sal_uLong GetStandardFormat( SvNumberFormatter&, - sal_uLong nFormat, short nType ); - SC_DLLPUBLIC static sal_uLong GetStandardFormat( double, SvNumberFormatter&, - sal_uLong nFormat, short nType ); - - SC_DLLPUBLIC static double nScreenPPTX; - SC_DLLPUBLIC static double nScreenPPTY; - - static ScDocShellRef* pDrawClipDocShellRef; - - static sal_uInt16 nDefFontHeight; - static sal_uInt16 nStdRowHeight; - - SC_DLLPUBLIC static long nLastRowHeightExtra; - static long nLastColWidthExtra; - - static void Init(); // am Anfang - static void InitAddIns(); - static void Clear(); // bei Programmende - - static void UpdatePPT(OutputDevice* pDev); - - static void InitTextHeight(SfxItemPool* pPool); - static SvxBrushItem* GetEmptyBrushItem() { return pEmptyBrushItem; } - static SvxBrushItem* GetButtonBrushItem(); - static SvxBrushItem* GetEmbeddedBrushItem() { return pEmbeddedBrushItem; } - static SvxBrushItem* GetProtectedBrushItem() { return pProtectedBrushItem; } - SC_DLLPUBLIC static const String& GetEmptyString(); - static const String& GetScDocString(); - - /** Returns the specified image list with outline symbols. - @param bHC false = standard symbols; true = high contrast symbols. */ - static ImageList* GetOutlineSymbols( bool bHC ); - -// static const Bitmap& GetAnchorBitmap(); -// static const Bitmap& GetGrayAnchorBitmap(); - - static bool HasStarCalcFunctionList(); - static ScFunctionList* GetStarCalcFunctionList(); - static ScFunctionMgr* GetStarCalcFunctionMgr(); - static void ResetFunctionList(); - - static String GetErrorString(sal_uInt16 nErrNumber); - static String GetLongErrorString(sal_uInt16 nErrNumber); - static sal_Bool EETextObjEqual( const EditTextObject* pObj1, - const EditTextObject* pObj2 ); - static sal_Bool CheckWidthInvalidate( sal_Bool& bNumFormatChanged, - const SfxItemSet& rNewAttrs, - const SfxItemSet& rOldAttrs ); - static sal_Bool HasAttrChanged( const SfxItemSet& rNewAttrs, - const SfxItemSet& rOldAttrs, - const sal_uInt16 nWhich ); - - static ScUnitConverter* GetUnitConverter(); - - /// strchr() functionality on unicode, as long as we need it for ScToken etc. - static const sal_Unicode* UnicodeStrChr( const sal_Unicode* pStr, sal_Unicode c ); - - static inline sal_Unicode ToUpperAlpha( sal_Unicode c ) - { return ( c >= 'a' && c <= 'z' ) ? ( c-'a'+'A' ) : c; } - - /** Adds the string rToken to rTokenList, using a list separator character. - @param rTokenList The string list where the token will be appended to. - @param rToken The token string to append to the token list. - @param cSep The character to separate the tokens. - @param nSepCount Specifies how often cSep is inserted between two tokens. - @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */ - SC_DLLPUBLIC static void AddToken( - String& rTokenList, const String& rToken, - sal_Unicode cSep, xub_StrLen nSepCount = 1, - bool bForceSep = false ); - - /** Returns true, if the first and last character of the string is cQuote. */ - SC_DLLPUBLIC static bool IsQuoted( const String& rString, sal_Unicode cQuote = '\'' ); - - /** Inserts the character cQuote at beginning and end of rString. - @param bEscapeEmbedded If , embedded quote characters are - escaped by doubling them. - */ -SC_DLLPUBLIC static void AddQuotes( String& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true ); - - /** Erases the character cQuote from rString, if it exists at beginning AND end. - @param bUnescapeEmbedded If , embedded doubled quote characters - are unescaped by replacing them with a - single instance. - */ -SC_DLLPUBLIC static void EraseQuotes( String& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true ); - - /** Finds an unquoted instance of cChar in rString, starting at - offset nStart. Unquoted instances may occur when concatenating two - quoted strings with a separator, for example, 's1':'s2'. Embedded - quotes have to be escaped by being doubled. Caller must ensure that - nStart points into an unquoted range or the opening quote. Specialty: - if cChar==cQuote the first cQuote character from nStart on is found. - @returns offset if found, else STRING_NOTFOUND - */ -SC_DLLPUBLIC static xub_StrLen FindUnquoted( const String& rString, sal_Unicode cChar, xub_StrLen nStart = 0, sal_Unicode cQuote = '\'' ); - - /** Finds an unquoted instance of cChar in null-terminated pString. Same - semantics as FindUnquoted( const String&, ...) - @returns: pointer to cChar if found, else NULL - */ -SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pString, sal_Unicode cChar, sal_Unicode cQuote = '\'' ); - - - static CharSet GetCharsetValue( const String& rCharSet ); - static String GetCharsetString( CharSet eVal ); - - /// a "ReadOnly" formatter for UNO/XML export - static SvNumberFormatter* GetEnglishFormatter(); - - static sal_Bool IsSystemRTL(); // depending on system language - static LanguageType GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage - SC_DLLPUBLIC static sal_uInt8 GetDefaultScriptType(); // for all WEAK characters - /** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs. - If more than one SCRIPTTYPE_... values are or'ed together, prefers - first COMPLEX, then ASIAN */ - SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich ); - - /** Adds a language item to the item set, if the number format item contains - a language that differs from its parent's language. */ - SC_DLLPUBLIC static void AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter ); - - /** Obtain the ordinal suffix for a number according to the system locale */ - static String GetOrdinalSuffix( sal_Int32 nNumber); -}; -#endif - -//================================================================== -// evtl. in dbdata.hxx auslagern (?): - -enum ScQueryOp - { - SC_EQUAL, - SC_LESS, - SC_GREATER, - SC_LESS_EQUAL, - SC_GREATER_EQUAL, - SC_NOT_EQUAL, - SC_TOPVAL, - SC_BOTVAL, - SC_TOPPERC, - SC_BOTPERC, - SC_CONTAINS, - SC_DOES_NOT_CONTAIN, - SC_BEGINS_WITH, - SC_DOES_NOT_BEGIN_WITH, - SC_ENDS_WITH, - SC_DOES_NOT_END_WITH - }; - -// ----------------------------------------------------------------------- - -enum ScQueryConnect - { - SC_AND, - SC_OR - }; - -// ----------------------------------------------------------------------- - -enum ScSubTotalFunc - { - SUBTOTAL_FUNC_NONE = 0, - SUBTOTAL_FUNC_AVE = 1, - SUBTOTAL_FUNC_CNT = 2, - SUBTOTAL_FUNC_CNT2 = 3, - SUBTOTAL_FUNC_MAX = 4, - SUBTOTAL_FUNC_MIN = 5, - SUBTOTAL_FUNC_PROD = 6, - SUBTOTAL_FUNC_STD = 7, - SUBTOTAL_FUNC_STDP = 8, - SUBTOTAL_FUNC_SUM = 9, - SUBTOTAL_FUNC_VAR = 10, - SUBTOTAL_FUNC_VARP = 11 - }; - - -// ----------------------------------------------------------------------- - -/* - * Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer" - * als Konstanten SC_EMPTYFIELDS bzw. SC_NONEMPTYFIELDS in nVal in - * Verbindung mit dem Schalter bQueryByString auf FALSE. - */ - -#define SC_EMPTYFIELDS ((double)0x0042) -#define SC_NONEMPTYFIELDS ((double)0x0043) - -namespace utl -{ - class SearchParam; - class TextSearch; -} - -struct ScQueryEntry -{ - sal_Bool bDoQuery; - sal_Bool bQueryByString; - bool bQueryByDate; - SCCOLROW nField; - ScQueryOp eOp; - ScQueryConnect eConnect; - String* pStr; - double nVal; - utl::SearchParam* pSearchParam; // falls RegExp, nicht gespeichert - utl::TextSearch* pSearchText; // falls RegExp, nicht gespeichert - - ScQueryEntry(); - ScQueryEntry(const ScQueryEntry& r); - ~ScQueryEntry(); - - // legt ggbf. pSearchParam und pSearchText an, immer RegExp! - utl::TextSearch* GetSearchTextPtr( sal_Bool bCaseSens ); - - void Clear(); - ScQueryEntry& operator=( const ScQueryEntry& r ); - sal_Bool operator==( const ScQueryEntry& r ) const; -}; - -// ----------------------------------------------------------------------- - -struct SC_DLLPUBLIC ScSubTotalParam -{ - SCCOL nCol1; // Selektierter Bereich - SCROW nRow1; - SCCOL nCol2; - SCROW nRow2; - sal_Bool bRemoveOnly; - sal_Bool bReplace; // vorhandene Ergebnisse ersetzen - sal_Bool bPagebreak; // Seitenumbruch bei Gruppenwechsel - sal_Bool bCaseSens; // Gross-/Kleinschreibung - sal_Bool bDoSort; // vorher sortieren - sal_Bool bAscending; // aufsteigend sortieren - sal_Bool bUserDef; // Benutzer-def. Sort.Reihenfolge - sal_uInt16 nUserIndex; // Index auf Liste - sal_Bool bIncludePattern; // Formate mit sortieren - sal_Bool bGroupActive[MAXSUBTOTAL]; // aktive Gruppen - SCCOL nField[MAXSUBTOTAL]; // zugehoeriges Feld - SCCOL nSubTotals[MAXSUBTOTAL]; // Anzahl der SubTotals - SCCOL* pSubTotals[MAXSUBTOTAL]; // Array der zu berechnenden Spalten - ScSubTotalFunc* pFunctions[MAXSUBTOTAL]; // Array der zugehoerige Funktionen - - ScSubTotalParam(); - ScSubTotalParam( const ScSubTotalParam& r ); - - ScSubTotalParam& operator= ( const ScSubTotalParam& r ); - sal_Bool operator== ( const ScSubTotalParam& r ) const; - void Clear (); - void SetSubTotals ( sal_uInt16 nGroup, - const SCCOL* ptrSubTotals, - const ScSubTotalFunc* ptrFuncions, - sal_uInt16 nCount ); -}; - -// ----------------------------------------------------------------------- -class ScArea; - -struct ScConsolidateParam -{ - SCCOL nCol; // Cursor Position / - SCROW nRow; // bzw. Anfang des Zielbereiches - SCTAB nTab; - ScSubTotalFunc eFunction; // Berechnungsvorschrift - sal_uInt16 nDataAreaCount; // Anzahl der Datenbereiche - ScArea** ppDataAreas; // Zeiger-Array auf Datenbereiche - sal_Bool bByCol; // nach Spalten - sal_Bool bByRow; // nach Zeilen - sal_Bool bReferenceData; // Quelldaten referenzieren - - ScConsolidateParam(); - ScConsolidateParam( const ScConsolidateParam& r ); - ~ScConsolidateParam(); - - ScConsolidateParam& operator= ( const ScConsolidateParam& r ); - sal_Bool operator== ( const ScConsolidateParam& r ) const; - void Clear (); // = ClearDataAreas()+Members - void ClearDataAreas (); - void SetAreas ( ScArea* const* ppAreas, sal_uInt16 nCount ); -}; - -// ----------------------------------------------------------------------- -extern ::utl::TransliterationWrapper* GetScGlobalpTransliteration();//CHINA001 -extern const LocaleDataWrapper* GetScGlobalpLocaleData(); - -#endif +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + + + +#ifndef SC_SCGLOB_HXX +#define SC_SCGLOB_HXX + +#include "address.hxx" +#include +#include +#include +#include +#include "scdllapi.h" + +#include + +class ImageList; +class Bitmap; +class SfxItemSet; +class Color; + +// Macro fuer den Call-Profiler unter WinNT +// mit S_CAP kann eine Messung gestarted, mit E_CAP wieder gestoppt werden +#if defined( WNT ) && defined( PROFILE ) + +extern "C" { + void StartCAP(); + void StopCAP(); + void DumpCAP(); +}; + +#define S_CAP StartCAP(); +#define E_CAP StopCAP(); DumpCAP(); + +#endif + +#if 0 +// I18N doesn't get this right, can't specify more than one to ignore +#define SC_COLLATOR_IGNORES ( \ + ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE | \ + ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_KANA | \ + ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_WIDTH ) +#else +#define SC_COLLATOR_IGNORES ( \ + ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ) +#endif +#if 0 +// #107998# Don't ignore Width and Kana. The issue was mainly with AutoInput, +// but affects also comparison of names in general. +#define SC_TRANSLITERATION_IGNORECASE ( \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE | \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH ) +#define SC_TRANSLITERATION_CASESENSE ( \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH ) +#else +#define SC_TRANSLITERATION_IGNORECASE ( \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE ) +#define SC_TRANSLITERATION_CASESENSE 0 +#endif + +//------------------------------------------------------------------------ + +// die 1000 Namen des Calc... +// Clipboard-Namen sind jetzt in so3/soapp.hxx +// STRING_SCAPP war "scalc3", "scalc4", jetzt nur noch "scalc" + +#define STRING_SCAPP "scalc" +#define STRING_SCSTREAM "StarCalcDocument" + +#define STRING_STANDARD "Standard" + +// characters ----------------------------------------------------------------- + +// '\r' geht auf'm Mac nicht... +#define CHAR_CR char(13) + +const sal_Unicode CHAR_NBSP = 0x00A0; +const sal_Unicode CHAR_SHY = 0x00AD; +const sal_Unicode CHAR_ZWSP = 0x200B; +const sal_Unicode CHAR_LRM = 0x200E; +const sal_Unicode CHAR_RLM = 0x200F; +const sal_Unicode CHAR_NBHY = 0x2011; +const sal_Unicode CHAR_ZWNBSP = 0x2060; + +// ---------------------------------------------------------------------------- + +#define MINDOUBLE 1.7e-307 +#define MAXDOUBLE 1.7e307 + +#define MINZOOM 20 +#define MAXZOOM 400 + +#ifdef SC_ROWLIMIT_TYPECONVERSION_NOCONVPASS +const size_t MAXSUBTOTAL = 3; +const size_t MAXQUERY = 8; +#else +const SCSIZE MAXSUBTOTAL = 3; +const SCSIZE MAXQUERY = 8; +#endif + +#define SC_START_INDEX_DB_COLL 50000 + // Oberhalb dieser Grenze liegen + // die Indizes fuer DBBereiche + +/* +#ifdef OS2 +#define PIXEL_PER_INCH 72.0 +#else +#define PIXEL_PER_INCH 96.0 +#endif +*/ + +#define PIXEL_PER_INCH 96.0 + +#define CM_PER_INCH 2.54 +#define POINTS_PER_INCH 72.27 +#define PIXEL_PER_POINT (PIXEL_PER_INCH / POINTS_PER_INCH) +#define INCHT_PER_CM (1.0 / CM_PER_INCH) +#define POINTS_PER_CM (POINTS_PER_INCH / CM_PER_INCH) +#define TWIPS_PER_POINT 20.0 +#define TWIPS_PER_INCH (TWIPS_PER_POINT * POINTS_PER_INCH) +#define TWIPS_PER_CM (TWIPS_PER_INCH / CM_PER_INCH) +#define CM_PER_TWIPS (CM_PER_INCH / TWIPS_PER_INCH) +#define TWIPS_PER_PIXEL (TWIPS_PER_INCH / PIXEL_PER_INCH) +#define TWIPS_PER_CHAR (TWIPS_PER_INCH / 13.6) +#define PIXEL_PER_TWIPS (PIXEL_PER_INCH / TWIPS_PER_INCH) +#define HMM_PER_TWIPS (CM_PER_TWIPS * 1000.0) + +#define STD_COL_WIDTH 1285 +#define STD_EXTRA_WIDTH 113 // 2mm Extra fuer optimale Breite + // Standard Zeilenhoehe: Text + Rand - STD_ROWHEIGHT_DIFF + + +#define MAX_EXTRA_WIDTH 23811 // 42cm in TWIPS +#define MAX_EXTRA_HEIGHT 23811 +#define MAX_COL_WIDTH 56693 // 1m in TWIPS +#define MAX_COL_HEIGHT 56693 + +#define STD_ROWHEIGHT_DIFF 23 +#define STD_FONT_HEIGHT 200 // entspricht 10 Punkt + +//! statt STD_ROW_HEIGHT ScGlobal::nStdRowHeight benutzen ! + +#define STD_ROW_HEIGHT (12.8 * TWIPS_PER_POINT) // 256 Twips, 0.45 cm + + // Standardgroesse als Ole-Server (Zellen) +#define OLE_STD_CELLS_X 4 +#define OLE_STD_CELLS_Y 5 + +#define SC_SIZE_OPTIMUM 0xFFFF + + // Update-Flags +#define UF_SCROLL_LEFT 1 +#define UF_SCROLL_RIGHT 2 +#define UF_SCROLL_UP 4 +#define UF_SCROLL_DOWN 8 +#define UF_ROW 16 +#define UF_VIEW 32 + + // Repaint-Flags (fuer Messages) +#define PAINT_GRID 1 +#define PAINT_TOP 2 +#define PAINT_LEFT 4 +#define PAINT_EXTRAS 8 +#define PAINT_INVERT 16 +#define PAINT_MARKS 32 +#define PAINT_OBJECTS 64 +#define PAINT_SIZE 128 +#define PAINT_ALL ( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE ) + + + // Flags fuer Spalten / Zeilen + // FILTERED immer zusammen mit HIDDEN + // FILTERED und MANUALSIZE nur fuer Zeilen moeglich +const sal_uInt8 CR_HIDDEN = 1; +//const sal_uInt8 CR_MARKED = 2; +//const sal_uInt8 CR_PAGEBREAK = 4; +const sal_uInt8 CR_MANUALBREAK = 8; +const sal_uInt8 CR_FILTERED = 16; +const sal_uInt8 CR_MANUALSIZE = 32; +const sal_uInt8 CR_ALL = (CR_HIDDEN | CR_MANUALBREAK | CR_FILTERED | CR_MANUALSIZE); + +typedef sal_uInt8 ScBreakType; +const ScBreakType BREAK_NONE = 0; +const ScBreakType BREAK_PAGE = 1; +const ScBreakType BREAK_MANUAL = 2; + +// Insert-/Delete-Flags +const sal_uInt16 IDF_NONE = 0x0000; +const sal_uInt16 IDF_VALUE = 0x0001; /// Numeric values (and numeric results if IDF_FORMULA is not set). +const sal_uInt16 IDF_DATETIME = 0x0002; /// Dates, times, datetime values. +const sal_uInt16 IDF_STRING = 0x0004; /// Strings (and string results if IDF_FORMULA is not set). +const sal_uInt16 IDF_NOTE = 0x0008; /// Cell notes. +const sal_uInt16 IDF_FORMULA = 0x0010; /// Formula cells. +const sal_uInt16 IDF_HARDATTR = 0x0020; /// Hard cell attributes. +const sal_uInt16 IDF_STYLES = 0x0040; /// Cell styles. +const sal_uInt16 IDF_OBJECTS = 0x0080; /// Drawing objects. +const sal_uInt16 IDF_EDITATTR = 0x0100; /// Rich-text attributes. +const sal_uInt16 IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES; +const sal_uInt16 IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA; +const sal_uInt16 IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS; +const sal_uInt16 IDF_NOCAPTIONS = 0x0200; /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes. +const sal_uInt16 IDF_ADDNOTES = 0x0400; /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes. + +/// Copy flags for auto/series fill functions: do not touch notes and drawing objects. +const sal_uInt16 IDF_AUTOFILL = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS); + +#define PASTE_NOFUNC 0 +#define PASTE_ADD 1 +#define PASTE_SUB 2 +#define PASTE_MUL 3 +#define PASTE_DIV 4 + +#define PASTE_NONEMPTY 5 + + // Bits fuer HasAttr +#define HASATTR_LINES 1 +#define HASATTR_MERGED 2 +#define HASATTR_OVERLAPPED 4 +#define HASATTR_PROTECTED 8 +#define HASATTR_SHADOW 16 +#define HASATTR_NEEDHEIGHT 32 +#define HASATTR_SHADOW_RIGHT 64 +#define HASATTR_SHADOW_DOWN 128 +#define HASATTR_AUTOFILTER 256 +#define HASATTR_CONDITIONAL 512 +#define HASATTR_ROTATE 1024 +#define HASATTR_NOTOVERLAPPED 2048 +#define HASATTR_RTL 4096 +#define HASATTR_RIGHTORCENTER 8192 // right or centered logical alignment + +#define HASATTR_PAINTEXT ( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL ) + + +#define EMPTY_STRING ScGlobal::GetEmptyString() + + // Layer-ID's fuer Drawing +#define SC_LAYER_FRONT 0 +#define SC_LAYER_BACK 1 +#define SC_LAYER_INTERN 2 +#define SC_LAYER_CONTROLS 3 +#define SC_LAYER_HIDDEN 4 + + // Tabellen linken +#define SC_LINK_NONE 0 +#define SC_LINK_NORMAL 1 +#define SC_LINK_VALUE 2 + + // Eingabe +#define SC_ENTER_NORMAL 0 +#define SC_ENTER_BLOCK 1 +#define SC_ENTER_MATRIX 2 + + // Step = 10pt, max. Einzug = 100 Schritte +#define SC_INDENT_STEP 200 +#define SC_MAX_INDENT 20000 + + // Szenario-Flags +#define SC_SCENARIO_COPYALL 1 +#define SC_SCENARIO_SHOWFRAME 2 +#define SC_SCENARIO_PRINTFRAME 4 +#define SC_SCENARIO_TWOWAY 8 +#define SC_SCENARIO_ATTRIB 16 +#define SC_SCENARIO_VALUE 32 +#define SC_SCENARIO_PROTECT 64 + + +#ifndef DELETEZ +#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; } +#endif + + // Ist Bit in Set gesetzt? +#define IS_SET(bit,set)(((set)&(bit))==(bit)) + +#define SEL_ALL -1 // Eingabezeile: alles Selektieren +#define RES_CANCEL 0 // Resultate der Funk.AutoPilot-Seiten +#define RES_BACKWARD 1 +#define RES_END 2 + +enum CellType + { + CELLTYPE_NONE, + CELLTYPE_VALUE, + CELLTYPE_STRING, + CELLTYPE_FORMULA, + CELLTYPE_NOTE, + CELLTYPE_EDIT, + CELLTYPE_SYMBOLS // fuer Laden/Speichern +#if DBG_UTIL + ,CELLTYPE_DESTROYED +#endif + }; + +enum DelCellCmd + { + DEL_CELLSUP, + DEL_CELLSLEFT, + DEL_DELROWS, + DEL_DELCOLS, + DEL_NONE + }; + +enum InsCellCmd + { + INS_CELLSDOWN, + INS_CELLSRIGHT, + INS_INSROWS, + INS_INSCOLS, + INS_NONE + }; + +enum UpdateRefMode + { + URM_INSDEL, + URM_COPY, + URM_MOVE, + URM_REORDER + }; + +enum FillDir + { + FILL_TO_BOTTOM, + FILL_TO_RIGHT, + FILL_TO_TOP, + FILL_TO_LEFT + }; + +enum FillCmd + { + FILL_SIMPLE, + FILL_LINEAR, + FILL_GROWTH, + FILL_DATE, + FILL_AUTO + }; + +enum FillDateCmd + { + FILL_DAY, + FILL_WEEKDAY, + FILL_MONTH, + FILL_YEAR + }; + +enum ScDirection + { + DIR_BOTTOM, + DIR_RIGHT, + DIR_TOP, + DIR_LEFT + }; + +enum ScSizeMode + { + SC_SIZE_DIRECT, // set size or hide if value is 0 + SC_SIZE_OPTIMAL, // set optimal size for everything + SC_SIZE_SHOW, // show with original size + SC_SIZE_VISOPT, // set optimal size only if visible + SC_SIZE_ORIGINAL // only set size, don't change visible flag + }; + +enum ScInputMode + { + SC_INPUT_NONE, + SC_INPUT_TYPE, // Eingabe, ohne im Inplace-Modus zu sein + SC_INPUT_TABLE, // Textcursor in der Tabelle + SC_INPUT_TOP // Textcursor in der Eingabezeile + }; + +enum ScVObjMode // Ausgabemodi von Objekten auf einer Seite +{ + VOBJ_MODE_SHOW, + VOBJ_MODE_HIDE + // #i80528# VOBJ_MODE_DUMMY removed, no longer supported +}; + +enum ScAnchorType // Verankerung eines Zeichenobjekts +{ + SCA_CELL, + SCA_PAGE, + SCA_DONTKNOW // bei Mehrfachselektion +}; + +enum ScGetDBMode +{ + SC_DB_MAKE, // wenn noetig, "unbenannt" anlegen + SC_DB_IMPORT, // wenn noetig, "Importx" anlegen + SC_DB_OLD, // nicht neu anlegen + SC_DB_MAKE_FILTER, // to create a new filter/sort/subtotal + SC_DB_MAKE_SORT, + SC_DB_MAKE_SUBTOTAL, + SC_DB_OLD_FILTER //to find a existed filter +}; + +/// For ScDBFunc::GetDBData() +enum ScGetDBSelection +{ + /** Keep selection as is, expand to used data area if no selection. */ + SC_DBSEL_KEEP, + + /** Shrink selection to sheet's data area. */ + SC_DBSEL_SHRINK_TO_SHEET_DATA, + + /** Shrink selection to actually used data area within the selection. */ + SC_DBSEL_SHRINK_TO_USED_DATA, + + /** If only one row or portion thereof is selected, shrink row to used data + columns and select further rows down until end of data. If an area is + selected, shrink rows to actually used columns. Else, no selection, + expand to used data area. */ + SC_DBSEL_ROW_DOWN, + + /** Behave as if the range corresponding to a ScDBData area was selected, + for API use. */ + SC_DBSEL_FORCE_MARK +}; + +enum ScLkUpdMode +{ //Verknuepfungen + LM_ALWAYS, //immer aktualisieren + LM_NEVER, //niemals + LM_ON_DEMAND, //auf nachfrage + LM_UNKNOWN //Shit happens +}; + + +// ----------------------------------------------------------------------- + +//================================================================== + +// ----------------------------------------------------------------------- + +// enum with values equal to old DBObject enum from sdb +enum ScDBObject +{ + ScDbTable, + ScDbQuery +}; + +struct ScImportParam +{ + SCCOL nCol1; + SCROW nRow1; + SCCOL nCol2; + SCROW nRow2; + sal_Bool bImport; + String aDBName; // Alias der Datenbank + String aStatement; + sal_Bool bNative; + sal_Bool bSql; // Statement oder Name? + sal_uInt8 nType; // enum DBObject + + ScImportParam(); + ScImportParam( const ScImportParam& r ); + ~ScImportParam(); + + ScImportParam& operator= ( const ScImportParam& r ); + sal_Bool operator== ( const ScImportParam& r ) const; +//UNUSED2009-05 void Clear (); +}; + +struct ScStringHashCode +{ + size_t operator()( const String& rStr ) const + { + return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() ); + } +}; + +// ----------------------------------------------------------------------- + +class ScDocument; +class ScDocShell; +class ScDocShellRef; +class SvxSearchItem; +class ScAutoFormat; +class FuncCollection; +class ScUnoAddInCollection; +class ScUserList; +class SvxBrushItem; +class ScFunctionList; +class ScFunctionMgr; +class SfxItemPool; +class SdrModel; +class EditTextObject; +class SfxObjectShell; +class SvNumberFormatter; +class ScUnitConverter; +class CharClass; +class LocaleDataWrapper; +class SvtSysLocale; +class CalendarWrapper; +class CollatorWrapper; +class IntlWrapper; +class OutputDevice; + +namespace com { namespace sun { namespace star { + namespace lang { + struct Locale; + } + namespace i18n { + class XOrdinalSuffix; + } +}}} +namespace utl { + class TransliterationWrapper; +} + +#ifndef _SCALC_EXE +class ScGlobal +{ + static SvxSearchItem* pSearchItem; + static ScAutoFormat* pAutoFormat; + static FuncCollection* pFuncCollection; + static ScUnoAddInCollection* pAddInCollection; + static ScUserList* pUserList; + static String** ppRscString; + static String* pStrScDoc; + static String* pEmptyString; + static String* pStrClipDocName; + static SvxBrushItem* pEmptyBrushItem; + static SvxBrushItem* pButtonBrushItem; + static SvxBrushItem* pEmbeddedBrushItem; + static SvxBrushItem* pProtectedBrushItem; + + static ImageList* pOutlineBitmaps; + static ImageList* pOutlineBitmapsHC; + +// static Bitmap* pAnchorBitmap; +// static Bitmap* pGrayAnchorBitmap; + + static ScFunctionList* pStarCalcFunctionList; + static ScFunctionMgr* pStarCalcFunctionMgr; + + static ScUnitConverter* pUnitConverter; + + static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export + + static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix; + static CalendarWrapper* pCalendar; + static CollatorWrapper* pCaseCollator; + static CollatorWrapper* pCollator; + static ::utl::TransliterationWrapper* pTransliteration; + static ::utl::TransliterationWrapper* pCaseTransliteration; + static IntlWrapper* pScIntlWrapper; + static ::com::sun::star::lang::Locale* pLocale; + +public: + static SvtSysLocale* pSysLocale; + // for faster access a pointer to the single instance provided by SvtSysLocale + SC_DLLPUBLIC static const CharClass* pCharClass; + // for faster access a pointer to the single instance provided by SvtSysLocale + SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData; + SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData(); + + static CalendarWrapper* GetCalendar(); + SC_DLLPUBLIC static CollatorWrapper* GetCollator(); + static CollatorWrapper* GetCaseCollator(); + static IntlWrapper* GetScIntlWrapper(); + static ::com::sun::star::lang::Locale* GetLocale(); + + SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration(); //CHINA001 + static ::utl::TransliterationWrapper* GetCaseTransliteration(); + + SC_DLLPUBLIC static LanguageType eLnge; + static sal_Unicode cListDelimiter; + + static const String& GetClipDocName(); + static void SetClipDocName( const String& rNew ); + SC_DLLPUBLIC static const SvxSearchItem& GetSearchItem(); + SC_DLLPUBLIC static void SetSearchItem( const SvxSearchItem& rNew ); + SC_DLLPUBLIC static ScAutoFormat* GetAutoFormat(); + static void ClearAutoFormat(); //BugId 54209 + static FuncCollection* GetFuncCollection(); + SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection(); + SC_DLLPUBLIC static ScUserList* GetUserList(); + static void SetUserList( const ScUserList* pNewList ); + SC_DLLPUBLIC static const String& GetRscString( sal_uInt16 nIndex ); + static void OpenURL( const String& rURL, const String& rTarget ); + SC_DLLPUBLIC static String GetAbsDocName( const String& rFileName, + SfxObjectShell* pShell ); + SC_DLLPUBLIC static String GetDocTabName( const String& rFileName, + const String& rTabName ); + SC_DLLPUBLIC static sal_uLong GetStandardFormat( SvNumberFormatter&, + sal_uLong nFormat, short nType ); + SC_DLLPUBLIC static sal_uLong GetStandardFormat( double, SvNumberFormatter&, + sal_uLong nFormat, short nType ); + + SC_DLLPUBLIC static double nScreenPPTX; + SC_DLLPUBLIC static double nScreenPPTY; + + static ScDocShellRef* pDrawClipDocShellRef; + + static sal_uInt16 nDefFontHeight; + static sal_uInt16 nStdRowHeight; + + SC_DLLPUBLIC static long nLastRowHeightExtra; + static long nLastColWidthExtra; + + static void Init(); // am Anfang + static void InitAddIns(); + static void Clear(); // bei Programmende + + static void UpdatePPT(OutputDevice* pDev); + + static void InitTextHeight(SfxItemPool* pPool); + static SvxBrushItem* GetEmptyBrushItem() { return pEmptyBrushItem; } + static SvxBrushItem* GetButtonBrushItem(); + static SvxBrushItem* GetEmbeddedBrushItem() { return pEmbeddedBrushItem; } + static SvxBrushItem* GetProtectedBrushItem() { return pProtectedBrushItem; } + SC_DLLPUBLIC static const String& GetEmptyString(); + static const String& GetScDocString(); + + /** Returns the specified image list with outline symbols. + @param bHC false = standard symbols; true = high contrast symbols. */ + static ImageList* GetOutlineSymbols( bool bHC ); + +// static const Bitmap& GetAnchorBitmap(); +// static const Bitmap& GetGrayAnchorBitmap(); + + static bool HasStarCalcFunctionList(); + static ScFunctionList* GetStarCalcFunctionList(); + static ScFunctionMgr* GetStarCalcFunctionMgr(); + static void ResetFunctionList(); + + static String GetErrorString(sal_uInt16 nErrNumber); + static String GetLongErrorString(sal_uInt16 nErrNumber); + static sal_Bool EETextObjEqual( const EditTextObject* pObj1, + const EditTextObject* pObj2 ); + static sal_Bool CheckWidthInvalidate( sal_Bool& bNumFormatChanged, + const SfxItemSet& rNewAttrs, + const SfxItemSet& rOldAttrs ); + static sal_Bool HasAttrChanged( const SfxItemSet& rNewAttrs, + const SfxItemSet& rOldAttrs, + const sal_uInt16 nWhich ); + + static ScUnitConverter* GetUnitConverter(); + + /// strchr() functionality on unicode, as long as we need it for ScToken etc. + static const sal_Unicode* UnicodeStrChr( const sal_Unicode* pStr, sal_Unicode c ); + + static inline sal_Unicode ToUpperAlpha( sal_Unicode c ) + { return ( c >= 'a' && c <= 'z' ) ? ( c-'a'+'A' ) : c; } + + /** Adds the string rToken to rTokenList, using a list separator character. + @param rTokenList The string list where the token will be appended to. + @param rToken The token string to append to the token list. + @param cSep The character to separate the tokens. + @param nSepCount Specifies how often cSep is inserted between two tokens. + @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */ + SC_DLLPUBLIC static void AddToken( + String& rTokenList, const String& rToken, + sal_Unicode cSep, xub_StrLen nSepCount = 1, + bool bForceSep = false ); + + /** Returns true, if the first and last character of the string is cQuote. */ + SC_DLLPUBLIC static bool IsQuoted( const String& rString, sal_Unicode cQuote = '\'' ); + + /** Inserts the character cQuote at beginning and end of rString. + @param bEscapeEmbedded If , embedded quote characters are + escaped by doubling them. + */ +SC_DLLPUBLIC static void AddQuotes( String& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true ); + + /** Erases the character cQuote from rString, if it exists at beginning AND end. + @param bUnescapeEmbedded If , embedded doubled quote characters + are unescaped by replacing them with a + single instance. + */ +SC_DLLPUBLIC static void EraseQuotes( String& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true ); + + /** Finds an unquoted instance of cChar in rString, starting at + offset nStart. Unquoted instances may occur when concatenating two + quoted strings with a separator, for example, 's1':'s2'. Embedded + quotes have to be escaped by being doubled. Caller must ensure that + nStart points into an unquoted range or the opening quote. Specialty: + if cChar==cQuote the first cQuote character from nStart on is found. + @returns offset if found, else STRING_NOTFOUND + */ +SC_DLLPUBLIC static xub_StrLen FindUnquoted( const String& rString, sal_Unicode cChar, xub_StrLen nStart = 0, sal_Unicode cQuote = '\'' ); + + /** Finds an unquoted instance of cChar in null-terminated pString. Same + semantics as FindUnquoted( const String&, ...) + @returns: pointer to cChar if found, else NULL + */ +SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pString, sal_Unicode cChar, sal_Unicode cQuote = '\'' ); + + + static CharSet GetCharsetValue( const String& rCharSet ); + static String GetCharsetString( CharSet eVal ); + + /// a "ReadOnly" formatter for UNO/XML export + static SvNumberFormatter* GetEnglishFormatter(); + + static sal_Bool IsSystemRTL(); // depending on system language + static LanguageType GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage + SC_DLLPUBLIC static sal_uInt8 GetDefaultScriptType(); // for all WEAK characters + /** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs. + If more than one SCRIPTTYPE_... values are or'ed together, prefers + first COMPLEX, then ASIAN */ + SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich ); + + /** Adds a language item to the item set, if the number format item contains + a language that differs from its parent's language. */ + SC_DLLPUBLIC static void AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter ); + + /** Obtain the ordinal suffix for a number according to the system locale */ + static String GetOrdinalSuffix( sal_Int32 nNumber); +}; +#endif + +//================================================================== +// evtl. in dbdata.hxx auslagern (?): + +enum ScQueryOp + { + SC_EQUAL, + SC_LESS, + SC_GREATER, + SC_LESS_EQUAL, + SC_GREATER_EQUAL, + SC_NOT_EQUAL, + SC_TOPVAL, + SC_BOTVAL, + SC_TOPPERC, + SC_BOTPERC, + SC_CONTAINS, + SC_DOES_NOT_CONTAIN, + SC_BEGINS_WITH, + SC_DOES_NOT_BEGIN_WITH, + SC_ENDS_WITH, + SC_DOES_NOT_END_WITH + }; + +// ----------------------------------------------------------------------- + +enum ScQueryConnect + { + SC_AND, + SC_OR + }; + +// ----------------------------------------------------------------------- + +enum ScSubTotalFunc + { + SUBTOTAL_FUNC_NONE = 0, + SUBTOTAL_FUNC_AVE = 1, + SUBTOTAL_FUNC_CNT = 2, + SUBTOTAL_FUNC_CNT2 = 3, + SUBTOTAL_FUNC_MAX = 4, + SUBTOTAL_FUNC_MIN = 5, + SUBTOTAL_FUNC_PROD = 6, + SUBTOTAL_FUNC_STD = 7, + SUBTOTAL_FUNC_STDP = 8, + SUBTOTAL_FUNC_SUM = 9, + SUBTOTAL_FUNC_VAR = 10, + SUBTOTAL_FUNC_VARP = 11 + }; + + +// ----------------------------------------------------------------------- + +/* + * Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer" + * als Konstanten SC_EMPTYFIELDS bzw. SC_NONEMPTYFIELDS in nVal in + * Verbindung mit dem Schalter bQueryByString auf FALSE. + */ + +#define SC_EMPTYFIELDS ((double)0x0042) +#define SC_NONEMPTYFIELDS ((double)0x0043) + +namespace utl +{ + class SearchParam; + class TextSearch; +} + +struct ScQueryEntry +{ + sal_Bool bDoQuery; + sal_Bool bQueryByString; + bool bQueryByDate; + SCCOLROW nField; + ScQueryOp eOp; + ScQueryConnect eConnect; + String* pStr; + double nVal; + utl::SearchParam* pSearchParam; // falls RegExp, nicht gespeichert + utl::TextSearch* pSearchText; // falls RegExp, nicht gespeichert + + ScQueryEntry(); + ScQueryEntry(const ScQueryEntry& r); + ~ScQueryEntry(); + + // legt ggbf. pSearchParam und pSearchText an, immer RegExp! + utl::TextSearch* GetSearchTextPtr( sal_Bool bCaseSens ); + + void Clear(); + ScQueryEntry& operator=( const ScQueryEntry& r ); + sal_Bool operator==( const ScQueryEntry& r ) const; +}; + +// ----------------------------------------------------------------------- + +struct SC_DLLPUBLIC ScSubTotalParam +{ + SCCOL nCol1; // Selektierter Bereich + SCROW nRow1; + SCCOL nCol2; + SCROW nRow2; + sal_Bool bRemoveOnly; + sal_Bool bReplace; // vorhandene Ergebnisse ersetzen + sal_Bool bPagebreak; // Seitenumbruch bei Gruppenwechsel + sal_Bool bCaseSens; // Gross-/Kleinschreibung + sal_Bool bDoSort; // vorher sortieren + sal_Bool bAscending; // aufsteigend sortieren + sal_Bool bUserDef; // Benutzer-def. Sort.Reihenfolge + sal_uInt16 nUserIndex; // Index auf Liste + sal_Bool bIncludePattern; // Formate mit sortieren + sal_Bool bGroupActive[MAXSUBTOTAL]; // aktive Gruppen + SCCOL nField[MAXSUBTOTAL]; // zugehoeriges Feld + SCCOL nSubTotals[MAXSUBTOTAL]; // Anzahl der SubTotals + SCCOL* pSubTotals[MAXSUBTOTAL]; // Array der zu berechnenden Spalten + ScSubTotalFunc* pFunctions[MAXSUBTOTAL]; // Array der zugehoerige Funktionen + + ScSubTotalParam(); + ScSubTotalParam( const ScSubTotalParam& r ); + + ScSubTotalParam& operator= ( const ScSubTotalParam& r ); + sal_Bool operator== ( const ScSubTotalParam& r ) const; + void Clear (); + void SetSubTotals ( sal_uInt16 nGroup, + const SCCOL* ptrSubTotals, + const ScSubTotalFunc* ptrFuncions, + sal_uInt16 nCount ); +}; + +// ----------------------------------------------------------------------- +class ScArea; + +struct ScConsolidateParam +{ + SCCOL nCol; // Cursor Position / + SCROW nRow; // bzw. Anfang des Zielbereiches + SCTAB nTab; + ScSubTotalFunc eFunction; // Berechnungsvorschrift + sal_uInt16 nDataAreaCount; // Anzahl der Datenbereiche + ScArea** ppDataAreas; // Zeiger-Array auf Datenbereiche + sal_Bool bByCol; // nach Spalten + sal_Bool bByRow; // nach Zeilen + sal_Bool bReferenceData; // Quelldaten referenzieren + + ScConsolidateParam(); + ScConsolidateParam( const ScConsolidateParam& r ); + ~ScConsolidateParam(); + + ScConsolidateParam& operator= ( const ScConsolidateParam& r ); + sal_Bool operator== ( const ScConsolidateParam& r ) const; + void Clear (); // = ClearDataAreas()+Members + void ClearDataAreas (); + void SetAreas ( ScArea* const* ppAreas, sal_uInt16 nCount ); +}; + +// ----------------------------------------------------------------------- +extern ::utl::TransliterationWrapper* GetScGlobalpTransliteration();//CHINA001 +extern const LocaleDataWrapper* GetScGlobalpLocaleData(); + +#endif Index: sc/source/core/data/documen3.cxx =================================================================== --- sc/source/core/data/documen3.cxx (revision 1370673) +++ sc/source/core/data/documen3.cxx (working copy) @@ -192,6 +192,13 @@ else return NULL; } +ScDBData* ScDocument::GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const +{ + if (pDBCollection) + return pDBCollection->GetDBAtTable(nTab, eMode); + else + return NULL; +} ScDBData* ScDocument::GetFilterDBAtTable(SCTAB nTab) const { @@ -1291,7 +1298,8 @@ sal_Bool ScDocument::HasAutoFilter( SCCOL nCurCol, SCROW nCurRow, SCTAB nCurTab ) { - ScDBData* pDBData = GetDBAtCursor( nCurCol, nCurRow, nCurTab ); + //ScDBData* pDBData = GetDBAtCursor( nCurCol, nCurRow, nCurTab ); + ScDBData* pDBData = GetDBAtTable(nCurTab, SC_DB_OLD_FILTER); sal_Bool bHasAutoFilter = ( pDBData != NULL ); if ( pDBData ) Index: sc/source/core/tool/dbcolect.cxx =================================================================== --- sc/source/core/tool/dbcolect.cxx (revision 1370673) +++ sc/source/core/tool/dbcolect.cxx (working copy) @@ -36,6 +36,7 @@ #include "queryparam.hxx" #include "globstr.hrc" +#define SC_DBNAME_UNNAMED "__Anonymous_Sheet_DB__" //--------------------------------------------------------------------------------------- @@ -690,8 +691,13 @@ { return new ScDBData(*this); } +sal_Bool ScDBData::IsBuildin() +{ + String aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED); + String aBeginName = aName.Copy(0,22); + return (sal_Bool)(!ScGlobal::GetpTransliteration()->compareString( aNoName, aBeginName )); +} - //--------------------------------------------------------------------------------------- // Compare zum Sortieren @@ -714,13 +720,12 @@ ScDBData* pNoNameData = NULL; if (pItems) { - const String& rNoName = ScGlobal::GetRscString( STR_DB_NONAME ); for (sal_uInt16 i = 0; i < nCount; i++) if (((ScDBData*)pItems[i])->IsDBAtCursor(nCol, nRow, nTab, bStartOnly)) { ScDBData* pDB = (ScDBData*)pItems[i]; - if ( pDB->GetName() == rNoName ) + if ( pDB->IsBuildin() ) pNoNameData = pDB; else return pDB; @@ -734,13 +739,12 @@ ScDBData* pNoNameData = NULL; if (pItems) { - const String& rNoName = ScGlobal::GetRscString( STR_DB_NONAME ); for (sal_uInt16 i = 0; i < nCount; i++) if (((ScDBData*)pItems[i])->IsDBAtArea(nTab, nCol1, nRow1, nCol2, nRow2)) { ScDBData* pDB = (ScDBData*)pItems[i]; - if ( pDB->GetName() == rNoName ) + if ( pDB->IsBuildin() ) pNoNameData = pDB; else return pDB; @@ -903,6 +907,67 @@ return bInserted; } +String ScDBCollection::GetNewDefaultDBName() +{ + String aNoName = String::CreateFromAscii(SC_DBNAME_UNNAMED); + String aNewName; + unsigned short nDummy; + int i = 1; + do + { + aNewName = aNoName; + aNewName += String::CreateFromInt32( i++ ); + }while(SearchName(aNewName,nDummy)); + return aNewName; +} +/* +sal_Bool ScDBCollection::IsFiltered(SCTAB nTab, SCROW nRow) +{ + SCCOL nLastCol; + SCROW nLastRow; + pDoc->GetLastAttrCellArea(nTab, nLastCol, nLastRow); + if ( pItems ) + { + for (unsigned short i = 0; i < nCount; i++) + { + ScDBData* pData = (ScDBData*)pItems[i]; + if ( pData->nTable == nTab && pData->HasQueryParam() && pData->bQueryInplace ) + if ( nRow >= (pData->nStartRow + (pData->HasHeader()?1:0)) && nRow <= pData->nEndRow && nRow <= nLastRow ) + return sal_True; + } + } + return sal_False; +} +*/ +ScDBData* ScDBCollection::GetDBAtTable(SCTAB nTab, ScGetDBMode eMode) const +{ + ScDBData* pDataEmpty = NULL; + if (pItems) + { + for (unsigned short i = 0; i < nCount; i++) + { + ScDBData* pDBTemp = (ScDBData*)pItems[i]; + if ( pDBTemp->nTable == nTab ) //Sym2_7885 mod + { + sal_Bool bImport = pDBTemp->HasImportParam(); + sal_Bool bFilter = pDBTemp->HasAutoFilter() || pDBTemp->HasQueryParam(); + sal_Bool bSort = pDBTemp->HasSortParam(); + sal_Bool bSubtotal = pDBTemp->HasSubTotalParam(); + sal_Bool bAnyParam = bImport || bFilter || bSort || bSubtotal; + if ( ((eMode == SC_DB_MAKE_SORT) && bSort && !bFilter) || //Sym2_7334 mod 20100420 + ((eMode == SC_DB_MAKE_SUBTOTAL) && bSubtotal && !bFilter ) || + ((eMode == SC_DB_MAKE_FILTER || eMode == SC_DB_OLD_FILTER) && bFilter ) ) + { + return pDBTemp; + } + else if ( pDBTemp->IsBuildin() && !bAnyParam ) //Sym2_7885 mod + { + pDataEmpty = pDBTemp; + } + } + } + } - + return pDataEmpty; +} Index: sc/source/core/tool/rangeutl.cxx =================================================================== --- sc/source/core/tool/rangeutl.cxx (revision 1370673) +++ sc/source/core/tool/rangeutl.cxx (working copy) @@ -1032,7 +1032,8 @@ if ( pDBCollection && nPos < pDBCollection->GetCount() ) { ScDBData* pData = (*pDBCollection)[nPos++]; - if (pData && pData->GetName() != aStrNoName) +// if (pData && pData->GetName() != aStrNoName) + if (pData && !pData->IsBuildin()) { pData->GetArea( rRange ); rName = pData->GetName(); Index: sc/source/ui/dbgui/dbnamdlg.cxx =================================================================== --- sc/source/ui/dbgui/dbnamdlg.cxx (revision 1370673) +++ sc/source/ui/dbgui/dbnamdlg.cxx (working copy) @@ -266,7 +266,8 @@ && (rEnd.Col() == nCol2) && (rEnd.Row() == nRow2 ) ) { pDBData->GetName( theDbName ); - if ( theDbName != aStrNoName ) + //if ( theDbName != aStrNoName ) + if ( !pDBData->IsBuildin() ) aEdName.SetText( theDbName ); else aEdName.SetText( EMPTY_STRING ); @@ -378,7 +379,8 @@ if ( pDbData ) { pDbData->GetName( aString ); - if ( aString != aStrNoName ) + //if ( aString != aStrNoName ) + if ( !pDbData->IsBuildin() ) aEdName.InsertEntry( aString ); } } Index: sc/source/ui/dbgui/foptmgr.cxx =================================================================== --- sc/source/ui/dbgui/foptmgr.cxx (revision 1370673) +++ sc/source/ui/dbgui/foptmgr.cxx (working copy) @@ -186,7 +186,7 @@ rBtnHeader.Check( pDBData->HasHeader() ); pDBData->GetName( theDbName ); - if ( theDbName != rStrNoName ) + if ( !pDBData->IsBuildin() ) { rBtnHeader.Disable(); } Index: sc/source/ui/docshell/dbdocfun.cxx =================================================================== --- sc/source/ui/docshell/dbdocfun.cxx (revision 1370673) +++ sc/source/ui/docshell/dbdocfun.cxx (working copy) @@ -592,7 +592,7 @@ if (pDestData) pNewData = pDestData; // Bereich vorhanden -> anpassen else // Bereich ab Cursor/Markierung wird angelegt - pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); + pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE_SORT, SC_DBSEL_FORCE_MARK ); if (pNewData) { pNewData->SetArea( nTab, @@ -919,7 +919,7 @@ pNewData = rDocShell.GetDBData( ScRange( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab, aLocalParam.nCol2, aLocalParam.nRow2, nDestTab ), - SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); + SC_DB_MAKE_FILTER, SC_DBSEL_FORCE_MARK ); if (pNewData) { Index: sc/source/ui/docshell/docsh5.cxx =================================================================== --- sc/source/ui/docshell/docsh5.cxx (revision 1370673) +++ sc/source/ui/docshell/docsh5.cxx (working copy) @@ -150,6 +150,8 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ) { + if ( eMode == SC_DB_MAKE_FILTER || eMode == SC_DB_MAKE_SORT || eMode == SC_DB_MAKE_SUBTOTAL || eMode == SC_DB_OLD_FILTER ) + return GetDBDataAdd(rMarked, eMode, eSel); SCCOL nCol = rMarked.aStart.Col(); SCROW nRow = rMarked.aStart.Row(); SCTAB nTab = rMarked.aStart.Tab(); @@ -184,7 +186,8 @@ SCCOL nOldCol2; SCROW nOldRow2; pData->GetArea( nDummy, nOldCol1,nOldRow1, nOldCol2,nOldRow2 ); - sal_Bool bIsNoName = ( pData->GetName() == ScGlobal::GetRscString( STR_DB_NONAME ) ); +// sal_Bool bIsNoName = ( pData->GetName() == ScGlobal::GetRscString( STR_DB_NONAME ) ); + sal_Bool bIsNoName = pData->IsBuildin(); if (!bSelected) { @@ -322,7 +325,9 @@ while (pColl->SearchName( aNewName, nDummy )); } else - aNewName = ScGlobal::GetRscString( STR_DB_NONAME ); + //aNewName = ScGlobal::GetRscString( STR_DB_NONAME ); + aNewName = pColl->GetNewDefaultDBName(); + pNoNameData = new ScDBData( aNewName, nTab, nStartCol,nStartRow, nEndCol,nEndRow, sal_True, bHasHeader ); @@ -351,6 +356,170 @@ return pData; } +ScDBData* ScDocShell::GetDBDataAdd( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ) +{ + SCCOL nCol = rMarked.aStart.Col(); + SCROW nRow = rMarked.aStart.Row(); + SCTAB nTab = rMarked.aStart.Tab(); + + SCCOL nStartCol = nCol; + SCROW nStartRow = nRow; + SCTAB nStartTab = nTab; + SCCOL nEndCol = rMarked.aEnd.Col(); + SCROW nEndRow = rMarked.aEnd.Row(); + SCTAB nEndTab = rMarked.aEnd.Tab(); + + ScDBData* pData = NULL; + ScDBData* pCursorData; + pCursorData = aDocument.GetDBAtArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow ); + if ( !pCursorData ) + pCursorData = aDocument.GetDBAtCursor( nStartCol, nStartRow, nTab ); + + //Get DBData at current table + ScDBData* pTableData = aDocument.GetDBAtTable( nTab, eMode ); + + if ( eMode == SC_DB_OLD_FILTER ) + return pTableData; + + sal_Bool bSelected = ( eSel == SC_DBSEL_FORCE_MARK || rMarked.aStart != rMarked.aEnd ); + bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row()); + + sal_Bool bUseThis = sal_False; + if (pCursorData) + { + SCTAB nDummy; + SCCOL nOldCol1; + SCROW nOldRow1; + SCCOL nOldCol2; + SCROW nOldRow2; + pCursorData->GetArea( nDummy, nOldCol1,nOldRow1, nOldCol2,nOldRow2 ); + if ( !bSelected ) + { + ScRange tmpRange; + if ( !pCursorData->IsBuildin() && pCursorData->GetAdvancedQuerySource(tmpRange)) + bUseThis = sal_True; + else + { + nStartCol = nCol; + nStartRow = nRow; + nEndCol = nStartCol; + nEndRow = nStartRow; + aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown ); + if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow ) + bUseThis = sal_False; + else + { + bUseThis = sal_True; + if ( nOldRow2 != nEndRow )// Range of new end-line expand + pCursorData->SetArea( nTab, nOldCol1,nOldRow1, nOldCol2,nEndRow ); + } + } + + } + else + { + if ( nOldCol1 == nStartCol && nOldRow1 == nStartRow && nOldCol2 == nEndCol && nOldRow2 == nEndRow ) + bUseThis = sal_True; + else + bUseThis = sal_False; // Always take mark (Bug 11964) + } + } + + if ( bUseThis ) + { + pData = pCursorData; + if ( pTableData && eMode == SC_DB_MAKE_FILTER && !(*pTableData == *pCursorData ) ) + { + if ( !pOldAutoDBRange ) + pOldAutoDBRange = new ScDBData(*pTableData); + SCCOL nOldX1; + SCROW nOldY1; + SCCOL nOldX2; + SCROW nOldY2; + SCTAB nOldTab; + pTableData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 ); + + if (pTableData->HasQueryParam()) + { + ScQueryParam aParam; + pTableData->GetQueryParam(aParam); + SCSIZE nEC = aParam.GetEntryCount(); + for (SCSIZE i=0; iSetQueryParam( ScQueryParam() ); + pTableData->SetAutoFilter( sal_False ); + } + + } + else + { + if ( bSelected ) + { +// bMark = sal_False; + } + else + { + nStartCol = nCol; + nStartRow = nRow; + nEndCol = nStartCol; + nEndRow = nStartRow; + aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, sal_False, bOnlyDown ); + } + sal_Bool bHasHeader = aDocument.HasColHeader( nStartCol,nStartRow, nEndCol,nEndRow, nTab ); + ScDBCollection* pColl = aDocument.GetDBCollection(); + if ( pTableData ) + { + if ( !pOldAutoDBRange ) + pOldAutoDBRange = new ScDBData(*pTableData); + SCCOL nOldX1; + SCROW nOldY1; + SCCOL nOldX2; + SCROW nOldY2; + SCTAB nOldTab; + pTableData->GetArea( nOldTab, nOldX1, nOldY1, nOldX2, nOldY2 ); + + if (pTableData->HasQueryParam()) + { + ScQueryParam aParam; + pTableData->GetQueryParam(aParam); + SCSIZE nEC = aParam.GetEntryCount(); + for (SCSIZE i=0; iSetSortParam( ScSortParam() ); + pTableData->SetQueryParam( ScQueryParam() ); + pTableData->SetSubTotalParam( ScSubTotalParam() ); + + pTableData->SetArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow ); + pTableData->SetByRow( sal_True ); + pTableData->SetHeader( bHasHeader ); + pTableData->SetAutoFilter( sal_False ); + } + else + { + String aNewName = pColl->GetNewDefaultDBName(); + pTableData = new ScDBData( aNewName, nTab, nStartCol,nStartRow, nEndCol,nEndRow, sal_True, bHasHeader ); + pColl->Insert( pTableData ); + } + pData = pTableData; + } + + return pData; +} + + ScDBData* ScDocShell::GetOldAutoDBRange() { ScDBData* pRet = pOldAutoDBRange; Index: sc/source/ui/inc/dbfunc.hxx =================================================================== --- sc/source/ui/inc/dbfunc.hxx (revision 1370673) +++ sc/source/ui/inc/dbfunc.hxx (working copy) @@ -75,6 +75,7 @@ // DB-Bereich vom Cursor ScDBData* GetDBData( sal_Bool bMarkArea = sal_True, ScGetDBMode eMode = SC_DB_MAKE, ScGetDBSelection eSel = SC_DBSEL_KEEP ); + //ScRange GetDBRange( BOOL bMark, bool bIgnoreNotes ); void NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& rDelAreaList ); void Consolidate( const ScConsolidateParam& rParam, sal_Bool bRecord = sal_True ); Index: sc/source/ui/inc/docsh.hxx =================================================================== --- sc/source/ui/inc/docsh.hxx (revision 1370673) +++ sc/source/ui/inc/docsh.hxx (working copy) @@ -1,459 +1,461 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SC_DOCSHELL_HXX -#define SC_DOCSHELL_HXX - - -#include - -#include -#include -#include - -#include "scdllapi.h" -#include "scdll.hxx" -#include "document.hxx" -#include "shellids.hxx" -#include "refreshtimer.hxx" - -#include - -class ScEditEngineDefaulter; -class FontList; -class SfxStyleSheetBasePool; -class SfxStyleSheetHint; -struct ChartSelectionInfo; -class INetURLObject; - -class ScPaintItem; -class ScViewData; -class ScDocFunc; -class ScDrawLayer; -class ScTabViewShell; -class ScSbxDocHelper; -class ScAutoStyleList; -class ScRange; -class ScMarkData; -class ScPaintLockData; -class ScJobSetup; -class ScChangeAction; -class VirtualDevice; -class ScImportOptions; -class ScDocShellModificator; -class ScOptSolverSave; -class ScSheetSaveData; - -namespace sfx2 { class FileDialogHelper; } -struct DocShell_Impl; - -typedef ::std::hash_map< sal_uLong, sal_uLong > ScChangeActionMergeMap; - -//================================================================== - -//enum ScDBFormat { SC_FORMAT_SDF, SC_FORMAT_DBF }; - - // Extra-Flags fuer Repaint -#define SC_PF_LINES 1 -#define SC_PF_TESTMERGE 2 -#define SC_PF_WHOLEROWS 4 - -class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener -{ - static const sal_Char __FAR_DATA pStarCalcDoc[]; - static const sal_Char __FAR_DATA pStyleName[]; - - ScDocument aDocument; - - String aDdeTextFmt; - String aConvFilterName; //@ #BugId 54198 - - double nPrtToScreenFactor; -//! FontList* pFontList; - DocShell_Impl* pImpl; - ScDocFunc* pDocFunc; - - //SfxObjectCreateMode eShellMode; - - sal_Bool bIsInplace; // wird von der View gesetzt - sal_Bool bHeaderOn; - sal_Bool bFooterOn; - sal_Bool bNoInformLost; - sal_Bool bIsEmpty; - sal_Bool bIsInUndo; - sal_Bool bDocumentModifiedPending; - sal_uInt16 nDocumentLock; - sal_Int16 nCanUpdate; // stores the UpdateDocMode from loading a document till update links - sal_Bool bUpdateEnabled; - - ScDBData* pOldAutoDBRange; - - ScSbxDocHelper* pDocHelper; - - ScAutoStyleList* pAutoStyleList; - ScPaintLockData* pPaintLockData; - ScJobSetup* pOldJobSetup; - ScOptSolverSave* pSolverSaveData; - ScSheetSaveData* pSheetSaveData; - - ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading) - - SC_DLLPRIVATE void InitItems(); - SC_DLLPRIVATE void DoEnterHandler(); - SC_DLLPRIVATE void InitOptions(bool bForLoading); - SC_DLLPRIVATE void ResetDrawObjectShell(); - - // SUNWS needs a forward declared friend, otherwise types and members - // of the outer class are not accessible. - class PrepareSaveGuard; - friend class ScDocShell::PrepareSaveGuard; - /** Do things that need to be done before saving to our own format and - necessary clean ups in dtor. */ - class PrepareSaveGuard - { - public: - explicit PrepareSaveGuard( ScDocShell & rDocShell ); - ~PrepareSaveGuard(); - private: - ScDocShell & mrDocShell; - }; - - SC_DLLPRIVATE sal_Bool LoadXML( SfxMedium* pMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); - SC_DLLPRIVATE sal_Bool SaveXML( SfxMedium* pMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); - SC_DLLPRIVATE SCTAB GetSaveTab(); - - SC_DLLPRIVATE sal_uLong DBaseImport( const String& rFullFileName, CharSet eCharSet, - sal_Bool bSimpleColWidth[MAXCOLCOUNT] ); - SC_DLLPRIVATE sal_uLong DBaseExport( const String& rFullFileName, CharSet eCharSet, - sal_Bool& bHasMemo ); - - SC_DLLPRIVATE static sal_Bool MoveFile( const INetURLObject& rSource, const INetURLObject& rDest ); - SC_DLLPRIVATE static sal_Bool KillFile( const INetURLObject& rURL ); - SC_DLLPRIVATE static sal_Bool IsDocument( const INetURLObject& rURL ); - - SC_DLLPRIVATE void LockPaint_Impl(sal_Bool bDoc); - SC_DLLPRIVATE void UnlockPaint_Impl(sal_Bool bDoc); - SC_DLLPRIVATE void LockDocument_Impl(sal_uInt16 nNew); - SC_DLLPRIVATE void UnlockDocument_Impl(sal_uInt16 nNew); - - SC_DLLPRIVATE void EnableSharedSettings( bool bEnable ); - SC_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument(); - - SC_DLLPRIVATE void UseSheetSaveEntries(); - -protected: - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - -public: - TYPEINFO(); - - SFX_DECL_INTERFACE(SCID_DOC_SHELL) - SFX_DECL_OBJECTFACTORY(); - - ScDocShell( const ScDocShell& rDocShell ); - ScDocShell( const sal_uInt64 i_nSfxCreationFlags = SFXMODEL_EMBEDDED_OBJECT ); - ~ScDocShell(); - - using SotObject::GetInterface; - using SfxShell::Activate; // with sal_Bool bMDI - using SfxShell::Deactivate; // with sal_Bool bMDI - using SfxObjectShell::Print; // print styles - - virtual void Activate(); - virtual void Deactivate(); - - virtual ::svl::IUndoManager* - GetUndoManager(); - - virtual void FillClass( SvGlobalName * pClassName, - sal_uInt32 * pFormat, - String * pAppName, - String * pFullTypeName, - String * pShortTypeName, - sal_Int32 nFileFormat, - sal_Bool bTemplate = sal_False ) const; - - virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); - virtual sal_Bool Load( SfxMedium& rMedium ); - virtual sal_Bool LoadFrom( SfxMedium& rMedium ); - virtual sal_Bool ConvertFrom( SfxMedium &rMedium ); - virtual sal_Bool Save(); - virtual sal_Bool SaveAs( SfxMedium& rMedium ); - virtual sal_Bool ConvertTo( SfxMedium &rMedium ); - virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False ); - virtual void PrepareReload(); - virtual sal_Bool IsInformationLost(); - virtual void LoadStyles( SfxObjectShell &rSource ); - virtual sal_Bool Insert( SfxObjectShell &rSource, - sal_uInt16 nSourceIdx1, sal_uInt16 nSourceIdx2, sal_uInt16 nSourceIdx3, - sal_uInt16 &nIdx1, sal_uInt16 &nIdx2, sal_uInt16 &nIdx3, sal_uInt16 &rIdxDeleted ); - - virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); // SfxInPlaceObject - virtual sal_Bool DoSaveCompleted( SfxMedium * pNewStor); // SfxObjectShell - virtual sal_Bool QuerySlotExecutable( sal_uInt16 nSlotId ); - - virtual void Draw( OutputDevice *, const JobSetup & rSetup, - sal_uInt16 nAspect = ASPECT_CONTENT ); - - virtual void SetVisArea( const Rectangle & rVisArea ); - - using SfxObjectShell::GetVisArea; - virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const; - - virtual Printer* GetDocumentPrinter(); - - virtual void SetModified( sal_Bool = sal_True ); - - void SetVisAreaOrSize( const Rectangle& rVisArea, sal_Bool bModifyStart ); - - virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( Window *pParent, - const SfxItemSet &rSet ); - - void GetDocStat( ScDocStat& rDocStat ); - - ScDocument* GetDocument() { return &aDocument; } - ScDocFunc& GetDocFunc() { return *pDocFunc; } - - SfxPrinter* GetPrinter( sal_Bool bCreateIfNotExist = sal_True ); - sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL ); - - void UpdateFontList(); - - String CreateObjectName( const String& rPrefix ); - - ScDrawLayer* MakeDrawLayer(); - - void AsciiSave( SvStream& rStream, const ScImportOptions& rOpt ); - - void GetSbxState( SfxItemSet &rSet ); - void GetDrawObjState( SfxItemSet &rSet ); - - void Execute( SfxRequest& rReq ); - void GetState( SfxItemSet &rSet ); - void ExecutePageStyle ( SfxViewShell& rCaller, SfxRequest& rReq, SCTAB nCurTab ); - void GetStatePageStyle( SfxViewShell& rCaller, SfxItemSet& rSet, SCTAB nCurTab ); - - void CompareDocument( ScDocument& rOtherDoc ); - void MergeDocument( ScDocument& rOtherDoc, bool bShared = false, bool bCheckDuplicates = false, sal_uLong nOffset = 0, ScChangeActionMergeMap* pMergeMap = NULL, bool bInverseMap = false ); - bool MergeSharedDocument( ScDocShell* pSharedDocShell ); - - ScChangeAction* GetChangeAction( const ScAddress& rPos ); - void SetChangeComment( ScChangeAction* pAction, const String& rComment ); - void ExecuteChangeCommentDialog( ScChangeAction* pAction, Window* pParent,sal_Bool bPrevNext=sal_True ); - /// Protect/unprotect ChangeTrack and return if - /// protection was successfully changed. - /// If bJustQueryIfProtected==sal_True protection is not - /// changed and is returned if not protected or - /// password was entered correctly. - sal_Bool ExecuteChangeProtectionDialog( Window* _pParent, sal_Bool bJustQueryIfProtected = sal_False ); - - void SetPrintZoom( SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages ); - sal_Bool AdjustPrintZoom( const ScRange& rRange ); - - void LoadStylesArgs( ScDocShell& rSource, sal_Bool bReplace, sal_Bool bCellStyles, sal_Bool bPageStyles ); - - void PageStyleModified( const String& rStyleName, sal_Bool bApi ); - - void NotifyStyle( const SfxStyleSheetHint& rHint ); - void DoAutoStyle( const ScRange& rRange, const String& rStyle ); - - Window* GetActiveDialogParent(); - void ErrorMessage( sal_uInt16 nGlobStrId ); - sal_Bool IsEditable() const; - - sal_Bool AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ); - void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL ); - void UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore = false ); - - void RefreshPivotTables( const ScRange& rSource ); - void DoConsolidate( const ScConsolidateParam& rParam, sal_Bool bRecord = sal_True ); - void UseScenario( SCTAB nTab, const String& rName, sal_Bool bRecord = sal_True ); - SCTAB MakeScenario( SCTAB nTab, const String& rName, const String& rComment, - const Color& rColor, sal_uInt16 nFlags, - ScMarkData& rMark, sal_Bool bRecord = sal_True ); - void ModifyScenario( SCTAB nTab, const String& rName, const String& rComment, - const Color& rColor, sal_uInt16 nFlags ); - sal_Bool MoveTable( SCTAB nSrcTab, SCTAB nDestTab, sal_Bool bCopy, sal_Bool bRecord ); - - void DoRecalc( sal_Bool bApi ); - void DoHardRecalc( sal_Bool bApi ); - - void UpdateOle( const ScViewData* pViewData, sal_Bool bSnapSize = sal_False); - sal_Bool IsOle(); - - void DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ); - ScDBData* GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ); - ScDBData* GetOldAutoDBRange(); // has to be deleted by caller! - void CancelAutoDBRange(); // called when dialog is cancelled - - void UpdateLinks(); // Link-Eintraege aktuallisieren - sal_Bool ReloadTabLinks(); // Links ausfuehren (Inhalt aktualisieren) - - void PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddress& rCursorPos ); - - void PostPaint( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, - SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, sal_uInt16 nPart, - sal_uInt16 nExtFlags = 0 ); - void PostPaint( const ScRange& rRange, sal_uInt16 nPart, sal_uInt16 nExtFlags = 0 ); - - void PostPaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab ); - void PostPaintCell( const ScAddress& rPos ); - void PostPaintGridAll(); - void PostPaintExtras(); - - bool IsPaintLocked() const { return pPaintLockData != NULL; } - - void PostDataChanged(); - - void UpdatePaintExt( sal_uInt16& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, - SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab ); - void UpdatePaintExt( sal_uInt16& rExtFlags, const ScRange& rRange ); - - void SetDocumentModified( sal_Bool bIsModified = sal_True ); - void SetDrawModified( sal_Bool bIsModified = sal_True ); - - void LockPaint(); - void UnlockPaint(); - sal_uInt16 GetLockCount() const; - void SetLockCount(sal_uInt16 nNew); - - void LockDocument(); - void UnlockDocument(); - - DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* ); - - virtual SfxStyleSheetBasePool* GetStyleSheetPool(); - - void SetInplace( sal_Bool bInplace ); - sal_Bool IsEmpty() const; - void SetEmpty(sal_Bool bSet); - - sal_Bool IsInUndo() const { return bIsInUndo; } - void SetInUndo(sal_Bool bSet); - - void CalcOutputFactor(); - double GetOutputFactor() const; - void GetPageOnFromPageStyleSet( const SfxItemSet* pStyleSet, - SCTAB nCurTab, - sal_Bool& rbHeader, - sal_Bool& rbFooter ); - - virtual long DdeGetData( const String& rItem, const String& rMimeType, - ::com::sun::star::uno::Any & rValue ); - virtual long DdeSetData( const String& rItem, const String& rMimeType, - const ::com::sun::star::uno::Any & rValue ); - virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem ); - - const String& GetDdeTextFmt() const { return aDdeTextFmt; } - - SfxBindings* GetViewBindings(); - - ScTabViewShell* GetBestViewShell( sal_Bool bOnlyVisible = sal_True ); - ScSbxDocHelper* GetDocHelperObject() { return pDocHelper; } - - void SetDocumentModifiedPending( sal_Bool bVal ) - { bDocumentModifiedPending = bVal; } - sal_Bool IsDocumentModifiedPending() const - { return bDocumentModifiedPending; } - - sal_Bool IsUpdateEnabled() const - { return bUpdateEnabled; } - void SetUpdateEnabled(sal_Bool bValue) - { bUpdateEnabled = bValue; } - - OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice... - - static ScViewData* GetViewData(); - static SCTAB GetCurTab(); - - static ScDocShell* GetShellByNum( sal_uInt16 nDocNo ); - static String GetOwnFilterName(); - static String GetHtmlFilterName(); - static String GetWebQueryFilterName(); - static String GetAsciiFilterName(); - static String GetLotusFilterName(); - static String GetDBaseFilterName(); - static String GetDifFilterName(); - static sal_Bool HasAutomaticTableName( const String& rFilter ); - - DECL_LINK( RefreshDBDataHdl, ScRefreshTimer* ); - - void BeforeXMLLoading(); - void AfterXMLLoading(sal_Bool bRet); - - virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates ); - - const ScOptSolverSave* GetSolverSaveData() const { return pSolverSaveData; } // may be null - void SetSolverSaveData( const ScOptSolverSave& rData ); - //Added by PengYunQuan for Validity Cell Range Picker - ScSheetSaveData* GetSheetSaveData(); - - // passwword protection for Calc (derived from SfxObjectShell) - // see also: FID_CHG_RECORD, SID_CHG_PROTECT - virtual bool IsChangeRecording() const; - virtual bool HasChangeRecordProtection() const; - virtual void SetChangeRecording( bool bActivate ); - virtual bool SetProtectionPassword( const String &rPassword ); - virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ); -}; - - -void UpdateAcceptChangesDialog(); - - -SO2_DECL_REF(ScDocShell) -SO2_IMPL_REF(ScDocShell) - - -// Vor Modifizierungen des Dokuments anlegen und danach zerstoeren. -// Merkt sich im Ctor AutoCalcShellDisabled und IdleDisabled, schaltet sie ab -// und stellt sie im Dtor wieder her, AutoCalcShellDisabled ggbf. auch vor -// einem ScDocShell SetDocumentModified. -// SetDocumentModified hierdran aufrufen statt an der ScDocShell. -// Im Dtor wird wenn ScDocShell bDocumentModifiedPending gesetzt ist und -// bAutoCalcShellDisabled nicht gesetzt ist ein SetDocumentModified gerufen. -class SC_DLLPUBLIC ScDocShellModificator -{ - ScDocShell& rDocShell; - ScRefreshTimerProtector aProtector; - sal_Bool bAutoCalcShellDisabled; - sal_Bool bIdleDisabled; - - // not implemented - ScDocShellModificator( const ScDocShellModificator& ); - ScDocShellModificator& operator=( const ScDocShellModificator& ); - -public: - ScDocShellModificator( ScDocShell& ); - ~ScDocShellModificator(); - void SetDocumentModified(); -}; - - - -#endif - - +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + + + +#ifndef SC_DOCSHELL_HXX +#define SC_DOCSHELL_HXX + + +#include + +#include +#include +#include + +#include "scdllapi.h" +#include "scdll.hxx" +#include "document.hxx" +#include "shellids.hxx" +#include "refreshtimer.hxx" + +#include + +class ScEditEngineDefaulter; +class FontList; +class SfxStyleSheetBasePool; +class SfxStyleSheetHint; +struct ChartSelectionInfo; +class INetURLObject; + +class ScPaintItem; +class ScViewData; +class ScDocFunc; +class ScDrawLayer; +class ScTabViewShell; +class ScSbxDocHelper; +class ScAutoStyleList; +class ScRange; +class ScMarkData; +class ScPaintLockData; +class ScJobSetup; +class ScChangeAction; +class VirtualDevice; +class ScImportOptions; +class ScDocShellModificator; +class ScOptSolverSave; +class ScSheetSaveData; + +namespace sfx2 { class FileDialogHelper; } +struct DocShell_Impl; + +typedef ::std::hash_map< sal_uLong, sal_uLong > ScChangeActionMergeMap; + +//================================================================== + +//enum ScDBFormat { SC_FORMAT_SDF, SC_FORMAT_DBF }; + + // Extra-Flags fuer Repaint +#define SC_PF_LINES 1 +#define SC_PF_TESTMERGE 2 +#define SC_PF_WHOLEROWS 4 + +class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener +{ + static const sal_Char __FAR_DATA pStarCalcDoc[]; + static const sal_Char __FAR_DATA pStyleName[]; + + ScDocument aDocument; + + String aDdeTextFmt; + String aConvFilterName; //@ #BugId 54198 + + double nPrtToScreenFactor; +//! FontList* pFontList; + DocShell_Impl* pImpl; + ScDocFunc* pDocFunc; + + //SfxObjectCreateMode eShellMode; + + sal_Bool bIsInplace; // wird von der View gesetzt + sal_Bool bHeaderOn; + sal_Bool bFooterOn; + sal_Bool bNoInformLost; + sal_Bool bIsEmpty; + sal_Bool bIsInUndo; + sal_Bool bDocumentModifiedPending; + sal_uInt16 nDocumentLock; + sal_Int16 nCanUpdate; // stores the UpdateDocMode from loading a document till update links + sal_Bool bUpdateEnabled; + + ScDBData* pOldAutoDBRange; + + ScSbxDocHelper* pDocHelper; + + ScAutoStyleList* pAutoStyleList; + ScPaintLockData* pPaintLockData; + ScJobSetup* pOldJobSetup; + ScOptSolverSave* pSolverSaveData; + ScSheetSaveData* pSheetSaveData; + + ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading) + + SC_DLLPRIVATE void InitItems(); + SC_DLLPRIVATE void DoEnterHandler(); + SC_DLLPRIVATE void InitOptions(bool bForLoading); + SC_DLLPRIVATE void ResetDrawObjectShell(); + + // SUNWS needs a forward declared friend, otherwise types and members + // of the outer class are not accessible. + class PrepareSaveGuard; + friend class ScDocShell::PrepareSaveGuard; + /** Do things that need to be done before saving to our own format and + necessary clean ups in dtor. */ + class PrepareSaveGuard + { + public: + explicit PrepareSaveGuard( ScDocShell & rDocShell ); + ~PrepareSaveGuard(); + private: + ScDocShell & mrDocShell; + }; + + SC_DLLPRIVATE sal_Bool LoadXML( SfxMedium* pMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); + SC_DLLPRIVATE sal_Bool SaveXML( SfxMedium* pMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); + SC_DLLPRIVATE SCTAB GetSaveTab(); + + SC_DLLPRIVATE sal_uLong DBaseImport( const String& rFullFileName, CharSet eCharSet, + sal_Bool bSimpleColWidth[MAXCOLCOUNT] ); + SC_DLLPRIVATE sal_uLong DBaseExport( const String& rFullFileName, CharSet eCharSet, + sal_Bool& bHasMemo ); + + SC_DLLPRIVATE static sal_Bool MoveFile( const INetURLObject& rSource, const INetURLObject& rDest ); + SC_DLLPRIVATE static sal_Bool KillFile( const INetURLObject& rURL ); + SC_DLLPRIVATE static sal_Bool IsDocument( const INetURLObject& rURL ); + + SC_DLLPRIVATE void LockPaint_Impl(sal_Bool bDoc); + SC_DLLPRIVATE void UnlockPaint_Impl(sal_Bool bDoc); + SC_DLLPRIVATE void LockDocument_Impl(sal_uInt16 nNew); + SC_DLLPRIVATE void UnlockDocument_Impl(sal_uInt16 nNew); + + SC_DLLPRIVATE void EnableSharedSettings( bool bEnable ); + SC_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument(); + ScDBData* GetDBDataAdd( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ); + + SC_DLLPRIVATE void UseSheetSaveEntries(); + +protected: + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + +public: + TYPEINFO(); + + SFX_DECL_INTERFACE(SCID_DOC_SHELL) + SFX_DECL_OBJECTFACTORY(); + + ScDocShell( const ScDocShell& rDocShell ); + ScDocShell( const sal_uInt64 i_nSfxCreationFlags = SFXMODEL_EMBEDDED_OBJECT ); + ~ScDocShell(); + + using SotObject::GetInterface; + using SfxShell::Activate; // with sal_Bool bMDI + using SfxShell::Deactivate; // with sal_Bool bMDI + using SfxObjectShell::Print; // print styles + + virtual void Activate(); + virtual void Deactivate(); + + virtual ::svl::IUndoManager* + GetUndoManager(); + + virtual void FillClass( SvGlobalName * pClassName, + sal_uInt32 * pFormat, + String * pAppName, + String * pFullTypeName, + String * pShortTypeName, + sal_Int32 nFileFormat, + sal_Bool bTemplate = sal_False ) const; + + virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); + virtual sal_Bool Load( SfxMedium& rMedium ); + virtual sal_Bool LoadFrom( SfxMedium& rMedium ); + virtual sal_Bool ConvertFrom( SfxMedium &rMedium ); + virtual sal_Bool Save(); + virtual sal_Bool SaveAs( SfxMedium& rMedium ); + virtual sal_Bool ConvertTo( SfxMedium &rMedium ); + virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False ); + virtual void PrepareReload(); + virtual sal_Bool IsInformationLost(); + virtual void LoadStyles( SfxObjectShell &rSource ); + virtual sal_Bool Insert( SfxObjectShell &rSource, + sal_uInt16 nSourceIdx1, sal_uInt16 nSourceIdx2, sal_uInt16 nSourceIdx3, + sal_uInt16 &nIdx1, sal_uInt16 &nIdx2, sal_uInt16 &nIdx3, sal_uInt16 &rIdxDeleted ); + + virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); // SfxInPlaceObject + virtual sal_Bool DoSaveCompleted( SfxMedium * pNewStor); // SfxObjectShell + virtual sal_Bool QuerySlotExecutable( sal_uInt16 nSlotId ); + + virtual void Draw( OutputDevice *, const JobSetup & rSetup, + sal_uInt16 nAspect = ASPECT_CONTENT ); + + virtual void SetVisArea( const Rectangle & rVisArea ); + + using SfxObjectShell::GetVisArea; + virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const; + + virtual Printer* GetDocumentPrinter(); + + virtual void SetModified( sal_Bool = sal_True ); + + void SetVisAreaOrSize( const Rectangle& rVisArea, sal_Bool bModifyStart ); + + virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( Window *pParent, + const SfxItemSet &rSet ); + + void GetDocStat( ScDocStat& rDocStat ); + + ScDocument* GetDocument() { return &aDocument; } + ScDocFunc& GetDocFunc() { return *pDocFunc; } + + SfxPrinter* GetPrinter( sal_Bool bCreateIfNotExist = sal_True ); + sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL ); + + void UpdateFontList(); + + String CreateObjectName( const String& rPrefix ); + + ScDrawLayer* MakeDrawLayer(); + + void AsciiSave( SvStream& rStream, const ScImportOptions& rOpt ); + + void GetSbxState( SfxItemSet &rSet ); + void GetDrawObjState( SfxItemSet &rSet ); + + void Execute( SfxRequest& rReq ); + void GetState( SfxItemSet &rSet ); + void ExecutePageStyle ( SfxViewShell& rCaller, SfxRequest& rReq, SCTAB nCurTab ); + void GetStatePageStyle( SfxViewShell& rCaller, SfxItemSet& rSet, SCTAB nCurTab ); + + void CompareDocument( ScDocument& rOtherDoc ); + void MergeDocument( ScDocument& rOtherDoc, bool bShared = false, bool bCheckDuplicates = false, sal_uLong nOffset = 0, ScChangeActionMergeMap* pMergeMap = NULL, bool bInverseMap = false ); + bool MergeSharedDocument( ScDocShell* pSharedDocShell ); + + ScChangeAction* GetChangeAction( const ScAddress& rPos ); + void SetChangeComment( ScChangeAction* pAction, const String& rComment ); + void ExecuteChangeCommentDialog( ScChangeAction* pAction, Window* pParent,sal_Bool bPrevNext=sal_True ); + /// Protect/unprotect ChangeTrack and return if + /// protection was successfully changed. + /// If bJustQueryIfProtected==sal_True protection is not + /// changed and is returned if not protected or + /// password was entered correctly. + sal_Bool ExecuteChangeProtectionDialog( Window* _pParent, sal_Bool bJustQueryIfProtected = sal_False ); + + void SetPrintZoom( SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages ); + sal_Bool AdjustPrintZoom( const ScRange& rRange ); + + void LoadStylesArgs( ScDocShell& rSource, sal_Bool bReplace, sal_Bool bCellStyles, sal_Bool bPageStyles ); + + void PageStyleModified( const String& rStyleName, sal_Bool bApi ); + + void NotifyStyle( const SfxStyleSheetHint& rHint ); + void DoAutoStyle( const ScRange& rRange, const String& rStyle ); + + Window* GetActiveDialogParent(); + void ErrorMessage( sal_uInt16 nGlobStrId ); + sal_Bool IsEditable() const; + + sal_Bool AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ); + void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL ); + void UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore = false ); + + void RefreshPivotTables( const ScRange& rSource ); + void DoConsolidate( const ScConsolidateParam& rParam, sal_Bool bRecord = sal_True ); + void UseScenario( SCTAB nTab, const String& rName, sal_Bool bRecord = sal_True ); + SCTAB MakeScenario( SCTAB nTab, const String& rName, const String& rComment, + const Color& rColor, sal_uInt16 nFlags, + ScMarkData& rMark, sal_Bool bRecord = sal_True ); + void ModifyScenario( SCTAB nTab, const String& rName, const String& rComment, + const Color& rColor, sal_uInt16 nFlags ); + sal_Bool MoveTable( SCTAB nSrcTab, SCTAB nDestTab, sal_Bool bCopy, sal_Bool bRecord ); + + void DoRecalc( sal_Bool bApi ); + void DoHardRecalc( sal_Bool bApi ); + + void UpdateOle( const ScViewData* pViewData, sal_Bool bSnapSize = sal_False); + sal_Bool IsOle(); + + void DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ); + ScDBData* GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ); + ScDBData* GetOldAutoDBRange(); // has to be deleted by caller! + void CancelAutoDBRange(); // called when dialog is cancelled + ScDBCollection* GetDBCollection(){ return aDocument.GetDBCollection();} + + void UpdateLinks(); // Link-Eintraege aktuallisieren + sal_Bool ReloadTabLinks(); // Links ausfuehren (Inhalt aktualisieren) + + void PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddress& rCursorPos ); + + void PostPaint( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, + SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, sal_uInt16 nPart, + sal_uInt16 nExtFlags = 0 ); + void PostPaint( const ScRange& rRange, sal_uInt16 nPart, sal_uInt16 nExtFlags = 0 ); + + void PostPaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab ); + void PostPaintCell( const ScAddress& rPos ); + void PostPaintGridAll(); + void PostPaintExtras(); + + bool IsPaintLocked() const { return pPaintLockData != NULL; } + + void PostDataChanged(); + + void UpdatePaintExt( sal_uInt16& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, + SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab ); + void UpdatePaintExt( sal_uInt16& rExtFlags, const ScRange& rRange ); + + void SetDocumentModified( sal_Bool bIsModified = sal_True ); + void SetDrawModified( sal_Bool bIsModified = sal_True ); + + void LockPaint(); + void UnlockPaint(); + sal_uInt16 GetLockCount() const; + void SetLockCount(sal_uInt16 nNew); + + void LockDocument(); + void UnlockDocument(); + + DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* ); + + virtual SfxStyleSheetBasePool* GetStyleSheetPool(); + + void SetInplace( sal_Bool bInplace ); + sal_Bool IsEmpty() const; + void SetEmpty(sal_Bool bSet); + + sal_Bool IsInUndo() const { return bIsInUndo; } + void SetInUndo(sal_Bool bSet); + + void CalcOutputFactor(); + double GetOutputFactor() const; + void GetPageOnFromPageStyleSet( const SfxItemSet* pStyleSet, + SCTAB nCurTab, + sal_Bool& rbHeader, + sal_Bool& rbFooter ); + + virtual long DdeGetData( const String& rItem, const String& rMimeType, + ::com::sun::star::uno::Any & rValue ); + virtual long DdeSetData( const String& rItem, const String& rMimeType, + const ::com::sun::star::uno::Any & rValue ); + virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem ); + + const String& GetDdeTextFmt() const { return aDdeTextFmt; } + + SfxBindings* GetViewBindings(); + + ScTabViewShell* GetBestViewShell( sal_Bool bOnlyVisible = sal_True ); + ScSbxDocHelper* GetDocHelperObject() { return pDocHelper; } + + void SetDocumentModifiedPending( sal_Bool bVal ) + { bDocumentModifiedPending = bVal; } + sal_Bool IsDocumentModifiedPending() const + { return bDocumentModifiedPending; } + + sal_Bool IsUpdateEnabled() const + { return bUpdateEnabled; } + void SetUpdateEnabled(sal_Bool bValue) + { bUpdateEnabled = bValue; } + + OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice... + + static ScViewData* GetViewData(); + static SCTAB GetCurTab(); + + static ScDocShell* GetShellByNum( sal_uInt16 nDocNo ); + static String GetOwnFilterName(); + static String GetHtmlFilterName(); + static String GetWebQueryFilterName(); + static String GetAsciiFilterName(); + static String GetLotusFilterName(); + static String GetDBaseFilterName(); + static String GetDifFilterName(); + static sal_Bool HasAutomaticTableName( const String& rFilter ); + + DECL_LINK( RefreshDBDataHdl, ScRefreshTimer* ); + + void BeforeXMLLoading(); + void AfterXMLLoading(sal_Bool bRet); + + virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates ); + + const ScOptSolverSave* GetSolverSaveData() const { return pSolverSaveData; } // may be null + void SetSolverSaveData( const ScOptSolverSave& rData ); + //Added by PengYunQuan for Validity Cell Range Picker + ScSheetSaveData* GetSheetSaveData(); + + // passwword protection for Calc (derived from SfxObjectShell) + // see also: FID_CHG_RECORD, SID_CHG_PROTECT + virtual bool IsChangeRecording() const; + virtual bool HasChangeRecordProtection() const; + virtual void SetChangeRecording( bool bActivate ); + virtual bool SetProtectionPassword( const String &rPassword ); + virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ); +}; + + +void UpdateAcceptChangesDialog(); + + +SO2_DECL_REF(ScDocShell) +SO2_IMPL_REF(ScDocShell) + + +// Vor Modifizierungen des Dokuments anlegen und danach zerstoeren. +// Merkt sich im Ctor AutoCalcShellDisabled und IdleDisabled, schaltet sie ab +// und stellt sie im Dtor wieder her, AutoCalcShellDisabled ggbf. auch vor +// einem ScDocShell SetDocumentModified. +// SetDocumentModified hierdran aufrufen statt an der ScDocShell. +// Im Dtor wird wenn ScDocShell bDocumentModifiedPending gesetzt ist und +// bAutoCalcShellDisabled nicht gesetzt ist ein SetDocumentModified gerufen. +class SC_DLLPUBLIC ScDocShellModificator +{ + ScDocShell& rDocShell; + ScRefreshTimerProtector aProtector; + sal_Bool bAutoCalcShellDisabled; + sal_Bool bIdleDisabled; + + // not implemented + ScDocShellModificator( const ScDocShellModificator& ); + ScDocShellModificator& operator=( const ScDocShellModificator& ); + +public: + ScDocShellModificator( ScDocShell& ); + ~ScDocShellModificator(); + void SetDocumentModified(); +}; + + + +#endif + + Index: sc/source/ui/navipi/content.cxx =================================================================== --- sc/source/ui/navipi/content.cxx (revision 1370673) +++ sc/source/ui/navipi/content.cxx (working copy) @@ -734,7 +734,8 @@ { ScDBData* pData = (*pDbNames)[i]; String aStrName = pData->GetName(); - if ( aStrName != aStrNoName ) + //if ( aStrName != aStrNoName ) + if ( !pData->IsBuildin() ) InsertContent( SC_CONTENT_DBAREA, aStrName ); } } Index: sc/source/ui/undo/undobase.cxx =================================================================== --- sc/source/ui/undo/undobase.cxx (revision 1370673) +++ sc/source/ui/undo/undobase.cxx (working copy) @@ -33,6 +33,7 @@ #include "undobase.hxx" #include "refundo.hxx" #include "docsh.hxx" +#include "dbdocfun.hxx" #include "tabvwsh.hxx" #include "undoolk.hxx" #include "undodraw.hxx" @@ -390,7 +391,7 @@ sal_uInt16 nNoNameIndex; ScDocument* pDoc = pDocShell->GetDocument(); ScDBCollection* pColl = pDoc->GetDBCollection(); - if ( pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nNoNameIndex ) ) + if ( pColl->SearchName( pAutoDBRange->GetName(), nNoNameIndex ) ) { ScDBData* pNoNameData = (*pColl)[nNoNameIndex]; @@ -403,6 +404,13 @@ pDocShell->DBAreaDeleted( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 ); *pNoNameData = *pAutoDBRange; + /*if (pAutoDBRange->HasQueryParam()) //maybe conflict with AOO + { + ScQueryParam aParam; + pAutoDBRange->GetQueryParam(aParam); + ScDBDocFunc aDBDocFunc( *pDocShell ); + aDBDocFunc.Query( nRangeTab, aParam, NULL, sal_False, sal_False ); + }*/ if ( pAutoDBRange->HasAutoFilter() ) { @@ -425,7 +433,7 @@ sal_uInt16 nNoNameIndex; ScDocument* pDoc = pDocShell->GetDocument(); ScDBCollection* pColl = pDoc->GetDBCollection(); - if ( pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nNoNameIndex ) ) + if ( pColl->SearchName( pAutoDBRange->GetName(), nNoNameIndex ) ) { ScDBData* pNoNameData = (*pColl)[nNoNameIndex]; @@ -435,6 +443,17 @@ SCROW nRangeY2; SCTAB nRangeTab; pNoNameData->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 ); + /*if (pAutoDBRange->HasQueryParam()) + { + ScQueryParam aParam; + pAutoDBRange->GetQueryParam(aParam); + SCSIZE nEC = aParam.GetEntryCount(); + for (SCSIZE i=0; iDBAreaDeleted( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 ); pNoNameData->SetSortParam( ScSortParam() ); Index: sc/source/ui/undo/undoutil.cxx =================================================================== --- sc/source/ui/undo/undoutil.cxx (revision 1370673) +++ sc/source/ui/undo/undoutil.cxx (working copy) @@ -93,7 +93,8 @@ { String aName; pUndoData->GetName( aName ); - if ( aName == ScGlobal::GetRscString( STR_DB_NONAME ) ) +// if ( aName == ScGlobal::GetRscString( STR_DB_NONAME ) ) + if (pUndoData->IsBuildin()) bWasTemp = sal_True; } DBG_ASSERT(bWasTemp, "Undo: didn't find database range"); @@ -104,7 +105,8 @@ pRet = (*pColl)[nIndex]; else { - pRet = new ScDBData( ScGlobal::GetRscString( STR_DB_NONAME ), nTab, + String aNoNamed = pColl->GetNewDefaultDBName(); + pRet = new ScDBData( aNoNamed/*ScGlobal::GetRscString( STR_DB_NONAME )*/, nTab, nCol1,nRow1, nCol2,nRow2, sal_True, pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) ); pColl->Insert( pRet ); Index: sc/source/ui/view/cellsh2.cxx =================================================================== --- sc/source/ui/view/cellsh2.cxx (revision 1370673) +++ sc/source/ui/view/cellsh2.cxx (working copy) @@ -357,7 +357,8 @@ ScSubTotalParam aSubTotalParam; SfxItemSet aArgSet( GetPool(), SCITEM_SUBTDATA, SCITEM_SUBTDATA ); - ScDBData* pDBData = pTabViewShell->GetDBData(); + //ScDBData* pDBData = pTabViewShell->GetDBData(); + ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SUBTOTAL); pDBData->GetSubTotalParam( aSubTotalParam ); aSubTotalParam.bRemoveOnly = sal_False; @@ -411,7 +412,7 @@ //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data //the patch comes from maoyg ScSortParam aSortParam; - ScDBData* pDBData = pTabViewShell->GetDBData(); + ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT); ScViewData* pData = GetViewData(); pDBData->GetSortParam( aSortParam ); @@ -462,7 +463,7 @@ if ( pArgs ) // Basic { ScSortParam aSortParam; - ScDBData* pDBData = pTabViewShell->GetDBData(); + ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT); ScViewData* pData = GetViewData(); pDBData->GetSortParam( aSortParam ); @@ -525,7 +526,7 @@ else { ScSortParam aSortParam; - ScDBData* pDBData = pTabViewShell->GetDBData(); + ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_MAKE_SORT); ScViewData* pData = GetViewData(); pDBData->GetSortParam( aSortParam ); @@ -680,7 +681,7 @@ case SID_UNFILTER: { ScQueryParam aParam; - ScDBData* pDBData = pTabViewShell->GetDBData(); + ScDBData* pDBData = pTabViewShell->GetDBData(sal_True, SC_DB_OLD_FILTER); pDBData->GetQueryParam( aParam ); SCSIZE nEC = aParam.GetEntryCount(); Index: sc/source/ui/view/dbfunc.cxx =================================================================== --- sc/source/ui/view/dbfunc.cxx (revision 1370673) +++ sc/source/ui/view/dbfunc.cxx (working copy) @@ -334,35 +334,37 @@ ScQueryParam aParam; ScDocument* pDoc = GetViewData()->GetDocument(); - ScDBData* pDBData = GetDBData( sal_False, SC_DB_MAKE, SC_DBSEL_ROW_DOWN ); + ScDBData* pDBData = GetDBData( sal_False, SC_DB_OLD_FILTER, SC_DBSEL_ROW_DOWN ); - pDBData->SetByRow( sal_True ); //! Undo, vorher abfragen ?? - pDBData->GetQueryParam( aParam ); + SCCOL nCol; - SCROW nRow = aParam.nRow1; + SCROW nRow; SCTAB nTab = GetViewData()->GetTabNo(); sal_Int16 nFlag; - sal_Bool bHasAuto = sal_True; - sal_Bool bHeader = pDBData->HasHeader(); + //sal_Bool bHasAuto = sal_True; + sal_Bool bHeader; sal_Bool bPaint = sal_False; //! stattdessen aus DB-Bereich abfragen? - for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++) + /*for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++) { nFlag = ((ScMergeFlagAttr*) pDoc-> GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); if ( (nFlag & SC_MF_AUTO) == 0 ) bHasAuto = sal_False; - } + }*/ - if (bHasAuto) // aufheben + if (pDBData && pDBData->HasAutoFilter()) // aufheben { // Filterknoepfe ausblenden - + pDBData->SetByRow( sal_True ); //! Undo, vorher abfragen ?? + pDBData->GetQueryParam( aParam ); + nRow = aParam.nRow1; + bHeader = pDBData->HasHeader(); for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++) { nFlag = ((ScMergeFlagAttr*) pDoc-> @@ -396,6 +398,12 @@ } else // Filterknoepfe einblenden { + pDBData = GetDBData(sal_False, SC_DB_MAKE_FILTER); + pDBData->SetByRow(sal_True); + pDBData->GetQueryParam(aParam); + nRow = aParam.nRow1; + bHeader = pDBData->HasHeader(); + if ( !pDoc->IsBlockEmpty( nTab, aParam.nCol1, aParam.nRow1, aParam.nCol2, aParam.nRow2 ) ) @@ -457,7 +465,8 @@ ScDocument* pDoc = pDocSh->GetDocument(); ScQueryParam aParam; - ScDBData* pDBData = GetDBData( sal_False ); + //ScDBData* pDBData = GetDBData( FALSE ); + ScDBData* pDBData = GetDBData(sal_False, SC_DB_OLD_FILTER); SCTAB nTab; SCCOL nCol1, nCol2; Index: sc/source/ui/view/tabvwshc.cxx =================================================================== --- sc/source/ui/view/tabvwshc.cxx (revision 1370673) +++ sc/source/ui/view/tabvwshc.cxx (working copy) @@ -171,7 +171,7 @@ SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); + ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE_FILTER, SC_DBSEL_ROW_DOWN); pDBData->GetQueryParam( aQueryParam ); ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam ); @@ -196,7 +196,7 @@ SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); + ScDBData* pDBData = GetDBData( sal_True, SC_DB_MAKE_FILTER, SC_DBSEL_ROW_DOWN); pDBData->GetQueryParam( aQueryParam ); aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA,