LibreOffice Module sfx2 (master) 1
viewsh.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 <config_features.h>
21
22#include <boost/property_tree/json_parser.hpp>
23
24#include <sal/log.hxx>
25#include <svl/stritem.hxx>
26#include <svl/eitem.hxx>
27#include <svl/whiter.hxx>
28#include <utility>
29#include <vcl/svapp.hxx>
30#include <vcl/toolbox.hxx>
31#include <vcl/weld.hxx>
32#include <svl/intitem.hxx>
33#include <svtools/langhelp.hxx>
34#include <com/sun/star/awt/XPopupMenu.hpp>
35#include <com/sun/star/frame/XLayoutManager.hpp>
36#include <com/sun/star/frame/ModuleManager.hpp>
37#include <com/sun/star/io/IOException.hpp>
38#include <com/sun/star/beans/XPropertySet.hpp>
39#include <com/sun/star/embed/EmbedStates.hpp>
40#include <com/sun/star/embed/EmbedMisc.hpp>
41#include <com/sun/star/embed/XEmbeddedObject.hpp>
42#include <com/sun/star/container/XContainerQuery.hpp>
43#include <com/sun/star/frame/XStorable.hpp>
44#include <com/sun/star/frame/XModel.hpp>
45#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
46#include <com/sun/star/lang/XMultiServiceFactory.hpp>
47#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
48#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
49#include <com/sun/star/view/XRenderable.hpp>
50#include <com/sun/star/uno/Reference.hxx>
51#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
52#include <com/sun/star/accessibility/XAccessibleContext.hpp>
53#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
54#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
55#include <com/sun/star/accessibility/AccessibleEventId.hpp>
56#include <com/sun/star/accessibility/AccessibleStateType.hpp>
57#include <com/sun/star/accessibility/XAccessibleText.hpp>
59#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
60
62
63#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
64#include <com/sun/star/accessibility/AccessibleTextType.hpp>
65#include <com/sun/star/awt/FontSlant.hpp>
66
68#include <tools/urlobj.hxx>
69#include <unotools/tempfile.hxx>
70#include <svtools/soerr.hxx>
71#include <tools/svborder.hxx>
72
74#include <comphelper/lok.hxx>
79#include <vcl/settings.hxx>
81#include <LibreOfficeKit/LibreOfficeKitEnums.h>
82
83#include <officecfg/Setup.hxx>
84#include <sfx2/app.hxx>
85#include <sfx2/flatpak.hxx>
86#include <sfx2/viewsh.hxx>
87#include "viewimp.hxx"
88#include <sfx2/sfxresid.hxx>
89#include <sfx2/request.hxx>
90#include <sfx2/printer.hxx>
91#include <sfx2/docfile.hxx>
92#include <sfx2/dispatch.hxx>
93#include <sfx2/strings.hrc>
95#include <sfx2/mailmodelapi.hxx>
96#include <bluthsndapi.hxx>
97#include <sfx2/viewfrm.hxx>
98#include <sfx2/event.hxx>
99#include <sfx2/ipclient.hxx>
100#include <sfx2/sfxsids.hrc>
101#include <sfx2/objface.hxx>
102#include <sfx2/lokhelper.hxx>
103#include <sfx2/lokcallback.hxx>
104#include <openuriexternally.hxx>
105#include <iostream>
106#include <vector>
107#include <libxml/xmlwriter.h>
109#include <unordered_map>
110#include <unordered_set>
111
112using namespace ::com::sun::star;
113using namespace ::com::sun::star::uno;
114using namespace ::com::sun::star::frame;
115using namespace ::com::sun::star::beans;
116using namespace ::com::sun::star::util;
117using namespace ::cppu;
118
119#define ShellClass_SfxViewShell
120#include <sfxslots.hxx>
121
122
123class SfxClipboardChangeListener : public ::cppu::WeakImplHelper<
124 datatransfer::clipboard::XClipboardListener >
125{
126public:
127 SfxClipboardChangeListener( SfxViewShell* pView, uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr );
128
129 // XEventListener
130 virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) override;
131
132 // XClipboardListener
133 virtual void SAL_CALL changedContents( const datatransfer::clipboard::ClipboardEvent& rEventObject ) override;
134
135 void DisconnectViewShell() { m_pViewShell = nullptr; }
136 void ChangedContents();
137
139 {
142 };
143
145 {
147 m_eCmd( eCmd ), m_xListener( pListener ) {}
148
151 };
152
153private:
155 uno::Reference< datatransfer::clipboard::XClipboardNotifier > m_xClpbrdNtfr;
156 uno::Reference< lang::XComponent > m_xCtrl;
157
158 DECL_STATIC_LINK( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, void*, void );
159};
160
161SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView, uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr )
162 : m_pViewShell( nullptr ), m_xClpbrdNtfr(std::move( xClpbrdNtfr )), m_xCtrl(pView->GetController())
163{
164 if ( m_xCtrl.is() )
165 {
166 m_xCtrl->addEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this ) ) );
167 m_pViewShell = pView;
168 }
169 if ( m_xClpbrdNtfr.is() )
170 {
171 m_xClpbrdNtfr->addClipboardListener( uno::Reference< datatransfer::clipboard::XClipboardListener >(
172 static_cast< datatransfer::clipboard::XClipboardListener* >( this )));
173 }
174}
175
177{
178 const SolarMutexGuard aGuard;
179 if (!m_pViewShell)
180 return;
181
183 rBind.Invalidate(SID_PASTE);
184 rBind.Invalidate(SID_PASTE_SPECIAL);
185 rBind.Invalidate(SID_CLIPBOARD_FORMAT_ITEMS);
186
188 {
189 // In the future we might send the payload as well.
190 SfxLokHelper::notifyAllViews(LOK_CALLBACK_CLIPBOARD_CHANGED, "");
191 }
192}
193
194IMPL_STATIC_LINK( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, void*, p, void )
195{
196 AsyncExecuteInfo* pAsyncExecuteInfo = static_cast<AsyncExecuteInfo*>(p);
197 if ( pAsyncExecuteInfo )
198 {
199 if ( pAsyncExecuteInfo->m_xListener.is() )
200 {
201 if ( pAsyncExecuteInfo->m_eCmd == ASYNCEXECUTE_CMD_DISPOSING )
202 pAsyncExecuteInfo->m_xListener->DisconnectViewShell();
203 else if ( pAsyncExecuteInfo->m_eCmd == ASYNCEXECUTE_CMD_CHANGEDCONTENTS )
204 pAsyncExecuteInfo->m_xListener->ChangedContents();
205 }
206 }
207 delete pAsyncExecuteInfo;
208}
209
210void SAL_CALL SfxClipboardChangeListener::disposing( const lang::EventObject& /*rEventObject*/ )
211{
212 // Either clipboard or ViewShell is going to be destroyed -> no interest in listening anymore
213 uno::Reference< lang::XComponent > xCtrl( m_xCtrl );
214 uno::Reference< datatransfer::clipboard::XClipboardNotifier > xNotify( m_xClpbrdNtfr );
215
216 uno::Reference< datatransfer::clipboard::XClipboardListener > xThis( static_cast< datatransfer::clipboard::XClipboardListener* >( this ));
217 if ( xCtrl.is() )
218 xCtrl->removeEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this )));
219 if ( xNotify.is() )
220 xNotify->removeClipboardListener( xThis );
221
222 // Make asynchronous call to avoid locking SolarMutex which is the
223 // root for many deadlocks, especially in conjunction with the "Windows"
224 // based single thread apartment clipboard code!
226 if (!Application::PostUserEvent( LINK( nullptr, SfxClipboardChangeListener, AsyncExecuteHdl_Impl ), pInfo ))
227 delete pInfo;
228}
229
230void SAL_CALL SfxClipboardChangeListener::changedContents( const datatransfer::clipboard::ClipboardEvent& )
231{
232 // Make asynchronous call to avoid locking SolarMutex which is the
233 // root for many deadlocks, especially in conjunction with the "Windows"
234 // based single thread apartment clipboard code!
236 if (!Application::PostUserEvent( LINK( nullptr, SfxClipboardChangeListener, AsyncExecuteHdl_Impl ), pInfo ))
237 delete pInfo;
238}
239
241 public ::cppu::WeakImplHelper< accessibility::XAccessibleEventListener >
242{
243 static constexpr sal_Int64 MAX_ATTACHABLE_CHILDREN = 30;
244
246 std::unordered_set< uno::Reference< uno::XInterface > > m_aRefList;
255
256public:
257 LOKDocumentFocusListener(const SfxViewShell* pViewShell);
258
261 void attachRecursive(
262 const uno::Reference< accessibility::XAccessible >& xAccessible
263 );
264
267 void attachRecursive(
268 const uno::Reference< accessibility::XAccessible >& xAccessible,
269 const uno::Reference< accessibility::XAccessibleContext >& xContext
270 );
271
274 void attachRecursive(
275 const uno::Reference< accessibility::XAccessible >& xAccessible,
276 const uno::Reference< accessibility::XAccessibleContext >& xContext,
277 const sal_Int64 nStateSet
278 );
279
282 void detachRecursive(
283 const uno::Reference< accessibility::XAccessible >& xAccessible
284 );
285
288 void detachRecursive(
289 const uno::Reference< accessibility::XAccessibleContext >& xContext
290 );
291
294 void detachRecursive(
295 const uno::Reference< accessibility::XAccessibleContext >& xContext,
296 const sal_Int64 nStateSet
297 );
298
301 static uno::Reference< accessibility::XAccessible > getAccessible(const lang::EventObject& aEvent );
302
303 // XEventListener
304 virtual void SAL_CALL disposing( const lang::EventObject& Source ) override;
305
306 // XAccessibleEventListener
307 virtual void SAL_CALL notifyEvent( const accessibility::AccessibleEventObject& aEvent ) override;
308
310 void notifyCaretChanged();
312
313 OUString getFocusedParagraph() const;
314 int getCaretPosition() const;
315};
316
318 : m_pViewShell(pViewShell)
319 , m_bFocusedParagraphNotified(false)
320 , m_nCaretPosition(0)
321 , m_nSelectionStart(0)
322 , m_nSelectionEnd(0)
323 , m_bIsEditingCell(false)
324{
325}
326
328{
329 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::getFocusedParagraph: " << m_sFocusedParagraph);
330 const_cast<LOKDocumentFocusListener*>(this)->m_bFocusedParagraphNotified = true;
331
332 sal_Int32 nSelectionStart = m_nSelectionStart;
333 sal_Int32 nSelectionEnd = m_nSelectionEnd;
334 if (nSelectionStart < 0 || nSelectionEnd < 0)
335 nSelectionStart = nSelectionEnd = m_nCaretPosition;
336
337 boost::property_tree::ptree aPayloadTree;
338 aPayloadTree.put("content", m_sFocusedParagraph.toUtf8().getStr());
339 aPayloadTree.put("start", nSelectionStart);
340 aPayloadTree.put("end", nSelectionEnd);
341 std::stringstream aStream;
342 boost::property_tree::write_json(aStream, aPayloadTree);
343 std::string aPayload = aStream.str();
344 OUString sRet = OUString::fromUtf8(aPayload);
345 return sRet;
346}
347
349{
350 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::getCaretPosition: " << m_nCaretPosition);
351 return m_nCaretPosition;
352}
353
355{
356 boost::property_tree::ptree aPayloadTree;
357 aPayloadTree.put("content", m_sFocusedParagraph.toUtf8().getStr());
358 aPayloadTree.put("position", m_nCaretPosition);
359 std::stringstream aStream;
360 boost::property_tree::write_json(aStream, aPayloadTree);
361 std::string aPayload = aStream.str();
362 if (m_pViewShell)
363 {
364 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyFocusedParagraphChanged: " << m_sFocusedParagraph);
366 const char* pPayload = aPayload.c_str();
367 m_pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_A11Y_FOCUS_CHANGED, pPayload);
368 }
369}
370
372{
373 boost::property_tree::ptree aPayloadTree;
374 aPayloadTree.put("position", m_nCaretPosition);
375 std::stringstream aStream;
376 boost::property_tree::write_json(aStream, aPayloadTree);
377 std::string aPayload = aStream.str();
378 if (m_pViewShell)
379 {
380 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyCaretChanged: " << m_nCaretPosition);
381 const char* pPayload = aPayload.c_str();
382 m_pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_A11Y_CARET_CHANGED, pPayload);
383 }
384}
385
387{
388 boost::property_tree::ptree aPayloadTree;
389 aPayloadTree.put("start", m_nSelectionStart);
390 aPayloadTree.put("end", m_nSelectionEnd);
391 std::stringstream aStream;
392 boost::property_tree::write_json(aStream, aPayloadTree);
393 std::string aPayload = aStream.str();
394 if (m_pViewShell)
395 {
396 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyTextSelectionChanged: start: " << m_nSelectionStart << ", end: " << m_nSelectionEnd);
397 const char* pPayload = aPayload.c_str();
398 m_pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED, pPayload);
399 }
400}
401
402void LOKDocumentFocusListener::disposing( const lang::EventObject& aEvent )
403{
404 // Unref the object here, but do not remove as listener since the object
405 // might no longer be in a state that safely allows this.
406 if( aEvent.Source.is() )
407 m_aRefList.erase(aEvent.Source);
408
409}
410
411namespace
412{
413bool hasState(const accessibility::AccessibleEventObject& aEvent, ::sal_Int64 nState)
414{
415 bool res = false;
416 uno::Reference< accessibility::XAccessibleContext > xContext(aEvent.Source, uno::UNO_QUERY);
417 if (xContext.is())
418 {
419 ::sal_Int64 nStateSet = xContext->getAccessibleStateSet();
420 res = (nStateSet & nState) != 0;
421 }
422 return res;
423}
424
425bool isFocused(const accessibility::AccessibleEventObject& aEvent)
426{
427 return hasState(aEvent, accessibility::AccessibleStateType::FOCUSED);
428}
429} // anonymous namespace
430
431void LOKDocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObject& aEvent )
432{
433 try
434 {
435 switch( aEvent.EventId )
436 {
437 case accessibility::AccessibleEventId::STATE_CHANGED:
438 {
439 uno::Reference< accessibility::XAccessible > xAccStateChanged = getAccessible(aEvent);
440 sal_Int64 nState = accessibility::AccessibleStateType::INVALID;
441 aEvent.NewValue >>= nState;
442 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: STATE_CHANGED: XAccessible: " << xAccStateChanged.get() << ", nState: " << nState);
443
444 if( accessibility::AccessibleStateType::FOCUSED == nState )
445 {
446 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: FOCUSED");
447
449 {
450 if (!hasState(aEvent, accessibility::AccessibleStateType::ACTIVE))
451 {
452 SAL_WARN("lok.a11y",
453 "LOKDocumentFocusListener::notifyEvent: FOCUSED: Cell not ACTIVE for editing yet");
454 return;
455 }
456 }
457 uno::Reference<css::accessibility::XAccessibleText> xAccText(xAccStateChanged, uno::UNO_QUERY);
458 if( xAccText.is() )
459 {
460 OUString sText = xAccText->getText();
461 sal_Int32 nLength = sText.getLength();
462 sal_Int32 nCaretPosition = xAccText->getCaretPosition();
463 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: xAccText: " << xAccText.get()
464 << ", text: >" << sText << "<, caret pos: " << nCaretPosition);
465
466 if (nLength)
467 {
468 css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
469 xAccTextAttr(xAccText, uno::UNO_QUERY);
470 css::uno::Sequence< OUString > aRequestedAttributes;
471
472 sal_Int32 nPos = 0;
473 while (nPos < nLength)
474 {
475 css::accessibility::TextSegment aTextSegment =
476 xAccText->getTextAtIndex(nPos, css::accessibility::AccessibleTextType::ATTRIBUTE_RUN);
477 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: "
478 "text segment: '" << aTextSegment.SegmentText
479 << "', start: " << aTextSegment.SegmentStart
480 << ", end: " << aTextSegment.SegmentEnd);
481
482 css::uno::Sequence< css::beans::PropertyValue > aRunAttributeList;
483 if (xAccTextAttr.is())
484 {
485 aRunAttributeList = xAccTextAttr->getRunAttributes(nPos, aRequestedAttributes);
486 }
487 else
488 {
489 aRunAttributeList = xAccText->getCharacterAttributes(nPos, aRequestedAttributes);
490 }
491
492 sal_Int32 nSize = aRunAttributeList.getLength();
493 SAL_INFO("lok.a11y",
494 "LOKDocumentFocusListener::notifyEvent: attribute list size: " << nSize);
495 if (nSize)
496 {
497 OUString sValue;
498 OUString sAttributes = "{ ";
499 for (const auto& attribute: aRunAttributeList)
500 {
501 if (attribute.Name.isEmpty())
502 continue;
503
504 if (attribute.Name == "CharHeight" || attribute.Name == "CharWeight")
505 {
506 float fValue(0.0);
507 attribute.Value >>= fValue;
508 sValue = OUString::number(fValue);
509 }
510 else if (attribute.Name == "CharPosture")
511 {
512 awt::FontSlant nValue;
513 attribute.Value >>= nValue;
514 sValue = OUString::number(static_cast<unsigned int>(nValue));
515 }
516 else if (attribute.Name == "CharUnderline")
517 {
518 sal_Int16 nValue(0);
519 attribute.Value >>= nValue;
520 sValue = OUString::number(nValue);
521 }
522 else if (attribute.Name == "CharFontName")
523 {
524 attribute.Value >>= sValue;
525 }
526 else if (attribute.Name == "Rsid")
527 {
528 sal_uInt32 nValue(0);
529 attribute.Value >>= nValue;
530 sValue = OUString::number(nValue);
531 }
532
533 if (!sValue.isEmpty())
534 {
535 if (sAttributes != "{ ")
536 sAttributes += ", ";
537 sAttributes += attribute.Name + ": " + sValue;
538 sValue = "";
539 }
540 }
541 sAttributes += " }";
542 SAL_INFO("lok.a11y",
543 "LOKDocumentFocusListener::notifyEvent: attributes: " << sAttributes);
544 }
545 nPos = aTextSegment.SegmentEnd + 1;
546 }
547 }
549 {
550 m_sFocusedParagraph = sText;
551 m_nCaretPosition = nCaretPosition;
553 }
554 }
555 }
556
557 break;
558 }
559
560 case accessibility::AccessibleEventId::CARET_CHANGED:
561 {
562 if (!isFocused(aEvent))
563 {
564 SAL_WARN("lok.a11y",
565 "LOKDocumentFocusListener::notifyEvent: CARET_CHANGED: skip non focused paragraph");
566 return;
567 }
568
569 sal_Int32 nNewPos = -1;
570 aEvent.NewValue >>= nNewPos;
571 sal_Int32 nOldPos = -1;
572 aEvent.OldValue >>= nOldPos;
573
574 if (nNewPos >= 0)
575 {
576 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: CARET_CHANGED: new pos: " << nNewPos << ", nOldPos: " << nOldPos);
577 uno::Reference<css::accessibility::XAccessibleText>
578 xAccText(getAccessible(aEvent), uno::UNO_QUERY);
579 if( xAccText.is() )
580 {
581 OUString sText = xAccText->getText();
582 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: CARET_CHANGED: xAccText: " << xAccText.get() << ", text: >" << sText << "<");
583
584 m_nCaretPosition = nNewPos;
587 }
588 }
589
590 break;
591 }
592
593 case accessibility::AccessibleEventId::TEXT_CHANGED:
594 {
595 if (!isFocused(aEvent))
596 {
597 SAL_WARN("lok.a11y",
598 "LOKDocumentFocusListener::notifyEvent: TEXT_CHANGED: skip non focused paragraph");
599 return;
600 }
601
602 accessibility::TextSegment aDeletedText;
603 accessibility::TextSegment aInsertedText;
604
605 if (aEvent.OldValue >>= aDeletedText)
606 {
607 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: TEXT_CHANGED: deleted text: >" << aDeletedText.SegmentText << "<");
608 }
609 if (aEvent.NewValue >>= aInsertedText)
610 {
611 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: TEXT_CHANGED: inserted text: >" << aInsertedText.SegmentText << "<");
612 }
613 uno::Reference<css::accessibility::XAccessibleText> xAccText(getAccessible(aEvent), uno::UNO_QUERY);
614 if (xAccText.is())
615 {
616 OUString sText = xAccText->getText();
617 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: TEXT_CHANGED: "
618 "xAccText: " << xAccText.get() << ", text: >" << sText << "<");
619 m_sFocusedParagraph = sText;
621 }
622
623 break;
624 }
625 case accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED:
626 {
627 if (!isFocused(aEvent))
628 {
629 SAL_WARN("lok.a11y",
630 "LOKDocumentFocusListener::notifyEvent: TEXT_SELECTION_CHANGED: skip non focused paragraph");
631 return;
632 }
633
634 uno::Reference<css::accessibility::XAccessibleText> xAccText(getAccessible(aEvent), uno::UNO_QUERY);
635 if (xAccText.is())
636 {
637 OUString sText = xAccText->getText();
638 sal_Int32 nSelectionStart = xAccText->getSelectionStart();
639 sal_Int32 nSelectionEnd = xAccText->getSelectionEnd();
640 m_sSelectedText = xAccText->getSelectedText();
641
642 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: TEXT_SELECTION_CHANGED: "
643 "\n xAccText: " << xAccText.get() << ", text: >" << sText << "<"
644 "\n start: " << nSelectionStart << ", end: " << nSelectionEnd
645 << "\n selected text: >" << m_sSelectedText << "<");
646
647 // This should not be risky since selection start/end are set also on CARET_CHANGED event
648 if (nSelectionStart == m_nSelectionStart && nSelectionEnd == m_nSelectionEnd)
649 return;
650
651 // We send a message to client also when start/end are -1, in this way the client knows
652 // if a text selection object exists or not. That's needed because of the odd behavior
653 // occurring when <backspace>/<delete> are hit and a text selection is empty but it still exists.
654 // Such keys delete the empty selection instead of the previous/next char.
655 m_nSelectionStart = nSelectionStart;
656 m_nSelectionEnd = nSelectionEnd;
657
658 // Calc: when editing a formula send the update content
660 && !m_sSelectedText.isEmpty() && sText.startsWith("="))
661 {
663 }
665 }
666
667 break;
668 }
669 case accessibility::AccessibleEventId::SELECTION_CHANGED:
670 {
671 uno::Reference< accessibility::XAccessible > xNewValue;
672 aEvent.NewValue >>= xNewValue;
673 if (xNewValue.is())
674 {
675 uno::Reference< accessibility::XAccessibleContext > xContext =
676 xNewValue->getAccessibleContext();
677
678 if (xContext.is())
679 {
680 OUString sName = xContext->getAccessibleName();
681 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: SELECTION_CHANGED: this: " << this
682 << ", selected cell address: >" << sName << "<"
683 ", m_bIsEditingCell: " << m_bIsEditingCell);
684 if (m_bIsEditingCell && !sName.isEmpty())
685 {
687 // Check cell address: "$Sheet1.A10".
688 // On cell editing SELECTION_CHANGED is not emitted when selection is expanded.
689 // So selection can't be a cell range.
690 sal_Int32 nDotIndex = m_sSelectedText.indexOf('.');
691 OUString sCellAddress = m_sSelectedText.copy(nDotIndex + 1);
692 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::notifyEvent: SELECTION_CHANGED: "
693 "cell address: >" << sCellAddress << "<");
694 if (m_sSelectedCellAddress == sCellAddress)
695 {
698 }
699 }
700 }
701 }
702 break;
703 }
704 case accessibility::AccessibleEventId::CHILD:
705 {
706 uno::Reference< accessibility::XAccessible > xChild;
707 if( (aEvent.OldValue >>= xChild) && xChild.is() )
708 detachRecursive(xChild);
709
710 if( (aEvent.NewValue >>= xChild) && xChild.is() )
711 attachRecursive(xChild);
712
713 break;
714 }
715
716 case accessibility::AccessibleEventId::INVALIDATE_ALL_CHILDREN:
717 SAL_INFO("lok.a11y", "Invalidate all children called");
718 break;
719
720 default:
721 break;
722 }
723 }
724 catch( const lang::IndexOutOfBoundsException& )
725 {
726 SAL_WARN("lok.a11y", "Focused object has invalid index in parent");
727 }
728}
729
730uno::Reference< accessibility::XAccessible > LOKDocumentFocusListener::getAccessible(const lang::EventObject& aEvent )
731{
732 uno::Reference< accessibility::XAccessible > xAccessible(aEvent.Source, uno::UNO_QUERY);
733
734 if( xAccessible.is() )
735 return xAccessible;
736
737 uno::Reference< accessibility::XAccessibleContext > xContext(aEvent.Source, uno::UNO_QUERY);
738
739 if( xContext.is() )
740 {
741 uno::Reference< accessibility::XAccessible > xParent( xContext->getAccessibleParent() );
742 if( xParent.is() )
743 {
744 uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
745 if( xParentContext.is() )
746 {
747 return xParentContext->getAccessibleChild( xContext->getAccessibleIndexInParent() );
748 }
749 }
750 }
751
752 return uno::Reference< accessibility::XAccessible >();
753}
754
756 const uno::Reference< accessibility::XAccessible >& xAccessible
757)
758{
759 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::attachRecursive(1): xAccessible: " << xAccessible.get());
760
761 uno::Reference< accessibility::XAccessibleContext > xContext =
762 xAccessible->getAccessibleContext();
763
764 if( xContext.is() )
765 attachRecursive(xAccessible, xContext);
766}
767
769 const uno::Reference< accessibility::XAccessible >& xAccessible,
770 const uno::Reference< accessibility::XAccessibleContext >& xContext
771)
772{
773 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::attachRecursive(2): xAccessible: " << xAccessible.get()
774 << ", role: " << xContext->getAccessibleRole()
775 << ", name: " << xContext->getAccessibleName()
776 << ", parent: " << xContext->getAccessibleParent().get()
777 << ", child count: " << xContext->getAccessibleChildCount());
778
779 sal_Int64 nStateSet = xContext->getAccessibleStateSet();
780
781 if (!m_bIsEditingCell)
782 {
783 ::rtl::OUString sName = xContext->getAccessibleName();
784 m_bIsEditingCell = sName.startsWith("Cell");
785 }
786
787 attachRecursive(xAccessible, xContext, nStateSet);
788}
789
791 const uno::Reference< accessibility::XAccessible >& xAccessible,
792 const uno::Reference< accessibility::XAccessibleContext >& xContext,
793 const sal_Int64 nStateSet
794)
795{
796 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::attachRecursive(3) #1: this: " << this
797 << ", xAccessible: " << xAccessible.get()
798 << ", role: " << xContext->getAccessibleRole()
799 << ", name: " << xContext->getAccessibleName()
800 << ", parent: " << xContext->getAccessibleParent().get()
801 << ", child count: " << xContext->getAccessibleChildCount());
802
803 uno::Reference< accessibility::XAccessibleEventBroadcaster > xBroadcaster(xContext, uno::UNO_QUERY);
804
805 if (!xBroadcaster.is())
806 return;
807 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::attachRecursive(3) #2: xBroadcaster.is()");
808 // If not already done, add the broadcaster to the list and attach as listener.
809 const uno::Reference< uno::XInterface >& xInterface = xBroadcaster;
810 if( m_aRefList.insert(xInterface).second )
811 {
812 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::attachRecursive(3) #3: m_aRefList.insert(xInterface).second");
813 xBroadcaster->addAccessibleEventListener(static_cast< accessibility::XAccessibleEventListener *>(this));
814
815
816 if( !(nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS) )
817 {
818 sal_Int64 nmax = xContext->getAccessibleChildCount();
819 if( nmax > MAX_ATTACHABLE_CHILDREN )
821
822 for( sal_Int64 n = 0; n < nmax; n++ )
823 {
824 uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild( n ) );
825
826 if( xChild.is() )
827 attachRecursive(xChild);
828 }
829 }
830 }
831}
832
834 const uno::Reference< accessibility::XAccessible >& xAccessible
835)
836{
837 uno::Reference< accessibility::XAccessibleContext > xContext =
838 xAccessible->getAccessibleContext();
839
840 if( xContext.is() )
841 detachRecursive(xContext);
842}
843
845 const uno::Reference< accessibility::XAccessibleContext >& xContext
846)
847{
848 sal_Int64 nStateSet = xContext->getAccessibleStateSet();
849
850 SAL_INFO("lok.a11y", "LOKDocumentFocusListener::detachRecursive(2): this: " << this
851 << ", name: " << xContext->getAccessibleName()
852 << ", parent: " << xContext->getAccessibleParent().get()
853 << ", child count: " << xContext->getAccessibleChildCount());
854
856 {
857 ::rtl::OUString sName = xContext->getAccessibleName();
858 m_bIsEditingCell = !sName.startsWith("Cell");
859 if (!m_bIsEditingCell)
860 {
864 }
865 }
866
867 detachRecursive(xContext, nStateSet);
868}
869
871 const uno::Reference< accessibility::XAccessibleContext >& xContext,
872 const sal_Int64 nStateSet
873)
874{
875 uno::Reference< accessibility::XAccessibleEventBroadcaster > xBroadcaster(xContext, uno::UNO_QUERY);
876
877 if( xBroadcaster.is() && 0 < m_aRefList.erase(xBroadcaster) )
878 {
879 xBroadcaster->removeAccessibleEventListener(static_cast< accessibility::XAccessibleEventListener *>(this));
880
881 if( !( nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS ) )
882 {
883 sal_Int64 nmax = xContext->getAccessibleChildCount();
884 if( nmax > MAX_ATTACHABLE_CHILDREN )
886
887 for( sal_Int64 n = 0; n < nmax; n++ )
888 {
889 uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild( n ) );
890
891 if( xChild.is() )
892 detachRecursive(xChild);
893 }
894 }
895 }
896}
897
899
901: m_bHasPrintOptions(nFlags & SfxViewShellFlags::HAS_PRINTOPTIONS)
902, m_nFamily(0xFFFF) // undefined, default set by TemplateDialog
903, m_pLibreOfficeKitViewCallback(nullptr)
904, m_bTiledSearching(false)
905, m_nViewShellId(SfxViewShell_Impl::m_nLastViewShellId++)
906, m_nDocId(nDocId)
907{
908}
909
911{
912}
913
914std::vector< SfxInPlaceClient* >& SfxViewShell_Impl::GetIPClients_Impl()
915{
916 return maIPClients;
917}
918
920
921void SfxViewShell::InitInterface_Impl()
922{
923}
924
925
929 const css::uno::Reference< css::container::XContainerQuery >& rContainerQuery,
930 const OUString& rType,
931 const OUString& rModuleIdentifier,
932 const sal_Int32 nFlags )
933{
934 // Retrieve filter from type
935 css::uno::Sequence< css::beans::NamedValue > aQuery {
936 { "Type", css::uno::Any( rType ) },
937 { "DocumentService", css::uno::Any( rModuleIdentifier ) }
938 };
939
940 css::uno::Reference< css::container::XEnumeration > xEnumeration =
941 rContainerQuery->createSubSetEnumerationByProperties( aQuery );
942
943 OUString aFoundFilterName;
944 while ( xEnumeration->hasMoreElements() )
945 {
946 ::comphelper::SequenceAsHashMap aFilterPropsHM( xEnumeration->nextElement() );
947 OUString aFilterName = aFilterPropsHM.getUnpackedValueOrDefault(
948 "Name",
949 OUString() );
950
951 sal_Int32 nFilterFlags = aFilterPropsHM.getUnpackedValueOrDefault(
952 "Flags",
953 sal_Int32( 0 ) );
954
955 if ( nFilterFlags & nFlags )
956 {
957 aFoundFilterName = aFilterName;
958 break;
959 }
960 }
961
962 return aFoundFilterName;
963}
964
965namespace {
966
970enum ETypeFamily
971{
972 E_MS_DOC,
973 E_OOO_DOC
974};
975
976}
977
978static OUString impl_searchFormatTypeForApp(const css::uno::Reference< css::frame::XFrame >& xFrame ,
979 ETypeFamily eTypeFamily)
980{
981 try
982 {
983 css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext());
984 css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext));
985
986 OUString sModule = xModuleManager->identify(xFrame);
987 OUString sType ;
988
989 switch(eTypeFamily)
990 {
991 case E_MS_DOC:
992 {
993 if ( sModule == "com.sun.star.text.TextDocument" )
994 sType = "writer_MS_Word_2007";
995 else
996 if ( sModule == "com.sun.star.sheet.SpreadsheetDocument" )
997 sType = "MS Excel 2007 XML";
998 else
999 if ( sModule == "com.sun.star.presentation.PresentationDocument" )
1000 sType = "MS PowerPoint 2007 XML";
1001 }
1002 break;
1003
1004 case E_OOO_DOC:
1005 {
1006 if ( sModule == "com.sun.star.text.TextDocument" )
1007 sType = "writer8";
1008 else
1009 if ( sModule == "com.sun.star.sheet.SpreadsheetDocument" )
1010 sType = "calc8";
1011 else
1012 if ( sModule == "com.sun.star.drawing.DrawingDocument" )
1013 sType = "draw8";
1014 else
1015 if ( sModule == "com.sun.star.presentation.PresentationDocument" )
1016 sType = "impress8";
1017 }
1018 break;
1019 }
1020
1021 return sType;
1022 }
1023 catch (const css::uno::RuntimeException&)
1024 {
1025 throw;
1026 }
1027 catch (const css::uno::Exception&)
1028 {
1029 }
1030
1031 return OUString();
1032}
1033
1035{
1036 pImpl->GetIPClients_Impl().push_back(pIPClient);
1037}
1038
1040{
1041 std::vector< SfxInPlaceClient* >& pClients = pImpl->GetIPClients_Impl();
1042
1043 auto it = std::find(pClients.begin(), pClients.end(), pIPClient);
1044 if (it != pClients.end())
1045 pClients.erase( it );
1046}
1047
1048
1050{
1051 const sal_uInt16 nId = rReq.GetSlot();
1052 switch( nId )
1053 {
1054 case SID_STYLE_FAMILY :
1055 {
1056 const SfxUInt16Item* pItem = rReq.GetArg<SfxUInt16Item>(nId);
1057 if (pItem)
1058 {
1059 pImpl->m_nFamily = pItem->GetValue();
1060 }
1061 break;
1062 }
1063 case SID_ACTIVATE_STYLE_APPLY:
1064 {
1065 uno::Reference< frame::XFrame > xFrame =
1067
1068 Reference< beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
1069 Reference< frame::XLayoutManager > xLayoutManager;
1070 if ( xPropSet.is() )
1071 {
1072 try
1073 {
1074 Any aValue = xPropSet->getPropertyValue("LayoutManager");
1075 aValue >>= xLayoutManager;
1076 if ( xLayoutManager.is() )
1077 {
1078 uno::Reference< ui::XUIElement > xElement = xLayoutManager->getElement( "private:resource/toolbar/textobjectbar" );
1079 if(!xElement.is())
1080 {
1081 xElement = xLayoutManager->getElement( "private:resource/toolbar/frameobjectbar" );
1082 }
1083 if(!xElement.is())
1084 {
1085 xElement = xLayoutManager->getElement( "private:resource/toolbar/oleobjectbar" );
1086 }
1087 if(xElement.is())
1088 {
1089 uno::Reference< awt::XWindow > xWin( xElement->getRealInterface(), uno::UNO_QUERY_THROW );
1091 ToolBox* pTextToolbox = dynamic_cast< ToolBox* >( pWin.get() );
1092 if( pTextToolbox )
1093 {
1094 ToolBox::ImplToolItems::size_type nItemCount = pTextToolbox->GetItemCount();
1095 for( ToolBox::ImplToolItems::size_type nItem = 0; nItem < nItemCount; ++nItem )
1096 {
1097 ToolBoxItemId nItemId = pTextToolbox->GetItemId( nItem );
1098 const OUString& rCommand = pTextToolbox->GetItemCommand( nItemId );
1099 if (rCommand == ".uno:StyleApply")
1100 {
1101 vcl::Window* pItemWin = pTextToolbox->GetItemWindow( nItemId );
1102 if( pItemWin )
1103 pItemWin->GrabFocus();
1104 break;
1105 }
1106 }
1107 }
1108 }
1109 }
1110 }
1111 catch (const Exception&)
1112 {
1113 }
1114 }
1115 rReq.Done();
1116 }
1117 break;
1118
1119 case SID_MAIL_SENDDOCASMS:
1120 case SID_MAIL_SENDDOCASOOO:
1121 case SID_MAIL_SENDDOCASPDF:
1122 case SID_MAIL_SENDDOC:
1123 case SID_MAIL_SENDDOCASFORMAT:
1124 {
1126 if ( pDoc && pDoc->QueryHiddenInformation(
1128 break;
1129
1130
1131 SfxMailModel aModel;
1132 OUString aDocType;
1133
1134 const SfxStringItem* pMailRecipient = rReq.GetArg<SfxStringItem>(SID_MAIL_RECIPIENT);
1135 if ( pMailRecipient )
1136 {
1137 OUString aRecipient( pMailRecipient->GetValue() );
1138 OUString aMailToStr("mailto:");
1139
1140 if ( aRecipient.startsWith( aMailToStr ) )
1141 aRecipient = aRecipient.copy( aMailToStr.getLength() );
1142 aModel.AddToAddress( aRecipient );
1143 }
1144 const SfxStringItem* pMailDocType = rReq.GetArg<SfxStringItem>(SID_TYPE_NAME);
1145 if ( pMailDocType )
1146 aDocType = pMailDocType->GetValue();
1147
1148 uno::Reference < frame::XFrame > xFrame( rFrame.GetFrame().GetFrameInterface() );
1150
1151 if ( nId == SID_MAIL_SENDDOC )
1152 eResult = aModel.SaveAndSend( xFrame, OUString() );
1153 else if ( nId == SID_MAIL_SENDDOCASPDF )
1154 eResult = aModel.SaveAndSend( xFrame, "pdf_Portable_Document_Format");
1155 else if ( nId == SID_MAIL_SENDDOCASMS )
1156 {
1157 aDocType = impl_searchFormatTypeForApp(xFrame, E_MS_DOC);
1158 if (!aDocType.isEmpty())
1159 eResult = aModel.SaveAndSend( xFrame, aDocType );
1160 }
1161 else if ( nId == SID_MAIL_SENDDOCASOOO )
1162 {
1163 aDocType = impl_searchFormatTypeForApp(xFrame, E_OOO_DOC);
1164 if (!aDocType.isEmpty())
1165 eResult = aModel.SaveAndSend( xFrame, aDocType );
1166 }
1167
1168 if ( eResult == SfxMailModel::SEND_MAIL_ERROR )
1169 {
1171 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin,
1172 VclMessageType::Info, VclButtonsType::Ok,
1173 SfxResId(STR_ERROR_SEND_MAIL)));
1174 xBox->run();
1175 rReq.Ignore();
1176 }
1177 else
1178 rReq.Done();
1179 }
1180 break;
1181
1182 case SID_BLUETOOTH_SENDDOC:
1183 {
1184 SfxBluetoothModel aModel;
1186 if ( pDoc && pDoc->QueryHiddenInformation(
1188 break;
1189 uno::Reference < frame::XFrame > xFrame( rFrame.GetFrame().GetFrameInterface() );
1191 if( eResult == SfxMailModel::SEND_MAIL_ERROR )
1192 {
1194 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin,
1195 VclMessageType::Info, VclButtonsType::Ok,
1196 SfxResId(STR_ERROR_SEND_MAIL)));
1197 xBox->run();
1198 rReq.Ignore();
1199 }
1200 else
1201 rReq.Done();
1202 }
1203 break;
1204
1205 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1206 case SID_WEBHTML:
1207 {
1208 css::uno::Reference< lang::XMultiServiceFactory > xSMGR(::comphelper::getProcessServiceFactory(), css::uno::UNO_SET_THROW);
1209 css::uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext(), css::uno::UNO_SET_THROW);
1210 css::uno::Reference< css::frame::XFrame > xFrame( rFrame.GetFrame().GetFrameInterface() );
1211 css::uno::Reference< css::frame::XModel > xModel;
1212
1213 css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( css::frame::ModuleManager::create(xContext) );
1214
1215 OUString aModule;
1216 try
1217 {
1218 aModule = xModuleManager->identify( xFrame );
1219 }
1220 catch (const css::uno::RuntimeException&)
1221 {
1222 throw;
1223 }
1224 catch (const css::uno::Exception&)
1225 {
1226 }
1227
1228 if ( xFrame.is() )
1229 {
1230 css::uno::Reference< css::frame::XController > xController = xFrame->getController();
1231 if ( xController.is() )
1232 xModel = xController->getModel();
1233 }
1234
1235 // We need at least a valid module name and model reference
1236 css::uno::Reference< css::frame::XStorable > xStorable( xModel, css::uno::UNO_QUERY );
1237 if ( xModel.is() && xStorable.is() )
1238 {
1239 OUString aFilterName;
1240 OUString aTypeName( "generic_HTML" );
1241 OUString aFileName;
1242
1243 OUString aLocation = xStorable->getLocation();
1244 INetURLObject aFileObj( aLocation );
1245
1246 bool bPrivateProtocol = ( aFileObj.GetProtocol() == INetProtocol::PrivSoffice );
1247 bool bHasLocation = !aLocation.isEmpty() && !bPrivateProtocol;
1248
1249 css::uno::Reference< css::container::XContainerQuery > xContainerQuery(
1250 xSMGR->createInstance( "com.sun.star.document.FilterFactory" ),
1251 css::uno::UNO_QUERY_THROW );
1252
1253 // Retrieve filter from type
1254
1255 sal_Int32 nFilterFlags = 0x00000002; // export
1256 aFilterName = impl_retrieveFilterNameFromTypeAndModule( xContainerQuery, aTypeName, aModule, nFilterFlags );
1257 if ( aFilterName.isEmpty() )
1258 {
1259 // Draw/Impress uses a different type. 2nd chance try to use alternative type name
1261 xContainerQuery, "graphic_HTML", aModule, nFilterFlags );
1262 }
1263
1264 // No filter found => error
1265 // No type and no location => error
1266 if ( aFilterName.isEmpty() || aTypeName.isEmpty())
1267 {
1268 rReq.Done();
1269 return;
1270 }
1271
1272 // Use provided save file name. If empty determine file name
1273 if ( !bHasLocation )
1274 {
1275 // Create a default file name with the correct extension
1276 aFileName = "webpreview";
1277 }
1278 else
1279 {
1280 // Determine file name from model
1281 INetURLObject aFObj( xStorable->getLocation() );
1283 }
1284
1285 OSL_ASSERT( !aFilterName.isEmpty() );
1286 OSL_ASSERT( !aFileName.isEmpty() );
1287
1288 // Creates a temporary directory to store our predefined file into it (for the
1289 // flatpak case, create it in XDG_CACHE_HOME instead of /tmp for technical reasons,
1290 // so that it can be accessed by the browser running outside the sandbox):
1291 OUString * parent = nullptr;
1293 {
1294 SAL_WARN("sfx.view", "cannot create Flatpak html temp dir");
1295 }
1296
1297 INetURLObject aFilePathObj( ::utl::CreateTempURL(parent, true) );
1298 aFilePathObj.insertName( aFileName );
1299 aFilePathObj.setExtension( u"htm" );
1300
1301 OUString aFileURL = aFilePathObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
1302
1303 css::uno::Sequence< css::beans::PropertyValue > aArgs{
1304 comphelper::makePropertyValue("FilterName", aFilterName)
1305 };
1306
1307 // Store document in the html format
1308 try
1309 {
1310 xStorable->storeToURL( aFileURL, aArgs );
1311 }
1312 catch (const io::IOException&)
1313 {
1314 rReq.Done();
1315 return;
1316 }
1317
1318 sfx2::openUriExternally(aFileURL, true, rReq.GetFrameWeld());
1319 rReq.Done(true);
1320 break;
1321 }
1322 else
1323 {
1324 rReq.Done();
1325 return;
1326 }
1327 }
1328 }
1329}
1330
1331
1333{
1334
1335 SfxWhichIter aIter( rSet );
1337 for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
1338 {
1339 switch ( nSID )
1340 {
1341
1342 case SID_BLUETOOTH_SENDDOC:
1343 case SID_MAIL_SENDDOC:
1344 case SID_MAIL_SENDDOCASFORMAT:
1345 case SID_MAIL_SENDDOCASMS:
1346 case SID_MAIL_SENDDOCASOOO:
1347 case SID_MAIL_SENDDOCASPDF:
1348 {
1349#if HAVE_FEATURE_MACOSX_SANDBOX
1350 rSet.DisableItem(nSID);
1351#endif
1352 if (pSh && pSh->isExportLocked())
1353 rSet.DisableItem(nSID);
1354 break;
1355 }
1356 case SID_WEBHTML:
1357 {
1358 if (pSh && pSh->isExportLocked())
1359 rSet.DisableItem(nSID);
1360 break;
1361 }
1362 // Printer functions
1363 case SID_PRINTDOC:
1364 case SID_PRINTDOCDIRECT:
1365 case SID_SETUPPRINTER:
1366 case SID_PRINTER_NAME:
1367 {
1368 if (Application::GetSettings().GetMiscSettings().GetDisablePrinting()
1369 || (pSh && pSh->isPrintLocked()))
1370 {
1371 rSet.DisableItem(nSID);
1372 break;
1373 }
1374
1375 SfxPrinter *pPrinter = GetPrinter();
1376
1377 if ( SID_PRINTDOCDIRECT == nSID )
1378 {
1379 OUString aPrinterName;
1380 if ( pPrinter != nullptr )
1381 aPrinterName = pPrinter->GetName();
1382 else
1383 {
1384 // tdf#109149 don't poll the Default Printer Name on every query.
1385 // We are queried on every change, so on every
1386 // keystroke, and we are only using this to fill in the
1387 // printername inside the label of "Print Directly (printer-name)"
1388 // On Printer::GetDefaultPrinterName() is implemented with
1389 // GetDefaultPrinter so don't call this excessively. 5 mins
1390 // seems a reasonable refresh time.
1391 std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
1392 std::chrono::minutes five_mins(5);
1393 if (now > pImpl->m_nDefaultPrinterNameFetchTime + five_mins)
1394 {
1395 pImpl->m_sDefaultPrinterName = Printer::GetDefaultPrinterName();
1396 pImpl->m_nDefaultPrinterNameFetchTime = now;
1397 }
1398 aPrinterName = pImpl->m_sDefaultPrinterName;
1399 }
1400 if ( !aPrinterName.isEmpty() )
1401 {
1402 uno::Reference < frame::XFrame > xFrame( rFrame.GetFrame().GetFrameInterface() );
1403
1407 " (" + aPrinterName + ")";
1408
1409 rSet.Put( SfxStringItem( SID_PRINTDOCDIRECT, val ) );
1410 }
1411 }
1412 break;
1413 }
1414 case SID_STYLE_FAMILY :
1415 {
1416 rSet.Put( SfxUInt16Item( SID_STYLE_FAMILY, pImpl->m_nFamily ) );
1417 break;
1418 }
1419 }
1420 }
1421}
1422
1424 const Fraction &rZoomY )
1425{
1426 DBG_ASSERT( GetWindow(), "no window" );
1427 MapMode aMap( GetWindow()->GetMapMode() );
1428 aMap.SetScaleX( rZoomX );
1429 aMap.SetScaleY( rZoomY );
1431}
1432
1433ErrCode SfxViewShell::DoVerb(sal_Int32 /*nVerb*/)
1434
1435/* [Description]
1436
1437 Virtual Method used to perform a Verb on a selected Object.
1438 Since this Object is only known by the derived classes, they must override
1439 DoVerb.
1440*/
1441
1442{
1443 return ERRCODE_SO_NOVERBS;
1444}
1445
1447{
1448 if ( !bActive )
1449 GetFrame()->GetFrame().Appear();
1450}
1451
1453{
1454 uno::Reference < frame::XFrame > xOwnFrame( rFrame.GetFrame().GetFrameInterface() );
1455 uno::Reference < frame::XFramesSupplier > xParentFrame = xOwnFrame->getCreator();
1456 if ( xParentFrame.is() )
1457 xParentFrame->setActiveFrame( xOwnFrame );
1458
1460 rFrame.GetDispatcher()->Update_Impl( true );
1461}
1462
1464{
1466 rFrame.GetDispatcher()->Update_Impl( true );
1467 rFrame.GetBindings().HidePopups(false);
1468
1470}
1471
1473(
1474 const uno::Reference < embed::XEmbeddedObject >& xObj,
1475 vcl::Window* pObjParentWin
1476) const
1477{
1478 std::vector< SfxInPlaceClient* >& rClients = pImpl->GetIPClients_Impl();
1479 if ( rClients.empty() )
1480 return nullptr;
1481
1482 if( !pObjParentWin )
1483 pObjParentWin = GetWindow();
1484 for (SfxInPlaceClient* pIPClient : rClients)
1485 {
1486 if ( pIPClient->GetObject() == xObj && pIPClient->GetEditWin() == pObjParentWin )
1487 return pIPClient;
1488 }
1489
1490 return nullptr;
1491}
1492
1493
1495{
1496 return GetUIActiveClient();
1497}
1498
1499
1501{
1502 // this method is needed as long as SFX still manages the border space for ChildWindows (see SfxFrame::Resize)
1503 std::vector< SfxInPlaceClient* >& rClients = pImpl->GetIPClients_Impl();
1504 if ( rClients.empty() )
1505 return nullptr;
1506
1507 for (SfxInPlaceClient* pIPClient : rClients)
1508 {
1509 if ( pIPClient->IsUIActive() )
1510 return pIPClient;
1511 }
1512
1513 return nullptr;
1514}
1515
1517{
1518 std::vector< SfxInPlaceClient* >& rClients = pImpl->GetIPClients_Impl();
1519 if ( rClients.empty() )
1520 return nullptr;
1521
1522 const bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
1523
1524 for (SfxInPlaceClient* pIPClient : rClients)
1525 {
1526 if ( pIPClient->IsObjectUIActive() || ( bIsTiledRendering && pIPClient->IsObjectInPlaceActive() ) )
1527 return pIPClient;
1528 }
1529
1530 return nullptr;
1531}
1532
1533
1534void SfxViewShell::Activate( bool bMDI )
1535{
1536 if ( bMDI )
1537 {
1539 if (const auto xModel = pSh->GetModel())
1540 xModel->setCurrentController(GetController());
1541
1543 }
1544}
1545
1546
1547void SfxViewShell::Deactivate(bool /*bMDI*/)
1548{
1549}
1550
1551
1553
1554/* [Description]
1555
1556 This virtual Method is called when the window displayed in the
1557 SfxViewShell gets a StarView-Move() notification.
1558
1559 This base implementation does not have to be called. .
1560
1561 [Note]
1562
1563 This Method can be used to cancel a selection, in order to catch the
1564 mouse movement which is due to moving a window.
1565
1566 For now the notification does not work In-Place.
1567*/
1568
1569{
1570}
1571
1572
1574(
1575 const Point& /*rToolOffset*/,// Upper left corner Tools in Frame-Window
1576 const Size& /*rSize*/ // All available sizes.
1577)
1578
1579/* [Description]
1580
1581 Override this Method to be able to react to the size-change of
1582 the View. Thus the View is defined as the Edit window and also the
1583 attached Tools are defined (for example the ruler).
1584
1585 The Edit window must not be changed either in size or position.
1586
1587 The Vis-Area of SfxObjectShell, its scale and position can be changed
1588 here. The main use is to change the size of the Vis-Area.
1589
1590 If the Border is changed due to the new calculation then this has to be set
1591 by <SfxViewShell::SetBorderPixel(const SvBorder&)>. The Positioning of Tools
1592 is only allowed after the calling of 'SetBorderPixel'.
1593
1594 [Example]
1595
1596 void AppViewSh::OuterViewResizePixel( const Point &rOfs, const Size &rSz )
1597 {
1598 // Calculate Tool position and size externally, do not set!
1599 // (due to the following Border calculation)
1600 Point aHLinPos...; Size aHLinSz...;
1601 ...
1602
1603 // Calculate and Set a Border of Tools which matches rSize.
1604 SvBorder aBorder...
1605 SetBorderPixel( aBorder ); // Allow Positioning from here on.
1606
1607 // Arrange Tools
1608 pHLin->SetPosSizePixel( aHLinPos, aHLinSz );
1609 ...
1610 }
1611
1612 [Cross-reference]
1613
1614 <SfxViewShell::InnerResizePixel(const Point&,const Size& rSize)>
1615*/
1616
1617{
1619}
1620
1621
1623(
1624 const Point& /*rToolOffset*/,// Upper left corner Tools in Frame-Window
1625 const Size& /*rSize*/, // All available sizes.
1626 bool
1627)
1628
1629/* [Description]
1630
1631 Override this Method to be able to react to the size-change of
1632 the Edit window.
1633
1634 The Edit window must not be changed either in size or position.
1635 Neither the Vis-Area of SfxObjectShell nor its scale or position are
1636 allowed to be changed
1637
1638 If the Border is changed due to the new calculation then is has to be set
1639 by <SfxViewShell::SetBorderPixel(const SvBorder&)>.
1640 The Positioning of Tools is only allowed after the calling of
1641 'SetBorderPixel'.
1642
1643
1644 [Note]
1645
1646 void AppViewSh::InnerViewResizePixel( const Point &rOfs, const Size &rSz )
1647 {
1648 // Calculate Tool position and size internally, do not set!
1649 // (due to the following Border calculation)
1650 Point aHLinPos...; Size aHLinSz...;
1651 ...
1652
1653 // Calculate and Set a Border of Tools which matches rSize.
1654 SvBorder aBorder...
1655 SetBorderPixel( aBorder ); // Allow Positioning from here on.
1656
1657 // Arrange Tools
1658 pHLin->SetPosSizePixel( aHLinPos, aHLinSz );
1659 ...
1660 }
1661
1662 [Cross-reference]
1663
1664 <SfxViewShell::OuterResizePixel(const Point&,const Size& rSize)>
1665*/
1666
1667{
1669}
1670
1672{
1674 if (pImpl->m_pController.is())
1675 {
1676 pImpl->m_pController->BorderWidthsChanged_Impl();
1677 }
1678}
1679
1681{
1682 GetViewFrame().SetBorderPixelImpl( this, rBorder );
1683
1684 // notify related controller that border size is changed
1685 if (pImpl->m_pController.is())
1686 {
1687 pImpl->m_pController->BorderWidthsChanged_Impl();
1688 }
1689}
1690
1692{
1694}
1695
1697(
1698 vcl::Window* pViewPort // For example Null pointer in the Destructor.
1699)
1700
1701/* [Description]
1702
1703 With this method the SfxViewShell is set in the data window. This is
1704 needed for the in-place container and for restoring the proper focus.
1705
1706 Even in-place-active the conversion of the ViewPort Windows is forbidden.
1707*/
1708
1709{
1710 if( pWindow == pViewPort )
1711 return;
1712
1713 // Disconnect existing IP-Clients if possible
1715
1716 // Switch View-Port
1717 bool bHadFocus = pWindow && pWindow->HasChildPathFocus( true );
1718 pWindow = pViewPort;
1719
1720 if( pWindow )
1721 {
1722 // Disable automatic GUI mirroring (right-to-left) for document windows
1723 pWindow->EnableRTL( false );
1724 }
1725
1726 if ( bHadFocus && pWindow )
1727 pWindow->GrabFocus();
1728 //TODO/CLEANUP
1729 //Do we still need this Method?!
1730 //SfxGetpApp()->GrabFocus( pWindow );
1731}
1732
1734
1736(
1737 SfxViewFrame& rViewFrame, /* <SfxViewFrame>, which will be
1738 displayed in this View */
1739 SfxViewShellFlags nFlags /* See <SfxViewShell-Flags> */
1740)
1741
1742: SfxShell(this)
1743, pImpl( new SfxViewShell_Impl(nFlags, SfxViewShell::mnCurrentDocId) )
1744, rFrame(rViewFrame)
1745, pWindow(nullptr)
1746, bNoNewWindow( nFlags & SfxViewShellFlags::NO_NEWWINDOW )
1747, mbPrinterSettingsModified(false)
1748, maLOKLanguageTag(LANGUAGE_NONE)
1749, maLOKLocale(LANGUAGE_NONE)
1750, maLOKDeviceFormFactor(LOKDeviceFormFactor::UNKNOWN)
1751, mbLOKAccessibilityEnabled(false)
1752{
1753 SetMargin( rViewFrame.GetMargin_Impl() );
1754
1755 SetPool( &rViewFrame.GetObjectShell()->GetPool() );
1756 StartListening(*rViewFrame.GetObjectShell());
1757
1758 // Insert into list
1759 std::vector<SfxViewShell*> &rViewArr = SfxGetpApp()->GetViewShells_Impl();
1760 rViewArr.push_back(this);
1761
1763 {
1766
1767 const auto [isTimezoneSet, aTimezone] = SfxLokHelper::getDefaultTimezone();
1768 maLOKIsTimezoneSet = isTimezoneSet;
1769 maLOKTimezone = aTimezone;
1770
1772
1773 vcl::Window* pFrameWin = rViewFrame.GetWindow().GetFrameWindow();
1774 if (pFrameWin && !pFrameWin->GetLOKNotifier())
1775 pFrameWin->SetLOKNotifier(this, true);
1776 }
1777}
1778
1780{
1781 // Remove from list
1782 const SfxViewShell *pThis = this;
1783 std::vector<SfxViewShell*> &rViewArr = SfxGetpApp()->GetViewShells_Impl();
1784 auto it = std::find( rViewArr.begin(), rViewArr.end(), pThis );
1785 rViewArr.erase( it );
1786
1787 if ( pImpl->xClipboardListener.is() )
1788 {
1789 pImpl->xClipboardListener->DisconnectViewShell();
1790 pImpl->xClipboardListener = nullptr;
1791 }
1792
1793 if (pImpl->m_pController.is())
1794 {
1795 pImpl->m_pController->ReleaseShell_Impl();
1796 pImpl->m_pController.clear();
1797 }
1798
1800 if (pFrameWin && pFrameWin->GetLOKNotifier() == this)
1801 pFrameWin->ReleaseLOKNotifier();
1802}
1803
1805{
1806 const LOKDocumentFocusListener& rDocFocusListener = GetLOKDocumentFocusListener();
1807 return rDocFocusListener.getFocusedParagraph();
1808}
1809
1811{
1812 const LOKDocumentFocusListener& rDocFocusListener = GetLOKDocumentFocusListener();
1813 return rDocFocusListener.getCaretPosition();
1814}
1815
1817(
1818 bool bUI // TRUE: Allow Dialog and so on, FALSE: silent-mode
1819)
1820{
1821 if (GetViewFrame().GetWindow().GetLOKNotifier() == this)
1823
1824 SfxPrinter *pPrinter = GetPrinter();
1825 if ( pPrinter && pPrinter->IsPrinting() )
1826 {
1827 if ( bUI )
1828 {
1829 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewFrame().GetFrameWeld(),
1830 VclMessageType::Info, VclButtonsType::Ok,
1831 SfxResId(STR_CANT_CLOSE)));
1832 xBox->run();
1833 }
1834
1835 return false;
1836 }
1837
1838 if( GetViewFrame().IsInModalMode() )
1839 return false;
1840
1841 if( bUI && GetViewFrame().GetDispatcher()->IsLocked() )
1842 return false;
1843
1844 return true;
1845}
1846
1847
1849{
1850 SfxViewFrame *pCurrent = SfxViewFrame::Current();
1851 return pCurrent ? pCurrent->GetViewShell() : nullptr;
1852}
1853
1854
1855SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController )
1856{
1857 if ( !i_rController.is() )
1858 return nullptr;
1859
1860 for ( SfxViewShell* pViewShell = SfxViewShell::GetFirst( false );
1861 pViewShell;
1862 pViewShell = SfxViewShell::GetNext( *pViewShell, false )
1863 )
1864 {
1865 if ( pViewShell->GetController() == i_rController )
1866 return pViewShell;
1867 }
1868 return nullptr;
1869}
1870
1871
1873
1874/* [Description]
1875
1876 This virtual Method has to be overloaded by the sub classes, to be able
1877 make the Property-Editor available.
1878
1879 The default implementation does always return zero.
1880*/
1881
1882{
1883 return nullptr;
1884}
1885
1886
1888(
1889 bool /*bCompleteWords*/, /* FALSE (default)
1890 Only the actual selected text is returned.
1891
1892 TRUE
1893 The selected text is expanded so that only
1894 whole words are returned. As word separators
1895 these are used: white spaces and punctuation
1896 ".,;" and single and double quotes.
1897 */
1898 bool /*bOnlyASample*/ /* used by some dialogs to avoid constructing monster strings e.g. in calc */
1899)
1900
1901/* [Description]
1902
1903 Override this Method to return a text that
1904 is included in the current selection. This is for example used when
1905 sending emails.
1906
1907 When called with "CompleteWords == TRUE", it is for example sufficient
1908 with having the Cursor positioned somewhere within a URL in-order
1909 to have the entire URL returned.
1910*/
1911
1912{
1913 return OUString();
1914}
1915
1916
1918
1919/* [Description]
1920
1921 With this virtual Method can a for example a Dialog be queried, to
1922 check if something is selected in the current view. If the Parameter
1923 is <BOOL> TRUE then it is checked whether some text is selected.
1924*/
1925
1926{
1927 return false;
1928}
1929
1931{
1932 pImpl->aArr.push_back(&rShell);
1934 if ( pDisp->IsActive(*this) )
1935 {
1936 pDisp->Push(rShell);
1937 pDisp->Flush();
1938 }
1939}
1940
1942{
1944 if ( !pShell )
1945 {
1946 size_t nCount = pImpl->aArr.size();
1947 if ( pDisp->IsActive(*this) )
1948 {
1949 for(size_t n = nCount; n > 0; --n)
1950 pDisp->Pop(*pImpl->aArr[n - 1]);
1951 pDisp->Flush();
1952 }
1953 pImpl->aArr.clear();
1954 }
1955 else
1956 {
1957 SfxShellArr_Impl::iterator i = std::find(pImpl->aArr.begin(), pImpl->aArr.end(), pShell);
1958 if(i != pImpl->aArr.end())
1959 {
1960 pImpl->aArr.erase(i);
1961 if(pDisp->IsActive(*this))
1962 {
1963 pDisp->RemoveShell_Impl(*pShell);
1964 pDisp->Flush();
1965 }
1966 }
1967 }
1968}
1969
1971{
1972 sal_uInt16 nCount = pImpl->aArr.size();
1973 if(nNo < nCount)
1974 return pImpl->aArr[nCount - nNo - 1];
1975 return nullptr;
1976}
1977
1979{
1981 if ( bPush )
1982 {
1983 for (auto const& elem : pImpl->aArr)
1984 pDisp->Push(*elem);
1985 }
1986 else if(!pImpl->aArr.empty())
1987 {
1988 SfxShell& rPopUntil = *pImpl->aArr[0];
1989 if ( pDisp->GetShellLevel( rPopUntil ) != USHRT_MAX )
1990 pDisp->Pop( rPopUntil, SfxDispatcherPopFlags::POP_UNTIL );
1991 }
1992
1993 pDisp->Flush();
1994}
1995
1996
1997void SfxViewShell::WriteUserData( OUString&, bool )
1998{
1999}
2000
2001
2002void SfxViewShell::ReadUserData(const OUString&, bool )
2003{
2004}
2005
2006void SfxViewShell::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >& )
2007{
2008}
2009
2010void SfxViewShell::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& )
2011{
2012}
2013
2014
2015// returns the first shell of spec. type viewing the specified doc.
2017(
2018 bool bOnlyVisible,
2019 const std::function< bool ( const SfxViewShell* ) >& isViewShell
2020)
2021{
2022 // search for a SfxViewShell of the specified type
2023 std::vector<SfxViewShell*> &rShells = SfxGetpApp()->GetViewShells_Impl();
2024 for (SfxViewShell* pShell : rShells)
2025 {
2026 if ( pShell )
2027 {
2028 // This code used to check that the frame exists in the other list,
2029 // because of https://bz.apache.org/ooo/show_bug.cgi?id=62084, with the explanation:
2030 // sometimes dangling SfxViewShells exist that point to a dead SfxViewFrame
2031 // these ViewShells shouldn't be accessible anymore
2032 // a destroyed ViewFrame is not in the ViewFrame array anymore, so checking this array helps
2033 // That doesn't seem to be needed anymore, but keep an assert, just in case.
2034 assert(std::find(SfxGetpApp()->GetViewFrames_Impl().begin(), SfxGetpApp()->GetViewFrames_Impl().end(),
2035 &pShell->GetViewFrame()) != SfxGetpApp()->GetViewFrames_Impl().end());
2036 if ( ( !bOnlyVisible || pShell->GetViewFrame().IsVisible() ) && (!isViewShell || isViewShell(pShell)))
2037 return pShell;
2038 }
2039 }
2040
2041 return nullptr;
2042}
2043
2044// returns the next shell of spec. type viewing the specified doc.
2046(
2047 const SfxViewShell& rPrev,
2048 bool bOnlyVisible,
2049 const std::function<bool ( const SfxViewShell* )>& isViewShell
2050)
2051{
2052 std::vector<SfxViewShell*> &rShells = SfxGetpApp()->GetViewShells_Impl();
2053 size_t nPos;
2054 for ( nPos = 0; nPos < rShells.size(); ++nPos )
2055 if ( rShells[nPos] == &rPrev )
2056 break;
2057
2058 for ( ++nPos; nPos < rShells.size(); ++nPos )
2059 {
2060 SfxViewShell *pShell = rShells[nPos];
2061 if ( pShell )
2062 {
2063 assert(std::find(SfxGetpApp()->GetViewFrames_Impl().begin(), SfxGetpApp()->GetViewFrames_Impl().end(),
2064 &pShell->GetViewFrame()) != SfxGetpApp()->GetViewFrames_Impl().end());
2065 if ( ( !bOnlyVisible || pShell->GetViewFrame().IsVisible() ) && (!isViewShell || isViewShell(pShell)) )
2066 return pShell;
2067 }
2068 }
2069
2070 return nullptr;
2071}
2072
2073
2075 const SfxHint& rHint )
2076{
2077 const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint);
2078 if ( !(pEventHint && pEventHint->GetEventId() == SfxEventHintId::LoadFinished) )
2079 return;
2080
2081 if ( !GetController().is() )
2082 return;
2083
2084 // avoid access to dangling ViewShells
2085 auto &rFrames = SfxGetpApp()->GetViewFrames_Impl();
2086 for (SfxViewFrame* frame : rFrames)
2087 {
2088 if ( frame == &GetViewFrame() && &rBC == GetObjectShell() )
2089 {
2091 const SfxUnoAnyItem* pItem = rSet.GetItem(SID_VIEW_DATA, false);
2092 if ( pItem )
2093 {
2094 pImpl->m_pController->restoreViewData( pItem->GetValue() );
2095 rSet.ClearItem( SID_VIEW_DATA );
2096 }
2097 break;
2098 }
2099 }
2100}
2101
2103{
2104 bool setModuleConfig = false; // In case libreofficekit is active, we will re-set the module config class.
2105 if (!pImpl->m_xAccExec)
2106 {
2108 pImpl->m_xAccExec->init(::comphelper::getProcessComponentContext(),
2110 setModuleConfig = true;
2111 }
2112
2114 {
2115 // Get the module name.
2116 css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext());
2117 css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext));
2118 OUString sModule = xModuleManager->identify(rFrame.GetFrame().GetFrameInterface());
2119
2120 // Get the language name.
2121 OUString viewLang = GetLOKLanguageTag().getBcp47();
2122
2123 // Merge them & have a key.
2124 OUString key = sModule + viewLang;
2125
2126 // Check it in configurations map. Create a configuration manager if there isn't one for the key.
2127 std::unordered_map<OUString, css::uno::Reference<com::sun::star::ui::XAcceleratorConfiguration>>& acceleratorConfs = SfxApplication::Get()->GetAcceleratorConfs_Impl();
2128 if (acceleratorConfs.find(key) == acceleratorConfs.end())
2129 {
2130 // Create a new configuration manager for the module.
2131
2132 OUString actualLang = officecfg::Setup::L10N::ooLocale::get();
2133
2134 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
2135 officecfg::Setup::L10N::ooLocale::set(viewLang, batch);
2136 batch->commit();
2137
2138 // We have set the language. Time to create the config manager.
2139 acceleratorConfs[key] = svt::AcceleratorExecute::lok_createNewAcceleratorConfiguration(::comphelper::getProcessComponentContext(), sModule);
2140
2141 std::shared_ptr<comphelper::ConfigurationChanges> batch2(comphelper::ConfigurationChanges::create());
2142 officecfg::Setup::L10N::ooLocale::set(actualLang, batch2);
2143 batch2->commit();
2144 }
2145
2146 if (setModuleConfig)
2147 pImpl->m_xAccExec->lok_setModuleConfig(acceleratorConfs[key]);
2148 }
2149
2150 return pImpl->m_xAccExec->execute(aKey.GetKeyCode());
2151}
2152
2154{
2155 pImpl->m_pLibreOfficeKitViewCallback = pCallback;
2156
2158
2159 if (!pImpl->m_pLibreOfficeKitViewCallback)
2160 return;
2161
2162 // Ask other views to tell us about their cursors.
2163 SfxViewShell* pViewShell = SfxViewShell::GetFirst();
2164 while (pViewShell)
2165 {
2166 if (pViewShell->GetDocId() == GetDocId())
2167 pViewShell->NotifyCursor(this);
2168 pViewShell = SfxViewShell::GetNext(*pViewShell);
2169 }
2170}
2171
2173{
2174 return pImpl->m_pLibreOfficeKitViewCallback;
2175}
2176
2177void SfxViewShell::dumpLibreOfficeKitViewState(rtl::OStringBuffer &rState)
2178{
2179 if (pImpl->m_pLibreOfficeKitViewCallback)
2180 pImpl->m_pLibreOfficeKitViewCallback->dumpState(rState);
2181}
2182
2183static bool ignoreLibreOfficeKitViewCallback(int nType, const SfxViewShell_Impl* pImpl)
2184{
2186 return true;
2187
2189 {
2190 switch (nType)
2191 {
2192 case LOK_CALLBACK_FORM_FIELD_BUTTON:
2193 case LOK_CALLBACK_TEXT_SELECTION:
2194 case LOK_CALLBACK_COMMENT:
2195 break;
2196 default:
2197 // Reject e.g. invalidate during paint.
2198 return true;
2199 }
2200 }
2201
2202 if (pImpl->m_bTiledSearching)
2203 {
2204 switch (nType)
2205 {
2206 case LOK_CALLBACK_TEXT_SELECTION:
2207 case LOK_CALLBACK_TEXT_VIEW_SELECTION:
2208 case LOK_CALLBACK_TEXT_SELECTION_START:
2209 case LOK_CALLBACK_TEXT_SELECTION_END:
2210 case LOK_CALLBACK_GRAPHIC_SELECTION:
2211 case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION:
2212 return true;
2213 }
2214 }
2215
2216 return false;
2217}
2218
2220{
2221 if (ignoreLibreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, pImpl.get()))
2222 return;
2223 if (pImpl->m_pLibreOfficeKitViewCallback)
2224 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewInvalidateTilesCallback(pRect, nPart, nMode);
2225 else
2226 SAL_INFO(
2227 "sfx.view",
2228 "SfxViewShell::libreOfficeKitViewInvalidateTilesCallback no callback set!");
2229}
2230
2231void SfxViewShell::libreOfficeKitViewCallbackWithViewId(int nType, const OString& pPayload, int nViewId) const
2232{
2234 return;
2235 if (pImpl->m_pLibreOfficeKitViewCallback)
2236 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewCallbackWithViewId(nType, pPayload, nViewId);
2237 else
2238 SAL_INFO(
2239 "sfx.view",
2240 "SfxViewShell::libreOfficeKitViewCallbackWithViewId no callback set! Dropped payload of type "
2241 << lokCallbackTypeToString(nType) << ": [" << pPayload << ']');
2242}
2243
2244void SfxViewShell::libreOfficeKitViewCallback(int nType, const OString& pPayload) const
2245{
2247 return;
2248 if (pImpl->m_pLibreOfficeKitViewCallback)
2249 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewCallback(nType, pPayload);
2250 else
2251 SAL_INFO(
2252 "sfx.view",
2253 "SfxViewShell::libreOfficeKitViewCallback no callback set! Dropped payload of type "
2254 << lokCallbackTypeToString(nType) << ": [" << pPayload << ']');
2255}
2256
2258{
2260 return;
2261 if (pImpl->m_pLibreOfficeKitViewCallback)
2262 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewUpdatedCallback(nType);
2263 else
2264 SAL_INFO(
2265 "sfx.view",
2266 "SfxViewShell::libreOfficeKitViewUpdatedCallback no callback set! Dropped payload of type "
2267 << lokCallbackTypeToString(nType));
2268}
2269
2270void SfxViewShell::libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const
2271{
2273 return;
2274 if (pImpl->m_pLibreOfficeKitViewCallback)
2275 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewUpdatedCallbackPerViewId(nType, nViewId, nSourceViewId);
2276 else
2277 SAL_INFO(
2278 "sfx.view",
2279 "SfxViewShell::libreOfficeKitViewUpdatedCallbackPerViewId no callback set! Dropped payload of type "
2280 << lokCallbackTypeToString(nType));
2281}
2282
2284{
2285 if (pImpl->m_pLibreOfficeKitViewCallback)
2286 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewAddPendingInvalidateTiles();
2287 else
2288 SAL_INFO(
2289 "sfx.view",
2290 "SfxViewShell::libreOfficeKitViewAddPendingInvalidateTiles no callback set!");
2291}
2292
2294{
2295}
2296
2298{
2299 // SfxViewShell itself does not delay any tile invalidations.
2300}
2301
2302std::optional<OString> SfxViewShell::getLOKPayload(int nType, int /*nViewId*/) const
2303{
2304 // SfxViewShell itself currently doesn't handle any updated-payload types.
2305 SAL_WARN("sfx.view", "SfxViewShell::getLOKPayload unhandled type " << lokCallbackTypeToString(nType));
2306 abort();
2307}
2308
2310{
2311 vcl::Window* pEditWin = nullptr;
2312 SfxInPlaceClient* pIPClient = GetIPClient();
2313 if (pIPClient)
2314 {
2315 pEditWin = pIPClient->GetEditWin();
2316 }
2317 return pEditWin;
2318}
2319
2321{
2322 SAL_WARN("sfx.view", "SfxViewShell::GetColorConfigColor not overridden!");
2323 return {};
2324}
2325
2327{
2328 SAL_WARN("sfx.view", "SfxViewShell::GetColorConfigName not overridden!");
2329 return {};
2330}
2331
2332void SfxViewShell::SetLOKLanguageTag(const OUString& rBcp47LanguageTag)
2333{
2334 LanguageTag aTag(rBcp47LanguageTag, true);
2335
2336 css::uno::Sequence<OUString> inst(officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
2337 LanguageTag aFallbackTag = LanguageTag(getInstalledLocaleForSystemUILanguage(inst, /* bRequestInstallIfMissing */ false, rBcp47LanguageTag), true).makeFallback();
2338
2339 // If we want de-CH, and the de localisation is available, we don't want to use de-DE as then
2340 // the magic in Translate::get() won't turn ess-zet into double s. Possibly other similar cases?
2341 if (comphelper::LibreOfficeKit::isActive() && aTag.getLanguage() == aFallbackTag.getLanguage())
2342 maLOKLanguageTag = aTag;
2343 else
2344 maLOKLanguageTag = aFallbackTag;
2345}
2346
2348{
2351
2354}
2355
2357{
2358 return const_cast<SfxViewShell*>(this)->GetLOKDocumentFocusListener();
2359}
2360
2362{
2363 if (bEnabled == mbLOKAccessibilityEnabled)
2364 return;
2365 mbLOKAccessibilityEnabled = bEnabled;
2366
2367 LOKDocumentFocusListener& rDocumentFocusListener = GetLOKDocumentFocusListener();
2368
2369 if (!pWindow)
2370 return;
2371
2372 uno::Reference< accessibility::XAccessible > xAccessible =
2373 pWindow->GetAccessible();
2374
2375 if (!xAccessible.is())
2376 return;
2377
2379 {
2380 try
2381 {
2382 rDocumentFocusListener.attachRecursive(xAccessible);
2383 }
2384 catch (const uno::Exception&)
2385 {
2386 SAL_WARN("lok.a11y", "Exception caught processing LOKDocumentFocusListener::attachRecursive");
2387 }
2388 }
2389 else
2390 {
2391 try
2392 {
2393 rDocumentFocusListener.detachRecursive(xAccessible);
2394 }
2395 catch (const uno::Exception&)
2396 {
2397 SAL_WARN("lok.a11y", "Exception caught processing LOKDocumentFocusListener::detachRecursive");
2398 }
2399 }
2400}
2401
2402void SfxViewShell::SetLOKLocale(const OUString& rBcp47LanguageTag)
2403{
2404 maLOKLocale = LanguageTag(rBcp47LanguageTag, true).makeFallback();
2405}
2406
2407void SfxViewShell::NotifyCursor(SfxViewShell* /*pViewShell*/) const
2408{
2409}
2410
2411void SfxViewShell::setTiledSearching(bool bTiledSearching)
2412{
2413 pImpl->m_bTiledSearching = bTiledSearching;
2414}
2415
2417{
2418 return 0;
2419}
2420
2422{
2423 return 0;
2424}
2425
2427{
2428 return pImpl->m_nViewShellId;
2429}
2430
2432{
2434}
2435
2437{
2438 assert(pImpl->m_nDocId >= ViewShellDocId(0) && "m_nDocId should have been initialized, but it is invalid.");
2439 return pImpl->m_nDocId;
2440}
2441
2443{
2445}
2446
2447void SfxViewShell::NotifyOtherViews(int nType, const OString& rKey, const OString& rPayload)
2448{
2449 SfxLokHelper::notifyOtherViews(this, nType, rKey, rPayload);
2450}
2451
2452void SfxViewShell::NotifyOtherView(OutlinerViewShell* pOther, int nType, const OString& rKey, const OString& rPayload)
2453{
2454 auto pOtherShell = dynamic_cast<SfxViewShell*>(pOther);
2455 if (!pOtherShell)
2456 return;
2457
2458 SfxLokHelper::notifyOtherView(this, pOtherShell, nType, rKey, rPayload);
2459}
2460
2462{
2463 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SfxViewShell"));
2464 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
2465 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number(static_cast<sal_Int32>(GetViewShellId())).getStr()));
2466 (void)xmlTextWriterEndElement(pWriter);
2467}
2468
2469bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent )
2470
2471/* [Description]
2472
2473 This Method executes the KeyEvent 'rKeyEvent' of the Keys (Accelerator)
2474 configured either direct or indirect (for example by the Application)
2475 in the SfxViewShell.
2476
2477 [Return value]
2478
2479 bool TRUE
2480 The Key (Accelerator) is configured and the
2481 associated Handler was called
2482
2483 FALSE
2484 The Key (Accelerator) is not configured and
2485 subsequently no Handler was called
2486
2487 [Cross-reference]
2488
2489 <SfxApplication::KeyInput(const KeyEvent&)>
2490*/
2491{
2492 return ExecKey_Impl(rKeyEvent);
2493}
2494
2496{
2497 return ExecKey_Impl(rKeyEvent);
2498}
2499
2500
2501void SfxViewShell::ShowCursor( bool /*bOn*/ )
2502
2503/* [Description]
2504
2505 Subclasses must override this Method so that SFx can switch the
2506 Cursor on and off, for example while a <SfxProgress> is running.
2507*/
2508
2509{
2510}
2511
2512
2514{
2515
2516 std::vector< SfxInPlaceClient* >& rClients = pImpl->GetIPClients_Impl();
2517 if ( rClients.empty() )
2518 return;
2519
2520 for (SfxInPlaceClient* pIPClient : rClients)
2521 {
2522 if( pIPClient != pIP )
2523 pIPClient->ResetObject();
2524 }
2525}
2526
2527
2529{
2530 std::vector< SfxInPlaceClient* >& rClients = pImpl->GetIPClients_Impl();
2531 if ( rClients.empty() )
2532 return;
2533
2534 for ( size_t n = 0; n < rClients.size(); )
2535 // clients will remove themselves from the list
2536 delete rClients.at( n );
2537}
2538
2539
2541{
2542}
2543
2544
2546{
2547 std::vector< SfxInPlaceClient* >& rClients = pImpl->GetIPClients_Impl();
2548 if ( rClients.empty() )
2549 return;
2550
2551 for (SfxInPlaceClient* pIPClient : rClients)
2552 {
2553 if ( pIPClient->IsObjectInPlaceActive() )
2554 // client is active, notify client that the VisArea might have changed
2555 pIPClient->VisAreaChanged();
2556 }
2557}
2558
2559
2561 SfxInPlaceClient const *const pIPClient, const tools::Rectangle& rVisArea)
2562{
2563 if ( GetObjectShell()->IsInClose() )
2564 return;
2565
2566 bool bAlwaysActive =
2567 ( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) != 0 );
2568 bool bActiveWhenVisible =
2569 ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0;
2570
2571 // this method is called when a client is created
2572 if (pIPClient->IsObjectInPlaceActive())
2573 return;
2574
2575 // object in client is currently not active
2576 // check if the object wants to be activated always or when it becomes at least partially visible
2577 // TODO/LATER: maybe we should use the scaled area instead of the ObjArea?!
2578 if (bAlwaysActive || (bActiveWhenVisible && rVisArea.Overlaps(pIPClient->GetObjArea())))
2579 {
2580 try
2581 {
2582 pIPClient->GetObject()->changeState( embed::EmbedStates::INPLACE_ACTIVE );
2583 }
2584 catch (const uno::Exception&)
2585 {
2586 TOOLS_WARN_EXCEPTION("sfx.view", "SfxViewShell::CheckIPClient_Impl");
2587 }
2588 }
2589}
2590
2592{
2593 return rFrame.GetObjectShell();
2594}
2595
2596Reference< XModel > SfxViewShell::GetCurrentDocument() const
2597{
2598 Reference< XModel > xDocument;
2599
2600 const SfxObjectShell* pDocShell( const_cast< SfxViewShell* >( this )->GetObjectShell() );
2601 OSL_ENSURE( pDocShell, "SfxViewFrame::GetCurrentDocument: no DocShell!?" );
2602 if ( pDocShell )
2603 xDocument = pDocShell->GetModel();
2604 return xDocument;
2605}
2606
2607
2609{
2610 uno::Reference< frame::XModel > xDocument( GetCurrentDocument() );
2611 if ( xDocument.is() )
2613}
2614
2615
2617{
2618 return pImpl->aMargin;
2619}
2620
2621
2622void SfxViewShell::SetMargin( const Size& rSize )
2623{
2624 // the default margin was verified using www.apple.com !!
2625 Size aMargin = rSize;
2626 if ( aMargin.Width() == -1 )
2627 aMargin.setWidth( DEFAULT_MARGIN_WIDTH );
2628 if ( aMargin.Height() == -1 )
2630
2631 if ( aMargin != pImpl->aMargin )
2632 {
2633 pImpl->aMargin = aMargin;
2634 MarginChanged();
2635 }
2636}
2637
2639{
2640}
2641
2642void SfxViewShell::JumpToMark( const OUString& rMark )
2643{
2644 SfxStringItem aMarkItem( SID_JUMPTOMARK, rMark );
2646 SID_JUMPTOMARK,
2648 { &aMarkItem });
2649}
2650
2652{
2653 pImpl->m_pController = pController;
2654
2655 // there should be no old listener, but if there is one, it should be disconnected
2656 if ( pImpl->xClipboardListener.is() )
2657 pImpl->xClipboardListener->DisconnectViewShell();
2658
2659 pImpl->xClipboardListener = new SfxClipboardChangeListener( this, GetClipboardNotifier() );
2660}
2661
2662Reference < XController > SfxViewShell::GetController() const
2663{
2664 return pImpl->m_pController;
2665}
2666
2668{
2669 return pImpl->m_pController.get();
2670}
2671
2672void SfxViewShell::AddContextMenuInterceptor_Impl( const uno::Reference< ui::XContextMenuInterceptor >& xInterceptor )
2673{
2674 std::unique_lock g(pImpl->aMutex);
2675 pImpl->aInterceptorContainer.addInterface( g, xInterceptor );
2676}
2677
2678void SfxViewShell::RemoveContextMenuInterceptor_Impl( const uno::Reference< ui::XContextMenuInterceptor >& xInterceptor )
2679{
2680 std::unique_lock g(pImpl->aMutex);
2681 pImpl->aInterceptorContainer.removeInterface( g, xInterceptor );
2682}
2683
2685 const OUString& rMenuIdentifier,
2687 ui::ContextMenuExecuteEvent aEvent)
2688{
2689 rOut.clear();
2690 bool bModified = false;
2691
2692 // create container from menu
2694 rIn, &rMenuIdentifier);
2695
2696 // get selection from controller
2697 aEvent.Selection.set( GetController(), uno::UNO_QUERY );
2698
2699 // call interceptors
2700 std::unique_lock g(pImpl->aMutex);
2701 std::vector<uno::Reference< ui::XContextMenuInterceptor>> aInterceptors =
2702 pImpl->aInterceptorContainer.getElements(g);
2703 g.unlock();
2704 for (const auto & rListener : aInterceptors )
2705 {
2706 try
2707 {
2708 ui::ContextMenuInterceptorAction eAction;
2709 {
2711 eAction = rListener->notifyContextMenuExecute( aEvent );
2712 }
2713 switch ( eAction )
2714 {
2715 case ui::ContextMenuInterceptorAction_CANCELLED :
2716 // interceptor does not want execution
2717 return false;
2718 case ui::ContextMenuInterceptorAction_EXECUTE_MODIFIED :
2719 // interceptor wants his modified menu to be executed
2720 bModified = true;
2721 break;
2722 case ui::ContextMenuInterceptorAction_CONTINUE_MODIFIED :
2723 // interceptor has modified menu, but allows for calling other interceptors
2724 bModified = true;
2725 continue;
2726 case ui::ContextMenuInterceptorAction_IGNORED :
2727 // interceptor is indifferent
2728 continue;
2729 default:
2730 OSL_FAIL("Wrong return value of ContextMenuInterceptor!");
2731 continue;
2732 }
2733 }
2734 catch (...)
2735 {
2736 g.lock();
2737 pImpl->aInterceptorContainer.removeInterface(g, rListener);
2738 g.unlock();
2739 }
2740
2741 break;
2742 }
2743
2744 if (bModified)
2745 {
2746 // container was modified, create a new menu out of it
2747 rOut = new VCLXPopupMenu();
2749 }
2750
2751 return true;
2752}
2753
2755 const OUString& rMenuIdentifier, css::ui::ContextMenuExecuteEvent aEvent)
2756{
2757 bool bModified = false;
2758
2759 // create container from menu
2761 rPopupMenu, &rMenuIdentifier);
2762
2763 // get selection from controller
2764 aEvent.Selection = css::uno::Reference< css::view::XSelectionSupplier >( GetController(), css::uno::UNO_QUERY );
2765
2766 // call interceptors
2767 std::unique_lock g(pImpl->aMutex);
2768 std::vector<uno::Reference< ui::XContextMenuInterceptor>> aInterceptors =
2769 pImpl->aInterceptorContainer.getElements(g);
2770 g.unlock();
2771 for (const auto & rListener : aInterceptors )
2772 {
2773 try
2774 {
2775 css::ui::ContextMenuInterceptorAction eAction;
2776 {
2778 eAction = rListener->notifyContextMenuExecute( aEvent );
2779 }
2780 switch ( eAction )
2781 {
2782 case css::ui::ContextMenuInterceptorAction_CANCELLED:
2783 // interceptor does not want execution
2784 return false;
2785 case css::ui::ContextMenuInterceptorAction_EXECUTE_MODIFIED:
2786 // interceptor wants his modified menu to be executed
2787 bModified = true;
2788 break;
2789 case css::ui::ContextMenuInterceptorAction_CONTINUE_MODIFIED:
2790 // interceptor has modified menu, but allows for calling other interceptors
2791 bModified = true;
2792 continue;
2793 case css::ui::ContextMenuInterceptorAction_IGNORED:
2794 // interceptor is indifferent
2795 continue;
2796 default:
2797 SAL_WARN( "sfx.view", "Wrong return value of ContextMenuInterceptor!" );
2798 continue;
2799 }
2800 }
2801 catch (...)
2802 {
2803 g.lock();
2804 pImpl->aInterceptorContainer.removeInterface(g, rListener);
2805 g.unlock();
2806 }
2807
2808 break;
2809 }
2810
2811 if ( bModified )
2812 {
2813 rPopupMenu->clear();
2815 }
2816
2817 return true;
2818}
2819
2821{
2822 if (pImpl->m_pController.is())
2823 return pImpl->m_pController->HandleEvent_Impl( rEvent );
2824 return false;
2825}
2826
2828{
2829 return (pImpl->m_pController.is())
2830 && pImpl->m_pController->HasKeyListeners_Impl();
2831}
2832
2834{
2835 return (pImpl->m_pController.is())
2836 && pImpl->m_pController->HasMouseClickListeners_Impl();
2837}
2838
2840{
2841 return GetViewFrame().GetBindings().Execute(SID_TERMINATE_INPLACEACTIVATION);
2842}
2843
2845{
2848 if( pObj )
2849 {
2850 Reference< frame::XModel > xModel( pObj->GetModel() );
2851 if( xModel.is() )
2852 xRender.set( xModel, UNO_QUERY );
2853 }
2854 return xRender;
2855}
2856
2857void SfxViewShell::notifyWindow(vcl::LOKWindowId nDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) const
2858{
2859 SfxLokHelper::notifyWindow(this, nDialogId, rAction, rPayload);
2860}
2861
2862uno::Reference< datatransfer::clipboard::XClipboardNotifier > SfxViewShell::GetClipboardNotifier() const
2863{
2864 uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClipboardNotifier;
2865 xClipboardNotifier.set(GetViewFrame().GetWindow().GetClipboard(), uno::UNO_QUERY);
2866 return xClipboardNotifier;
2867}
2868
2869void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransfer::clipboard::XClipboardListener >& rClp, bool bAdd )
2870{
2871 try
2872 {
2873 uno::Reference< datatransfer::clipboard::XClipboard > xClipboard(GetViewFrame().GetWindow().GetClipboard());
2874 if( xClipboard.is() )
2875 {
2876 uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY );
2877 if( xClpbrdNtfr.is() )
2878 {
2879 if( bAdd )
2880 xClpbrdNtfr->addClipboardListener( rClp );
2881 else
2882 xClpbrdNtfr->removeClipboardListener( rClp );
2883 }
2884 }
2885 }
2886 catch (const uno::Exception&)
2887 {
2888 }
2889}
2890
2892{
2893 return pWindow ? pWindow->GetFrameWeld() : nullptr;
2894}
2895
2896void SfxViewShell::setBlockedCommandList(const char* blockedCommandList)
2897{
2898 if(!mvLOKBlockedCommandList.empty())
2899 return;
2900
2901 OUString BlockedListString(blockedCommandList, strlen(blockedCommandList), RTL_TEXTENCODING_UTF8);
2902 OUString command = BlockedListString.getToken(0, ' ');
2903 for (size_t i = 1; !command.isEmpty(); i++)
2904 {
2905 mvLOKBlockedCommandList.emplace(command);
2906 command = BlockedListString.getToken(i, ' ');
2907 }
2908}
2909
2911{
2912 return mvLOKBlockedCommandList.find(command) != mvLOKBlockedCommandList.end();
2913}
2914
2915/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
PropertiesInfo aProperties
SfxApplication * SfxGetpApp()
Definition: app.hxx:231
AnyEventRef aEvent
static const AllSettings & GetSettings()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
sal_uInt16 GetValue() const
const OUString & GetValue() const
OUString getName(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool insertName(std::u16string_view rTheName, bool bAppendFinalSlash=false, sal_Int32 nIndex=LAST_SEGMENT, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
INetProtocol GetProtocol() const
bool setExtension(std::u16string_view rTheExtension, sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
const vcl::KeyCode & GetKeyCode() const
OUString m_sFocusedParagraph
Definition: viewsh.cxx:247
sal_Int32 m_nSelectionStart
Definition: viewsh.cxx:250
static uno::Reference< accessibility::XAccessible > getAccessible(const lang::EventObject &aEvent)
Definition: viewsh.cxx:730
void detachRecursive(const uno::Reference< accessibility::XAccessible > &xAccessible)
Definition: viewsh.cxx:833
sal_Int32 m_nSelectionEnd
Definition: viewsh.cxx:251
sal_Int32 m_nCaretPosition
Definition: viewsh.cxx:249
static constexpr sal_Int64 MAX_ATTACHABLE_CHILDREN
Definition: viewsh.cxx:243
OUString getFocusedParagraph() const
Definition: viewsh.cxx:327
std::unordered_set< uno::Reference< uno::XInterface > > m_aRefList
Definition: viewsh.cxx:246
OUString m_sSelectedCellAddress
Definition: viewsh.cxx:254
void attachRecursive(const uno::Reference< accessibility::XAccessible > &xAccessible)
Definition: viewsh.cxx:755
virtual void SAL_CALL disposing(const lang::EventObject &Source) override
Definition: viewsh.cxx:402
const SfxViewShell * m_pViewShell
Definition: viewsh.cxx:245
void notifyTextSelectionChanged()
Definition: viewsh.cxx:386
virtual void SAL_CALL notifyEvent(const accessibility::AccessibleEventObject &aEvent) override
Definition: viewsh.cxx:431
int getCaretPosition() const
Definition: viewsh.cxx:348
LOKDocumentFocusListener(const SfxViewShell *pViewShell)
Definition: viewsh.cxx:317
void notifyFocusedParagraphChanged()
Definition: viewsh.cxx:354
OUString getLanguage() const
const OUString & getBcp47(bool bResolveSystem=true) const
LanguageTag & makeFallback()
static OUString GetDefaultPrinterName()
bool IsPrinting() const
const OUString & GetName() const
static SfxApplication * Get()
Definition: app.cxx:70
SAL_DLLPRIVATE std::vector< SfxViewShell * > & GetViewShells_Impl() const
Definition: app.cxx:365
SAL_DLLPRIVATE std::vector< SfxViewFrame * > & GetViewFrames_Impl() const
Definition: app.cxx:360
SAL_DLLPRIVATE std::unordered_map< OUString, css::uno::Reference< css::ui::XAcceleratorConfiguration > > & GetAcceleratorConfs_Impl() const
Definition: app.cxx:370
weld::Window * GetTopWindow() const
Definition: app.cxx:324
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
Definition: bindings.cxx:866
void Invalidate(sal_uInt16 nId)
Definition: bindings.cxx:639
void HidePopups(bool bHide=true)
Definition: bindings.cxx:230
void InvalidateAll(bool bWithMsg)
Definition: bindings.cxx:498
SendMailResult SaveAndSend(const css::uno::Reference< css::frame::XFrame > &xFrame)
Definition: bluthsnd.cxx:16
uno::Reference< lang::XComponent > m_xCtrl
Definition: viewsh.cxx:156
virtual void SAL_CALL disposing(const lang::EventObject &rEventObject) override
Definition: viewsh.cxx:210
SfxViewShell * m_pViewShell
Definition: viewsh.cxx:154
DECL_STATIC_LINK(SfxClipboardChangeListener, AsyncExecuteHdl_Impl, void *, void)
SfxClipboardChangeListener(SfxViewShell *pView, uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr)
Definition: viewsh.cxx:161
virtual void SAL_CALL changedContents(const datatransfer::clipboard::ClipboardEvent &rEventObject) override
Definition: viewsh.cxx:230
uno::Reference< datatransfer::clipboard::XClipboardNotifier > m_xClpbrdNtfr
Definition: viewsh.cxx:155
SAL_DLLPRIVATE void Update_Impl(bool bForce=false)
Definition: dispatch.cxx:1034
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
Method to execute a <SfxSlot>s over the Slot-Id.
Definition: dispatch.cxx:931
void Pop(SfxShell &rShell, SfxDispatcherPopFlags nMode=SfxDispatcherPopFlags::NONE)
With this method, one or more <SfxShell> are popped from the SfxDispatcher.
Definition: dispatch.cxx:380
sal_uInt16 GetShellLevel(const SfxShell &rShell)
Determines the position of a given SfxShell in the stack of the dispatcher.
Definition: dispatch.cxx:510
SAL_DLLPRIVATE void RemoveShell_Impl(SfxShell &rShell)
Definition: dispatch.cxx:2030
bool IsActive(const SfxShell &rShell)
This method checks whether a particular <SfxShell> instance is on the SfxDispatcher.
Definition: dispatch.cxx:180
void Push(SfxShell &rShell)
With this method, a <SfxShell> pushed on to the SfxDispatcher.
Definition: dispatch.cxx:168
void Flush()
This method performs outstanding push- and pop- commands.
Definition: dispatch.cxx:155
SfxEventHintId GetEventId() const
Definition: event.hxx:205
void Appear()
Definition: frame.cxx:528
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
Definition: frame.cxx:515
bool IsClosing_Impl() const
Definition: frame.cxx:197
sal_Int64 GetObjectMiscStatus() const
Definition: ipclient.cxx:692
const css::uno::Reference< css::embed::XEmbeddedObject > & GetObject() const
Definition: ipclient.cxx:700
vcl::Window * GetEditWin() const
Definition: ipclient.hxx:67
const tools::Rectangle & GetObjArea() const
Definition: ipclient.cxx:772
bool IsObjectInPlaceActive() const
Definition: ipclient.cxx:856
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void DisableItem(sal_uInt16 nWhich)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
static void notifyInvalidation(SfxViewShell const *pThisView, tools::Rectangle const *)
Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed.
Definition: lokhelper.cxx:612
static void notifyAllViews(int nType, const OString &rPayload)
Notifies all views with the given type and payload.
Definition: lokhelper.cxx:693
static LOKDeviceFormFactor getDeviceFormFactor()
Get the device form factor that should be used for a new view.
Definition: lokhelper.cxx:344
static void notifyWindow(const SfxViewShell *pThisView, vcl::LOKWindowId nWindowId, std::u16string_view rAction, const std::vector< vcl::LOKPayloadItem > &rPayload=std::vector< vcl::LOKPayloadItem >())
Emits a LOK_CALLBACK_WINDOW.
Definition: lokhelper.cxx:583
static void notifyOtherView(const SfxViewShell *pThisView, SfxViewShell const *pOtherView, int nType, std::string_view rKey, const OString &rPayload)
Same as notifyOtherViews(), but works on a selected "other" view, not on all of them.
Definition: lokhelper.cxx:450
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
Invoke the LOK callback of all other views showing the same document as pThisView,...
Definition: lokhelper.cxx:473
static const LanguageTag & getDefaultLanguage()
Get the default language that should be used for views.
Definition: lokhelper.cxx:285
static std::pair< bool, OUString > getDefaultTimezone()
Get timezone of the given view. See @setDefaultTimezone.
Definition: lokhelper.cxx:367
void AddToAddress(const OUString &rAddress)
Definition: mailmodel.cxx:634
SendMailResult SaveAndSend(const css::uno::Reference< css::frame::XFrame > &xFrame, const OUString &rType)
Definition: mailmodel.cxx:779
SfxItemSet & GetItemSet() const
Definition: docfile.cxx:3647
sal_Int16 QueryHiddenInformation(HiddenWarningFact eFact, weld::Window *pParent)
Definition: objstor.cxx:3084
bool isExportLocked() const
Definition: objmisc.cxx:1902
static void SetCurrentComponent(const css::uno::Reference< css::uno::XInterface > &_rxComponent)
Definition: objxtor.cxx:870
SfxMedium * GetMedium() const
Definition: objsh.hxx:261
css::uno::Reference< css::frame::XModel3 > GetModel() const
Definition: objxtor.cxx:838
bool isPrintLocked() const
Definition: objmisc.cxx:1910
sal_uInt16 GetSlot() const
Definition: request.hxx:68
void Ignore()
Definition: request.cxx:521
const T * GetArg(sal_uInt16 nSlotId) const
Templatized access to the individual parameters of the SfxRequest.
Definition: request.hxx:84
weld::Window * GetFrameWeld() const
Return the window that should be used as the parent for any dialogs this request creates.
Definition: appserv.cxx:299
void Done(bool bRemove=false)
Definition: request.cxx:484
The class SfxShell is the base class for all classes, which provide the functionality of the form <Sl...
Definition: shell.hxx:128
SfxItemPool & GetPool() const
Each Subclass of SfxShell must reference a pool.
Definition: shell.hxx:511
SfxViewFrame * GetFrame() const
This method returns a pointer to the <SfxViewFrame> to which this SfxShell instance is associated or ...
Definition: shell.cxx:134
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
Definition: shell.cxx:129
void SetPool(SfxItemPool *pNewPool)
With this method, the subclasses register their special <SfxItemPool> in the SfxShell.
Definition: shell.hxx:525
SfxDispatcher * GetDispatcher() const
This method returns a pointer to the <SfxDispatcher>, when the SfxShell is currently <UI-active> or a...
Definition: shell.cxx:124
const css::uno::Any & GetValue() const
Definition: frame.hxx:175
SAL_DLLPRIVATE const SvBorder & GetBorderPixelImpl() const
Definition: viewfrm.cxx:1259
SAL_DLLPRIVATE void InvalidateBorderImpl(const SfxViewShell *pSh)
Definition: viewfrm.cxx:1202
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
Definition: viewfrm.cxx:1975
vcl::Window & GetWindow() const
Definition: viewfrm.cxx:2792
SfxBindings & GetBindings()
Definition: viewfrm.hxx:110
SAL_DLLPRIVATE void SetBorderPixelImpl(const SfxViewShell *pSh, const SvBorder &rBorder)
Definition: viewfrm.cxx:1221
SfxDispatcher * GetDispatcher()
Definition: viewfrm.hxx:109
SfxFrame & GetFrame() const
Definition: viewfrm.cxx:2782
virtual SfxObjectShell * GetObjectShell() override
Definition: viewfrm.cxx:2218
SAL_DLLPRIVATE const Size & GetMargin_Impl() const
Definition: viewfrm.cxx:2223
bool IsVisible() const
Definition: viewfrm.cxx:2162
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
Definition: viewsh.hxx:165
SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl(const css::uno::Reference< css::ui::XContextMenuInterceptor > &xInterceptor)
Definition: viewsh.cxx:2672
weld::Window * GetFrameWeld() const
Definition: viewsh.cxx:2891
rtl::Reference< LOKDocumentFocusListener > mpLOKDocumentFocusListener
Definition: viewsh.hxx:179
virtual bool PrepareClose(bool bUI=true)
Initialize is called after the frame has been loaded and the controller has been set.
Definition: viewsh.cxx:1817
VclPtr< vcl::Window > pWindow
Definition: viewsh.hxx:172
virtual vcl::Window * GetEditWindowForActiveOLEObj() const override
See OutlinerViewShell::GetEditWindowForActiveOLEObj().
Definition: viewsh.cxx:2309
void InvalidateBorder()
Definition: viewsh.cxx:1671
virtual void libreOfficeKitViewAddPendingInvalidateTiles() override
Definition: viewsh.cxx:2283
virtual void QueryObjAreaPixel(tools::Rectangle &rRect) const
Definition: viewsh.cxx:2540
SAL_DLLPRIVATE bool ExecKey_Impl(const KeyEvent &aKey)
Definition: viewsh.cxx:2102
virtual SfxPrinter * GetPrinter(bool bCreate=false)
Definition: viewprn.cxx:904
SAL_DLLPRIVATE bool HasMouseClickListeners_Impl() const
Definition: viewsh.cxx:2833
LanguageTag maLOKLocale
Definition: viewsh.hxx:176
virtual void Move()
Definition: viewsh.cxx:1552
virtual void Activate(bool IsMDIActivate) override
Virtual method that is called when enabling the SfxShell instance, in order to give the Subclasses th...
Definition: viewsh.cxx:1534
SfxInPlaceClient * GetUIActiveClient() const
Definition: viewsh.cxx:1516
virtual void WriteUserData(OUString &, bool bBrowse=false)
Definition: viewsh.cxx:1997
css::uno::Reference< css::frame::XController > GetController() const
Definition: viewsh.cxx:2662
virtual OUString GetSelectionText(bool bCompleteWords=false, bool bOnlyASample=false)
Definition: viewsh.cxx:1888
virtual void ShowCursor(bool bOn=true)
Definition: viewsh.cxx:2501
std::unique_ptr< struct SfxViewShell_Impl > pImpl
Definition: viewsh.hxx:170
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
Invokes the registered callback, if there are any.
Definition: viewsh.cxx:2244
void SetBorderPixel(const SvBorder &rBorder)
Definition: viewsh.cxx:1680
ViewShellDocId GetDocId() const override
Get the DocId used by Mobile LOKit to load multiple documents.
Definition: viewsh.cxx:2436
virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString &rAction, const std::vector< vcl::LOKPayloadItem > &rPayload=std::vector< vcl::LOKPayloadItem >()) const override
Definition: viewsh.cxx:2857
void DisconnectAllClients()
Definition: viewsh.cxx:2528
ViewShellId GetViewShellId() const override
See OutlinerViewShell::GetViewShellId().
Definition: viewsh.cxx:2426
virtual void UIActivating(SfxInPlaceClient *pClient)
Definition: viewsh.cxx:1452
virtual void flushPendingLOKInvalidateTiles()
Definition: viewsh.cxx:2297
virtual void InnerResizePixel(const Point &rOfs, const Size &rSize, bool inplaceEditModeChange)
Definition: viewsh.cxx:1623
virtual void notifyInvalidation(tools::Rectangle const *) const override
ILibreOfficeKitNotifier. Emits a LOK_CALLBACK_INVALIDATE_TILES.
Definition: viewsh.cxx:2442
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY)
Definition: viewsh.cxx:1423
SAL_DLLPRIVATE void ExecMisc_Impl(SfxRequest &)
Definition: viewsh.cxx:1049
SfxViewFrame & GetViewFrame() const
Definition: viewsh.hxx:290
static SAL_WARN_UNUSED_RESULT SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
Definition: viewsh.cxx:1855
OUString maLOKTimezone
Definition: viewsh.hxx:181
void SetLOKLanguageTag(const OUString &rBcp47LanguageTag)
Set the LibreOfficeKit language of this view.
Definition: viewsh.cxx:2332
void NotifyOtherView(OutlinerViewShell *pOtherShell, int nType, const OString &rKey, const OString &rPayload) override
See OutlinerViewShell::NotifyOtherView().
Definition: viewsh.cxx:2452
bool maLOKIsTimezoneSet
Definition: viewsh.hxx:182
SfxInPlaceClient * FindIPClient(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, vcl::Window *pObjParentWin) const
Definition: viewsh.cxx:1473
SfxShell * GetSubShell(sal_uInt16)
Definition: viewsh.cxx:1970
SAL_DLLPRIVATE void IPClientGone_Impl(SfxInPlaceClient const *pIPClient)
Definition: viewsh.cxx:1039
void VisAreaChanged()
Definition: viewsh.cxx:2545
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
Definition: viewsh.cxx:2046
virtual OUString GetColorConfigName() const
Get the color scheme name of this view.
Definition: viewsh.cxx:2326
virtual int getEditMode() const
See lok::Document::getMode().
Definition: viewsh.cxx:2421
virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override
Definition: viewsh.cxx:2270
virtual void Deactivate(bool IsMDIActivate) override
Virtual method that is called when disabling the SfxShell instance, to give the Subclasses the opport...
Definition: viewsh.cxx:1547
void setTiledSearching(bool bTiledSearching)
Set if we are doing tiled searching.
Definition: viewsh.cxx:2411
void OutplaceActivated(bool bActive)
Definition: viewsh.cxx:1446
virtual void afterCallbackRegistered()
Where a new view can perform some update/initialization soon after the callback has been registered.
Definition: viewsh.cxx:2293
bool mbLOKAccessibilityEnabled
Definition: viewsh.hxx:178
virtual void OuterResizePixel(const Point &rOfs, const Size &rSize)
Definition: viewsh.cxx:1574
css::uno::Reference< css::datatransfer::clipboard::XClipboardNotifier > GetClipboardNotifier() const
Definition: viewsh.cxx:2862
void SetLOKAccessibilityState(bool bEnabled)
Enable/Disable LibreOfficeKit AT support for this view.
Definition: viewsh.cxx:2361
virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle *pRect, int nPart, int nMode) const override
Definition: viewsh.cxx:2219
bool TryContextMenuInterception(const rtl::Reference< VCLXPopupMenu > &rIn, const OUString &rMenuIdentifier, rtl::Reference< VCLXPopupMenu > &rOut, css::ui::ContextMenuExecuteEvent aEvent)
void dumpLibreOfficeKitViewState(rtl::OStringBuffer &rState)
dump view state for diagnostics
Definition: viewsh.cxx:2177
virtual void ReadUserDataSequence(const css::uno::Sequence< css::beans::PropertyValue > &)
Definition: viewsh.cxx:2006
SfxViewShell(SfxViewFrame &rFrame, SfxViewShellFlags nFlags)
Definition: viewsh.cxx:1736
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &)
Definition: viewsh.cxx:2010
LanguageTag maLOKLanguageTag
Definition: viewsh.hxx:175
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: viewsh.cxx:2074
virtual void ReadUserData(const OUString &, bool bBrowse=false)
Definition: viewsh.cxx:2002
virtual ~SfxViewShell() override
Definition: viewsh.cxx:1779
virtual void libreOfficeKitViewUpdatedCallback(int nType) const override
Definition: viewsh.cxx:2257
virtual ErrCode DoVerb(sal_Int32 nVerb)
Definition: viewsh.cxx:1433
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
Definition: viewsh.cxx:2017
SfxLokCallbackInterface * getLibreOfficeKitViewCallback() const
Definition: viewsh.cxx:2172
const LanguageTag & GetLOKLanguageTag() const
Get the LibreOfficeKit language of this view.
Definition: viewsh.hxx:440
int getA11yCaretPosition() const
Definition: viewsh.cxx:1810
SAL_DLLPRIVATE SfxBaseController * GetBaseController_Impl() const
Definition: viewsh.cxx:2667
std::unordered_set< OUString > mvLOKBlockedCommandList
Definition: viewsh.hxx:180
virtual css::uno::Reference< css::frame::XModel > GetCurrentDocument() const
retrieves the document which shall be considered the "current document" when the frame is active
Definition: viewsh.cxx:2596
void SetLOKLocale(const OUString &rBcp47LanguageTag)
Set the LibreOfficeKit locale of this view.
Definition: viewsh.cxx:2402
SAL_DLLPRIVATE bool GlobalKeyInput_Impl(const KeyEvent &rKeyEvent)
Definition: viewsh.cxx:2495
SAL_DLLPRIVATE void GetState_Impl(SfxItemSet &)
Definition: viewsh.cxx:1332
virtual bool HasSelection(bool bText=true) const
Definition: viewsh.cxx:1917
LOKDeviceFormFactor maLOKDeviceFormFactor
Definition: viewsh.hxx:177
SAL_DLLPRIVATE void PushSubShells_Impl(bool bPush=true)
Definition: viewsh.cxx:1978
const SvBorder & GetBorderPixel() const
Definition: viewsh.cxx:1691
bool Escape()
Definition: viewsh.cxx:2839
void setLibreOfficeKitViewCallback(SfxLokCallbackInterface *pCallback)
Set up a more efficient internal callback instead of LibreOfficeKitCallback.
Definition: viewsh.cxx:2153
void SetController(SfxBaseController *pController)
Definition: viewsh.cxx:2651
virtual std::optional< OString > getLOKPayload(int nType, int nViewId) const
Definition: viewsh.cxx:2302
void SetCurrentDocument() const
forwards the current document, as returned by ->GetCurrentDocument, to SfxObjectShell::SetWorkingDocu...
Definition: viewsh.cxx:2608
virtual SfxObjectShell * GetObjectShell() override
Definition: viewsh.cxx:2591
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: viewsh.cxx:2461
void JumpToMark(const OUString &rMark)
Definition: viewsh.cxx:2642
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
Definition: viewsh.cxx:1848
virtual SdrView * GetDrawView() const
Definition: viewsh.cxx:1872
static ViewShellDocId mnCurrentDocId
Used to set the DocId at construction time. See SetCurrentDocId.
Definition: viewsh.hxx:185
void NotifyOtherViews(int nType, const OString &rKey, const OString &rPayload) override
See OutlinerViewShell::NotifyOtherViews().
Definition: viewsh.cxx:2447
virtual void NotifyCursor(SfxViewShell *) const
Ask this view to send its cursor position to pViewShell.
Definition: viewsh.cxx:2407
SfxInPlaceClient * GetIPClient() const
Definition: viewsh.cxx:1494
SAL_DLLPRIVATE bool HasKeyListeners_Impl() const
Definition: viewsh.cxx:2827
SAL_DLLPRIVATE bool HandleNotifyEvent_Impl(NotifyEvent const &rEvent)
Definition: viewsh.cxx:2820
SfxViewFrame & rFrame
Definition: viewsh.hxx:171
virtual css::uno::Reference< css::view::XRenderable > GetRenderable()
get an XRenderable instance that can render this document
Definition: viewsh.cxx:2844
virtual bool KeyInput(const KeyEvent &rKeyEvent)
Definition: viewsh.cxx:2469
static void SetCurrentDocId(ViewShellDocId nId)
Set the current DocId, which is used by Mobile LOKit to load multiple documents and yet identify the ...
Definition: viewsh.cxx:2431
SAL_DLLPRIVATE void NewIPClient_Impl(SfxInPlaceClient *pIPClient)
Definition: viewsh.cxx:1034
SAL_DLLPRIVATE void ResetAllClients_Impl(SfxInPlaceClient const *pIP)
Definition: viewsh.cxx:2513
bool isBlockedCommand(OUString command)
Definition: viewsh.cxx:2910
void SetWindow(vcl::Window *pViewPort)
Definition: viewsh.cxx:1697
void SetMargin(const Size &)
Definition: viewsh.cxx:2622
SAL_DLLPRIVATE void CheckIPClient_Impl(SfxInPlaceClient const *, const tools::Rectangle &)
Definition: viewsh.cxx:2560
SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl(const css::uno::Reference< css::ui::XContextMenuInterceptor > &xInterceptor)
Definition: viewsh.cxx:2678
OUString getA11yFocusedParagraph() const
Definition: viewsh.cxx:1804
vcl::Window * GetWindow() const
Definition: viewsh.hxx:272
void setBlockedCommandList(const char *blockedCommandList)
Definition: viewsh.cxx:2896
SAL_DLLPRIVATE SfxInPlaceClient * GetUIActiveIPClient_Impl() const
Definition: viewsh.cxx:1500
virtual ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const
Get a color config color from this view.
Definition: viewsh.cxx:2320
const Size & GetMargin() const
Definition: viewsh.cxx:2616
void AddSubShell(SfxShell &rShell)
Definition: viewsh.cxx:1930
virtual void libreOfficeKitViewCallbackWithViewId(int nType, const OString &pPayload, int nViewId) const override
Definition: viewsh.cxx:2231
virtual void MarginChanged()
Definition: viewsh.cxx:2638
void RemoveSubShell(SfxShell *pShell=nullptr)
Definition: viewsh.cxx:1941
virtual int getPart() const
See lok::Document::getPart().
Definition: viewsh.cxx:2416
virtual void UIDeactivated(SfxInPlaceClient *pClient)
Definition: viewsh.cxx:1463
void AddRemoveClipboardListener(const css::uno::Reference< css::datatransfer::clipboard::XClipboardListener > &, bool)
Definition: viewsh.cxx:2869
LOKDocumentFocusListener & GetLOKDocumentFocusListener()
Definition: viewsh.cxx:2347
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
ToolBoxItemId GetItemId(ImplToolItems::size_type nPos) const
OUString GetItemCommand(ToolBoxItemId nItemId) const
ImplToolItems::size_type GetItemCount() const
vcl::Window * GetItemWindow(ToolBoxItemId nItemId) const
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
reference_type * get() const
static std::shared_ptr< ConfigurationChanges > create()
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
static void CreateMenuFromActionTriggerContainer(const css::uno::Reference< css::awt::XPopupMenu > &rNewMenu, const css::uno::Reference< css::container::XIndexContainer > &rActionTriggerContainer)
static css::uno::Reference< css::container::XIndexContainer > CreateActionTriggerContainerFromMenu(const css::uno::Reference< css::awt::XPopupMenu > &rMenu, const OUString *pMenuIdentifier)
static std::unique_ptr< AcceleratorExecute > createAcceleratorHelper()
static css::uno::Reference< css::ui::XAcceleratorConfiguration > lok_createNewAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext > &rxContext, OUString sModule)
bool Overlaps(const tools::Rectangle &rRect) const
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier *pNotifier, bool bParent=false)
void GrabFocus()
void ReleaseLOKNotifier()
void SetMapMode()
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
vcl::Window * GetFrameWindow() const
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual std::shared_ptr< SfxDialogController > GetController() override
float u
sal_Int32 nState
UNKNOWN
struct _xmlTextWriter * xmlTextWriterPtr
sal_Int16 nValue
OUString sName
void * p
sal_Int64 n
#define LANGUAGE_NONE
OUString SVT_DLLPUBLIC getInstalledLocaleForSystemUILanguage(css::uno::Sequence< OUString > const &installed, bool bRequestInstallIfMissing, const OUString &rPreferredLocale=OUString())
sal_uInt16 nPos
Definition: linksrc.cxx:118
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
DateTime now
@ Exception
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
bool createTemporaryHtmlDirectory(OUString **url)
Definition: flatpak.cxx:42
bool isFlatpak()
Definition: flatpak.cxx:27
int i
enumrange< T >::Iterator begin(enumrange< T >)
end
void openUriExternally(const OUString &sURI, bool bHandleSystemShellExecuteException, weld::Widget *pDialogParent)
Open a URI via com.sun.star.system.SystemShellExecute.
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
sal_uInt32 LOKWindowId
HashMap_OWString_Interface aMap
sal_Int16 nId
sal_Int32 attribute
QPRO_FUNC_TYPE nType
OUString SfxResId(TranslateId aId)
Definition: sfxresid.cxx:22
static SfxItemSet & rSet
Definition: shell.cxx:534
#define SFX_IMPL_SUPERCLASS_INTERFACE(Class, SuperClass)
Definition: shell.hxx:570
#define ERRCODE_SO_NOVERBS
AsyncExecuteInfo(AsyncExecuteCmd eCmd, SfxClipboardChangeListener *pListener)
Definition: viewsh.cxx:146
rtl::Reference< SfxClipboardChangeListener > m_xListener
Definition: viewsh.cxx:150
bool m_bTiledSearching
Set if we are in the middle of a tiled search.
Definition: viewimp.hxx:58
std::vector< SfxInPlaceClient * > & GetIPClients_Impl()
Definition: viewsh.cxx:914
SfxViewShell_Impl(SfxViewShellFlags const nFlags, ViewShellDocId nDocId)
Definition: viewsh.cxx:900
static sal_uInt32 m_nLastViewShellId
Definition: viewimp.hxx:59
std::vector< SfxInPlaceClient * > maIPClients
Definition: viewimp.hxx:54
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel
RET_YES
static OUString impl_retrieveFilterNameFromTypeAndModule(const css::uno::Reference< css::container::XContainerQuery > &rContainerQuery, const OUString &rType, const OUString &rModuleIdentifier, const sal_Int32 nFlags)
search for a filter name dependent on type and module
Definition: viewsh.cxx:928
IMPL_STATIC_LINK(SfxClipboardChangeListener, AsyncExecuteHdl_Impl, void *, p, void)
Definition: viewsh.cxx:194
static OUString impl_searchFormatTypeForApp(const css::uno::Reference< css::frame::XFrame > &xFrame, ETypeFamily eTypeFamily)
Definition: viewsh.cxx:978
static bool ignoreLibreOfficeKitViewCallback(int nType, const SfxViewShell_Impl *pImpl)
Definition: viewsh.cxx:2183
#define DEFAULT_MARGIN_HEIGHT
Definition: viewsh.hxx:98
LOKDeviceFormFactor
Definition: viewsh.hxx:122
SfxViewShellFlags
Definition: viewsh.hxx:104
#define DEFAULT_MARGIN_WIDTH
Definition: viewsh.hxx:97
sal_Int32 nLength