From a2c4fece04b6aa8d8163986f3dffbbf86bd9bfb2 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 1 Jul 2010 17:39:28 +0200 Subject: #i112436# use InterpretDirtyCells instead of SetDirty for charts in xls import --- sc/source/core/data/document.cxx | 13 +++++++++++++ sc/source/filter/excel/xiescher.cxx | 6 ++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'sc') diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index bef4cbf87396..eee87317c258 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3061,6 +3061,19 @@ void ScDocument::CalcAfterLoad() bCalcingAfterLoad = FALSE; SetDetectiveDirty(FALSE); // noch keine wirklichen Aenderungen + + // #i112436# If formula cells are already dirty, they don't broadcast further changes. + // So the source ranges of charts must be interpreted even if they are not visible, + // similar to ScMyShapeResizer::CreateChartListener for loading own files (i104899). + if (pChartListenerCollection) + { + sal_uInt16 nChartCount = pChartListenerCollection->GetCount(); + for ( sal_uInt16 nIndex = 0; nIndex < nChartCount; nIndex++ ) + { + ScChartListener* pChartListener = static_cast(pChartListenerCollection->At(nIndex)); + InterpretDirtyCells(*pChartListener->GetRangeList()); + } + } } diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index dc87bba4c050..8d09cae60941 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -98,7 +98,6 @@ #include "convuno.hxx" #include "postit.hxx" #include "globstr.hrc" -#include "chartlis.hxx" #include "fprogressbar.hxx" #include "xltracer.hxx" @@ -4056,9 +4055,8 @@ void XclImpObjectManager::ConvertObjects() for( XclImpSheetDrawingMap::iterator aIt = maSheetDrawings.begin(), aEnd = maSheetDrawings.end(); aIt != aEnd; ++aIt ) aIt->second->ConvertObjects( aDffConv ); - ScChartListenerCollection* pChartListeners = GetDoc().GetChartListenerCollection(); - if( pChartListeners && (pChartListeners->GetCount() > 0) ) - pChartListeners->SetDirty(); + // #i112436# don't call ScChartListenerCollection::SetDirty here, + // instead use InterpretDirtyCells in ScDocument::CalcAfterLoad. } String XclImpObjectManager::GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const -- cgit From df61240acdb6cf89e2b2c1895ba293eb78e0d973 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 1 Jul 2010 20:09:06 +0200 Subject: #i112858# don't access invalid resources in ScTabBgColorDlg --- sc/source/ui/inc/miscdlgs.hrc | 1 - sc/source/ui/inc/tabbgcolordlg.hxx | 2 -- sc/source/ui/miscdlgs/tabbgcolordlg.cxx | 21 ++++++++++----------- 3 files changed, 10 insertions(+), 14 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc index becd05165a4e..00b1658849d6 100644 --- a/sc/source/ui/inc/miscdlgs.hrc +++ b/sc/source/ui/inc/miscdlgs.hrc @@ -185,5 +185,4 @@ // Tab Bg Color #define TAB_BG_COLOR_CT_BORDER 1 #define TAB_BG_COLOR_SET_BGDCOLOR 2 -#define TAB_BG_COLOR_GB_BGDCOLOR 3 diff --git a/sc/source/ui/inc/tabbgcolordlg.hxx b/sc/source/ui/inc/tabbgcolordlg.hxx index 241fc806022d..338609ae0e4d 100644 --- a/sc/source/ui/inc/tabbgcolordlg.hxx +++ b/sc/source/ui/inc/tabbgcolordlg.hxx @@ -32,7 +32,6 @@ #define SC_TABBGCOLORDLG_HXX #include -#include #include #include @@ -63,7 +62,6 @@ private: Control aBorderWin; ScTabBgColorValueSet aTabBgColorSet; - FixedLine aTabBgColorBox; OKButton aBtnOk; CancelButton aBtnCancel; HelpButton aBtnHelp; diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx index fdc4c9fd34bf..463c06d76712 100644 --- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx +++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx @@ -39,14 +39,15 @@ #include "scresid.hxx" #include "miscdlgs.hrc" -#include "tools/debug.hxx" -#include "tools/color.hxx" -#include "sfx2/objsh.hxx" -#include "svx/xtable.hxx" -#include "svx/drawitem.hxx" -#include "unotools/pathoptions.hxx" -#include "tools/resid.hxx" -#include "editeng/editrids.hrc" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -62,7 +63,6 @@ ScTabBgColorDlg::ScTabBgColorDlg( Window* pParent, 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 ), - aTabBgColorBox ( this, ScResId( TAB_BG_COLOR_GB_BGDCOLOR ) ), aBtnOk ( this, ScResId( BTN_OK ) ), aBtnCancel ( this, ScResId( BTN_CANCEL ) ), aBtnHelp ( this, ScResId( BTN_HELP ) ), @@ -75,7 +75,6 @@ ScTabBgColorDlg::ScTabBgColorDlg( Window* pParent, this->SetText( rTitle ); this->SetStyle(GetStyle() | WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL | WB_SYSTEMWINDOW | WB_STANDALONE | WB_HIDE); - aTabBgColorBox.SetText(rTitle); FillColorValueSets_Impl(); aTabBgColorSet.SetDoubleClickHdl( HDL(TabBgColorDblClickHdl_Impl) ); aBtnOk.SetClickHdl( HDL(TabBgColorOKHdl_Impl) ); @@ -120,7 +119,7 @@ void ScTabBgColorDlg::FillColorValueSets_Impl() long nCount = pColorTable->Count(); XColorEntry* pEntry = NULL; Color aColWhite( COL_WHITE ); - String aStrWhite( ScResId( RID_SVXITEMS_COLOR_WHITE ) ); + String aStrWhite( EditResId( RID_SVXITEMS_COLOR_WHITE ) ); WinBits nBits = ( aTabBgColorSet.GetStyle() | WB_NAMEFIELD | WB_ITEMBORDER | WB_NONEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_NOPOINTERFOCUS); aTabBgColorSet.SetText( aTabBgColorNoColorText ); aTabBgColorSet.SetStyle( nBits ); -- cgit From da291caaae96e0e46cd6891746587528cbbdd925 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Fri, 2 Jul 2010 13:51:34 +0200 Subject: calc56: #i112849# Prevent hash from accessing dangling pointers --- sc/source/core/data/bcaslot.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sc') diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index 95482b1c624b..540fb577a79b 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -136,10 +136,16 @@ ScBroadcastAreaSlot::ScBroadcastAreaSlot( ScDocument* pDocument, ScBroadcastAreaSlot::~ScBroadcastAreaSlot() { for ( ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.begin()); - aIter != aBroadcastAreaTbl.end(); ++aIter) + aIter != aBroadcastAreaTbl.end(); /* none */) { - if (!(*aIter)->DecRef()) - delete *aIter; + // Prevent hash from accessing dangling pointer in case area is + // deleted. + ScBroadcastArea* pArea = *aIter; + // Erase all so no hash will be accessed upon destruction of the + // hash_set. + aBroadcastAreaTbl.erase( aIter++); + if (!pArea->DecRef()) + delete pArea; } } -- cgit From 50727c4ef2058ed886493876f016fee1f2db5dcd Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 5 Jul 2010 19:52:39 +0200 Subject: #i112745# get the right font size for ScDPFieldButton, clip text to bounding box --- sc/source/ui/cctrl/dpcontrol.cxx | 36 ++++++++++++++++++++++++++---------- sc/source/ui/inc/dpcontrol.hxx | 4 +++- sc/source/ui/view/gridwin2.cxx | 2 +- sc/source/ui/view/gridwin4.cxx | 4 ++-- 4 files changed, 32 insertions(+), 14 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index 52aae575b7d7..11f9cb197363 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -33,12 +33,16 @@ #include "dpcontrol.hxx" #include "dpcontrol.hrc" -#include "vcl/outdev.hxx" -#include "vcl/settings.hxx" -#include "vcl/wintypes.hxx" -#include "vcl/decoview.hxx" +#include +#include +#include +#include #include "strload.hxx" #include "global.hxx" +#include "scitems.hxx" +#include "document.hxx" +#include "docpool.hxx" +#include "patattr.hxx" #include "AccessibleFilterMenu.hxx" #include "AccessibleFilterTopWindow.hxx" @@ -55,7 +59,8 @@ using ::std::vector; using ::std::hash_map; using ::std::auto_ptr; -ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX, const Fraction* pZoomY) : +ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX, const Fraction* pZoomY, ScDocument* pDoc) : + mpDoc(pDoc), mpOutDev(pOutDev), mpStyle(pStyle), mbBaseButton(true), @@ -135,17 +140,28 @@ void ScDPFieldButton::draw() Point(maPos.X()+maSize.Width()-1, maPos.Y()+maSize.Height()-1)); // Field name. - Font aTextFont( mpStyle->GetLabelFont() ); - double fFontHeight = 12.0; - fFontHeight *= static_cast(maZoomY.GetNumerator()) / static_cast(maZoomY.GetDenominator()); - aTextFont.SetHeight(static_cast(fFontHeight)); + // Get the font and size the same way as in scenario selection (lcl_DrawOneFrame in gridwin4.cxx) + Font aTextFont( mpStyle->GetAppFont() ); + if ( mpDoc ) + { + // use ScPatternAttr::GetFont only for font size + Font aAttrFont; + static_cast(mpDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)). + GetFont( aAttrFont, SC_AUTOCOL_BLACK, mpOutDev, &maZoomY ); + aTextFont.SetSize( aAttrFont.GetSize() ); + } mpOutDev->SetFont(aTextFont); + mpOutDev->SetTextColor(mpStyle->GetButtonTextColor()); Point aTextPos = maPos; - long nTHeight = static_cast(fFontHeight); + long nTHeight = mpOutDev->GetTextHeight(); aTextPos.setX(maPos.getX() + nMargin); aTextPos.setY(maPos.getY() + (maSize.Height()-nTHeight)/2); + + mpOutDev->Push(PUSH_CLIPREGION); + mpOutDev->IntersectClipRegion(aRect); mpOutDev->DrawText(aTextPos, maText); + mpOutDev->Pop(); } if (mbPopupButton) diff --git a/sc/source/ui/inc/dpcontrol.hxx b/sc/source/ui/inc/dpcontrol.hxx index 15f0c9174cc8..45badf0c88fd 100644 --- a/sc/source/ui/inc/dpcontrol.hxx +++ b/sc/source/ui/inc/dpcontrol.hxx @@ -64,7 +64,8 @@ class ScAccessibleFilterMenu; class ScDPFieldButton { public: - ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX = NULL, const Fraction* pZoomY = NULL); + ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX = NULL, const Fraction* pZoomY = NULL, + ScDocument* pDoc = NULL); ~ScDPFieldButton(); void setText(const ::rtl::OUString& rText); @@ -86,6 +87,7 @@ private: ::rtl::OUString maText; Fraction maZoomX; Fraction maZoomY; + ScDocument* mpDoc; OutputDevice* mpOutDev; const StyleSettings* mpStyle; bool mbBaseButton; diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index f8b5c25c4a70..a64814d952ef 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -144,7 +144,7 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& Size aScrSize(nSizeX-1, nSizeY-1); // Check if the mouse cursor is clicking on the popup arrow box. - mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY())); + mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY(), pDoc)); mpFilterButton->setBoundingBox(aScrPos, aScrSize); Point aPopupPos; Size aPopupSize; diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index d8024e439173..4e1a19caae6d 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1208,14 +1208,14 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2 { aComboButton.SetOutputDevice( pContentDev ); - ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY()); + ScDocument* pDoc = pViewData->GetDocument(); + ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY(), pDoc); SCCOL nCol; SCROW nRow; SCSIZE nArrY; SCSIZE nQuery; SCTAB nTab = pViewData->GetTabNo(); - ScDocument* pDoc = pViewData->GetDocument(); ScDBData* pDBData = NULL; ScQueryParam* pQueryParam = NULL; -- cgit From e674baba51bdbe489e9c8617e5ed45840d6bfbd4 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Wed, 7 Jul 2010 17:28:29 +0200 Subject: #i112250# #i113022# better handling of automatic decimals for small values or equal cells --- sc/source/ui/view/output2.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sc') diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index b0b040f9b5e0..8e4a3e6b2ec9 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -565,6 +565,12 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth ) else if (c == sal_Unicode('E')) ++nExpCount; } + + // #i112250# A small value might be formatted as "0" when only counting the digits, + // but fit into the column when considering the smaller width of the decimal separator. + if (aString.EqualsAscii("0") && fVal != 0.0) + nDecimalCount = 1; + if (nDecimalCount) nWidth += (nMaxDigit - GetDotWidth()) * nDecimalCount; if (nSignCount) @@ -594,6 +600,7 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth ) } TextChanged(); + pLastCell = NULL; // #i113022# equal cell and format in another column may give different string } void ScDrawStringsVars::SetAutoText( const String& rAutoText ) -- cgit From f801707b085ea0356749a79588ab00ef13d3ac48 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 9 Jul 2010 09:58:50 +0200 Subject: #i113045# SetTextToWidthOrHash: do the single-character width calculations in logic units --- sc/source/ui/view/output2.cxx | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 8e4a3e6b2ec9..6d40d304fb13 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -171,12 +171,11 @@ public: private: void SetHashText(); - long GetMaxDigitWidth(); + long GetMaxDigitWidth(); // in logic units long GetSignWidth(); long GetDotWidth(); long GetExpWidth(); void TextChanged(); - long ConvertWidthLogicToPixel( long nWidth ) const; }; //================================================================== @@ -518,6 +517,10 @@ void ScDrawStringsVars::SetHashText() void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth ) { + // #i113045# do the single-character width calculations in logic units + if (bPixelToLogic) + nWidth = pOutput->pRefDevice->PixelToLogic(Size(nWidth,0)).Width(); + if (!pCell) return; @@ -588,10 +591,6 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth ) } long nActualTextWidth = pOutput->pFmtDevice->GetTextWidth(aString); - - if (bPixelToLogic) - nActualTextWidth = ConvertWidthLogicToPixel(nActualTextWidth); - if (nActualTextWidth > nWidth) { // Even after the decimal adjustment the text doesn't fit. Give up. @@ -645,9 +644,6 @@ long ScDrawStringsVars::GetMaxDigitWidth() long n = pOutput->pFmtDevice->GetTextWidth(String(cDigit)); nMaxDigitWidth = ::std::max(nMaxDigitWidth, n); } - - if (bPixelToLogic) - nMaxDigitWidth = ConvertWidthLogicToPixel(nMaxDigitWidth); return nMaxDigitWidth; } @@ -657,8 +653,6 @@ long ScDrawStringsVars::GetSignWidth() return nSignWidth; nSignWidth = pOutput->pFmtDevice->GetTextWidth(String('-')); - if (bPixelToLogic) - nSignWidth = ConvertWidthLogicToPixel(nSignWidth); return nSignWidth; } @@ -669,8 +663,6 @@ long ScDrawStringsVars::GetDotWidth() const ::rtl::OUString& sep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator; nDotWidth = pOutput->pFmtDevice->GetTextWidth(sep); - if (bPixelToLogic) - nDotWidth = ConvertWidthLogicToPixel(nDotWidth); return nDotWidth; } @@ -680,8 +672,6 @@ long ScDrawStringsVars::GetExpWidth() return nExpWidth; nExpWidth = pOutput->pFmtDevice->GetTextWidth(String('E')); - if (bPixelToLogic) - nExpWidth = ConvertWidthLogicToPixel(nExpWidth); return nExpWidth; } @@ -711,13 +701,6 @@ void ScDrawStringsVars::TextChanged() aTextSize = pRefDevice->LogicToPixel( aTextSize ); } -long ScDrawStringsVars::ConvertWidthLogicToPixel( long nWidth ) const -{ - Size aSize(nWidth, pOutput->pFmtDevice->GetTextHeight()); - aSize = pOutput->pRefDevice->LogicToPixel(aSize); - return aSize.Width(); -} - BOOL ScDrawStringsVars::HasEditCharacters() const { static const sal_Unicode pChars[] = -- cgit From aaf48ef999ab4345af109d6c4ff25ea0f986a238 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 9 Jul 2010 18:57:49 +0200 Subject: calc56: #i112745# draw edit cells and printer-metrics text before DataPilot buttons --- sc/source/ui/view/gridwin4.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 4e1a19caae6d..6bf27387314a 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -750,6 +750,15 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod if ( !bLogicText ) aOutputData.DrawStrings(FALSE); // in pixel MapMode + // edit cells and printer-metrics text must be before the buttons + // (DataPilot buttons contain labels in UI font) + + pContentDev->SetMapMode(pViewData->GetLogicMode(eWhich)); + if ( bLogicText ) + aOutputData.DrawStrings(TRUE); // in logic MapMode if bTextWysiwyg is set + aOutputData.DrawEdit(TRUE); + pContentDev->SetMapMode(MAP_PIXEL); + // Autofilter- und Pivot-Buttons DrawButtons( nX1, nY1, nX2, nY2, aTabInfo, pContentDev ); // Pixel @@ -759,14 +768,6 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod if ( rOpts.GetOption( VOPT_NOTES ) ) aOutputData.DrawNoteMarks(); - // Edit-Zellen - - pContentDev->SetMapMode(pViewData->GetLogicMode(eWhich)); - if ( bLogicText ) - aOutputData.DrawStrings(TRUE); // in logic MapMode if bTextWysiwyg is set - aOutputData.DrawEdit(TRUE); - - pContentDev->SetMapMode(MAP_PIXEL); if ( !bGridFirst && ( bGrid || bPage ) ) { aOutputData.DrawGrid( bGrid, bPage ); -- cgit From 8c7337513fc86371edcdf9fcddc8d1fef8efc329 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 12 Jul 2010 19:32:20 +0200 Subject: calc56: #i102690# correct attribute names diagonal-bl-tr-widths and diagonal-tl-br-widths --- sc/source/filter/xml/xmlstyle.cxx | 18 ++++++++++++++++-- sc/source/filter/xml/xmlstyle.hxx | 2 ++ sc/source/filter/xml/xmlstyli.cxx | 19 ++++++++++++++----- 3 files changed, 32 insertions(+), 7 deletions(-) (limited to 'sc') diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx index 4127f5246428..d061ea24b194 100644 --- a/sc/source/filter/xml/xmlstyle.cxx +++ b/sc/source/filter/xml/xmlstyle.cxx @@ -81,9 +81,11 @@ const XMLPropertyMapEntry aXMLScCellStylesProperties[] = MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_IMPORT_MAP ), MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MAP ), MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALBLTR ), - MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTH ), + MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTH ), // #i102690# for old files + MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTHS ), MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALTLBR ), - MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTH ), + MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTH ), // #i102690# for old files + MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTHS ), MAP( "HoriJustify", XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ), MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 ), MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ), @@ -490,6 +492,18 @@ void ScXMLCellExportPropertyMapper::ContextFilter( pParaMarginBottomRel->maValue.clear(); } + // #i102690# old diagonal line attribute names without "s" are only read, not written + if (pDiagonalTLBRWidthState) + { + pDiagonalTLBRWidthState->mnIndex = -1; + pDiagonalTLBRWidthState->maValue.clear(); + } + if (pDiagonalBLTRWidthState) + { + pDiagonalBLTRWidthState->mnIndex = -1; + pDiagonalBLTRWidthState->maValue.clear(); + } + SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet); } diff --git a/sc/source/filter/xml/xmlstyle.hxx b/sc/source/filter/xml/xmlstyle.hxx index 07e7138afc71..f8abf5e6443d 100644 --- a/sc/source/filter/xml/xmlstyle.hxx +++ b/sc/source/filter/xml/xmlstyle.hxx @@ -90,6 +90,8 @@ extern const XMLPropertyMapEntry aXMLScTableStylesImportProperties[]; #define CTF_SC_DIAGONALTLBRWIDTH (XML_SC_CTF_START + 26) #define CTF_SC_DIAGONALBLTR (XML_SC_CTF_START + 27) #define CTF_SC_DIAGONALBLTRWIDTH (XML_SC_CTF_START + 28) +#define CTF_SC_DIAGONALTLBRWIDTHS (XML_SC_CTF_START + 29) +#define CTF_SC_DIAGONALBLTRWIDTHS (XML_SC_CTF_START + 30) #define CTF_SC_ROWHEIGHT (XML_SC_CTF_START + 50) #define CTF_SC_ROWOPTIMALHEIGHT (XML_SC_CTF_START + 51) diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 9a04e284bf45..3866bba63239 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -105,6 +105,7 @@ void ScXMLCellImportPropertyMapper::finished(::std::vector< XMLPropertyState >& XMLPropertyState* pAllBorderWidthProperty = NULL; XMLPropertyState* pBorderWidths[4] = { NULL, NULL, NULL, NULL }; XMLPropertyState* pDiagBorders[2] = { 0 }; + XMLPropertyState* pOldDiagBorderWidths[2] = { 0 }; // old attribute names without "s" XMLPropertyState* pDiagBorderWidths[2] = { 0 }; ::std::vector< XMLPropertyState >::iterator endproperty(rProperties.end()); @@ -134,8 +135,10 @@ void ScXMLCellImportPropertyMapper::finished(::std::vector< XMLPropertyState >& case CTF_SC_BOTTOMBORDERWIDTH : pBorderWidths[XML_LINE_BOTTOM] = &*property; break; case CTF_SC_DIAGONALTLBR : pDiagBorders[XML_LINE_TLBR] = &*property; break; case CTF_SC_DIAGONALBLTR : pDiagBorders[XML_LINE_BLTR] = &*property; break; - case CTF_SC_DIAGONALTLBRWIDTH : pDiagBorderWidths[XML_LINE_TLBR] = &*property; break; - case CTF_SC_DIAGONALBLTRWIDTH : pDiagBorderWidths[XML_LINE_BLTR] = &*property; break; + case CTF_SC_DIAGONALTLBRWIDTH : pOldDiagBorderWidths[XML_LINE_TLBR] = &*property; break; + case CTF_SC_DIAGONALTLBRWIDTHS : pDiagBorderWidths[XML_LINE_TLBR] = &*property; break; + case CTF_SC_DIAGONALBLTRWIDTH : pOldDiagBorderWidths[XML_LINE_BLTR] = &*property; break; + case CTF_SC_DIAGONALBLTRWIDTHS : pDiagBorderWidths[XML_LINE_BLTR] = &*property; break; } } } @@ -179,17 +182,23 @@ void ScXMLCellImportPropertyMapper::finished(::std::vector< XMLPropertyState >& } for( i = 0; i < 2; ++i ) { - if( pDiagBorders[i] && pDiagBorderWidths[i] ) + if( pDiagBorders[i] && ( pDiagBorderWidths[i] || pOldDiagBorderWidths[i] ) ) { table::BorderLine aBorderLine; pDiagBorders[i]->maValue >>= aBorderLine; table::BorderLine aBorderLineWidth; - pDiagBorderWidths[i]->maValue >>= aBorderLineWidth; + if (pDiagBorderWidths[i]) + pDiagBorderWidths[i]->maValue >>= aBorderLineWidth; // prefer new attribute + else + pOldDiagBorderWidths[i]->maValue >>= aBorderLineWidth; aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth; aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth; aBorderLine.LineDistance = aBorderLineWidth.LineDistance; pDiagBorders[i]->maValue <<= aBorderLine; - pDiagBorderWidths[i]->mnIndex = -1; + if (pDiagBorderWidths[i]) + pDiagBorderWidths[i]->mnIndex = -1; + if (pOldDiagBorderWidths[i]) + pOldDiagBorderWidths[i]->mnIndex = -1; // reset mnIndex for old and new attribute if both are present } } -- cgit From b6a2eaed5b6b9ab8b2e957efc63229968e0023c6 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 15 Jul 2010 11:38:31 +0200 Subject: calc56: #i113160# use XSingleComponentFactory to load external DataPilotSource implementation --- sc/source/core/data/dpobject.cxx | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'sc') diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index a2a10329cf68..739b6a47d1a2 100755 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -2277,6 +2278,9 @@ uno::Sequence ScDPObject::GetRegisteredSources() return aSeq; } +// use getContext from addincol.cxx +uno::Reference getContext(uno::Reference xMSF); + // static uno::Reference ScDPObject::CreateSource( const ScDPServiceDesc& rDesc ) { @@ -2301,12 +2305,26 @@ uno::Reference ScDPObject::CreateSource( const ScDPS if ( xIntFac.is() ) { uno::Reference xInfo( xIntFac, uno::UNO_QUERY ); - uno::Reference xFac( xIntFac, uno::UNO_QUERY ); - if ( xFac.is() && xInfo.is() && xInfo->getImplementationName() == aImplName ) + if ( xInfo.is() && xInfo->getImplementationName() == aImplName ) { try { - uno::Reference xInterface = xFac->createInstance(); + // #i113160# try XSingleComponentFactory in addition to (old) XSingleServiceFactory, + // passing the context to the component (see ScUnoAddInCollection::Initialize) + + uno::Reference xInterface; + uno::Reference xCtx = getContext(xManager); + uno::Reference xCFac( xIntFac, uno::UNO_QUERY ); + if (xCtx.is() && xCFac.is()) + xInterface = xCFac->createInstanceWithContext(xCtx); + + if (!xInterface.is()) + { + uno::Reference xFac( xIntFac, uno::UNO_QUERY ); + if ( xFac.is() ) + xInterface = xFac->createInstance(); + } + uno::Reference xInit( xInterface, uno::UNO_QUERY ); if (xInit.is()) { -- cgit From d5d147219645771f745d46db17d6fd2c31347aae Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 15 Jul 2010 14:11:48 +0200 Subject: calc56: #i113159# check if GetTextEditOutlinerView is null in thesaurus state method --- sc/source/ui/drawfunc/drtxtob.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index bfbeba2d1302..a5159d8a8043 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -486,11 +486,16 @@ void __EXPORT ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) rSet.GetItemState( SID_THESAURUS ) != SFX_ITEM_UNKNOWN ) { SdrView * pView = pViewData->GetScDrawView(); - EditView & rEditView = pView->GetTextEditOutlinerView()->GetEditView(); + OutlinerView* pOutView = pView->GetTextEditOutlinerView(); String aStatusVal; LanguageType nLang = LANGUAGE_NONE; - bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); + bool bIsLookUpWord = false; + if ( pOutView ) + { + EditView& rEditView = pOutView->GetEditView(); + bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); + } rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable thesaurus main menu and context menu entry if there is nothing to look up -- cgit From 98cdf3324314ebf7ee69605af2a8fc28be092528 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Fri, 16 Jul 2010 15:58:36 +0200 Subject: calc56: #i113139# various performance improvements for 1MB rows, especially with large hidden segments --- sc/inc/document.hxx | 1 + sc/inc/table.hxx | 46 +++---- sc/source/core/data/documen3.cxx | 83 ++++++++----- sc/source/core/data/document.cxx | 54 ++++++--- sc/source/core/data/fillinfo.cxx | 20 ++- sc/source/core/data/markdata.cxx | 60 ++++++--- sc/source/core/data/table2.cxx | 38 ++++-- sc/source/core/data/table5.cxx | 52 +++++--- sc/source/filter/xml/XMLStylesExportHelper.cxx | 27 ++++- sc/source/filter/xml/XMLStylesExportHelper.hxx | 1 + sc/source/filter/xml/xmlexprt.cxx | 7 +- sc/source/ui/inc/viewdata.hxx | 18 +++ sc/source/ui/undo/undoblk.cxx | 2 +- sc/source/ui/view/gridwin4.cxx | 12 +- sc/source/ui/view/output.cxx | 14 ++- sc/source/ui/view/viewdata.cxx | 161 +++++++++++++++++-------- 16 files changed, 398 insertions(+), 198 deletions(-) (limited to 'sc') diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index f7ae5e63f165..304a9d1df0f7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1276,6 +1276,7 @@ public: SC_DLLPUBLIC USHORT GetColWidth( SCCOL nCol, SCTAB nTab ) const; SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const; + SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const; SC_DLLPUBLIC ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const; SCROW GetRowForHeight( SCTAB nTab, ULONG nHeight ) const; ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 78e5875b6879..5f42a2f37247 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -628,12 +628,12 @@ public: // nPPT fuer Test auf Veraenderung void SetManualHeight( SCROW nStartRow, SCROW nEndRow, BOOL bManual ); - USHORT GetColWidth( SCCOL nCol ); - SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ); - ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow ); - ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ); - ULONG GetColOffset( SCCOL nCol ); - ULONG GetRowOffset( SCROW nRow ); + USHORT GetColWidth( SCCOL nCol ) const; + SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const; + ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const; + ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const; + ULONG GetColOffset( SCCOL nCol ) const; + ULONG GetRowOffset( SCROW nRow ) const; /** * Get the last row such that the height of row 0 to the end row is as @@ -643,7 +643,7 @@ public: * * @return SCROW last row of the range within specified height. */ - SCROW GetRowForHeight(ULONG nHeight); + SCROW GetRowForHeight(ULONG nHeight) const; USHORT GetOriginalWidth( SCCOL nCol ) const; USHORT GetOriginalHeight( SCROW nRow ) const; @@ -711,33 +711,33 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const; - bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL); - bool RowHidden(SCROW nRow, SCROW& rLastRow); - bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow); - bool ColHidden(SCCOL nCol, SCCOL& rLastCol); - bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL); + bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const; + bool RowHidden(SCROW nRow, SCROW& rLastRow) const; + bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const; + bool ColHidden(SCCOL nCol, SCCOL& rLastCol) const; + bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const; void SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden); void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden); void CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol); void CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow); void CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset); - SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow); - SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow); - SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow); - sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow); + SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const; + SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const; + SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const; + sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const; - SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol); + SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const; - bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL); - bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL); - bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow); + bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const; + bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const; + bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const; void CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol); void CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow); void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered); void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered); - SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow); - SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow); - SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow); + SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const; + SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const; + SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const; void SyncColRowFlags(); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 1861988d78aa..29f59352695d 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1546,6 +1546,48 @@ void ScDocument::ResetEmbedded() aEmbedRange = ScRange(); } + +/** Similar to ScViewData::AddPixelsWhile(), but add height twips and only + while result is less than nStopTwips. + */ +void lcl_AddTwipsWhile( long & rTwips, long nStopTwips, SCROW & rPosY, SCROW nEndRow, const ScTable * pTable ) +{ + SCROW nRow = rPosY; + bool bStop = false; + while (rTwips < nStopTwips && nRow <= nEndRow && !bStop) + { + SCROW nHeightEndRow; + USHORT nHeight = pTable->GetRowHeight( nRow, NULL, &nHeightEndRow); + if (nHeightEndRow > nEndRow) + nHeightEndRow = nEndRow; + if (!nHeight) + nRow = nHeightEndRow + 1; + else + { + SCROW nRows = nHeightEndRow - nRow + 1; + sal_Int64 nAdd = static_cast(nHeight) * nRows; + if (nAdd + rTwips >= nStopTwips) + { + sal_Int64 nDiff = nAdd + rTwips - nStopTwips; + nRows -= nDiff / nHeight; + nAdd = nHeight * nRows; + // We're looking for a value that satisfies loop condition. + if (nAdd + rTwips >= nStopTwips) + { + --nRows; + nAdd -= nHeight; + } + bStop = true; + } + rTwips += static_cast(nAdd); + nRow += nRows; + } + } + if (nRow > rPosY) + --nRow; + rPosY = nRow; +} + ScRange ScDocument::GetRange( SCTAB nTab, const Rectangle& rMMRect ) { ScTable* pTable = pTab[nTab]; @@ -1602,43 +1644,18 @@ ScRange ScDocument::GetRange( SCTAB nTab, const Rectangle& rMMRect ) nTwips = (long) (aPosRect.Top() / HMM_PER_TWIPS); SCROW nY1 = 0; - bEnd = FALSE; - for (SCROW i = nY1; i <= MAXROW && !bEnd; ++i) - { - if (pTable->RowHidden(i)) - continue; - - nY1 = i; - nAdd = static_cast(pTable->GetRowHeight(i)); - if (nSize+nAdd <= nTwips+1 && nY1