LibreOffice Module sd (master) 1
futhes.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <futhes.hxx>
21
22#include <editeng/outliner.hxx>
23#include <sfx2/request.hxx>
24#include <svx/svdobj.hxx>
25#include <svx/svdotext.hxx>
26#include <editeng/eeitem.hxx>
27#include <tools/debug.hxx>
28
29#include <svx/svxerr.hxx>
30#include <svx/dialmgr.hxx>
31#include <editeng/unolingu.hxx>
32#include <vcl/weld.hxx>
33#include <drawdoc.hxx>
34#include <View.hxx>
35#include <Outliner.hxx>
36#include <DrawViewShell.hxx>
37#include <OutlineViewShell.hxx>
38#include <Window.hxx>
39
40using namespace ::com::sun::star;
41using namespace ::com::sun::star::uno;
42using namespace ::com::sun::star::lang;
43using namespace ::com::sun::star::linguistic2;
44
45class SfxRequest;
46
47namespace sd {
48
49
51 SdDrawDocument* pDoc, SfxRequest& rReq )
52 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
53{
54}
55
57{
58 rtl::Reference<FuPoor> xFunc( new FuThesaurus( pViewSh, pWin, pView, pDoc, rReq ) );
59 xFunc->DoExecute(rReq);
60 return xFunc;
61}
62
64{
66 mpWindow->GetFrameWeld(), RID_SVXERRCTX, SvxResLocale());
67
68 if (dynamic_cast< DrawViewShell *>( mpViewShell ))
69 {
70 SdrTextObj* pTextObj = nullptr;
71
72 if ( mpView->AreObjectsMarked() )
73 {
74 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
75
76 if ( rMarkList.GetMarkCount() == 1 )
77 {
78 SdrMark* pMark = rMarkList.GetMark(0);
79 SdrObject* pObj = pMark->GetMarkedSdrObj();
80
81 pTextObj = DynCastSdrTextObj( pObj );
82 }
83 }
84
86 const OutlinerView* pOutlView = mpView->GetTextEditOutlinerView();
87
88 if ( pTextObj && pOutliner && pOutlView )
89 {
90 if ( !pOutliner->GetSpeller().is() )
91 {
92 Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
93 if ( xSpellChecker.is() )
94 pOutliner->SetSpeller( xSpellChecker );
95
96 Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
97 if( xHyphenator.is() )
98 pOutliner->SetHyphenator( xHyphenator );
99
101 }
102
103 EESpellState eState = const_cast<OutlinerView*>(pOutlView)->StartThesaurus(rReq.GetFrameWeld());
104 DBG_ASSERT(eState != EESpellState::NoSpeller, "No SpellChecker");
105 }
106 }
107 else if (dynamic_cast< OutlineViewShell *>( mpViewShell ))
108 {
109 Outliner* pOutliner = mpDoc->GetOutliner();
110 OutlinerView* pOutlView = pOutliner->GetView(0);
111
112 if ( !pOutliner->GetSpeller().is() )
113 {
114 Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
115 if ( xSpellChecker.is() )
116 pOutliner->SetSpeller( xSpellChecker );
117
118 Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
119 if( xHyphenator.is() )
120 pOutliner->SetHyphenator( xHyphenator );
121
123 }
124
125 EESpellState eState = pOutlView->StartThesaurus(rReq.GetFrameWeld());
126 DBG_ASSERT(eState != EESpellState::NoSpeller, "No SpellChecker");
127 }
128}
129
130} // end of namespace sd
131
132/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker()
static css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator()
EESpellState StartThesaurus(weld::Widget *pDialogParent)
void SetHyphenator(css::uno::Reference< css::linguistic2::XHyphenator > const &xHyph)
void SetDefaultLanguage(LanguageType eLang)
OutlinerView * GetView(size_t nIndex) const
void SetSpeller(css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller)
css::uno::Reference< css::linguistic2::XSpellChecker1 > const & GetSpeller()
SAL_DLLPRIVATE SdOutliner * GetOutliner(bool bCreateOutliner=true)
Definition: drawdoc.cxx:912
SAL_DLLPRIVATE LanguageType GetLanguage(const sal_uInt16 nId) const
Definition: drawdoc2.cxx:875
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
SdrObject * GetMarkedSdrObj() const
const OutlinerView * GetTextEditOutlinerView() const
const SdrOutliner * GetTextEditOutliner() const
weld::Window * GetFrameWeld() const
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
Base class for all functions.
Definition: fupoor.hxx:48
SdDrawDocument * mpDoc
Definition: fupoor.hxx:148
VclPtr< ::sd::Window > mpWindow
Definition: fupoor.hxx:146
ViewShell * mpViewShell
Definition: fupoor.hxx:145
::sd::View * mpView
Definition: fupoor.hxx:144
FuThesaurus(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: futhes.cxx:50
virtual void DoExecute(SfxRequest &rReq) override
Definition: futhes.cxx:63
static rtl::Reference< FuPoor > Create(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: futhes.cxx:56
Show a textual overview of the text contents of all slides.
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
#define DBG_ASSERT(sCon, aError)
SVXCORE_DLLPUBLIC std::locale SvxResLocale()
EESpellState
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
SVX_DLLPUBLIC const ErrMsgCode RID_SVXERRCTX[]
#define ERRCTX_SVX_LINGU_THESAURUS