[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Fri Oct 18 09:52:06 PDT 2013
sc/source/ui/view/formatsh.cxx | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
New commits:
commit 82275ecb0c5aae406dcf6637a56a84d729e78ac7
Author: Eike Rathke <erack at redhat.com>
Date: Fri Oct 18 18:48:05 2013 +0200
eliminated cause of "SelectionPattern Null" dbgutil warning
No mark at all happens when creating a new document, in which
case the selection pattern is empty (created of GetPool())
anyway (hence there was a debug warning "SelectionPattern Null"
from ScDocument::CreateSelectionPattern()) and nothing needs to
be applied.
Change-Id: I9df338063baf27581f258f6c2fd0737b95804509
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index fe7d8b2..3c3e6db 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -314,18 +314,25 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
}
else
{
- ScPatternAttr aAttr( *pDoc->GetSelectionPattern( pDoc->GetPreviewSelection() ) );
- if ( ScStyleSheet* pPreviewStyle = pDoc->GetPreviewCellStyle() )
- aAttr.SetStyleSheet( pPreviewStyle );
- pDoc->SetPreviewCellStyle(NULL);
+ // No mark at all happens when creating a new document, in which
+ // case the selection pattern obtained would be empty (created of
+ // GetPool()) anyway and nothing needs to be applied.
+ ScMarkData aPreviewMark( pDoc->GetPreviewSelection());
+ if (aPreviewMark.IsMarked() || aPreviewMark.IsMultiMarked())
+ {
+ ScPatternAttr aAttr( *pDoc->GetSelectionPattern( aPreviewMark ) );
+ if ( ScStyleSheet* pPreviewStyle = pDoc->GetPreviewCellStyle() )
+ aAttr.SetStyleSheet( pPreviewStyle );
+ pDoc->SetPreviewCellStyle(NULL);
- SfxItemSet aItemSet( GetPool() );
+ SfxItemSet aItemSet( GetPool() );
- ScPatternAttr aNewAttrs( GetViewData()->GetDocument()->GetPool() );
- SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
- rNewSet.Put( aItemSet, false );
- pDoc->ApplySelectionPattern( aNewAttrs, pDoc->GetPreviewSelection() );
- pTabViewShell->UpdateSelectionArea( pDoc->GetPreviewSelection(), &aAttr );
+ ScPatternAttr aNewAttrs( GetViewData()->GetDocument()->GetPool() );
+ SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
+ rNewSet.Put( aItemSet, false );
+ pDoc->ApplySelectionPattern( aNewAttrs, aPreviewMark );
+ pTabViewShell->UpdateSelectionArea( aPreviewMark, &aAttr );
+ }
}
}
else if ( (nSlotId == SID_STYLE_NEW)
More information about the Libreoffice-commits
mailing list