summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-10-18 18:48:05 +0200
committerEike Rathke <erack@redhat.com>2013-10-18 18:51:45 +0200
commit82275ecb0c5aae406dcf6637a56a84d729e78ac7 (patch)
treecc0efa147d4970b972333834217e931adb0496c3
parent4219195dec664aa03395a52168fad356840e5402 (diff)
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
-rw-r--r--sc/source/ui/view/formatsh.cxx27
1 files changed, 17 insertions, 10 deletions
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index fe7d8b2e5d82..3c3e6db4f276 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)