diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-10-14 21:05:15 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-10-14 21:14:25 +0200 |
commit | 86b6bf6e53c234e3df951ebb08513b0d4fc47a14 (patch) | |
tree | 4219907cb65762236725e278463ace8e0d759cee /sd | |
parent | a7efb9b8dd0b7deee49975961ca49f6838648614 (diff) |
sd: fix crash in character format dialog:
When text with different fonts is selected in Draw or Impress, the
character format dialog crashes, because (among other things) the
selected text is not returned by SfxViewShell::GetSelectionText().
Crash was observed both with GraphicViewShellBase and
ImpressViewShellBase as current shell.
Override that method in sd::ViewShellBase to forward to a main shell
that happens to be a DrawViewShell which is not actually a SfxViewShell
but happens to implement GetSelectionText() for mysterious reasons.
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/inc/ViewShellBase.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx index 089368ab1542..7d1e7d53754f 100644 --- a/sd/source/ui/inc/ViewShellBase.hxx +++ b/sd/source/ui/inc/ViewShellBase.hxx @@ -123,6 +123,10 @@ public: */ virtual void GetState (SfxItemSet& rSet); + /* override these from SfxViewShell */ + virtual String GetSelectionText(sal_Bool); + virtual sal_Bool HasSelection(sal_Bool) const; + SvBorder GetBorder (bool bOuterResize); virtual void InnerResizePixel (const Point& rOrigin, const Size& rSize); virtual void OuterResizePixel (const Point& rOrigin, const Size& rSize); diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 764884112fae..d5d1ded0d196 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -489,7 +489,25 @@ void ViewShellBase::InitializeFramework (void) } +String ViewShellBase::GetSelectionText(sal_Bool bCompleteWords) +{ + ::boost::shared_ptr<ViewShell> const pMainShell(GetMainViewShell()); + DrawViewShell *const pDrawViewShell( + dynamic_cast<DrawViewShell*>(pMainShell.get())); + return (pDrawViewShell) + ? pDrawViewShell->GetSelectionText(bCompleteWords) + : SfxViewShell::GetSelectionText(bCompleteWords); +} +sal_Bool ViewShellBase::HasSelection(sal_Bool bText) const +{ + ::boost::shared_ptr<ViewShell> const pMainShell(GetMainViewShell()); + DrawViewShell *const pDrawViewShell( + dynamic_cast<DrawViewShell*>(pMainShell.get())); + return (pDrawViewShell) + ? pDrawViewShell->HasSelection(bText) + : SfxViewShell::HasSelection(bText); +} void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize) { |