diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-02-26 16:01:28 +0100 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-02-26 16:01:28 +0100 |
commit | e63f20a19aed2667d2c05b070059aee1e0f76bdf (patch) | |
tree | f4a82ed15847f7fc8249eb38210c494c070ce2a8 | |
parent | 8c3ce6044a3a250a65eaa39c976ba0c03f3e09db (diff) | |
parent | 77fc63b415dcdbb231e640be0b401fa1dd604a0f (diff) |
calctabcolor: resynced with the repository to get more recent changes in.
31 files changed, 875 insertions, 827 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 44bda96f8322..28b2ac55706a 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -593,6 +593,9 @@ public: Color& rColor, USHORT& rFlags ) const; SC_DLLPUBLIC void SetScenarioData( SCTAB nTab, const String& rComment, const Color& rColor, USHORT nFlags ); + SC_DLLPUBLIC Color GetTabBgColor( SCTAB nTab ) const; + SC_DLLPUBLIC void SetTabBgColor( SCTAB nTab, const Color& rColor ); + SC_DLLPUBLIC bool IsDefaultTabBgColor( SCTAB nTab ) const; void GetScenarioFlags( SCTAB nTab, USHORT& rFlags ) const; SC_DLLPUBLIC BOOL IsActiveScenario( SCTAB nTab ) const; SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, BOOL bActive ); // nur fuer Undo etc. diff --git a/sc/inc/scextopt.hxx b/sc/inc/scextopt.hxx index 7bda6b9fd490..b02df9816ef4 100644 --- a/sc/inc/scextopt.hxx +++ b/sc/inc/scextopt.hxx @@ -77,8 +77,6 @@ struct ScExtTabSettings bool mbSelected; /// true = Sheet is selected. bool mbFrozenPanes; /// true = Frozen panes; false = Normal splits. bool mbPageMode; /// true = Pagebreak mode; false = Normal view mode. - Color maTabBgColor; /// Tab Bg Color - bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? TRUE : FALSE; }; explicit ScExtTabSettings(); }; diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index ee2c956e7742..1b239c61d336 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -287,13 +287,11 @@ SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rO void SetInSharedDocSaving( bool bNew ) { mbIsInSharedDocSaving = bNew; } bool IsInSharedDocSaving() const { return mbIsInSharedDocSaving; } - //<!--Added by PengYunQuan for Validity Cell Range Picker SC_DLLPUBLIC BOOL RegisterRefWindow( USHORT nSlotId, Window *pWnd ); SC_DLLPUBLIC BOOL UnregisterRefWindow( USHORT nSlotId, Window *pWnd ); SC_DLLPUBLIC BOOL IsAliveRefDlg( USHORT nSlotId, Window *pWnd ); SC_DLLPUBLIC Window * Find1RefWindow( USHORT nSlotId, Window *pWndAncestor ); SC_DLLPUBLIC Window * Find1RefWindow( Window *pWndAncestor ); - //-->Added by PengYunQuan for Validity Cell Range Picker }; #define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) ) diff --git a/sc/inc/tabbgcolor.hxx b/sc/inc/tabbgcolor.hxx index 83b694af6219..c2b2a63baf65 100644 --- a/sc/inc/tabbgcolor.hxx +++ b/sc/inc/tabbgcolor.hxx @@ -27,20 +27,28 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ + #ifndef SC_TABBGCOLOR_HXX #define SC_TABBGCOLOR_HXX -#include <tools/color.hxx> -#include <tools/list.hxx> +#include "tools/color.hxx" +#include "address.hxx" + +#include <vector> -struct ScUndoSetTabBgColorInfo +struct ScUndoTabColorInfo { -public: - SCTAB nTabId; - Color aOldTabBgColor; - Color aNewTabBgColor; - BOOL IsDefaultOldTabBgColor() const {return aOldTabBgColor == Color( COL_AUTO ) ? TRUE : FALSE ;}; - BOOL IsDefaultNewTabBgColor() const {return aOldTabBgColor == Color( COL_AUTO ) ? TRUE : FALSE ;}; + SCTAB mnTabId; + Color maOldTabBgColor; + Color maNewTabBgColor; + + bool IsDefaultOldTabBgColor() const; + bool IsDefaultNewTabBgColor() const; + + explicit ScUndoTabColorInfo(SCTAB nTab); + ScUndoTabColorInfo(const ScUndoTabColorInfo& r); + + typedef ::std::vector<ScUndoTabColorInfo> List; }; -DECLARE_LIST( ScUndoSetTabBgColorInfoList, ScUndoSetTabBgColorInfo* ) + #endif diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 55d31d30430e..650af8b3c857 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -153,6 +153,7 @@ private: ScRangeList* pScenarioRanges; Color aScenarioColor; + Color aTabBgColor; USHORT nScenarioFlags; BOOL bActiveScenario; @@ -209,6 +210,8 @@ public: void SetScenarioComment( const String& rComment ) { aComment = rComment; } const Color& GetScenarioColor() const { return aScenarioColor; } void SetScenarioColor(const Color& rNew) { aScenarioColor = rNew; } + const Color& GetTabBgColor() const; + void SetTabBgColor(const Color& rColor); USHORT GetScenarioFlags() const { return nScenarioFlags; } void SetScenarioFlags(USHORT nNew) { nScenarioFlags = nNew; } void SetActiveScenario(BOOL bSet) { bActiveScenario = bSet; } diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 5fac22a082a8..e1801c37fcc1 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -173,6 +173,7 @@ #define SC_UNONAME_COPYFORM "CopyFormulas" #define SC_UNONAME_TABLAYOUT "TableLayout" #define SC_UNONAME_AUTOPRINT "AutomaticPrintArea" +#define SC_UNONAME_TABCOLOR "TabColor" // LinkTarget #define SC_UNO_LINKDISPBIT "LinkDisplayBitmap" @@ -526,7 +527,6 @@ #define SC_UNO_ZOOMTYPE "ZoomType" #define SC_UNO_ZOOMVALUE "ZoomValue" #define SC_UNO_UPDTEMPL "UpdateFromTemplate" -#define SC_UNO_TABCOLOR "TabColor" /*Stampit enable/disable print cancel */ #define SC_UNO_ALLOWPRINTJOBCANCEL "AllowPrintJobCancel" diff --git a/sc/inc/unowids.hxx b/sc/inc/unowids.hxx index 1765b9d06361..c5cd0cefeb6c 100644 --- a/sc/inc/unowids.hxx +++ b/sc/inc/unowids.hxx @@ -77,7 +77,8 @@ #define SC_WID_UNO_TABLAYOUT ( SC_WID_UNO_START + 37 ) #define SC_WID_UNO_AUTOPRINT ( SC_WID_UNO_START + 38 ) #define SC_WID_UNO_ABSNAME ( SC_WID_UNO_START + 39 ) -#define SC_WID_UNO_END ( SC_WID_UNO_START + 39 ) +#define SC_WID_UNO_TABCOLOR ( SC_WID_UNO_START + 40 ) +#define SC_WID_UNO_END ( SC_WID_UNO_START + 40 ) inline BOOL IsScUnoWid( USHORT nWid ) diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index cc06d7ac6b32..3f484520ae6a 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -280,6 +280,26 @@ void ScDocument::SetScenarioData( SCTAB nTab, const String& rComment, } } +Color ScDocument::GetTabBgColor( SCTAB nTab ) const +{ + if (ValidTab(nTab) && pTab[nTab]) + return pTab[nTab]->GetTabBgColor(); + return Color(COL_AUTO); +} + +void ScDocument::SetTabBgColor( SCTAB nTab, const Color& rColor ) +{ + if (ValidTab(nTab) && pTab[nTab]) + pTab[nTab]->SetTabBgColor(rColor); +} + +bool ScDocument::IsDefaultTabBgColor( SCTAB nTab ) const +{ + if (ValidTab(nTab) && pTab[nTab]) + return pTab[nTab]->GetTabBgColor() == COL_AUTO; + return true; +} + void ScDocument::GetScenarioData( SCTAB nTab, String& rComment, Color& rColor, USHORT& rFlags ) const { diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk index 1dd60f75176e..858a3835c58d 100644 --- a/sc/source/core/data/makefile.mk +++ b/sc/source/core/data/makefile.mk @@ -100,6 +100,7 @@ SLOFILES = \ $(SLO)$/sortparam.obj \ $(SLO)$/stlpool.obj \ $(SLO)$/stlsheet.obj \ + $(SLO)$/tabbgcolor.obj \ $(SLO)$/table1.obj \ $(SLO)$/table2.obj \ $(SLO)$/table3.obj \ @@ -126,6 +127,7 @@ EXCEPTIONSFILES= \ $(SLO)$/dptabres.obj \ $(SLO)$/dptabdat.obj \ $(SLO)$/global2.obj \ + $(SLO)$/tabbgcolor.obj \ $(SLO)$/table1.obj \ $(SLO)$/table2.obj \ $(SLO)$/table3.obj \ diff --git a/sc/source/core/data/tabbgcolor.cxx b/sc/source/core/data/tabbgcolor.cxx new file mode 100644 index 000000000000..a3d9eec16d99 --- /dev/null +++ b/sc/source/core/data/tabbgcolor.cxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabbgcolor.hxx,v $ + * $Revision: 1.00 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" + + + +// INCLUDE --------------------------------------------------------------- + +#include "tabbgcolor.hxx" + +bool ScUndoTabColorInfo::IsDefaultOldTabBgColor() const +{ + return maOldTabBgColor == Color(COL_AUTO); +} + +bool ScUndoTabColorInfo::IsDefaultNewTabBgColor() const +{ + return maOldTabBgColor == Color(COL_AUTO); +} + +ScUndoTabColorInfo::ScUndoTabColorInfo(SCTAB nTab) : + mnTabId(nTab), + maOldTabBgColor(COL_AUTO), + maNewTabBgColor(COL_AUTO) +{ +} + +ScUndoTabColorInfo::ScUndoTabColorInfo(const ScUndoTabColorInfo& r) : + mnTabId(r.mnTabId), + maOldTabBgColor(r.maOldTabBgColor), + maNewTabBgColor(r.maNewTabBgColor) +{ +} diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 76656accdf46..fafff6edcd13 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -153,6 +153,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName, nLockCount( 0 ), pScenarioRanges( NULL ), aScenarioColor( COL_LIGHTGRAY ), + aTabBgColor( COL_AUTO ), nScenarioFlags( 0 ), bActiveScenario( FALSE ) { @@ -276,6 +277,22 @@ void ScTable::SetLoadingRTL( BOOL bSet ) bLoadingRTL = bSet; } +const Color& ScTable::GetTabBgColor() const +{ + return aTabBgColor; +} + +void ScTable::SetTabBgColor(const Color& rColor) +{ + if (aTabBgColor != rColor) + { + // The tab color has changed. Set this table 'modified'. + aTabBgColor = rColor; + if (IsStreamValid()) + SetStreamValid(false); + } +} + void ScTable::SetScenario( BOOL bFlag ) { bScenario = bFlag; diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx index a4feed9725cc..035afd0a5830 100644 --- a/sc/source/filter/excel/xeview.cxx +++ b/sc/source/filter/excel/xeview.cxx @@ -394,14 +394,14 @@ XclExpTabViewSettings::XclExpTabViewSettings( const XclExpRoot& rRoot, SCTAB nSc maData.mnNormalZoom = lclGetXclZoom( rTabSett.mnNormalZoom, EXC_WIN2_NORMALZOOM_DEF ); maData.mnPageZoom = lclGetXclZoom( rTabSett.mnPageZoom, EXC_WIN2_PAGEZOOM_DEF ); maData.mnCurrentZoom = maData.mbPageMode ? maData.mnPageZoom : maData.mnNormalZoom; + } - // Tab Bg Color - if ( GetBiff() == EXC_BIFF8 && !rTabSett.IsDefaultTabBgColor() ) - { - XclExpPalette& rPal = GetPalette(); - maData.maTabBgColor = rTabSett.maTabBgColor; - maData.mnTabBgColorId = rPal.InsertColor(maData.maTabBgColor, EXC_COLOR_TABBG, EXC_COLOR_NOTABBG ); - } + // Tab Bg Color + if ( GetBiff() == EXC_BIFF8 && !GetDoc().IsDefaultTabBgColor(nScTab) ) + { + XclExpPalette& rPal = GetPalette(); + maData.maTabBgColor = GetDoc().GetTabBgColor(nScTab); + maData.mnTabBgColorId = rPal.InsertColor(maData.maTabBgColor, EXC_COLOR_TABBG, EXC_COLOR_NOTABBG ); } } diff --git a/sc/source/filter/excel/xiview.cxx b/sc/source/filter/excel/xiview.cxx index 747ded0efe92..f75032ff461e 100644 --- a/sc/source/filter/excel/xiview.cxx +++ b/sc/source/filter/excel/xiview.cxx @@ -297,7 +297,7 @@ void XclImpTabViewSettings::Finalize() // *** set tab bg color if ( !maData.IsDefaultTabBgColor() ) - rTabSett.maTabBgColor = maData.maTabBgColor; + rDoc.SetTabBgColor(nScTab, maData.maTabBgColor); } // ============================================================================ diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index d53f26a5e887..b3f08f7e554d 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -84,6 +84,7 @@ #include <rtl/ustring.hxx> #include <tools/debug.hxx> +#include "tools/color.hxx" #include <rtl/math.hxx> #include <svl/zforlist.hxx> #include <svx/unoshape.hxx> @@ -124,6 +125,7 @@ #include <com/sun/star/form/XFormsSupplier2.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> @@ -161,6 +163,7 @@ using namespace formula; using namespace com::sun::star; using namespace xmloff::token; using ::std::vector; +using ::com::sun::star::uno::UNO_QUERY; //---------------------------------------------------------------------------- @@ -1705,132 +1708,130 @@ void ScXMLExport::_ExportContent() } else { - //! indent after rebasing to m52 - - uno::Reference<sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY); - if (xTable.is()) - { - xCurrentTable.set(xTable); - xCurrentTableCellRange.set(xTable, uno::UNO_QUERY); - uno::Reference<container::XNamed> xName (xTable, uno::UNO_QUERY ); - if ( xName.is() ) + uno::Reference<sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY); + if (xTable.is()) { - nCurrentTable = sal::static_int_cast<sal_uInt16>( nTable ); - rtl::OUString sOUTableName(xName->getName()); - AddAttribute(sAttrName, sOUTableName); - AddAttribute(sAttrStyleName, aTableStyles[nTable]); - uno::Reference<util::XProtectable> xProtectable (xTable, uno::UNO_QUERY); - if (xProtectable.is() && xProtectable->isProtected()) + xCurrentTable.set(xTable); + xCurrentTableCellRange.set(xTable, uno::UNO_QUERY); + uno::Reference<container::XNamed> xName (xTable, uno::UNO_QUERY ); + if ( xName.is() ) { - AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE); - rtl::OUStringBuffer aBuffer; - if (pDoc) + nCurrentTable = sal::static_int_cast<sal_uInt16>( nTable ); + rtl::OUString sOUTableName(xName->getName()); + AddAttribute(sAttrName, sOUTableName); + AddAttribute(sAttrStyleName, aTableStyles[nTable]); + + uno::Reference<util::XProtectable> xProtectable (xTable, uno::UNO_QUERY); + if (xProtectable.is() && xProtectable->isProtected()) { - ScTableProtection* pProtect = pDoc->GetTabProtection(static_cast<SCTAB>(nTable)); - if (pProtect) - SvXMLUnitConverter::encodeBase64(aBuffer, pProtect->getPasswordHash(PASSHASH_OOO)); + AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE); + rtl::OUStringBuffer aBuffer; + if (pDoc) + { + ScTableProtection* pProtect = pDoc->GetTabProtection(static_cast<SCTAB>(nTable)); + if (pProtect) + SvXMLUnitConverter::encodeBase64(aBuffer, pProtect->getPasswordHash(PASSHASH_OOO)); + } + if (aBuffer.getLength()) + AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear()); } - if (aBuffer.getLength()) - AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear()); - } - rtl::OUString sPrintRanges; - table::CellRangeAddress aColumnHeaderRange; - sal_Bool bHasColumnHeader; - GetColumnRowHeader(bHasColumnHeader, aColumnHeaderRange, bHasRowHeader, aRowHeaderRange, sPrintRanges); - if( sPrintRanges.getLength() ) - AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT_RANGES, sPrintRanges ); - else if (!pDoc->IsPrintEntireSheet(static_cast<SCTAB>(nTable))) - AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT, XML_FALSE); - SvXMLElementExport aElemT(*this, sElemTab, sal_True, sal_True); - CheckAttrList(); - WriteTableSource(); - WriteScenario(); - uno::Reference<drawing::XDrawPage> xDrawPage; - if (pSharedData->HasForm(nTable, xDrawPage) && xDrawPage.is()) - { - ::xmloff::OOfficeFormsExport aForms(*this); - GetFormExport()->exportForms( xDrawPage ); - sal_Bool bRet(GetFormExport()->seekPage( xDrawPage )); - DBG_ASSERT( bRet, "OFormLayerXMLExport::seekPage failed!" ); - (void)bRet; // avoid warning in product version - } - if (pSharedData->HasDrawPage()) - { - GetShapeExport()->seekShapes(uno::Reference<drawing::XShapes>(pSharedData->GetDrawPage(nTable), uno::UNO_QUERY)); - WriteTableShapes(); - } - table::CellRangeAddress aRange(GetEndAddress(xTable, nTable)); - pSharedData->SetLastColumn(nTable, aRange.EndColumn); - pSharedData->SetLastRow(nTable, aRange.EndRow); - pCellsItr->SetCurrentTable(static_cast<SCTAB>(nTable), xCurrentTable); - pGroupColumns->NewTable(); - pGroupRows->NewTable(); - FillColumnRowGroups(); - if (bHasColumnHeader) - pSharedData->SetLastColumn(nTable, aColumnHeaderRange.EndColumn); - bRowHeaderOpen = sal_False; - if (bHasRowHeader) - pSharedData->SetLastRow(nTable, aRowHeaderRange.EndRow); - pDefaults->FillDefaultStyles(nTable, pSharedData->GetLastRow(nTable), - pSharedData->GetLastColumn(nTable), pCellStyles, pDoc); - pRowFormatRanges->SetRowDefaults(pDefaults->GetRowDefaults()); - pRowFormatRanges->SetColDefaults(pDefaults->GetColDefaults()); - pCellStyles->SetRowDefaults(pDefaults->GetRowDefaults()); - pCellStyles->SetColDefaults(pDefaults->GetColDefaults()); - ExportColumns(nTable, aColumnHeaderRange, bHasColumnHeader); - sal_Bool bIsFirst(sal_True); - sal_Int32 nEqualCells(0); - ScMyCell aCell; - ScMyCell aPrevCell; - while(pCellsItr->GetNext(aCell, pCellStyles)) - { - if (bIsFirst) + rtl::OUString sPrintRanges; + table::CellRangeAddress aColumnHeaderRange; + sal_Bool bHasColumnHeader; + GetColumnRowHeader(bHasColumnHeader, aColumnHeaderRange, bHasRowHeader, aRowHeaderRange, sPrintRanges); + if( sPrintRanges.getLength() ) + AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT_RANGES, sPrintRanges ); + else if (!pDoc->IsPrintEntireSheet(static_cast<SCTAB>(nTable))) + AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT, XML_FALSE); + SvXMLElementExport aElemT(*this, sElemTab, sal_True, sal_True); + CheckAttrList(); + WriteTableSource(); + WriteScenario(); + uno::Reference<drawing::XDrawPage> xDrawPage; + if (pSharedData->HasForm(nTable, xDrawPage) && xDrawPage.is()) { - ExportFormatRanges(0, 0, aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable); - aPrevCell = aCell; - bIsFirst = sal_False; + ::xmloff::OOfficeFormsExport aForms(*this); + GetFormExport()->exportForms( xDrawPage ); + sal_Bool bRet(GetFormExport()->seekPage( xDrawPage )); + DBG_ASSERT( bRet, "OFormLayerXMLExport::seekPage failed!" ); + (void)bRet; // avoid warning in product version } - else + if (pSharedData->HasDrawPage()) { - if ((aPrevCell.aCellAddress.Row == aCell.aCellAddress.Row) && - (aPrevCell.aCellAddress.Column + nEqualCells + 1 == aCell.aCellAddress.Column)) + GetShapeExport()->seekShapes(uno::Reference<drawing::XShapes>(pSharedData->GetDrawPage(nTable), uno::UNO_QUERY)); + WriteTableShapes(); + } + table::CellRangeAddress aRange(GetEndAddress(xTable, nTable)); + pSharedData->SetLastColumn(nTable, aRange.EndColumn); + pSharedData->SetLastRow(nTable, aRange.EndRow); + pCellsItr->SetCurrentTable(static_cast<SCTAB>(nTable), xCurrentTable); + pGroupColumns->NewTable(); + pGroupRows->NewTable(); + FillColumnRowGroups(); + if (bHasColumnHeader) + pSharedData->SetLastColumn(nTable, aColumnHeaderRange.EndColumn); + bRowHeaderOpen = sal_False; + if (bHasRowHeader) + pSharedData->SetLastRow(nTable, aRowHeaderRange.EndRow); + pDefaults->FillDefaultStyles(nTable, pSharedData->GetLastRow(nTable), + pSharedData->GetLastColumn(nTable), pCellStyles, pDoc); + pRowFormatRanges->SetRowDefaults(pDefaults->GetRowDefaults()); + pRowFormatRanges->SetColDefaults(pDefaults->GetColDefaults()); + pCellStyles->SetRowDefaults(pDefaults->GetRowDefaults()); + pCellStyles->SetColDefaults(pDefaults->GetColDefaults()); + ExportColumns(nTable, aColumnHeaderRange, bHasColumnHeader); + sal_Bool bIsFirst(sal_True); + sal_Int32 nEqualCells(0); + ScMyCell aCell; + ScMyCell aPrevCell; + while(pCellsItr->GetNext(aCell, pCellStyles)) + { + if (bIsFirst) + { + ExportFormatRanges(0, 0, aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable); + aPrevCell = aCell; + bIsFirst = sal_False; + } + else { - if(IsCellEqual(aPrevCell, aCell)) - ++nEqualCells; + if ((aPrevCell.aCellAddress.Row == aCell.aCellAddress.Row) && + (aPrevCell.aCellAddress.Column + nEqualCells + 1 == aCell.aCellAddress.Column)) + { + if(IsCellEqual(aPrevCell, aCell)) + ++nEqualCells; + else + { + SetRepeatAttribute(nEqualCells); + WriteCell(aPrevCell); + nEqualCells = 0; + aPrevCell = aCell; + } + } else { SetRepeatAttribute(nEqualCells); WriteCell(aPrevCell); + ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row, + aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable); nEqualCells = 0; aPrevCell = aCell; } } - else - { - SetRepeatAttribute(nEqualCells); - WriteCell(aPrevCell); - ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row, - aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable); - nEqualCells = 0; - aPrevCell = aCell; - } } + if (!bIsFirst) + { + SetRepeatAttribute(nEqualCells); + WriteCell(aPrevCell); + ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row, + pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable); + } + else + ExportFormatRanges(0, 0, pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable); + CloseRow(pSharedData->GetLastRow(nTable)); + nEqualCells = 0; } - if (!bIsFirst) - { - SetRepeatAttribute(nEqualCells); - WriteCell(aPrevCell); - ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row, - pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable); - } - else - ExportFormatRanges(0, 0, pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable); - CloseRow(pSharedData->GetLastRow(nTable)); - nEqualCells = 0; } } - - } IncrementProgressBar(sal_False); } } @@ -2148,498 +2149,502 @@ uno::Any lcl_GetEnumerated( uno::Reference<container::XEnumerationAccess> xEnumA void ScXMLExport::_ExportAutoStyles() { - if (GetModel().is()) + if (!GetModel().is()) + // no model to export. + return; + + uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY ); + if (!xSpreadDoc.is()) + // no spreadsheet document to export. + return; + + uno::Reference<container::XIndexAccess> xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY ); + if (!xIndex.is()) + // no sheets to export. + return; + + if (getExportFlags() & EXPORT_CONTENT) { - uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY ); - if ( xSpreadDoc.is() ) + // re-create automatic styles with old names from stored data + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData(); + if (pSheetData && pDoc) { - uno::Reference<container::XIndexAccess> xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY ); - if ( xIndex.is() ) - { - if (getExportFlags() & EXPORT_CONTENT) + // formulas have to be calculated now, to detect changed results + // (during normal save, they will be calculated anyway) + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB nTab=0; nTab<nTabCount; ++nTab) + if (pDoc->IsStreamValid(nTab)) { - // re-create automatic styles with old names from stored data - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData(); - if (pSheetData && pDoc) + ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab ); + ScBaseCell* pCell = aIter.GetFirst(); + while (pCell) { - // formulas have to be calculated now, to detect changed results - // (during normal save, they will be calculated anyway) - SCTAB nTabCount = pDoc->GetTableCount(); - for (SCTAB nTab=0; nTab<nTabCount; ++nTab) - if (pDoc->IsStreamValid(nTab)) - { - ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab ); - ScBaseCell* pCell = aIter.GetFirst(); - while (pCell) - { - if (pCell->GetCellType() == CELLTYPE_FORMULA) - static_cast<ScFormulaCell*>(pCell)->IsValue(); // interpret if dirty - pCell = aIter.GetNext(); - } - } + if (pCell->GetCellType() == CELLTYPE_FORMULA) + static_cast<ScFormulaCell*>(pCell)->IsValue(); // interpret if dirty + pCell = aIter.GetNext(); + } + } - // stored cell styles - const std::vector<ScCellStyleEntry>& rCellEntries = pSheetData->GetCellStyles(); - std::vector<ScCellStyleEntry>::const_iterator aCellIter = rCellEntries.begin(); - std::vector<ScCellStyleEntry>::const_iterator aCellEnd = rCellEntries.end(); - while (aCellIter != aCellEnd) - { - ScAddress aPos = aCellIter->maCellPos; - sal_Int32 nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); - if (bCopySheet) - { - uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY); - uno::Reference <beans::XPropertySet> xProperties( - xTable->getCellByPosition( aPos.Col(), aPos.Row() ), uno::UNO_QUERY ); + // stored cell styles + const std::vector<ScCellStyleEntry>& rCellEntries = pSheetData->GetCellStyles(); + std::vector<ScCellStyleEntry>::const_iterator aCellIter = rCellEntries.begin(); + std::vector<ScCellStyleEntry>::const_iterator aCellEnd = rCellEntries.end(); + while (aCellIter != aCellEnd) + { + ScAddress aPos = aCellIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); + if (bCopySheet) + { + uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY); + uno::Reference <beans::XPropertySet> xProperties( + xTable->getCellByPosition( aPos.Col(), aPos.Row() ), uno::UNO_QUERY ); - AddStyleFromCells(xProperties, xTable, nTable, &aCellIter->maName); - } - ++aCellIter; - } + AddStyleFromCells(xProperties, xTable, nTable, &aCellIter->maName); + } + ++aCellIter; + } - // stored column styles - const std::vector<ScCellStyleEntry>& rColumnEntries = pSheetData->GetColumnStyles(); - std::vector<ScCellStyleEntry>::const_iterator aColumnIter = rColumnEntries.begin(); - std::vector<ScCellStyleEntry>::const_iterator aColumnEnd = rColumnEntries.end(); - while (aColumnIter != aColumnEnd) - { - ScAddress aPos = aColumnIter->maCellPos; - sal_Int32 nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); - if (bCopySheet) - { - uno::Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY); - uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns()); - uno::Reference<beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex( aPos.Col() ), uno::UNO_QUERY); + // stored column styles + const std::vector<ScCellStyleEntry>& rColumnEntries = pSheetData->GetColumnStyles(); + std::vector<ScCellStyleEntry>::const_iterator aColumnIter = rColumnEntries.begin(); + std::vector<ScCellStyleEntry>::const_iterator aColumnEnd = rColumnEntries.end(); + while (aColumnIter != aColumnEnd) + { + ScAddress aPos = aColumnIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); + if (bCopySheet) + { + uno::Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY); + uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns()); + uno::Reference<beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex( aPos.Col() ), uno::UNO_QUERY); - sal_Int32 nIndex(-1); - sal_Bool bIsVisible(sal_True); - AddStyleFromColumn( xColumnProperties, &aColumnIter->maName, nIndex, bIsVisible ); - } - ++aColumnIter; - } + sal_Int32 nIndex(-1); + sal_Bool bIsVisible(sal_True); + AddStyleFromColumn( xColumnProperties, &aColumnIter->maName, nIndex, bIsVisible ); + } + ++aColumnIter; + } - // stored row styles - const std::vector<ScCellStyleEntry>& rRowEntries = pSheetData->GetRowStyles(); - std::vector<ScCellStyleEntry>::const_iterator aRowIter = rRowEntries.begin(); - std::vector<ScCellStyleEntry>::const_iterator aRowEnd = rRowEntries.end(); - while (aRowIter != aRowEnd) - { - ScAddress aPos = aRowIter->maCellPos; - sal_Int32 nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); - if (bCopySheet) - { - uno::Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY); - uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows()); - uno::Reference<beans::XPropertySet> xRowProperties(xTableRows->getByIndex( aPos.Row() ), uno::UNO_QUERY); + // stored row styles + const std::vector<ScCellStyleEntry>& rRowEntries = pSheetData->GetRowStyles(); + std::vector<ScCellStyleEntry>::const_iterator aRowIter = rRowEntries.begin(); + std::vector<ScCellStyleEntry>::const_iterator aRowEnd = rRowEntries.end(); + while (aRowIter != aRowEnd) + { + ScAddress aPos = aRowIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); + if (bCopySheet) + { + uno::Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows()); + uno::Reference<beans::XPropertySet> xRowProperties(xTableRows->getByIndex( aPos.Row() ), uno::UNO_QUERY); - sal_Int32 nIndex(-1); - AddStyleFromRow( xRowProperties, &aRowIter->maName, nIndex ); - } - ++aRowIter; - } + sal_Int32 nIndex(-1); + AddStyleFromRow( xRowProperties, &aRowIter->maName, nIndex ); + } + ++aRowIter; + } - // stored table styles - const std::vector<ScCellStyleEntry>& rTableEntries = pSheetData->GetTableStyles(); - std::vector<ScCellStyleEntry>::const_iterator aTableIter = rTableEntries.begin(); - std::vector<ScCellStyleEntry>::const_iterator aTableEnd = rTableEntries.end(); - while (aTableIter != aTableEnd) - { - ScAddress aPos = aTableIter->maCellPos; - sal_Int32 nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); - if (bCopySheet) - { - //! separate method AddStyleFromTable needed? - uno::Reference<beans::XPropertySet> xTableProperties(xIndex->getByIndex(nTable), uno::UNO_QUERY); - if (xTableProperties.is()) - { - std::vector<XMLPropertyState> xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties)); - rtl::OUString sParent; - rtl::OUString sName( aTableIter->maName ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TABLE_TABLE, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_TABLE, sName); - } - } - ++aTableIter; - } + // stored table styles + const std::vector<ScCellStyleEntry>& rTableEntries = pSheetData->GetTableStyles(); + std::vector<ScCellStyleEntry>::const_iterator aTableIter = rTableEntries.begin(); + std::vector<ScCellStyleEntry>::const_iterator aTableEnd = rTableEntries.end(); + while (aTableIter != aTableEnd) + { + ScAddress aPos = aTableIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); + if (bCopySheet) + { + //! separate method AddStyleFromTable needed? + uno::Reference<beans::XPropertySet> xTableProperties(xIndex->getByIndex(nTable), uno::UNO_QUERY); + if (xTableProperties.is()) + { + std::vector<XMLPropertyState> xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties)); + rtl::OUString sParent; + rtl::OUString sName( aTableIter->maName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TABLE_TABLE, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_TABLE, sName); + } + } + ++aTableIter; + } - // stored styles for notes + // stored styles for notes - UniReference<SvXMLExportPropertyMapper> xShapeMapper = XMLShapeExport::CreateShapePropMapper( *this ); - GetShapeExport(); // make sure the graphics styles family is added + UniReference<SvXMLExportPropertyMapper> xShapeMapper = XMLShapeExport::CreateShapePropMapper( *this ); + GetShapeExport(); // make sure the graphics styles family is added - const std::vector<ScNoteStyleEntry>& rNoteEntries = pSheetData->GetNoteStyles(); - std::vector<ScNoteStyleEntry>::const_iterator aNoteIter = rNoteEntries.begin(); - std::vector<ScNoteStyleEntry>::const_iterator aNoteEnd = rNoteEntries.end(); - while (aNoteIter != aNoteEnd) + const std::vector<ScNoteStyleEntry>& rNoteEntries = pSheetData->GetNoteStyles(); + std::vector<ScNoteStyleEntry>::const_iterator aNoteIter = rNoteEntries.begin(); + std::vector<ScNoteStyleEntry>::const_iterator aNoteEnd = rNoteEntries.end(); + while (aNoteIter != aNoteEnd) + { + ScAddress aPos = aNoteIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); + if (bCopySheet) + { + //! separate method AddStyleFromNote needed? + + ScPostIt* pNote = pDoc->GetNote( aPos ); + DBG_ASSERT( pNote, "note not found" ); + if (pNote) + { + SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); + // all uno shapes are created anyway in CollectSharedData + uno::Reference<beans::XPropertySet> xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY ); + if (xShapeProperties.is()) { - ScAddress aPos = aNoteIter->maCellPos; - sal_Int32 nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); - if (bCopySheet) + if ( aNoteIter->maStyleName.getLength() ) { - //! separate method AddStyleFromNote needed? - - ScPostIt* pNote = pDoc->GetNote( aPos ); - DBG_ASSERT( pNote, "note not found" ); - if (pNote) - { - SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); - // all uno shapes are created anyway in CollectSharedData - uno::Reference<beans::XPropertySet> xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY ); - if (xShapeProperties.is()) - { - if ( aNoteIter->maStyleName.getLength() ) - { - std::vector<XMLPropertyState> xPropStates(xShapeMapper->Filter(xShapeProperties)); - rtl::OUString sParent; - rtl::OUString sName( aNoteIter->maStyleName ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_SD_GRAPHICS_ID, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_SD_GRAPHICS_ID, sName); - } - if ( aNoteIter->maTextStyle.getLength() ) - { - std::vector<XMLPropertyState> xPropStates( - GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(xShapeProperties)); - rtl::OUString sParent; - rtl::OUString sName( aNoteIter->maTextStyle ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); - } - } - } + std::vector<XMLPropertyState> xPropStates(xShapeMapper->Filter(xShapeProperties)); + rtl::OUString sParent; + rtl::OUString sName( aNoteIter->maStyleName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_SD_GRAPHICS_ID, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_SD_GRAPHICS_ID, sName); + } + if ( aNoteIter->maTextStyle.getLength() ) + { + std::vector<XMLPropertyState> xPropStates( + GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(xShapeProperties)); + rtl::OUString sParent; + rtl::OUString sName( aNoteIter->maTextStyle ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); } - ++aNoteIter; } + } + } + ++aNoteIter; + } - // note paragraph styles + // note paragraph styles - //UniReference<SvXMLExportPropertyMapper> xParaPropMapper = XMLTextParagraphExport::CreateParaExtPropMapper( *this ); - UniReference<SvXMLExportPropertyMapper> xParaPropMapper = GetTextParagraphExport()->GetParagraphPropertyMapper(); + //UniReference<SvXMLExportPropertyMapper> xParaPropMapper = XMLTextParagraphExport::CreateParaExtPropMapper( *this ); + UniReference<SvXMLExportPropertyMapper> xParaPropMapper = GetTextParagraphExport()->GetParagraphPropertyMapper(); - const std::vector<ScTextStyleEntry>& rNoteParaEntries = pSheetData->GetNoteParaStyles(); - std::vector<ScTextStyleEntry>::const_iterator aNoteParaIter = rNoteParaEntries.begin(); - std::vector<ScTextStyleEntry>::const_iterator aNoteParaEnd = rNoteParaEntries.end(); - while (aNoteParaIter != aNoteParaEnd) + const std::vector<ScTextStyleEntry>& rNoteParaEntries = pSheetData->GetNoteParaStyles(); + std::vector<ScTextStyleEntry>::const_iterator aNoteParaIter = rNoteParaEntries.begin(); + std::vector<ScTextStyleEntry>::const_iterator aNoteParaEnd = rNoteParaEntries.end(); + while (aNoteParaIter != aNoteParaEnd) + { + ScAddress aPos = aNoteParaIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); + if (bCopySheet) + { + ScPostIt* pNote = pDoc->GetNote( aPos ); + DBG_ASSERT( pNote, "note not found" ); + if (pNote) + { + SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); + uno::Reference<container::XEnumerationAccess> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xParaProp( + lcl_GetEnumerated( xCellText, aNoteParaIter->maSelection.nStartPara ), uno::UNO_QUERY ); + if ( xParaProp.is() ) { - ScAddress aPos = aNoteParaIter->maCellPos; - sal_Int32 nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); - if (bCopySheet) - { - ScPostIt* pNote = pDoc->GetNote( aPos ); - DBG_ASSERT( pNote, "note not found" ); - if (pNote) - { - SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); - uno::Reference<container::XEnumerationAccess> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xParaProp( - lcl_GetEnumerated( xCellText, aNoteParaIter->maSelection.nStartPara ), uno::UNO_QUERY ); - if ( xParaProp.is() ) - { - std::vector<XMLPropertyState> xPropStates(xParaPropMapper->Filter(xParaProp)); - rtl::OUString sParent; - rtl::OUString sName( aNoteParaIter->maName ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); - } - } - } - ++aNoteParaIter; + std::vector<XMLPropertyState> xPropStates(xParaPropMapper->Filter(xParaProp)); + rtl::OUString sParent; + rtl::OUString sName( aNoteParaIter->maName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); } + } + } + ++aNoteParaIter; + } - // note text styles + // note text styles - UniReference<SvXMLExportPropertyMapper> xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this ); + UniReference<SvXMLExportPropertyMapper> xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this ); - const std::vector<ScTextStyleEntry>& rNoteTextEntries = pSheetData->GetNoteTextStyles(); - std::vector<ScTextStyleEntry>::const_iterator aNoteTextIter = rNoteTextEntries.begin(); - std::vector<ScTextStyleEntry>::const_iterator aNoteTextEnd = rNoteTextEntries.end(); - while (aNoteTextIter != aNoteTextEnd) + const std::vector<ScTextStyleEntry>& rNoteTextEntries = pSheetData->GetNoteTextStyles(); + std::vector<ScTextStyleEntry>::const_iterator aNoteTextIter = rNoteTextEntries.begin(); + std::vector<ScTextStyleEntry>::const_iterator aNoteTextEnd = rNoteTextEntries.end(); + while (aNoteTextIter != aNoteTextEnd) + { + ScAddress aPos = aNoteTextIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); + if (bCopySheet) + { + ScPostIt* pNote = pDoc->GetNote( aPos ); + DBG_ASSERT( pNote, "note not found" ); + if (pNote) + { + SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); + uno::Reference<text::XSimpleText> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY); + ScDrawTextCursor* pCursor = ScDrawTextCursor::getImplementation( xCursorProp ); + if (pCursor) { - ScAddress aPos = aNoteTextIter->maCellPos; - sal_Int32 nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); - if (bCopySheet) - { - ScPostIt* pNote = pDoc->GetNote( aPos ); - DBG_ASSERT( pNote, "note not found" ); - if (pNote) - { - SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); - uno::Reference<text::XSimpleText> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY); - ScDrawTextCursor* pCursor = ScDrawTextCursor::getImplementation( xCursorProp ); - if (pCursor) - { - pCursor->SetSelection( aNoteTextIter->maSelection ); + pCursor->SetSelection( aNoteTextIter->maSelection ); - std::vector<XMLPropertyState> xPropStates(xTextPropMapper->Filter(xCursorProp)); - rtl::OUString sParent; - rtl::OUString sName( aNoteTextIter->maName ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_TEXT, sName); - } - } - } - ++aNoteTextIter; + std::vector<XMLPropertyState> xPropStates(xTextPropMapper->Filter(xCursorProp)); + rtl::OUString sParent; + rtl::OUString sName( aNoteTextIter->maName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_TEXT, sName); } + } + } + ++aNoteTextIter; + } - // stored text styles + // stored text styles - //UniReference<SvXMLExportPropertyMapper> xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this ); + //UniReference<SvXMLExportPropertyMapper> xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this ); - const std::vector<ScTextStyleEntry>& rTextEntries = pSheetData->GetTextStyles(); - std::vector<ScTextStyleEntry>::const_iterator aTextIter = rTextEntries.begin(); - std::vector<ScTextStyleEntry>::const_iterator aTextEnd = rTextEntries.end(); - while (aTextIter != aTextEnd) - { - ScAddress aPos = aTextIter->maCellPos; - sal_Int32 nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); - if (bCopySheet) - { - //! separate method AddStyleFromText needed? - //! cache sheet object - - uno::Reference<table::XCellRange> xCellRange(xIndex->getByIndex(nTable), uno::UNO_QUERY); - uno::Reference<text::XSimpleText> xCellText(xCellRange->getCellByPosition(aPos.Col(), aPos.Row()), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY); - ScCellTextCursor* pCursor = ScCellTextCursor::getImplementation( xCursorProp ); - if (pCursor) - { - pCursor->SetSelection( aTextIter->maSelection ); + const std::vector<ScTextStyleEntry>& rTextEntries = pSheetData->GetTextStyles(); + std::vector<ScTextStyleEntry>::const_iterator aTextIter = rTextEntries.begin(); + std::vector<ScTextStyleEntry>::const_iterator aTextEnd = rTextEntries.end(); + while (aTextIter != aTextEnd) + { + ScAddress aPos = aTextIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) ); + if (bCopySheet) + { + //! separate method AddStyleFromText needed? + //! cache sheet object + + uno::Reference<table::XCellRange> xCellRange(xIndex->getByIndex(nTable), uno::UNO_QUERY); + uno::Reference<text::XSimpleText> xCellText(xCellRange->getCellByPosition(aPos.Col(), aPos.Row()), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY); + ScCellTextCursor* pCursor = ScCellTextCursor::getImplementation( xCursorProp ); + if (pCursor) + { + pCursor->SetSelection( aTextIter->maSelection ); - std::vector<XMLPropertyState> xPropStates(xTextPropMapper->Filter(xCursorProp)); - rtl::OUString sParent; - rtl::OUString sName( aTextIter->maName ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_TEXT, sName); - } - } - ++aTextIter; - } + std::vector<XMLPropertyState> xPropStates(xTextPropMapper->Filter(xCursorProp)); + rtl::OUString sParent; + rtl::OUString sName( aTextIter->maName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_TEXT, sName); } + } + ++aTextIter; + } + } - ExportExternalRefCacheStyles(); + ExportExternalRefCacheStyles(); - if (!pSharedData) + if (!pSharedData) + { + sal_Int32 nTableCount(0); + sal_Int32 nShapesCount(0); + sal_Int32 nCellCount(pDoc ? pDoc->GetCellCount() : 0); + CollectSharedData(nTableCount, nShapesCount, nCellCount); + //DBG_ERROR("no shared data setted"); + } + sal_Int32 nTableCount(xIndex->getCount()); + pCellStyles->AddNewTable(nTableCount - 1); + CollectShapesAutoStyles(nTableCount); + for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable) + { + bool bUseStream = pSheetData && pDoc && pDoc->IsStreamValid((SCTAB)nTable) && + pSheetData->HasStreamPos(nTable) && xSourceStream.is(); + + uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY); + if (xTable.is()) + { + // table styles array must be complete, including copied tables - Add should find the stored style + uno::Reference<beans::XPropertySet> xTableProperties(xTable, uno::UNO_QUERY); + if (xTableProperties.is()) + { + std::vector<XMLPropertyState> xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties)); + if(xPropStates.size()) { - sal_Int32 nTableCount(0); - sal_Int32 nShapesCount(0); - sal_Int32 nCellCount(pDoc ? pDoc->GetCellCount() : 0); - CollectSharedData(nTableCount, nShapesCount, nCellCount); - //DBG_ERROR("no shared data setted"); + rtl::OUString sParent; + rtl::OUString sName; + GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_TABLE, sParent, xPropStates); + aTableStyles.push_back(sName); } - sal_Int32 nTableCount(xIndex->getCount()); - pCellStyles->AddNewTable(nTableCount - 1); - CollectShapesAutoStyles(nTableCount); - for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable) + } + } + // collect other auto-styles only for non-copied sheets + if (xTable.is() && !bUseStream) + { + uno::Reference<sheet::XUniqueCellFormatRangesSupplier> xCellFormatRanges ( xTable, uno::UNO_QUERY ); + if ( xCellFormatRanges.is() ) + { + uno::Reference<container::XIndexAccess> xFormatRangesIndex(xCellFormatRanges->getUniqueCellFormatRanges()); + if (xFormatRangesIndex.is()) { - bool bUseStream = pSheetData && pDoc && pDoc->IsStreamValid((SCTAB)nTable) && - pSheetData->HasStreamPos(nTable) && xSourceStream.is(); - - uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY); - if (xTable.is()) + sal_Int32 nFormatRangesCount(xFormatRangesIndex->getCount()); + GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nFormatRangesCount); + for (sal_Int32 nFormatRange = 0; nFormatRange < nFormatRangesCount; ++nFormatRange) { - // table styles array must be complete, including copied tables - Add should find the stored style - uno::Reference<beans::XPropertySet> xTableProperties(xTable, uno::UNO_QUERY); - if (xTableProperties.is()) + uno::Reference< sheet::XSheetCellRanges> xCellRanges(xFormatRangesIndex->getByIndex(nFormatRange), uno::UNO_QUERY); + if (xCellRanges.is()) { - std::vector<XMLPropertyState> xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties)); - if(xPropStates.size()) + uno::Reference <beans::XPropertySet> xProperties (xCellRanges, uno::UNO_QUERY); + if (xProperties.is()) { - rtl::OUString sParent; - rtl::OUString sName; - GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_TABLE, sParent, xPropStates); - aTableStyles.push_back(sName); + AddStyleFromCells(xProperties, xTable, nTable, NULL); + IncrementProgressBar(sal_False); } } } - // collect other auto-styles only for non-copied sheets - if (xTable.is() && !bUseStream) + } + } + uno::Reference<table::XColumnRowRange> xColumnRowRange (xTable, uno::UNO_QUERY); + if (xColumnRowRange.is()) + { + if (pDoc) + { + uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns()); + if (xTableColumns.is()) { - uno::Reference<sheet::XUniqueCellFormatRangesSupplier> xCellFormatRanges ( xTable, uno::UNO_QUERY ); - if ( xCellFormatRanges.is() ) + sal_Int32 nColumns(pDoc->GetLastChangedCol(sal::static_int_cast<SCTAB>(nTable))); + pSharedData->SetLastColumn(nTable, nColumns); + table::CellRangeAddress aCellAddress(GetEndAddress(xTable, nTable)); + if (aCellAddress.EndColumn > nColumns) { - uno::Reference<container::XIndexAccess> xFormatRangesIndex(xCellFormatRanges->getUniqueCellFormatRanges()); - if (xFormatRangesIndex.is()) - { - sal_Int32 nFormatRangesCount(xFormatRangesIndex->getCount()); - GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nFormatRangesCount); - for (sal_Int32 nFormatRange = 0; nFormatRange < nFormatRangesCount; ++nFormatRange) - { - uno::Reference< sheet::XSheetCellRanges> xCellRanges(xFormatRangesIndex->getByIndex(nFormatRange), uno::UNO_QUERY); - if (xCellRanges.is()) - { - uno::Reference <beans::XPropertySet> xProperties (xCellRanges, uno::UNO_QUERY); - if (xProperties.is()) - { - AddStyleFromCells(xProperties, xTable, nTable, NULL); - IncrementProgressBar(sal_False); - } - } - } - } + ++nColumns; + pColumnStyles->AddNewTable(nTable, aCellAddress.EndColumn); } - uno::Reference<table::XColumnRowRange> xColumnRowRange (xTable, uno::UNO_QUERY); - if (xColumnRowRange.is()) +// else if (nColumns < MAXCOL) +// pColumnStyles->AddNewTable(nTable, ++nColumns); + else + pColumnStyles->AddNewTable(nTable, nColumns); + sal_Int32 nColumn = 0; + while (/*nColumn <= nColumns && */nColumn <= MAXCOL) { - if (pDoc) + sal_Int32 nIndex(-1); + sal_Bool bIsVisible(sal_True); + uno::Reference <beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY); + if (xColumnProperties.is()) { - uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns()); - if (xTableColumns.is()) - { - sal_Int32 nColumns(pDoc->GetLastChangedCol(sal::static_int_cast<SCTAB>(nTable))); - pSharedData->SetLastColumn(nTable, nColumns); - table::CellRangeAddress aCellAddress(GetEndAddress(xTable, nTable)); - if (aCellAddress.EndColumn > nColumns) - { - ++nColumns; - pColumnStyles->AddNewTable(nTable, aCellAddress.EndColumn); - } - // else if (nColumns < MAXCOL) - // pColumnStyles->AddNewTable(nTable, ++nColumns); - else - pColumnStyles->AddNewTable(nTable, nColumns); - sal_Int32 nColumn = 0; - while (/*nColumn <= nColumns && */nColumn <= MAXCOL) - { - sal_Int32 nIndex(-1); - sal_Bool bIsVisible(sal_True); - uno::Reference <beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY); - if (xColumnProperties.is()) - { - AddStyleFromColumn( xColumnProperties, NULL, nIndex, bIsVisible ); - //if(xPropStates.size()) - pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible); - } - sal_Int32 nOld(nColumn); - nColumn = pDoc->GetNextDifferentChangedCol(sal::static_int_cast<SCTAB>(nTable), static_cast<USHORT>(nColumn)); - for (sal_Int32 i = nOld + 1; i < nColumn; ++i) - pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible); - } - if (aCellAddress.EndColumn > nColumns) - { - sal_Bool bIsVisible(sal_True); - sal_Int32 nIndex(pColumnStyles->GetStyleNameIndex(nTable, nColumns, bIsVisible)); - for (sal_Int32 i = nColumns + 1; i <= aCellAddress.EndColumn; ++i) - pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible); - } - } - uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows()); - if (xTableRows.is()) - { - sal_Int32 nRows(pDoc->GetLastChangedRow(sal::static_int_cast<SCTAB>(nTable))); - pSharedData->SetLastRow(nTable, nRows); - table::CellRangeAddress aCellAddress(GetEndAddress(xTable, nTable)); - if (aCellAddress.EndRow > nRows) - { - ++nRows; - pRowStyles->AddNewTable(nTable, aCellAddress.EndRow); - } - // else if (nRows < MAXROW) - // pRowStyles->AddNewTable(nTable, ++nRows); - else - pRowStyles->AddNewTable(nTable, nRows); - sal_Int32 nRow = 0; - while ( /*nRow <= nRows && */nRow <= MAXROW) - { - sal_Int32 nIndex = 0; - uno::Reference <beans::XPropertySet> xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY); - if(xRowProperties.is()) - { - AddStyleFromRow( xRowProperties, NULL, nIndex ); - //if(xPropStates.size()) - pRowStyles->AddFieldStyleName(nTable, nRow, nIndex); - } - sal_Int32 nOld(nRow); - nRow = pDoc->GetNextDifferentChangedRow(sal::static_int_cast<SCTAB>(nTable), static_cast<USHORT>(nRow), false); - for (sal_Int32 i = nOld + 1; i < nRow; ++i) - pRowStyles->AddFieldStyleName(nTable, i, nIndex); - } - if (aCellAddress.EndRow > nRows) - { - sal_Int32 nIndex(pRowStyles->GetStyleNameIndex(nTable, nRows)); - for (sal_Int32 i = nRows + 1; i <= aCellAddress.EndRow; ++i) - pRowStyles->AddFieldStyleName(nTable, i, nIndex); - } - } + AddStyleFromColumn( xColumnProperties, NULL, nIndex, bIsVisible ); + //if(xPropStates.size()) + pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible); } + sal_Int32 nOld(nColumn); + nColumn = pDoc->GetNextDifferentChangedCol(sal::static_int_cast<SCTAB>(nTable), static_cast<USHORT>(nColumn)); + for (sal_Int32 i = nOld + 1; i < nColumn; ++i) + pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible); } - uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY); - if (xCellRangesQuery.is()) + if (aCellAddress.EndColumn > nColumns) { - uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED)); - uno::Reference<sheet::XSheetOperation> xSheetOperation(xSheetCellRanges, uno::UNO_QUERY); - if (xSheetCellRanges.is() && xSheetOperation.is()) + sal_Bool bIsVisible(sal_True); + sal_Int32 nIndex(pColumnStyles->GetStyleNameIndex(nTable, nColumns, bIsVisible)); + for (sal_Int32 i = nColumns + 1; i <= aCellAddress.EndColumn; ++i) + pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible); + } + } + uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows()); + if (xTableRows.is()) + { + sal_Int32 nRows(pDoc->GetLastChangedRow(sal::static_int_cast<SCTAB>(nTable))); + pSharedData->SetLastRow(nTable, nRows); + table::CellRangeAddress aCellAddress(GetEndAddress(xTable, nTable)); + if (aCellAddress.EndRow > nRows) + { + ++nRows; + pRowStyles->AddNewTable(nTable, aCellAddress.EndRow); + } +// else if (nRows < MAXROW) +// pRowStyles->AddNewTable(nTable, ++nRows); + else + pRowStyles->AddNewTable(nTable, nRows); + sal_Int32 nRow = 0; + while ( /*nRow <= nRows && */nRow <= MAXROW) + { + sal_Int32 nIndex = 0; + uno::Reference <beans::XPropertySet> xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY); + if(xRowProperties.is()) { - sal_uInt32 nCount(sal_uInt32(xSheetOperation->computeFunction(sheet::GeneralFunction_COUNT))); - uno::Reference<container::XEnumerationAccess> xCellsAccess(xSheetCellRanges->getCells()); - if (xCellsAccess.is()) - { - GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCount); - uno::Reference<container::XEnumeration> xCells(xCellsAccess->createEnumeration()); - if (xCells.is()) - { - sal_uInt32 nCount2(0); - while (xCells->hasMoreElements()) - { - uno::Reference<text::XText> xText(xCells->nextElement(), uno::UNO_QUERY); - if (xText.is()) - GetTextParagraphExport()->collectTextAutoStyles(xText, sal_False, sal_False); - ++nCount2; - IncrementProgressBar(sal_False); - } - if(nCount2 > nCount) - GetProgressBarHelper()->SetReference(GetProgressBarHelper()->GetReference() + nCount2 - nCount); - } - } + AddStyleFromRow( xRowProperties, NULL, nIndex ); + //if(xPropStates.size()) + pRowStyles->AddFieldStyleName(nTable, nRow, nIndex); } + sal_Int32 nOld(nRow); + nRow = pDoc->GetNextDifferentChangedRow(sal::static_int_cast<SCTAB>(nTable), static_cast<USHORT>(nRow), false); + for (sal_Int32 i = nOld + 1; i < nRow; ++i) + pRowStyles->AddFieldStyleName(nTable, i, nIndex); + } + if (aCellAddress.EndRow > nRows) + { + sal_Int32 nIndex(pRowStyles->GetStyleNameIndex(nTable, nRows)); + for (sal_Int32 i = nRows + 1; i <= aCellAddress.EndRow; ++i) + pRowStyles->AddFieldStyleName(nTable, i, nIndex); } } - IncrementProgressBar(sal_False); - } - pChangeTrackingExportHelper->CollectAutoStyles(); - - GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_COLUMN, - GetDocHandler(), GetMM100UnitConverter(), GetNamespaceMap()); - GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_ROW, - GetDocHandler(), GetMM100UnitConverter(), GetNamespaceMap()); - GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_TABLE, - GetDocHandler(), GetMM100UnitConverter(), GetNamespaceMap()); - exportAutoDataStyles(); - GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_CELL, - GetDocHandler(), GetMM100UnitConverter(), GetNamespaceMap()); - - GetShapeExport()->exportAutoStyles(); - GetFormExport()->exportAutoStyles( ); - - { - // Special table style for the external ref cache tables. - AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sExternalRefTabStyleName); - AddAttribute(XML_NAMESPACE_STYLE, XML_FAMILY, XML_TABLE); - SvXMLElementExport aElemStyle(*this, XML_NAMESPACE_STYLE, XML_STYLE, sal_True, sal_True); - AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY, XML_FALSE); - SvXMLElementExport aElemStyleTabProps(*this, XML_NAMESPACE_STYLE, XML_TABLE_PROPERTIES, sal_True, sal_True); } } - if (getExportFlags() & EXPORT_MASTERSTYLES) + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY); + if (xCellRangesQuery.is()) { - GetPageExport()->collectAutoStyles(sal_True); - GetPageExport()->exportAutoStyles(); + uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED)); + uno::Reference<sheet::XSheetOperation> xSheetOperation(xSheetCellRanges, uno::UNO_QUERY); + if (xSheetCellRanges.is() && xSheetOperation.is()) + { + sal_uInt32 nCount(sal_uInt32(xSheetOperation->computeFunction(sheet::GeneralFunction_COUNT))); + uno::Reference<container::XEnumerationAccess> xCellsAccess(xSheetCellRanges->getCells()); + if (xCellsAccess.is()) + { + GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCount); + uno::Reference<container::XEnumeration> xCells(xCellsAccess->createEnumeration()); + if (xCells.is()) + { + sal_uInt32 nCount2(0); + while (xCells->hasMoreElements()) + { + uno::Reference<text::XText> xText(xCells->nextElement(), uno::UNO_QUERY); + if (xText.is()) + GetTextParagraphExport()->collectTextAutoStyles(xText, sal_False, sal_False); + ++nCount2; + IncrementProgressBar(sal_False); + } + if(nCount2 > nCount) + GetProgressBarHelper()->SetReference(GetProgressBarHelper()->GetReference() + nCount2 - nCount); + } + } + } } + } + IncrementProgressBar(sal_False); + } + pChangeTrackingExportHelper->CollectAutoStyles(); - // #i30251#; only write Text Styles once + GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_COLUMN, + GetDocHandler(), GetMM100UnitConverter(), GetNamespaceMap()); + GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_ROW, + GetDocHandler(), GetMM100UnitConverter(), GetNamespaceMap()); + GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_TABLE, + GetDocHandler(), GetMM100UnitConverter(), GetNamespaceMap()); + exportAutoDataStyles(); + GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_CELL, + GetDocHandler(), GetMM100UnitConverter(), GetNamespaceMap()); - if ((getExportFlags() & EXPORT_CONTENT) || (getExportFlags() & EXPORT_MASTERSTYLES)) - GetTextParagraphExport()->exportTextAutoStyles(); - } + GetShapeExport()->exportAutoStyles(); + GetFormExport()->exportAutoStyles( ); + + { + // Special table style for the external ref cache tables. + AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sExternalRefTabStyleName); + AddAttribute(XML_NAMESPACE_STYLE, XML_FAMILY, XML_TABLE); + SvXMLElementExport aElemStyle(*this, XML_NAMESPACE_STYLE, XML_STYLE, sal_True, sal_True); + AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY, XML_FALSE); + SvXMLElementExport aElemStyleTabProps(*this, XML_NAMESPACE_STYLE, XML_TABLE_PROPERTIES, sal_True, sal_True); } } + + if (getExportFlags() & EXPORT_MASTERSTYLES) + { + GetPageExport()->collectAutoStyles(sal_True); + GetPageExport()->exportAutoStyles(); + } + + // #i30251#; only write Text Styles once + + if ((getExportFlags() & EXPORT_CONTENT) || (getExportFlags() & EXPORT_MASTERSTYLES)) + GetTextParagraphExport()->exportTextAutoStyles(); } void ScXMLExport::_ExportMasterStyles() diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index d1ef48bfa9ed..94785179f707 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -698,12 +698,12 @@ const SvXMLTokenMap& ScXMLImport::GetTableAttrTokenMap() { static __FAR_DATA SvXMLTokenMapEntry aTableAttrTokenMap[] = { - { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_NAME }, - { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_STYLE_NAME }, - { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_PROTECTION }, - { XML_NAMESPACE_TABLE, XML_PRINT_RANGES, XML_TOK_TABLE_PRINT_RANGES }, - { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, XML_TOK_TABLE_PASSWORD }, - { XML_NAMESPACE_TABLE, XML_PRINT, XML_TOK_TABLE_PRINT }, + { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_NAME }, + { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_STYLE_NAME }, + { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_PROTECTION }, + { XML_NAMESPACE_TABLE, XML_PRINT_RANGES, XML_TOK_TABLE_PRINT_RANGES }, + { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, XML_TOK_TABLE_PASSWORD }, + { XML_NAMESPACE_TABLE, XML_PRINT, XML_TOK_TABLE_PRINT }, XML_TOKEN_MAP_END }; diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx index f9f0d063a843..2082c17982ab 100644 --- a/sc/source/filter/xml/xmlstyle.cxx +++ b/sc/source/filter/xml/xmlstyle.cxx @@ -66,6 +66,7 @@ using namespace ::formula; using ::rtl::OUString; #define MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 } +#define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_LATEST } #define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFVER_010 } const XMLPropertyMapEntry aXMLScCellStylesProperties[] = @@ -161,6 +162,7 @@ const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] = MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ), MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ), MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ), + MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ), MAP_END() }; @@ -169,6 +171,7 @@ const XMLPropertyMapEntry aXMLScTableStylesProperties[] = MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ), MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ), MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ), + MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ), MAP_END() }; diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index dc5d1010dfc8..5220563be966 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2214,9 +2214,6 @@ IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo ) return 0; } - - -//<!--Added by PengYunQuan for Validity Cell Range Picker BOOL ScModule::RegisterRefWindow( USHORT nSlotId, Window *pWnd ) { std::list<Window*> & rlRefWindow = m_mapRefWindow[nSlotId]; @@ -2266,10 +2263,13 @@ BOOL ScModule::IsAliveRefDlg( USHORT nSlotId, Window *pWnd ) Window * ScModule::Find1RefWindow( USHORT nSlotId, Window *pWndAncestor ) { + if (!pWndAncestor) + return NULL; + std::map<USHORT, std::list<Window*> >::iterator iSlot = m_mapRefWindow.find( nSlotId ); if( iSlot == m_mapRefWindow.end() ) - return FALSE; + return NULL; std::list<Window*> & rlRefWindow = iSlot->second; @@ -2284,6 +2284,9 @@ Window * ScModule::Find1RefWindow( USHORT nSlotId, Window *pWndAncestor ) Window * ScModule::Find1RefWindow( Window *pWndAncestor ) { + if (!pWndAncestor) + return NULL; + while( Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent; for( std::map<USHORT, std::list<Window*> >::iterator i = m_mapRefWindow.begin(); @@ -2294,4 +2297,4 @@ Window * ScModule::Find1RefWindow( Window *pWndAncestor ) return NULL; } -//<!--Added by PengYunQuan for Validity Cell Range Picker + diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index c9871a08d7c9..53c1c64a6558 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2852,75 +2852,74 @@ BOOL ScDocFunc::RenameTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL return bSuccess; } -BOOL ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, BOOL bRecord, BOOL bApi ) +bool ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bool bApi ) { ScDocument* pDoc = rDocShell.GetDocument(); if (bRecord && !pDoc->IsUndoEnabled()) - bRecord = FALSE; + bRecord = false; if ( !pDoc->IsDocEditable() || pDoc->IsTabProtected(nTab) ) { if (!bApi) rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Check to see what this string is... - return FALSE; + return false; } - ScViewData* pViewData = rDocShell.GetViewData(); - Color aOldTabBgColor; - aOldTabBgColor = pViewData->GetTabBgColor(nTab); + aOldTabBgColor = pDoc->GetTabBgColor(nTab); - BOOL bSuccess = FALSE; - pViewData->SetTabBgColor(rColor, nTab); - if ( pViewData->GetTabBgColor( nTab ) == rColor) - bSuccess = TRUE; + bool bSuccess = false; + pDoc->SetTabBgColor(nTab, rColor); + if ( pDoc->GetTabBgColor(nTab) == rColor) + bSuccess = true; if (bSuccess) { if (bRecord) { rDocShell.GetUndoManager()->AddUndoAction( - new ScUndoSetTabBgColor( &rDocShell, nTab, aOldTabBgColor, rColor)); + new ScUndoTabColor( &rDocShell, nTab, aOldTabBgColor, rColor)); } rDocShell.PostPaintExtras(); ScDocShellModificator aModificator( rDocShell ); aModificator.SetDocumentModified(); SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); - bSuccess = TRUE; + bSuccess = true; } return bSuccess; } -BOOL ScDocFunc::SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorInfoList, BOOL bRecord, BOOL bApi ) +bool ScDocFunc::SetTabBgColor( + ScUndoTabColorInfo::List& rUndoTabColorList, bool bRecord, bool bApi ) { ScDocument* pDoc = rDocShell.GetDocument(); if (bRecord && !pDoc->IsUndoEnabled()) - bRecord = FALSE; + bRecord = false; + if ( !pDoc->IsDocEditable() ) { if (!bApi) rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Get a better String Error... - return FALSE; + return false; } - ScViewData* pViewData = rDocShell.GetViewData(); USHORT nTab; Color aNewTabBgColor; - ScUndoSetTabBgColorInfo* rUndoSetTabBgColorInfo; - BOOL bSuccess = TRUE; - USHORT nTabProtectCount = 0; - for ( USHORT i=0; i < rUndoSetTabBgColorInfoList->Count(); i++ ) + bool bSuccess = true; + size_t nTabProtectCount = 0; + size_t nTabListCount = rUndoTabColorList.size(); + for ( size_t i = 0; i < nTabListCount; ++i ) { - rUndoSetTabBgColorInfo = rUndoSetTabBgColorInfoList->GetObject(i); - nTab = rUndoSetTabBgColorInfo->nTabId; + ScUndoTabColorInfo& rInfo = rUndoTabColorList[i]; + nTab = rInfo.mnTabId; if ( !pDoc->IsTabProtected(nTab) ) { - aNewTabBgColor = rUndoSetTabBgColorInfo->aNewTabBgColor; - rUndoSetTabBgColorInfo->aOldTabBgColor = pViewData->GetTabBgColor(nTab); - pViewData->SetTabBgColor(aNewTabBgColor, nTab); - if ( pViewData->GetTabBgColor( nTab ) != aNewTabBgColor) + aNewTabBgColor = rInfo.maNewTabBgColor; + rInfo.maOldTabBgColor = pDoc->GetTabBgColor(nTab); + pDoc->SetTabBgColor(nTab, aNewTabBgColor); + if ( pDoc->GetTabBgColor(nTab) != aNewTabBgColor) { - bSuccess = FALSE; + bSuccess = false; break; } } @@ -2929,23 +2928,24 @@ BOOL ScDocFunc::SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorIn nTabProtectCount++; } } - if ( nTabProtectCount == rUndoSetTabBgColorInfoList->Count() ) + + if ( nTabProtectCount == nTabListCount ) { if (!bApi) rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Get a better String Error... - return FALSE; + return false; } + if (bSuccess) { if (bRecord) { rDocShell.GetUndoManager()->AddUndoAction( - new ScUndoSetTabBgColor( &rDocShell, rUndoSetTabBgColorInfoList)); + new ScUndoTabColor( &rDocShell, rUndoTabColorList)); } rDocShell.PostPaintExtras(); ScDocShellModificator aModificator( rDocShell ); aModificator.SetDocumentModified(); - SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); } return bSuccess; } diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index 3da45a797c69..c92cc082986d 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -118,9 +118,8 @@ public: BOOL RenameTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi ); BOOL DeleteTable( SCTAB nTab, BOOL bRecord, BOOL bApi ); - BOOL SetTabBgColor( SCTAB nTab, const Color& rColor, BOOL bRecord, BOOL bApi ); - BOOL SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorInfoList, - BOOL bRecord, BOOL bApi ); + bool SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bool bApi ); + bool SetTabBgColor( ScUndoTabColorInfo::List& rUndoTabColorList, bool bRecord, bool bApi ); BOOL SetTableVisible( SCTAB nTab, BOOL bVisible, BOOL bApi ); diff --git a/sc/source/ui/inc/tabbgcolordlg.hxx b/sc/source/ui/inc/tabbgcolordlg.hxx index 6beff970431c..241fc806022d 100644 --- a/sc/source/ui/inc/tabbgcolordlg.hxx +++ b/sc/source/ui/inc/tabbgcolordlg.hxx @@ -41,40 +41,40 @@ class ScTabBgColorDlg : public ModalDialog { public: - ScTabBgColorDlg( Window* pParent, - const String& rTitle, - const String& rTabBgColorNoColorText, - const Color& rDefaultColor, - ULONG nHelpId ); - ~ScTabBgColorDlg(); + ScTabBgColorDlg( Window* pParent, + const String& rTitle, + const String& rTabBgColorNoColorText, + const Color& rDefaultColor, + ULONG nHelpId ); + ~ScTabBgColorDlg(); + + void GetSelectedColor( Color& rColor ) const; - void GetSelectedColor( Color& rColor ) const; - //void SelectColor( const Color& rColor2 ) const; private: class ScTabBgColorValueSet : public ValueSet { - public: - ScTabBgColorValueSet(Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg); + ScTabBgColorValueSet(Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg); - virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); private: ScTabBgColorDlg* aTabBgColorDlg; }; - Control aBorderWin; - ScTabBgColorValueSet aTabBgColorSet; - FixedLine aTabBgColorBox; - OKButton aBtnOk; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - Color aTabBgColor; - const String aTabBgColorNoColorText; - ULONG aHelpId; - void FillColorValueSets_Impl(); + Control aBorderWin; + ScTabBgColorValueSet aTabBgColorSet; + FixedLine aTabBgColorBox; + OKButton aBtnOk; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + Color aTabBgColor; + const String aTabBgColorNoColorText; + ULONG mnHelpId; + + void FillColorValueSets_Impl(); - DECL_LINK( TabBgColorDblClickHdl_Impl, ValueSet* ); - DECL_LINK( TabBgColorOKHdl_Impl, OKButton* pBtn ); + DECL_LINK( TabBgColorDblClickHdl_Impl, ValueSet* ); + DECL_LINK( TabBgColorOKHdl_Impl, OKButton* pBtn ); }; #endif // SC_TABBGCOLORDLG_HXX diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx index ce43c10bcb99..c8d135070ab1 100644 --- a/sc/source/ui/inc/undotab.hxx +++ b/sc/source/ui/inc/undotab.hxx @@ -224,19 +224,19 @@ private: void DoChange() const; }; -class ScUndoSetTabBgColor: public ScSimpleUndo +class ScUndoTabColor: public ScSimpleUndo { public: TYPEINFO(); - ScUndoSetTabBgColor( + ScUndoTabColor( ScDocShell* pNewDocShell, SCTAB nT, const Color& aOTabBgColor, const Color& aNTabBgColor); - ScUndoSetTabBgColor( + ScUndoTabColor( ScDocShell* pNewDocShell, - ScUndoSetTabBgColorInfoList* pUndoSetTabBgColorInfoList); - virtual ~ScUndoSetTabBgColor(); + const ScUndoTabColorInfo::List& rUndoTabColorList); + virtual ~ScUndoTabColor(); virtual void Undo(); virtual void Redo(); @@ -246,14 +246,10 @@ public: virtual String GetComment() const; private: - ScUndoSetTabBgColorInfoList* aUndoSetTabBgColorInfoList; - SCTAB nTab; - Color aOldTabBgColor; - Color aNewTabBgColor; - BOOL bIsMultipleUndo; + ScUndoTabColorInfo::List aTabColorList; + bool bIsMultipleUndo; - void DoChange( SCTAB nTab, const Color& rTabBgColor ) const; - void DoChange( BOOL bUndoType ) const; + void DoChange(bool bUndoType) const; }; class ScUndoMakeScenario: public ScSimpleUndo diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index f890c3f5662c..106d196a8175 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -141,9 +141,6 @@ private: BOOL bOldCurValid; // "virtuelle" Cursorpos. bei zusammengefassten - Color aTabBgColor; - BOOL IsDefaultTabBgColor() const {return aTabBgColor == Color( COL_AUTO ) ? TRUE : FALSE ;}; - ScViewDataTable(); ~ScViewDataTable(); @@ -277,10 +274,6 @@ public: void CopyTab( SCTAB nSrcTab, SCTAB nDestTab ); void MoveTab( SCTAB nSrcTab, SCTAB nDestTab ); - void SetTabBgColor( Color rTabBgColor, SCTAB nTab ); - BOOL IsDefaultTabBgColor( SCTAB nTab ) const; - Color GetTabBgColor( SCTAB nTab ) const; - SCTAB GetRefTabNo() const { return nRefTabNo; } void SetRefTabNo( SCTAB nNewTab ) { nRefTabNo = nNewTab; } diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 91171fdb7349..59da2966cc60 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -275,8 +275,8 @@ public: SCTAB nCount, const SCTAB* pSrcTabs, BOOL bLink,SCTAB nTab); - BOOL SetTabBgColor( const Color& rColor, SCTAB nTabNr ); - BOOL SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorInfoList ); + bool SetTabBgColor( const Color& rColor, SCTAB nTabNr ); + bool SetTabBgColor( ScUndoTabColorInfo::List& rUndoSetTabBgColorInfoList ); void InsertTableLink( const String& rFile, const String& rFilter, const String& rOptions, diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx index 000d64955598..e0c9ab1fa471 100644 --- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx +++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx @@ -35,6 +35,10 @@ //------------------------------------------------------------------ +#include "tabbgcolordlg.hxx" +#include "scresid.hxx" +#include "miscdlgs.hrc" + #include <tools/debug.hxx> #include <tools/color.hxx> #include <sfx2/objsh.hxx> @@ -42,20 +46,19 @@ #include <svx/drawitem.hxx> #include <unotools/pathoptions.hxx> #include <tools/resid.hxx> -#include "tabbgcolordlg.hxx" -#include "scresid.hxx" -#include "miscdlgs.hrc" #include <svx/svxitems.hrc> +#include <boost/scoped_ptr.hpp> + //================================================================== #define HDL(hdl) LINK(this,ScTabBgColorDlg,hdl) -__EXPORT ScTabBgColorDlg::ScTabBgColorDlg( Window* pParent, - const String& rTitle, - const String& rTabBgColorNoColorText, - const Color& rDefaultColor, - ULONG nHelpId ) : +ScTabBgColorDlg::ScTabBgColorDlg( Window* pParent, + const String& rTitle, + const String& rTabBgColorNoColorText, + const Color& rDefaultColor, + ULONG nHelpId ) : ModalDialog ( pParent, ScResId( RID_SCDLG_TAB_BG_COLOR ) ), aBorderWin ( this, ScResId( TAB_BG_COLOR_CT_BORDER ) ), aTabBgColorSet ( &aBorderWin, ScResId( TAB_BG_COLOR_SET_BGDCOLOR ), this ), @@ -65,13 +68,13 @@ __EXPORT ScTabBgColorDlg::ScTabBgColorDlg( Window* pParent, aBtnHelp ( this, ScResId( BTN_HELP ) ), aTabBgColor ( rDefaultColor ), aTabBgColorNoColorText ( rTabBgColorNoColorText ), - aHelpId ( nHelpId ) + mnHelpId ( nHelpId ) { SetHelpId( nHelpId ); this->SetText( rTitle ); this->SetStyle(GetStyle() | WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL | WB_SYSTEMWINDOW | WB_STANDALONE | WB_HIDE); - //TODO: Assign Help ID's to all controls... + aTabBgColorBox.SetText(rTitle); FillColorValueSets_Impl(); aTabBgColorSet.SetDoubleClickHdl( HDL(TabBgColorDblClickHdl_Impl) ); @@ -86,7 +89,7 @@ void ScTabBgColorDlg::GetSelectedColor( Color& rColor ) const rColor = this->aTabBgColor; } -__EXPORT ScTabBgColorDlg::~ScTabBgColorDlg() +ScTabBgColorDlg::~ScTabBgColorDlg() { } @@ -95,20 +98,21 @@ void ScTabBgColorDlg::FillColorValueSets_Impl() SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pItem = NULL; XColorTable* pColorTable = NULL; + ::boost::scoped_ptr<XColorTable> pOwnColorTable; // locally instantiated in case the doc shell doesn't have one. + const Size aSize15x15 = Size( 15, 15 ); const Size aSize10x10 = Size( 10, 10 ); const Size aSize5x5 = Size( 5, 5 ); USHORT nSelectedItem = 0; - FASTBOOL bOwn = FALSE; DBG_ASSERT( pDocSh, "DocShell not found!" ); - if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) ) + if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem(SID_COLOR_TABLE) ) ) ) pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); if ( !pColorTable ) { - bOwn = TRUE; - pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); + pOwnColorTable.reset(new XColorTable(SvtPathOptions().GetPalettePath())); + pColorTable = pOwnColorTable.get(); } if ( pColorTable ) { @@ -145,8 +149,6 @@ void ScTabBgColorDlg::FillColorValueSets_Impl() aTabBgColorSet.Format(); aTabBgColorSet.SelectItem(nSelectedItem); aTabBgColorSet.Resize(); - if ( bOwn ) - delete pColorTable; } IMPL_LINK( ScTabBgColorDlg, TabBgColorDblClickHdl_Impl, ValueSet*, EMPTYARG ) @@ -173,7 +175,7 @@ IMPL_LINK( ScTabBgColorDlg, TabBgColorOKHdl_Impl, OKButton*, EMPTYARG ) return 0; } -__EXPORT ScTabBgColorDlg::ScTabBgColorValueSet::ScTabBgColorValueSet( Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg ) : +ScTabBgColorDlg::ScTabBgColorValueSet::ScTabBgColorValueSet( Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg ) : ValueSet(pParent, rResId) { aTabBgColorDlg = pTabBgColorDlg; diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index 55e7b9c7b6e2..fbc39ad62da5 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -93,7 +93,7 @@ TYPEINIT1(ScUndoScenarioFlags, SfxUndoAction); TYPEINIT1(ScUndoRenameObject, SfxUndoAction); TYPEINIT1(ScUndoLayoutRTL, SfxUndoAction); //UNUSED2009-05 TYPEINIT1(ScUndoSetGrammar, SfxUndoAction); -TYPEINIT1(ScUndoSetTabBgColor, SfxUndoAction); +TYPEINIT1(ScUndoTabColor, SfxUndoAction); // ----------------------------------------------------------------------- @@ -785,105 +785,70 @@ BOOL ScUndoCopyTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const // Tab Bg Color // -ScUndoSetTabBgColor::ScUndoSetTabBgColor( ScDocShell* pNewDocShell, - SCTAB nT, - const Color& aOTabBgColor, - const Color& aNTabBgColor) : - ScSimpleUndo( pNewDocShell ), - aUndoSetTabBgColorInfoList ( NULL ), - nTab ( nT ), - aOldTabBgColor( aOTabBgColor ), - aNewTabBgColor( aNTabBgColor ), - bIsMultipleUndo ( FALSE ) +ScUndoTabColor::ScUndoTabColor( + ScDocShell* pNewDocShell, SCTAB nT, const Color& aOTabBgColor, const Color& aNTabBgColor) : + ScSimpleUndo( pNewDocShell ) { + ScUndoTabColorInfo aInfo(nT); + aInfo.maOldTabBgColor = aOTabBgColor; + aInfo.maNewTabBgColor = aNTabBgColor; + aTabColorList.push_back(aInfo); } -ScUndoSetTabBgColor::ScUndoSetTabBgColor( ScDocShell* pNewDocShell, - ScUndoSetTabBgColorInfoList* pUndoSetTabBgColorInfoList) : - ScSimpleUndo( pNewDocShell ), - bIsMultipleUndo ( TRUE ) +ScUndoTabColor::ScUndoTabColor( + ScDocShell* pNewDocShell, + const ScUndoTabColorInfo::List& rUndoTabColorList) : + ScSimpleUndo(pNewDocShell), + aTabColorList(rUndoTabColorList) { - aUndoSetTabBgColorInfoList = pUndoSetTabBgColorInfoList; } -ScUndoSetTabBgColor::~ScUndoSetTabBgColor() +ScUndoTabColor::~ScUndoTabColor() { } -String ScUndoSetTabBgColor::GetComment() const +String ScUndoTabColor::GetComment() const { - if (bIsMultipleUndo && aUndoSetTabBgColorInfoList && aUndoSetTabBgColorInfoList->Count() > 1) - return ScGlobal::GetRscString( STR_UNDO_SET_MULTI_TAB_BG_COLOR ); - return ScGlobal::GetRscString( STR_UNDO_SET_TAB_BG_COLOR ); + if (aTabColorList.size() > 1) + return ScGlobal::GetRscString(STR_UNDO_SET_MULTI_TAB_BG_COLOR); + return ScGlobal::GetRscString(STR_UNDO_SET_TAB_BG_COLOR); } -void ScUndoSetTabBgColor::DoChange( SCTAB nTabP, const Color& rTabBgColor ) const +void ScUndoTabColor::DoChange(bool bUndoType) const { - if (bIsMultipleUndo) + ScDocument* pDoc = pDocShell->GetDocument(); + if (!pDoc) return; - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if (pViewShell) - { - ScViewData* pViewData = pViewShell->GetViewData(); - if (pViewData) - { - pViewData->SetTabBgColor( rTabBgColor, nTabP ); - pDocShell->PostPaintExtras(); - pDocShell->PostDataChanged(); - SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); - pViewShell->UpdateInputHandler(); - } - } -} -void ScUndoSetTabBgColor::DoChange(BOOL bUndoType) const -{ - if (!bIsMultipleUndo) - return; - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if (pViewShell) + size_t nTabColorCount = aTabColorList.size(); + for (size_t i = 0; i < nTabColorCount; ++i) { - ScViewData* pViewData = pViewShell->GetViewData(); - if (pViewData) - { - ScUndoSetTabBgColorInfo* aUndoSetTabBgColorInfo=NULL; - for (USHORT i=0; i < aUndoSetTabBgColorInfoList->Count(); i++) - { - aUndoSetTabBgColorInfo = aUndoSetTabBgColorInfoList->GetObject(i); - pViewData->SetTabBgColor( - bUndoType ? aUndoSetTabBgColorInfo->aOldTabBgColor : aUndoSetTabBgColorInfo->aNewTabBgColor, - aUndoSetTabBgColorInfo->nTabId); - } - pDocShell->PostPaintExtras(); - pDocShell->PostDataChanged(); - SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); - pViewShell->UpdateInputHandler(); - } + const ScUndoTabColorInfo& rTabColor = aTabColorList[i]; + pDoc->SetTabBgColor(rTabColor.mnTabId, + bUndoType ? rTabColor.maOldTabBgColor : rTabColor.maNewTabBgColor); } + + pDocShell->PostPaintExtras(); + ScDocShellModificator aModificator( *pDocShell ); + aModificator.SetDocumentModified(); } -void ScUndoSetTabBgColor::Undo() +void ScUndoTabColor::Undo() { - if ( bIsMultipleUndo ) - DoChange(TRUE); - else - DoChange(nTab, aOldTabBgColor); + DoChange(true); } -void ScUndoSetTabBgColor::Redo() +void ScUndoTabColor::Redo() { - if ( bIsMultipleUndo ) - DoChange(FALSE); - else - DoChange(nTab, aNewTabBgColor); + DoChange(false); } -void ScUndoSetTabBgColor::Repeat(SfxRepeatTarget& /* rTarget */) +void ScUndoTabColor::Repeat(SfxRepeatTarget& /* rTarget */) { // No Repeat } -BOOL ScUndoSetTabBgColor::CanRepeat(SfxRepeatTarget& /* rTarget */) const +BOOL ScUndoTabColor::CanRepeat(SfxRepeatTarget& /* rTarget */) const { return FALSE; } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index c61a6443af99..1a3dd3010734 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -769,6 +769,7 @@ const SfxItemPropertySet* lcl_GetSheetPropertySet() {MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 }, {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((table::CellVertJustify*)0), 0, 0 }, {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_TABCOLOR), SC_WID_UNO_TABCOLOR, &getCppuType((sal_Int32*)0), 0, 0 }, {0,0,0,0,0,0} }; static SfxItemPropertySet aSheetPropertySet( aSheetPropertyMap_Impl ); @@ -8467,6 +8468,15 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn pDoc->ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag. } } + else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR ) + { + sal_Int32 nColor = COL_AUTO; + if (aValue >>= nColor) + { + if (static_cast<ColorData>(nColor) != COL_AUTO) + pDoc->SetTabBgColor(nTab, Color(static_cast<ColorData>(nColor))); + } + } else ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID } @@ -8605,6 +8615,10 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn BOOL bAutoPrint = pDoc->IsPrintEntireSheet( nTab ); ScUnoHelpFunctions::SetBoolInAny( rAny, bAutoPrint ); } + else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR ) + { + rAny <<= sal_Int32(pDoc->GetTabBgColor(nTab).GetColor()); + } else ScCellRangeObj::GetOnePropertyValue(pEntry, rAny); } diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx index 25a12658f705..bead62419bb3 100644 --- a/sc/source/ui/view/scextopt.cxx +++ b/sc/source/ui/view/scextopt.cxx @@ -58,8 +58,7 @@ ScExtTabSettings::ScExtTabSettings() : mnPageZoom( 0 ), mbSelected( false ), mbFrozenPanes( false ), - mbPageMode( false ), - maTabBgColor( COL_AUTO) + mbPageMode( false ) { } diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 40199949b7a1..6014ded96e1e 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -59,8 +59,8 @@ ScTabControl::ScTabControl( Window* pParent, ScViewData* pData ) : DropTargetHelper( this ), DragSourceHelper( this ), pViewData( pData ), - nMouseClickPageId( TABBAR_PAGE_NOTFOUND ), - nSelPageIdByMouse( TABBAR_PAGE_NOTFOUND ), + nMouseClickPageId( TabBar::PAGE_NOT_FOUND ), + nSelPageIdByMouse( TabBar::PAGE_NOT_FOUND ), bErrorShown( FALSE ) { ScDocument* pDoc = pViewData->GetDocument(); @@ -78,10 +78,9 @@ ScTabControl::ScTabControl( Window* pParent, ScViewData* pData ) : InsertPage( static_cast<sal_uInt16>(i)+1, aString, TPB_SPECIAL ); else InsertPage( static_cast<sal_uInt16>(i)+1, aString ); - if ( !pViewData->IsDefaultTabBgColor(i) ) + if ( !pDoc->IsDefaultTabBgColor(i) ) { - aTabBgColor = pViewData->GetTabBgColor(i); - /*SetTabBgColor(static_cast<sal_uInt16>(i)+1, aTabBgColor, pViewData->IsDefaultTabBgColor(i) );*/ + aTabBgColor = pDoc->GetTabBgColor(i); SetTabBgColor( static_cast<sal_uInt16>(i)+1, aTabBgColor ); } } @@ -164,7 +163,7 @@ void ScTabControl::MouseButtonDown( const MouseEvent& rMEvt ) if( rMEvt.IsLeft() && (rMEvt.GetModifier() == 0) ) nMouseClickPageId = GetPageId( rMEvt.GetPosPixel() ); else - nMouseClickPageId = TABBAR_PAGE_NOTFOUND; + nMouseClickPageId = TabBar::PAGE_NOT_FOUND; TabBar::MouseButtonDown( rMEvt ); } @@ -175,7 +174,7 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt ) // mouse button down and up on same page? if( nMouseClickPageId != GetPageId( aPos ) ) - nMouseClickPageId = TABBAR_PAGE_NOTFOUND; + nMouseClickPageId = TabBar::PAGE_NOT_FOUND; if ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() && nMouseClickPageId != 0 && nMouseClickPageId != TAB_PAGE_NOTFOUND ) { @@ -192,7 +191,7 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt ) SfxDispatcher* pDispatcher = pViewData->GetViewShell()->GetViewFrame()->GetDispatcher(); pDispatcher->Execute( nSlot, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD ); // forget page ID, to be really sure that the dialog is not called twice - nMouseClickPageId = TABBAR_PAGE_NOTFOUND; + nMouseClickPageId = TabBar::PAGE_NOT_FOUND; } TabBar::MouseButtonUp( rMEvt ); @@ -204,7 +203,7 @@ void ScTabControl::Select() nSelPageIdByMouse = nMouseClickPageId; /* Reset nMouseClickPageId, so that next Select() call may invalidate nSelPageIdByMouse (i.e. if called from keyboard). */ - nMouseClickPageId = TABBAR_PAGE_NOTFOUND; + nMouseClickPageId = TabBar::PAGE_NOT_FOUND; ScModule* pScMod = SC_MOD(); ScDocument* pDoc = pViewData->GetDocument(); @@ -304,7 +303,7 @@ void ScTabControl::UpdateStatus() if (pDoc->IsVisible(i)) { pDoc->GetName(i,aString); - aTabBgColor = pViewData->GetTabBgColor(i); + aTabBgColor = pDoc->GetTabBgColor(i); } else { @@ -328,9 +327,9 @@ void ScTabControl::UpdateStatus() InsertPage( static_cast<sal_uInt16>(i)+1, aString, TPB_SPECIAL ); else InsertPage( static_cast<sal_uInt16>(i)+1, aString ); - if ( !pViewData->IsDefaultTabBgColor(i) ) + if ( !pDoc->IsDefaultTabBgColor(i) ) { - aTabBgColor = pViewData->GetTabBgColor(i); + aTabBgColor = pDoc->GetTabBgColor(i); SetTabBgColor( static_cast<sal_uInt16>(i)+1, aTabBgColor ); } } @@ -390,7 +389,7 @@ void ScTabControl::ActivateView(BOOL bActivate) void ScTabControl::SetSheetLayoutRTL( BOOL bSheetRTL ) { SetEffectiveRTL( bSheetRTL ); - nSelPageIdByMouse = TABBAR_PAGE_NOTFOUND; + nSelPageIdByMouse = TabBar::PAGE_NOT_FOUND; } @@ -626,12 +625,12 @@ void ScTabControl::EndRenaming() void ScTabControl::Mirror() { TabBar::Mirror(); - if( nSelPageIdByMouse != TABBAR_PAGE_NOTFOUND ) + if( nSelPageIdByMouse != TabBar::PAGE_NOT_FOUND ) { Rectangle aRect( GetPageRect( GetCurPageId() ) ); if( !aRect.IsEmpty() ) SetPointerPosPixel( aRect.Center() ); - nSelPageIdByMouse = TABBAR_PAGE_NOTFOUND; // only once after a Select() + nSelPageIdByMouse = TabBar::PAGE_NOT_FOUND; // only once after a Select() } } diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 45434da88f73..a20769b298ee 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -55,9 +55,13 @@ #include "scabstdlg.hxx" //CHINA001 -#include "tabbgcolor.hxx" //DBW -#include "tabbgcolordlg.hxx" //DBW -#include <svx/colritem.hxx> //DBW +#include "tabbgcolor.hxx" +#include "tabbgcolordlg.hxx" +#include "svx/colritem.hxx" + +#include <boost/scoped_ptr.hpp> + +using ::boost::scoped_ptr; #define IS_AVAILABLE(WhichId,ppItem) \ (pReqArgs->GetItemState((WhichId), TRUE, ppItem ) == SFX_ITEM_SET) @@ -697,9 +701,6 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) ScMarkData& rMark = pViewData->GetMarkData(); SCTAB nTabSelCount = rMark.GetSelectCount(); - ScUndoSetTabBgColorInfo* aTabBgColorUndoInfo=NULL; - ScUndoSetTabBgColorInfoList* aTabBgColorUndoInfoList =NULL; - if ( !pDoc->IsDocEditable() ) break; @@ -719,18 +720,18 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) if ( nTabSelCount > 1 ) { - aTabBgColorUndoInfoList = new ScUndoSetTabBgColorInfoList(); + scoped_ptr<ScUndoTabColorInfo::List> + pTabColorList(new ScUndoTabColorInfo::List); for (SCTAB nTab=0; nTab<nTabCount; nTab++) { if ( rMark.GetTableSelect(nTab) && !pDoc->IsTabProtected(nTab) ) { - aTabBgColorUndoInfo = new ScUndoSetTabBgColorInfo(); - aTabBgColorUndoInfo->nTabId = nTab; - aTabBgColorUndoInfo->aNewTabBgColor = aColor; - aTabBgColorUndoInfoList->Insert(aTabBgColorUndoInfo); + ScUndoTabColorInfo aTabColorInfo(nTab); + aTabColorInfo.maNewTabBgColor = aColor; + pTabColorList->push_back(aTabColorInfo); } } - bDone = SetTabBgColor( aTabBgColorUndoInfoList ); + bDone = SetTabBgColor( *pTabColorList ); } else { @@ -748,7 +749,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) Color aTabBgColor; Color aNewTabBgColor; - aTabBgColor = pViewData->GetTabBgColor( nCurrentTab ); + aTabBgColor = pDoc->GetTabBgColor( nCurrentTab ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "ScAbstractFactory create fail!"); AbstractScTabBgColorDlg* pDlg = pFact->CreateScTabBgColorDlg( @@ -764,20 +765,20 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { Color aSelectedColor; pDlg->GetSelectedColor(aSelectedColor); - aTabBgColorUndoInfoList = new ScUndoSetTabBgColorInfoList(); + scoped_ptr<ScUndoTabColorInfo::List> + pTabColorList(new ScUndoTabColorInfo::List); if ( nTabSelCount > 1 ) { for (SCTAB nTab=0; nTab<nTabCount; nTab++) { if ( rMark.GetTableSelect(nTab) && !pDoc->IsTabProtected(nTab) ) { - aTabBgColorUndoInfo = new ScUndoSetTabBgColorInfo(); - aTabBgColorUndoInfo->nTabId = nTab; - aTabBgColorUndoInfo->aNewTabBgColor = aSelectedColor; - aTabBgColorUndoInfoList->Insert(aTabBgColorUndoInfo); + ScUndoTabColorInfo aTabColorInfo(nTab); + aTabColorInfo.maNewTabBgColor = aSelectedColor; + pTabColorList->push_back(aTabColorInfo); } } - bDone = SetTabBgColor( aTabBgColorUndoInfoList ); + bDone = SetTabBgColor( *pTabColorList ); } else { @@ -932,7 +933,7 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet ) case FID_TAB_SET_TAB_BG_COLOR: { Color aColor; - aColor = pViewData->GetTabBgColor( nTab ); + aColor = pDoc->GetTabBgColor( nTab ); rSet.Put( SvxColorItem( aColor, nWhich ) ); } break; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 814501ae8a63..b0a3635d35c7 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -101,8 +101,7 @@ ScViewDataTable::ScViewDataTable() : nFixPosY( 0 ), nCurX( 0 ), nCurY( 0 ), - bOldCurValid( FALSE ), - aTabBgColor( Color(COL_AUTO) ) + bOldCurValid( FALSE ) { nPosX[0]=nPosX[1]=0; nPosY[0]=nPosY[1]=0; @@ -161,14 +160,6 @@ void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue> pSettings[SC_TABLE_ZOOM_VALUE].Value <<= nZoomValue; pSettings[SC_TABLE_PAGE_VIEW_ZOOM_VALUE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_PAGEVIEWZOOMVALUE)); pSettings[SC_TABLE_PAGE_VIEW_ZOOM_VALUE].Value <<= nPageZoomValue; - - if ( !IsDefaultTabBgColor() ) - { - pSettings[SC_TABLE_TAB_BG_COLOR].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_TABCOLOR)); - pSettings[SC_TABLE_TAB_BG_COLOR].Value <<= static_cast<sal_Int32>(aTabBgColor.GetColor()); - } -// pSettings[SC_TABLE_SELECTED].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_TABLESELECTED)); -// pSettings[SC_TABLE_SELECTED].Value <<= bool(rViewData.GetMarkData().GetTableSelect( nTab )); } } @@ -279,12 +270,16 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV aSettings[i].Value >>= bSelected; rViewData.GetMarkData().SelectTable( nTab, bSelected ); } - else if (sName.compareToAscii(SC_UNO_TABCOLOR) == 0) + else if (sName.compareToAscii(SC_UNONAME_TABCOLOR) == 0) { + // There are documents out there that have their tab color defined as a view setting. sal_Int32 nColor = COL_AUTO; aSettings[i].Value >>= nColor; if (static_cast<ColorData>(nColor) != COL_AUTO) - aTabBgColor.SetColor(static_cast<ColorData>(nColor)); + { + ScDocument* pDoc = rViewData.GetDocument(); + pDoc->SetTabBgColor(nTab, Color(static_cast<ColorData>(nColor))); + } } } if (eHSplitMode == SC_SPLIT_FIX) @@ -589,36 +584,6 @@ void ScViewData::MoveTab( SCTAB nSrcTab, SCTAB nDestTab ) aMarkData.InsertTab( nInsTab ); // ggf. angepasst } -void ScViewData::SetTabBgColor( Color rTabBgColor, SCTAB nTab ) -{ - if ( rTabBgColor != Color(COL_AUTO) ) - { - if ( !pTabData[nTab] ) - CreateTabData( nTab ); - pTabData[nTab]->aTabBgColor = rTabBgColor; - } - else - { - if ( pTabData[nTab] ) - pTabData[nTab]->aTabBgColor = Color( COL_AUTO ); - } -} - -Color ScViewData::GetTabBgColor( SCTAB nTab ) const -{ - if ( !pTabData[nTab] ) - return Color(COL_AUTO); - return pTabData[nTab]->aTabBgColor; -} - -BOOL ScViewData::IsDefaultTabBgColor( SCTAB nTab ) const -{ - if ( !pTabData[nTab] ) - return true; - BOOL bResult = pTabData[nTab]->aTabBgColor==Color( COL_AUTO ) ? TRUE : FALSE; - return bResult; -} - //UNUSED2008-05 void ScViewData::UpdateOle( ScSplitPos /* eWhich */ ) //UNUSED2008-05 { //UNUSED2008-05 GetDocShell()->UpdateOle(this); @@ -2563,9 +2528,6 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const rTabSett.mbPageMode = bPagebreak; rTabSett.mnNormalZoom = static_cast< long >( pViewTab->aZoomY * Fraction( 100.0 ) ); rTabSett.mnPageZoom = static_cast< long >( pViewTab->aPageZoomY * Fraction( 100.0 ) ); - - // Tab Bg Color - rTabSett.maTabBgColor = pViewTab->aTabBgColor; } } } @@ -2720,10 +2682,6 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt ) update map modes that are needed to draw text correctly. */ SetPagebreakMode( rTabSett.mbPageMode ); } - - // Tab Bg Color - if( !rTabSett.IsDefaultTabBgColor() ) - rViewTab.aTabBgColor = rTabSett.maTabBgColor; } } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 4e6d094bddc6..5afa6b0d0190 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -85,8 +85,7 @@ #include "inputwin.hxx" #include "funcdesc.hxx" #include "docuno.hxx" - -#include "tabbgcolor.hxx" //DBW +#include "tabbgcolor.hxx" // STATIC DATA --------------------------------------------------------------- @@ -2274,9 +2273,9 @@ BOOL ScViewFunc::RenameTable( const String& rName, SCTAB nTab ) //---------------------------------------------------------------------------- -BOOL ScViewFunc::SetTabBgColor( const Color& rColor, SCTAB nTab ) +bool ScViewFunc::SetTabBgColor( const Color& rColor, SCTAB nTab ) { - BOOL bSuccess = GetViewData()->GetDocShell()->GetDocFunc().SetTabBgColor( nTab, rColor, TRUE, FALSE ); + bool bSuccess = GetViewData()->GetDocShell()->GetDocFunc().SetTabBgColor( nTab, rColor, TRUE, FALSE ); if (bSuccess) { GetViewData()->GetViewShell()->UpdateInputHandler(); @@ -2284,9 +2283,9 @@ BOOL ScViewFunc::SetTabBgColor( const Color& rColor, SCTAB nTab ) return bSuccess; } -BOOL ScViewFunc::SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorInfoList ) +bool ScViewFunc::SetTabBgColor( ScUndoTabColorInfo::List& rUndoSetTabBgColorInfoList ) { - BOOL bSuccess = GetViewData()->GetDocShell()->GetDocFunc().SetTabBgColor( rUndoSetTabBgColorInfoList, TRUE, FALSE ); + bool bSuccess = GetViewData()->GetDocShell()->GetDocFunc().SetTabBgColor( rUndoSetTabBgColorInfoList, TRUE, FALSE ); if (bSuccess) { GetViewData()->GetViewShell()->UpdateInputHandler(); |