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