Kaydet (Commit) 86b6bf6e authored tarafından Michael Stahl's avatar Michael Stahl

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.
üst a7efb9b8
...@@ -123,6 +123,10 @@ public: ...@@ -123,6 +123,10 @@ public:
*/ */
virtual void GetState (SfxItemSet& rSet); 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); SvBorder GetBorder (bool bOuterResize);
virtual void InnerResizePixel (const Point& rOrigin, const Size& rSize); virtual void InnerResizePixel (const Point& rOrigin, const Size& rSize);
virtual void OuterResizePixel (const Point& rOrigin, const Size& rSize); virtual void OuterResizePixel (const Point& rOrigin, const Size& rSize);
......
...@@ -489,7 +489,25 @@ void ViewShellBase::InitializeFramework (void) ...@@ -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) void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment