20#include <config_features.h>
22#include <boost/property_tree/json_parser.hpp>
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>
63#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
64#include <com/sun/star/accessibility/AccessibleTextType.hpp>
65#include <com/sun/star/awt/FontSlant.hpp>
81#include <LibreOfficeKit/LibreOfficeKitEnums.h>
83#include <officecfg/Setup.hxx>
93#include <sfx2/strings.hrc>
100#include <sfx2/sfxsids.hrc>
107#include <libxml/xmlwriter.h>
109#include <unordered_map>
116using namespace ::
cppu;
118#define ShellClass_SfxViewShell
119#include <sfxslots.hxx>
123 datatransfer::clipboard::XClipboardListener >
129 virtual void SAL_CALL
disposing(
const lang::EventObject& rEventObject )
override;
132 virtual void SAL_CALL
changedContents(
const datatransfer::clipboard::ClipboardEvent& rEventObject )
override;
154 uno::Reference< datatransfer::clipboard::XClipboardNotifier >
m_xClpbrdNtfr;
161 : m_pViewShell( nullptr ), m_xClpbrdNtfr(
std::move( xClpbrdNtfr )), m_xCtrl(pView->
GetController())
165 m_xCtrl->addEventListener( uno::Reference < lang::XEventListener > (
static_cast < lang::XEventListener*
>(
this ) ) );
170 m_xClpbrdNtfr->addClipboardListener( uno::Reference< datatransfer::clipboard::XClipboardListener >(
171 static_cast< datatransfer::clipboard::XClipboardListener*
>(
this )));
195 AsyncExecuteInfo* pAsyncExecuteInfo =
static_cast<AsyncExecuteInfo*
>(
p);
196 if ( pAsyncExecuteInfo )
198 if ( pAsyncExecuteInfo->m_xListener.is() )
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();
206 delete pAsyncExecuteInfo;
212 uno::Reference< lang::XComponent > xCtrl(
m_xCtrl );
213 uno::Reference< datatransfer::clipboard::XClipboardNotifier > xNotify(
m_xClpbrdNtfr );
215 uno::Reference< datatransfer::clipboard::XClipboardListener > xThis(
static_cast< datatransfer::clipboard::XClipboardListener*
>(
this ));
217 xCtrl->removeEventListener( uno::Reference < lang::XEventListener > (
static_cast < lang::XEventListener*
>(
this )));
219 xNotify->removeClipboardListener( xThis );
240 public ::cppu::WeakImplHelper< accessibility::XAccessibleEventListener >
261 const uno::Reference< accessibility::XAccessible >& xAccessible
267 const uno::Reference< accessibility::XAccessible >& xAccessible,
268 const uno::Reference< accessibility::XAccessibleContext >& xContext
274 const uno::Reference< accessibility::XAccessible >& xAccessible,
275 const uno::Reference< accessibility::XAccessibleContext >& xContext,
276 const sal_Int64 nStateSet
282 const uno::Reference< accessibility::XAccessible >& xAccessible
288 const uno::Reference< accessibility::XAccessibleContext >& xContext
294 const uno::Reference< accessibility::XAccessibleContext >& xContext,
295 const sal_Int64 nStateSet
300 static uno::Reference< accessibility::XAccessible >
getAccessible(
const lang::EventObject& aEvent );
303 virtual void SAL_CALL
disposing(
const lang::EventObject& Source )
override;
306 virtual void SAL_CALL
notifyEvent(
const accessibility::AccessibleEventObject& aEvent )
override;
317 : m_pViewShell(pViewShell)
318 , m_bFocusedParagraphNotified(false)
319 , m_nCaretPosition(0)
320 , m_nSelectionStart(0)
322 , m_bIsEditingCell(false)
333 if (nSelectionStart < 0 || nSelectionEnd < 0)
336 boost::property_tree::ptree aPayloadTree;
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);
355 boost::property_tree::ptree aPayloadTree;
358 std::stringstream aStream;
359 boost::property_tree::write_json(aStream, aPayloadTree);
360 std::string aPayload = aStream.str();
365 const char* pPayload = aPayload.c_str();
372 boost::property_tree::ptree aPayloadTree;
374 std::stringstream aStream;
375 boost::property_tree::write_json(aStream, aPayloadTree);
376 std::string aPayload = aStream.str();
380 const char* pPayload = aPayload.c_str();
387 boost::property_tree::ptree aPayloadTree;
390 std::stringstream aStream;
391 boost::property_tree::write_json(aStream, aPayloadTree);
392 std::string aPayload = aStream.str();
396 const char* pPayload = aPayload.c_str();
412bool hasState(
const accessibility::AccessibleEventObject& aEvent, ::sal_Int64 nState)
415 uno::Reference< accessibility::XAccessibleContext > xContext(
aEvent.Source, uno::UNO_QUERY);
418 ::sal_Int64 nStateSet = xContext->getAccessibleStateSet();
419 res = (nStateSet &
nState) != 0;
424bool isFocused(
const accessibility::AccessibleEventObject& aEvent)
426 return hasState(aEvent, accessibility::AccessibleStateType::FOCUSED);
436 case accessibility::AccessibleEventId::STATE_CHANGED:
439 sal_Int64
nState = accessibility::AccessibleStateType::INVALID;
441 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: STATE_CHANGED: XAccessible: " << xAccStateChanged.get() <<
", nState: " <<
nState);
443 if( accessibility::AccessibleStateType::FOCUSED ==
nState )
445 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: FOCUSED");
449 if (!hasState(
aEvent, accessibility::AccessibleStateType::ACTIVE))
452 "LOKDocumentFocusListener::notifyEvent: FOCUSED: Cell not ACTIVE for editing yet");
456 uno::Reference<css::accessibility::XAccessibleText> xAccText(xAccStateChanged, uno::UNO_QUERY);
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);
467 css::uno::Reference<css::accessibility::XAccessibleTextAttributes>
468 xAccTextAttr(xAccText, uno::UNO_QUERY);
469 css::uno::Sequence< OUString > aRequestedAttributes;
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);
481 css::uno::Sequence< css::beans::PropertyValue > aRunAttributeList;
482 if (xAccTextAttr.is())
484 aRunAttributeList = xAccTextAttr->getRunAttributes(
nPos, aRequestedAttributes);
488 aRunAttributeList = xAccText->getCharacterAttributes(
nPos, aRequestedAttributes);
491 sal_Int32 nSize = aRunAttributeList.getLength();
493 "LOKDocumentFocusListener::notifyEvent: attribute list size: " << nSize);
497 OUString sAttributes =
"{ ";
498 for (
const auto&
attribute: aRunAttributeList)
507 sValue = OUString::number(fValue);
509 else if (
attribute.Name ==
"CharPosture")
513 sValue = OUString::number(
static_cast<unsigned int>(
nValue));
515 else if (
attribute.Name ==
"CharUnderline")
519 sValue = OUString::number(
nValue);
521 else if (
attribute.Name ==
"CharFontName")
529 sValue = OUString::number(
nValue);
532 if (!sValue.isEmpty())
534 if (sAttributes !=
"{ ")
536 sAttributes +=
attribute.Name +
": " + sValue;
542 "LOKDocumentFocusListener::notifyEvent: attributes: " << sAttributes);
544 nPos = aTextSegment.SegmentEnd + 1;
559 case accessibility::AccessibleEventId::CARET_CHANGED:
564 "LOKDocumentFocusListener::notifyEvent: CARET_CHANGED: skip non focused paragraph");
568 sal_Int32 nNewPos = -1;
569 aEvent.NewValue >>= nNewPos;
570 sal_Int32 nOldPos = -1;
571 aEvent.OldValue >>= nOldPos;
575 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: CARET_CHANGED: new pos: " << nNewPos <<
", nOldPos: " << nOldPos);
576 uno::Reference<css::accessibility::XAccessibleText>
580 OUString sText = xAccText->getText();
581 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: CARET_CHANGED: xAccText: " << xAccText.get() <<
", text: >" << sText <<
"<");
592 case accessibility::AccessibleEventId::TEXT_CHANGED:
597 "LOKDocumentFocusListener::notifyEvent: TEXT_CHANGED: skip non focused paragraph");
601 accessibility::TextSegment aDeletedText;
602 accessibility::TextSegment aInsertedText;
604 if (
aEvent.OldValue >>= aDeletedText)
606 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: TEXT_CHANGED: deleted text: >" << aDeletedText.SegmentText <<
"<");
608 if (
aEvent.NewValue >>= aInsertedText)
610 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: TEXT_CHANGED: inserted text: >" << aInsertedText.SegmentText <<
"<");
612 uno::Reference<css::accessibility::XAccessibleText> xAccText(
getAccessible(
aEvent), uno::UNO_QUERY);
615 OUString sText = xAccText->getText();
616 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: TEXT_CHANGED: "
617 "xAccText: " << xAccText.get() <<
", text: >" << sText <<
"<");
624 case accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED:
629 "LOKDocumentFocusListener::notifyEvent: TEXT_SELECTION_CHANGED: skip non focused paragraph");
633 uno::Reference<css::accessibility::XAccessibleText> xAccText(
getAccessible(
aEvent), uno::UNO_QUERY);
636 OUString sText = xAccText->getText();
637 sal_Int32 nSelectionStart = xAccText->getSelectionStart();
638 sal_Int32 nSelectionEnd = xAccText->getSelectionEnd();
641 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: TEXT_SELECTION_CHANGED: "
642 "\n xAccText: " << xAccText.get() <<
", text: >" << sText <<
"<"
643 "\n start: " << nSelectionStart <<
", end: " << nSelectionEnd
668 case accessibility::AccessibleEventId::SELECTION_CHANGED:
670 uno::Reference< accessibility::XAccessible > xNewValue;
671 aEvent.NewValue >>= xNewValue;
674 uno::Reference< accessibility::XAccessibleContext > xContext =
675 xNewValue->getAccessibleContext();
679 OUString
sName = xContext->getAccessibleName();
680 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: SELECTION_CHANGED: this: " <<
this
681 <<
", selected cell address: >" <<
sName <<
"<"
691 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::notifyEvent: SELECTION_CHANGED: "
692 "cell address: >" << sCellAddress <<
"<");
703 case accessibility::AccessibleEventId::CHILD:
705 uno::Reference< accessibility::XAccessible > xChild;
706 if( (
aEvent.OldValue >>= xChild) && xChild.is() )
709 if( (
aEvent.NewValue >>= xChild) && xChild.is() )
715 case accessibility::AccessibleEventId::INVALIDATE_ALL_CHILDREN:
716 SAL_INFO(
"lok.a11y",
"Invalidate all children called");
723 catch(
const lang::IndexOutOfBoundsException& )
725 SAL_WARN(
"lok.a11y",
"Focused object has invalid index in parent");
731 uno::Reference< accessibility::XAccessible > xAccessible(
aEvent.Source, uno::UNO_QUERY);
733 if( xAccessible.is() )
736 uno::Reference< accessibility::XAccessibleContext > xContext(
aEvent.Source, uno::UNO_QUERY);
740 uno::Reference< accessibility::XAccessible > xParent( xContext->getAccessibleParent() );
743 uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
744 if( xParentContext.is() )
746 return xParentContext->getAccessibleChild( xContext->getAccessibleIndexInParent() );
751 return uno::Reference< accessibility::XAccessible >();
755 const uno::Reference< accessibility::XAccessible >& xAccessible
758 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::attachRecursive(1): xAccessible: " << xAccessible.get());
760 uno::Reference< accessibility::XAccessibleContext > xContext =
761 xAccessible->getAccessibleContext();
768 const uno::Reference< accessibility::XAccessible >& xAccessible,
769 const uno::Reference< accessibility::XAccessibleContext >& xContext
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());
778 sal_Int64 nStateSet = xContext->getAccessibleStateSet();
782 ::rtl::OUString
sName = xContext->getAccessibleName();
790 const uno::Reference< accessibility::XAccessible >& xAccessible,
791 const uno::Reference< accessibility::XAccessibleContext >& xContext,
792 const sal_Int64 nStateSet
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());
802 uno::Reference< accessibility::XAccessibleEventBroadcaster > xBroadcaster(xContext, uno::UNO_QUERY);
804 if (!xBroadcaster.is())
806 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::attachRecursive(3) #2: xBroadcaster.is()");
808 const uno::Reference< uno::XInterface >& xInterface = xBroadcaster;
811 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::attachRecursive(3) #3: m_aRefList.insert(xInterface).second");
812 xBroadcaster->addAccessibleEventListener(
static_cast< accessibility::XAccessibleEventListener *
>(
this));
815 if( !(nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS) )
817 sal_Int64 nmax = xContext->getAccessibleChildCount();
821 for( sal_Int64
n = 0;
n < nmax;
n++ )
823 uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild(
n ) );
833 const uno::Reference< accessibility::XAccessible >& xAccessible
836 uno::Reference< accessibility::XAccessibleContext > xContext =
837 xAccessible->getAccessibleContext();
844 const uno::Reference< accessibility::XAccessibleContext >& xContext
847 sal_Int64 nStateSet = xContext->getAccessibleStateSet();
849 SAL_INFO(
"lok.a11y",
"LOKDocumentFocusListener::detachRecursive(2): this: " <<
this
850 <<
", name: " << xContext->getAccessibleName()
851 <<
", parent: " << xContext->getAccessibleParent().get()
852 <<
", child count: " << xContext->getAccessibleChildCount());
856 ::rtl::OUString
sName = xContext->getAccessibleName();
870 const uno::Reference< accessibility::XAccessibleContext >& xContext,
871 const sal_Int64 nStateSet
874 uno::Reference< accessibility::XAccessibleEventBroadcaster > xBroadcaster(xContext, uno::UNO_QUERY);
876 if( xBroadcaster.is() && 0 <
m_aRefList.erase(xBroadcaster) )
878 xBroadcaster->removeAccessibleEventListener(
static_cast< accessibility::XAccessibleEventListener *
>(
this));
880 if( !( nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS ) )
882 sal_Int64 nmax = xContext->getAccessibleChildCount();
886 for( sal_Int64
n = 0;
n < nmax;
n++ )
888 uno::Reference< accessibility::XAccessible > xChild( xContext->getAccessibleChild(
n ) );
902, m_pLibreOfficeKitViewCallback(nullptr)
903, m_bTiledSearching(false)
928 const css::uno::Reference< css::container::XContainerQuery >& rContainerQuery,
929 const OUString& rType,
930 const OUString& rModuleIdentifier,
931 const sal_Int32 nFlags )
934 css::uno::Sequence< css::beans::NamedValue > aQuery {
935 {
"Type", css::uno::Any( rType ) },
936 {
"DocumentService", css::uno::Any( rModuleIdentifier ) }
939 css::uno::Reference< css::container::XEnumeration > xEnumeration =
940 rContainerQuery->createSubSetEnumerationByProperties( aQuery );
942 OUString aFoundFilterName;
943 while ( xEnumeration->hasMoreElements() )
954 if ( nFilterFlags & nFlags )
956 aFoundFilterName = aFilterName;
961 return aFoundFilterName;
978 ETypeFamily eTypeFamily)
982 css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext());
983 css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext));
985 OUString sModule = xModuleManager->identify(
xFrame);
992 if ( sModule ==
"com.sun.star.text.TextDocument" )
993 sType =
"writer_MS_Word_2007";
995 if ( sModule ==
"com.sun.star.sheet.SpreadsheetDocument" )
996 sType =
"MS Excel 2007 XML";
998 if ( sModule ==
"com.sun.star.presentation.PresentationDocument" )
999 sType =
"MS PowerPoint 2007 XML";
1005 if ( sModule ==
"com.sun.star.text.TextDocument" )
1008 if ( sModule ==
"com.sun.star.sheet.SpreadsheetDocument" )
1011 if ( sModule ==
"com.sun.star.drawing.DrawingDocument" )
1014 if ( sModule ==
"com.sun.star.presentation.PresentationDocument" )
1022 catch (
const css::uno::RuntimeException&)
1026 catch (
const css::uno::Exception&)
1035 pImpl->GetIPClients_Impl().push_back(pIPClient);
1040 std::vector< SfxInPlaceClient* >& pClients =
pImpl->GetIPClients_Impl();
1042 auto it = std::find(pClients.begin(), pClients.end(), pIPClient);
1043 if (it != pClients.end())
1044 pClients.erase( it );
1053 case SID_STYLE_FAMILY :
1062 case SID_ACTIVATE_STYLE_APPLY:
1064 uno::Reference< frame::XFrame >
xFrame =
1067 Reference< beans::XPropertySet > xPropSet(
xFrame, UNO_QUERY );
1068 Reference< frame::XLayoutManager > xLayoutManager;
1069 if ( xPropSet.is() )
1073 Any aValue = xPropSet->getPropertyValue(
"LayoutManager");
1074 aValue >>= xLayoutManager;
1075 if ( xLayoutManager.is() )
1077 uno::Reference< ui::XUIElement > xElement = xLayoutManager->getElement(
"private:resource/toolbar/textobjectbar" );
1080 xElement = xLayoutManager->getElement(
"private:resource/toolbar/frameobjectbar" );
1084 xElement = xLayoutManager->getElement(
"private:resource/toolbar/oleobjectbar" );
1088 uno::Reference< awt::XWindow > xWin( xElement->getRealInterface(), uno::UNO_QUERY_THROW );
1093 ToolBox::ImplToolItems::size_type nItemCount = pTextToolbox->
GetItemCount();
1094 for( ToolBox::ImplToolItems::size_type nItem = 0; nItem < nItemCount; ++nItem )
1097 const OUString& rCommand = pTextToolbox->
GetItemCommand( nItemId );
1098 if (rCommand ==
".uno:StyleApply")
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:
1134 if ( pMailRecipient )
1136 OUString aRecipient( pMailRecipient->
GetValue() );
1137 OUString aMailToStr(
"mailto:");
1139 if ( aRecipient.startsWith( aMailToStr ) )
1140 aRecipient = aRecipient.copy( aMailToStr.getLength() );
1145 aDocType = pMailDocType->
GetValue();
1150 if (
nId == SID_MAIL_SENDDOC )
1152 else if (
nId == SID_MAIL_SENDDOCASPDF )
1154 else if (
nId == SID_MAIL_SENDDOCASMS )
1157 if (!aDocType.isEmpty())
1160 else if (
nId == SID_MAIL_SENDDOCASOOO )
1163 if (!aDocType.isEmpty())
1171 VclMessageType::Info, VclButtonsType::Ok,
1181 case SID_BLUETOOTH_SENDDOC:
1194 VclMessageType::Info, VclButtonsType::Ok,
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);
1210 css::uno::Reference< css::frame::XModel >
xModel;
1212 css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( css::frame::ModuleManager::create(xContext) );
1217 aModule = xModuleManager->identify(
xFrame );
1219 catch (
const css::uno::RuntimeException&)
1223 catch (
const css::uno::Exception&)
1229 css::uno::Reference< css::frame::XController >
xController =
xFrame->getController();
1235 css::uno::Reference< css::frame::XStorable > xStorable(
xModel, css::uno::UNO_QUERY );
1236 if (
xModel.is() && xStorable.is() )
1238 OUString aFilterName;
1239 OUString aTypeName(
"generic_HTML" );
1242 OUString aLocation = xStorable->getLocation();
1245 bool bPrivateProtocol = ( aFileObj.
GetProtocol() == INetProtocol::PrivSoffice );
1246 bool bHasLocation = !aLocation.isEmpty() && !bPrivateProtocol;
1248 css::uno::Reference< css::container::XContainerQuery > xContainerQuery(
1249 xSMGR->createInstance(
"com.sun.star.document.FilterFactory" ),
1250 css::uno::UNO_QUERY_THROW );
1254 sal_Int32 nFilterFlags = 0x00000002;
1256 if ( aFilterName.isEmpty() )
1260 xContainerQuery,
"graphic_HTML", aModule, nFilterFlags );
1265 if ( aFilterName.isEmpty() || aTypeName.isEmpty())
1272 if ( !bHasLocation )
1275 aFileName =
"webpreview";
1284 OSL_ASSERT( !aFilterName.isEmpty() );
1285 OSL_ASSERT( !aFileName.isEmpty() );
1290 OUString * parent =
nullptr;
1293 SAL_WARN(
"sfx.view",
"cannot create Flatpak html temp dir");
1296 INetURLObject aFilePathObj( ::utl::CreateTempURL(parent,
true) );
1302 css::uno::Sequence< css::beans::PropertyValue > aArgs{
1309 xStorable->storeToURL( aFileURL, aArgs );
1311 catch (
const io::IOException&)
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:
1348#if HAVE_FEATURE_MACOSX_SANDBOX
1363 case SID_PRINTDOCDIRECT:
1364 case SID_SETUPPRINTER:
1365 case SID_PRINTER_NAME:
1376 if ( SID_PRINTDOCDIRECT == nSID )
1378 OUString aPrinterName;
1379 if ( pPrinter !=
nullptr )
1380 aPrinterName = pPrinter->
GetName();
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)
1395 pImpl->m_nDefaultPrinterNameFetchTime =
now;
1397 aPrinterName =
pImpl->m_sDefaultPrinterName;
1399 if ( !aPrinterName.isEmpty() )
1406 " (" + aPrinterName +
")";
1413 case SID_STYLE_FAMILY :
1427 aMap.SetScaleX( rZoomX );
1428 aMap.SetScaleY( rZoomY );
1454 uno::Reference < frame::XFramesSupplier > xParentFrame = xOwnFrame->getCreator();
1455 if ( xParentFrame.is() )
1456 xParentFrame->setActiveFrame( xOwnFrame );
1473 const uno::Reference < embed::XEmbeddedObject >& xObj,
1477 std::vector< SfxInPlaceClient* >& rClients =
pImpl->GetIPClients_Impl();
1478 if ( rClients.empty() )
1481 if( !pObjParentWin )
1485 if ( pIPClient->GetObject() == xObj && pIPClient->GetEditWin() == pObjParentWin )
1502 std::vector< SfxInPlaceClient* >& rClients =
pImpl->GetIPClients_Impl();
1503 if ( rClients.empty() )
1508 if ( pIPClient->IsUIActive() )
1517 std::vector< SfxInPlaceClient* >& rClients =
pImpl->GetIPClients_Impl();
1518 if ( rClients.empty() )
1525 if ( pIPClient->IsObjectUIActive() || ( bIsTiledRendering && pIPClient->IsObjectInPlaceActive() ) )
1673 if (
pImpl->m_pController.is())
1675 pImpl->m_pController->BorderWidthsChanged_Impl();
1684 if (
pImpl->m_pController.is())
1686 pImpl->m_pController->BorderWidthsChanged_Impl();
1746, mbPrinterSettingsModified(false)
1750, mbLOKAccessibilityEnabled(false)
1759 rViewArr.push_back(
this);
1783 auto it = std::find( rViewArr.begin(), rViewArr.end(), pThis );
1784 rViewArr.erase( it );
1786 if (
pImpl->xClipboardListener.is() )
1788 pImpl->xClipboardListener->DisconnectViewShell();
1789 pImpl->xClipboardListener =
nullptr;
1792 if (
pImpl->m_pController.is())
1794 pImpl->m_pController->ReleaseShell_Impl();
1795 pImpl->m_pController.clear();
1829 VclMessageType::Info, VclButtonsType::Ok,
1856 if ( !i_rController.is() )
1864 if ( pViewShell->GetController() == i_rController )
1931 pImpl->aArr.push_back(&rShell);
1935 pDisp->
Push(rShell);
1952 pImpl->aArr.clear();
1956 SfxShellArr_Impl::iterator
i = std::find(
pImpl->aArr.begin(),
pImpl->aArr.end(), pShell);
1957 if(
i !=
pImpl->aArr.end())
1982 for (
auto const& elem :
pImpl->aArr)
1985 else if(!
pImpl->aArr.empty())
2018 const std::function<
bool (
const SfxViewShell* ) >& isViewShell
2034 &pShell->GetViewFrame()) !=
SfxGetpApp()->GetViewFrames_Impl().
end());
2035 if ( ( !bOnlyVisible || pShell->GetViewFrame().IsVisible() ) && (!isViewShell || isViewShell(pShell)))
2048 const std::function<
bool (
const SfxViewShell* )>& isViewShell
2054 if ( rShells[
nPos] == &rPrev )
2064 if ( ( !bOnlyVisible || pShell->
GetViewFrame().
IsVisible() ) && (!isViewShell || isViewShell(pShell)) )
2090 const SfxUnoAnyItem* pItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pSet, SID_VIEW_DATA,
false);
2103 bool setModuleConfig =
false;
2104 if (!
pImpl->m_xAccExec)
2107 pImpl->m_xAccExec->init(::comphelper::getProcessComponentContext(),
2109 setModuleConfig =
true;
2115 css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext());
2116 css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext));
2123 OUString key = sModule + viewLang;
2127 if (acceleratorConfs.find(key) == acceleratorConfs.end())
2131 OUString actualLang = officecfg::Setup::L10N::ooLocale::get();
2134 officecfg::Setup::L10N::ooLocale::set(viewLang, batch);
2141 officecfg::Setup::L10N::ooLocale::set(actualLang, batch2);
2145 if (setModuleConfig)
2146 pImpl->m_xAccExec->lok_setModuleConfig(acceleratorConfs[key]);
2154 pImpl->m_pLibreOfficeKitViewCallback = pCallback;
2158 if (!
pImpl->m_pLibreOfficeKitViewCallback)
2173 return pImpl->m_pLibreOfficeKitViewCallback;
2178 if (
pImpl->m_pLibreOfficeKitViewCallback)
2179 pImpl->m_pLibreOfficeKitViewCallback->dumpState(rState);
2191 case LOK_CALLBACK_FORM_FIELD_BUTTON:
2192 case LOK_CALLBACK_TEXT_SELECTION:
2193 case LOK_CALLBACK_COMMENT:
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:
2222 if (
pImpl->m_pLibreOfficeKitViewCallback)
2223 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewInvalidateTilesCallback(pRect, nPart, nMode);
2227 "SfxViewShell::libreOfficeKitViewInvalidateTilesCallback no callback set!");
2234 if (
pImpl->m_pLibreOfficeKitViewCallback)
2235 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewCallbackWithViewId(
nType, pPayload, nViewId);
2239 "SfxViewShell::libreOfficeKitViewCallbackWithViewId no callback set! Dropped payload of type "
2240 << lokCallbackTypeToString(
nType) <<
": [" << pPayload <<
']');
2247 if (
pImpl->m_pLibreOfficeKitViewCallback)
2248 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewCallback(
nType, pPayload);
2252 "SfxViewShell::libreOfficeKitViewCallback no callback set! Dropped payload of type "
2253 << lokCallbackTypeToString(
nType) <<
": [" << pPayload <<
']');
2260 if (
pImpl->m_pLibreOfficeKitViewCallback)
2261 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewUpdatedCallback(
nType);
2265 "SfxViewShell::libreOfficeKitViewUpdatedCallback no callback set! Dropped payload of type "
2266 << lokCallbackTypeToString(
nType));
2273 if (
pImpl->m_pLibreOfficeKitViewCallback)
2274 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewUpdatedCallbackPerViewId(
nType, nViewId, nSourceViewId);
2278 "SfxViewShell::libreOfficeKitViewUpdatedCallbackPerViewId no callback set! Dropped payload of type "
2279 << lokCallbackTypeToString(
nType));
2284 if (
pImpl->m_pLibreOfficeKitViewCallback)
2285 pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewAddPendingInvalidateTiles();
2289 "SfxViewShell::libreOfficeKitViewAddPendingInvalidateTiles no callback set!");
2304 SAL_WARN(
"sfx.view",
"SfxViewShell::getLOKPayload unhandled type " << lokCallbackTypeToString(
nType));
2323 css::uno::Sequence<OUString> inst(officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
2359 uno::Reference< accessibility::XAccessible > xAccessible =
2362 if (!xAccessible.is())
2371 catch (
const uno::Exception&)
2373 SAL_WARN(
"lok.a11y",
"Exception caught processing LOKDocumentFocusListener::attachRecursive");
2382 catch (
const uno::Exception&)
2384 SAL_WARN(
"lok.a11y",
"Exception caught processing LOKDocumentFocusListener::detachRecursive");
2400 pImpl->m_bTiledSearching = bTiledSearching;
2415 return pImpl->m_nViewShellId;
2425 assert(
pImpl->m_nDocId >=
ViewShellDocId(0) &&
"m_nDocId should have been initialized, but it is invalid.");
2426 return pImpl->m_nDocId;
2441 auto pOtherShell =
dynamic_cast<SfxViewShell*
>(pOther);
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);
2503 std::vector< SfxInPlaceClient* >& rClients =
pImpl->GetIPClients_Impl();
2504 if ( rClients.empty() )
2509 if( pIPClient != pIP )
2510 pIPClient->ResetObject();
2517 std::vector< SfxInPlaceClient* >& rClients =
pImpl->GetIPClients_Impl();
2518 if ( rClients.empty() )
2521 for (
size_t n = 0;
n < rClients.size(); )
2523 delete rClients.at(
n );
2534 std::vector< SfxInPlaceClient* >& rClients =
pImpl->GetIPClients_Impl();
2535 if ( rClients.empty() )
2540 if ( pIPClient->IsObjectInPlaceActive() )
2542 pIPClient->VisAreaChanged();
2553 bool bAlwaysActive =
2554 ( ( pIPClient->
GetObjectMiscStatus() & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) != 0 );
2555 bool bActiveWhenVisible =
2556 ( pIPClient->
GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0;
2565 if (bAlwaysActive || (bActiveWhenVisible && rVisArea.
Overlaps(pIPClient->
GetObjArea())))
2569 pIPClient->
GetObject()->changeState( embed::EmbedStates::INPLACE_ACTIVE );
2571 catch (
const uno::Exception&)
2585 Reference< XModel > xDocument;
2588 OSL_ENSURE( pDocShell,
"SfxViewFrame::GetCurrentDocument: no DocShell!?" );
2598 if ( xDocument.is() )
2605 return pImpl->aMargin;
2612 Size aMargin = rSize;
2613 if ( aMargin.
Width() == -1 )
2615 if ( aMargin.
Height() == -1 )
2618 if ( aMargin !=
pImpl->aMargin )
2620 pImpl->aMargin = aMargin;
2640 pImpl->m_pController = pController;
2643 if (
pImpl->xClipboardListener.is() )
2644 pImpl->xClipboardListener->DisconnectViewShell();
2651 return pImpl->m_pController;
2656 return pImpl->m_pController.get();
2661 std::unique_lock g(
pImpl->aMutex);
2662 pImpl->aInterceptorContainer.addInterface( g, xInterceptor );
2667 std::unique_lock g(
pImpl->aMutex);
2668 pImpl->aInterceptorContainer.removeInterface( g, xInterceptor );
2672 const OUString& rMenuIdentifier,
2674 ui::ContextMenuExecuteEvent aEvent)
2677 bool bModified =
false;
2681 rIn, &rMenuIdentifier);
2687 std::unique_lock g(
pImpl->aMutex);
2688 std::vector<uno::Reference< ui::XContextMenuInterceptor>> aInterceptors =
2689 pImpl->aInterceptorContainer.getElements(g);
2691 for (
const auto & rListener : aInterceptors )
2695 ui::ContextMenuInterceptorAction eAction;
2698 eAction = rListener->notifyContextMenuExecute( aEvent );
2702 case ui::ContextMenuInterceptorAction_CANCELLED :
2705 case ui::ContextMenuInterceptorAction_EXECUTE_MODIFIED :
2709 case ui::ContextMenuInterceptorAction_CONTINUE_MODIFIED :
2713 case ui::ContextMenuInterceptorAction_IGNORED :
2717 OSL_FAIL(
"Wrong return value of ContextMenuInterceptor!");
2724 pImpl->aInterceptorContainer.removeInterface(g, rListener);
2742 const OUString& rMenuIdentifier, css::ui::ContextMenuExecuteEvent aEvent)
2744 bool bModified =
false;
2748 rPopupMenu, &rMenuIdentifier);
2751 aEvent.Selection = css::uno::Reference< css::view::XSelectionSupplier >(
GetController(), css::uno::UNO_QUERY );
2754 std::unique_lock g(
pImpl->aMutex);
2755 std::vector<uno::Reference< ui::XContextMenuInterceptor>> aInterceptors =
2756 pImpl->aInterceptorContainer.getElements(g);
2758 for (
const auto & rListener : aInterceptors )
2762 css::ui::ContextMenuInterceptorAction eAction;
2765 eAction = rListener->notifyContextMenuExecute(
aEvent );
2769 case css::ui::ContextMenuInterceptorAction_CANCELLED:
2772 case css::ui::ContextMenuInterceptorAction_EXECUTE_MODIFIED:
2776 case css::ui::ContextMenuInterceptorAction_CONTINUE_MODIFIED:
2780 case css::ui::ContextMenuInterceptorAction_IGNORED:
2784 SAL_WARN(
"sfx.view",
"Wrong return value of ContextMenuInterceptor!" );
2791 pImpl->aInterceptorContainer.removeInterface(g, rListener);
2800 rPopupMenu->clear();
2809 if (
pImpl->m_pController.is())
2810 return pImpl->m_pController->HandleEvent_Impl( rEvent );
2816 return (
pImpl->m_pController.is())
2817 &&
pImpl->m_pController->HasKeyListeners_Impl();
2822 return (
pImpl->m_pController.is())
2823 &&
pImpl->m_pController->HasMouseClickListeners_Impl();
2839 xRender.set(
xModel, UNO_QUERY );
2851 uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClipboardNotifier;
2853 return xClipboardNotifier;
2860 uno::Reference< datatransfer::clipboard::XClipboard > xClipboard(
GetViewFrame().
GetWindow().GetClipboard());
2861 if( xClipboard.is() )
2863 uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY );
2864 if( xClpbrdNtfr.is() )
2867 xClpbrdNtfr->addClipboardListener( rClp );
2869 xClpbrdNtfr->removeClipboardListener( rClp );
2873 catch (
const uno::Exception&)
2888 OUString BlockedListString(blockedCommandList, strlen(blockedCommandList), RTL_TEXTENCODING_UTF8);
2889 OUString command = BlockedListString.getToken(0,
' ');
2890 for (
size_t i = 1; !command.isEmpty();
i++)
2893 command = BlockedListString.getToken(
i,
' ');
PropertiesInfo aProperties
SfxApplication * SfxGetpApp()
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
sal_Int32 m_nSelectionStart
static uno::Reference< accessibility::XAccessible > getAccessible(const lang::EventObject &aEvent)
void notifyCaretChanged()
void detachRecursive(const uno::Reference< accessibility::XAccessible > &xAccessible)
sal_Int32 m_nSelectionEnd
sal_Int32 m_nCaretPosition
bool m_bFocusedParagraphNotified
static constexpr sal_Int64 MAX_ATTACHABLE_CHILDREN
std::set< uno::Reference< uno::XInterface > > m_aRefList
OUString getFocusedParagraph() const
OUString m_sSelectedCellAddress
void attachRecursive(const uno::Reference< accessibility::XAccessible > &xAccessible)
virtual void SAL_CALL disposing(const lang::EventObject &Source) override
const SfxViewShell * m_pViewShell
void notifyTextSelectionChanged()
virtual void SAL_CALL notifyEvent(const accessibility::AccessibleEventObject &aEvent) override
int getCaretPosition() const
LOKDocumentFocusListener(const SfxViewShell *pViewShell)
void notifyFocusedParagraphChanged()
OUString getLanguage() const
const OUString & getBcp47(bool bResolveSystem=true) const
LanguageTag & makeFallback()
static OUString GetDefaultPrinterName()
const OUString & GetName() const
static SfxApplication * Get()
SAL_DLLPRIVATE std::vector< SfxViewShell * > & GetViewShells_Impl() const
SAL_DLLPRIVATE std::vector< SfxViewFrame * > & GetViewFrames_Impl() const
SAL_DLLPRIVATE std::unordered_map< OUString, css::uno::Reference< css::ui::XAcceleratorConfiguration > > & GetAcceleratorConfs_Impl() const
weld::Window * GetTopWindow() const
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
void Invalidate(sal_uInt16 nId)
void HidePopups(bool bHide=true)
void InvalidateAll(bool bWithMsg)
SendMailResult SaveAndSend(const css::uno::Reference< css::frame::XFrame > &xFrame)
uno::Reference< lang::XComponent > m_xCtrl
virtual void SAL_CALL disposing(const lang::EventObject &rEventObject) override
SfxViewShell * m_pViewShell
DECL_STATIC_LINK(SfxClipboardChangeListener, AsyncExecuteHdl_Impl, void *, void)
SfxClipboardChangeListener(SfxViewShell *pView, uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr)
virtual void SAL_CALL changedContents(const datatransfer::clipboard::ClipboardEvent &rEventObject) override
@ ASYNCEXECUTE_CMD_CHANGEDCONTENTS
@ ASYNCEXECUTE_CMD_DISPOSING
uno::Reference< datatransfer::clipboard::XClipboardNotifier > m_xClpbrdNtfr
void DisconnectViewShell()
SAL_DLLPRIVATE void Update_Impl(bool bForce=false)
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.
void Pop(SfxShell &rShell, SfxDispatcherPopFlags nMode=SfxDispatcherPopFlags::NONE)
With this method, one or more <SfxShell> are popped from the SfxDispatcher.
sal_uInt16 GetShellLevel(const SfxShell &rShell)
Determines the position of a given SfxShell in the stack of the dispatcher.
SAL_DLLPRIVATE void RemoveShell_Impl(SfxShell &rShell)
bool IsActive(const SfxShell &rShell)
This method checks whether a particular <SfxShell> instance is on the SfxDispatcher.
void Push(SfxShell &rShell)
With this method, a <SfxShell> pushed on to the SfxDispatcher.
void Flush()
This method performs outstanding push- and pop- commands.
SfxEventHintId GetEventId() const
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
bool IsClosing_Impl() const
sal_Int64 GetObjectMiscStatus() const
const css::uno::Reference< css::embed::XEmbeddedObject > & GetObject() const
vcl::Window * GetEditWin() const
const tools::Rectangle & GetObjArea() const
bool IsObjectInPlaceActive() const
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.
static void notifyAllViews(int nType, const OString &rPayload)
Notifies all views with the given type and payload.
static LOKDeviceFormFactor getDeviceFormFactor()
Get the device form factor that should be used for a new view.
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.
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.
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,...
static const LanguageTag & getDefaultLanguage()
Get the default language that should be used for views.
static std::pair< bool, OUString > getDefaultTimezone()
Get timezone of the given view. See @setDefaultTimezone.
void AddToAddress(const OUString &rAddress)
SendMailResult SaveAndSend(const css::uno::Reference< css::frame::XFrame > &xFrame, const OUString &rType)
SfxItemSet * GetItemSet() const
sal_Int16 QueryHiddenInformation(HiddenWarningFact eFact, weld::Window *pParent)
bool isExportLocked() const
static void SetCurrentComponent(const css::uno::Reference< css::uno::XInterface > &_rxComponent)
SfxMedium * GetMedium() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
bool isPrintLocked() const
sal_uInt16 GetSlot() const
const T * GetArg(sal_uInt16 nSlotId) const
Templatized access to the individual parameters of the SfxRequest.
weld::Window * GetFrameWeld() const
Return the window that should be used as the parent for any dialogs this request creates.
void Done(bool bRemove=false)
The class SfxShell is the base class for all classes, which provide the functionality of the form <Sl...
SfxItemPool & GetPool() const
Each Subclass of SfxShell must reference a pool.
SfxViewFrame * GetFrame() const
This method returns a pointer to the <SfxViewFrame> to which this SfxShell instance is associated or ...
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
void SetPool(SfxItemPool *pNewPool)
With this method, the subclasses register their special <SfxItemPool> in the SfxShell.
SfxDispatcher * GetDispatcher() const
This method returns a pointer to the <SfxDispatcher>, when the SfxShell is currently <UI-active> or a...
const css::uno::Any & GetValue() const
SAL_DLLPRIVATE const SvBorder & GetBorderPixelImpl() const
SAL_DLLPRIVATE void InvalidateBorderImpl(const SfxViewShell *pSh)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
vcl::Window & GetWindow() const
SfxBindings & GetBindings()
SAL_DLLPRIVATE void SetBorderPixelImpl(const SfxViewShell *pSh, const SvBorder &rBorder)
SfxDispatcher * GetDispatcher()
SfxFrame & GetFrame() const
virtual SfxObjectShell * GetObjectShell() override
SAL_DLLPRIVATE const Size & GetMargin_Impl() const
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl(const css::uno::Reference< css::ui::XContextMenuInterceptor > &xInterceptor)
weld::Window * GetFrameWeld() const
rtl::Reference< LOKDocumentFocusListener > mpLOKDocumentFocusListener
virtual bool PrepareClose(bool bUI=true)
Initialize is called after the frame has been loaded and the controller has been set.
VclPtr< vcl::Window > pWindow
virtual vcl::Window * GetEditWindowForActiveOLEObj() const override
See OutlinerViewShell::GetEditWindowForActiveOLEObj().
virtual void libreOfficeKitViewAddPendingInvalidateTiles() override
virtual void QueryObjAreaPixel(tools::Rectangle &rRect) const
SAL_DLLPRIVATE bool ExecKey_Impl(const KeyEvent &aKey)
virtual SfxPrinter * GetPrinter(bool bCreate=false)
SAL_DLLPRIVATE bool HasMouseClickListeners_Impl() const
virtual void Activate(bool IsMDIActivate) override
Virtual method that is called when enabling the SfxShell instance, in order to give the Subclasses th...
SfxInPlaceClient * GetUIActiveClient() const
virtual void WriteUserData(OUString &, bool bBrowse=false)
css::uno::Reference< css::frame::XController > GetController() const
virtual OUString GetSelectionText(bool bCompleteWords=false, bool bOnlyASample=false)
virtual void ShowCursor(bool bOn=true)
std::unique_ptr< struct SfxViewShell_Impl > pImpl
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
Invokes the registered callback, if there are any.
void SetBorderPixel(const SvBorder &rBorder)
ViewShellDocId GetDocId() const override
Get the DocId used by Mobile LOKit to load multiple documents.
virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString &rAction, const std::vector< vcl::LOKPayloadItem > &rPayload=std::vector< vcl::LOKPayloadItem >()) const override
void DisconnectAllClients()
ViewShellId GetViewShellId() const override
See OutlinerViewShell::GetViewShellId().
virtual void UIActivating(SfxInPlaceClient *pClient)
virtual void flushPendingLOKInvalidateTiles()
virtual void InnerResizePixel(const Point &rOfs, const Size &rSize, bool inplaceEditModeChange)
virtual void notifyInvalidation(tools::Rectangle const *) const override
ILibreOfficeKitNotifier. Emits a LOK_CALLBACK_INVALIDATE_TILES.
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY)
SAL_DLLPRIVATE void ExecMisc_Impl(SfxRequest &)
SfxViewFrame & GetViewFrame() const
static SAL_WARN_UNUSED_RESULT SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
void SetLOKLanguageTag(const OUString &rBcp47LanguageTag)
Set the LibreOfficeKit language of this view.
void NotifyOtherView(OutlinerViewShell *pOtherShell, int nType, const OString &rKey, const OString &rPayload) override
See OutlinerViewShell::NotifyOtherView().
SfxInPlaceClient * FindIPClient(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, vcl::Window *pObjParentWin) const
SfxShell * GetSubShell(sal_uInt16)
SAL_DLLPRIVATE void IPClientGone_Impl(SfxInPlaceClient const *pIPClient)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
virtual int getEditMode() const
See lok::Document::getMode().
virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override
virtual void Deactivate(bool IsMDIActivate) override
Virtual method that is called when disabling the SfxShell instance, to give the Subclasses the opport...
void setTiledSearching(bool bTiledSearching)
Set if we are doing tiled searching.
void OutplaceActivated(bool bActive)
virtual void afterCallbackRegistered()
Where a new view can perform some update/initialization soon after the callback has been registered.
bool mbLOKAccessibilityEnabled
virtual void OuterResizePixel(const Point &rOfs, const Size &rSize)
css::uno::Reference< css::datatransfer::clipboard::XClipboardNotifier > GetClipboardNotifier() const
void SetLOKAccessibilityState(bool bEnabled)
Enable/Disable LibreOfficeKit AT support for this view.
virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle *pRect, int nPart, int nMode) const override
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
virtual void ReadUserDataSequence(const css::uno::Sequence< css::beans::PropertyValue > &)
SfxViewShell(SfxViewFrame &rFrame, SfxViewShellFlags nFlags)
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &)
LanguageTag maLOKLanguageTag
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual void ReadUserData(const OUString &, bool bBrowse=false)
virtual ~SfxViewShell() override
virtual void libreOfficeKitViewUpdatedCallback(int nType) const override
virtual ErrCode DoVerb(sal_Int32 nVerb)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
SfxLokCallbackInterface * getLibreOfficeKitViewCallback() const
const LanguageTag & GetLOKLanguageTag() const
Get the LibreOfficeKit language of this view.
int getA11yCaretPosition() const
SAL_DLLPRIVATE SfxBaseController * GetBaseController_Impl() const
std::unordered_set< OUString > mvLOKBlockedCommandList
virtual css::uno::Reference< css::frame::XModel > GetCurrentDocument() const
retrieves the document which shall be considered the "current document" when the frame is active
void SetLOKLocale(const OUString &rBcp47LanguageTag)
Set the LibreOfficeKit locale of this view.
SAL_DLLPRIVATE bool GlobalKeyInput_Impl(const KeyEvent &rKeyEvent)
SAL_DLLPRIVATE void GetState_Impl(SfxItemSet &)
virtual bool HasSelection(bool bText=true) const
LOKDeviceFormFactor maLOKDeviceFormFactor
SAL_DLLPRIVATE void PushSubShells_Impl(bool bPush=true)
const SvBorder & GetBorderPixel() const
void setLibreOfficeKitViewCallback(SfxLokCallbackInterface *pCallback)
Set up a more efficient internal callback instead of LibreOfficeKitCallback.
void SetController(SfxBaseController *pController)
virtual std::optional< OString > getLOKPayload(int nType, int nViewId) const
void SetCurrentDocument() const
forwards the current document, as returned by ->GetCurrentDocument, to SfxObjectShell::SetWorkingDocu...
virtual SfxObjectShell * GetObjectShell() override
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
void JumpToMark(const OUString &rMark)
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
virtual SdrView * GetDrawView() const
static ViewShellDocId mnCurrentDocId
Used to set the DocId at construction time. See SetCurrentDocId.
void NotifyOtherViews(int nType, const OString &rKey, const OString &rPayload) override
See OutlinerViewShell::NotifyOtherViews().
virtual void NotifyCursor(SfxViewShell *) const
Ask this view to send its cursor position to pViewShell.
SfxInPlaceClient * GetIPClient() const
SAL_DLLPRIVATE bool HasKeyListeners_Impl() const
SAL_DLLPRIVATE bool HandleNotifyEvent_Impl(NotifyEvent const &rEvent)
virtual css::uno::Reference< css::view::XRenderable > GetRenderable()
get an XRenderable instance that can render this document
virtual bool KeyInput(const KeyEvent &rKeyEvent)
static void SetCurrentDocId(ViewShellDocId nId)
Set the current DocId, which is used by Mobile LOKit to load multiple documents and yet identify the ...
SAL_DLLPRIVATE void NewIPClient_Impl(SfxInPlaceClient *pIPClient)
SAL_DLLPRIVATE void ResetAllClients_Impl(SfxInPlaceClient const *pIP)
bool isBlockedCommand(OUString command)
void SetWindow(vcl::Window *pViewPort)
void SetMargin(const Size &)
SAL_DLLPRIVATE void CheckIPClient_Impl(SfxInPlaceClient const *, const tools::Rectangle &)
SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl(const css::uno::Reference< css::ui::XContextMenuInterceptor > &xInterceptor)
OUString getA11yFocusedParagraph() const
vcl::Window * GetWindow() const
void setBlockedCommandList(const char *blockedCommandList)
SAL_DLLPRIVATE SfxInPlaceClient * GetUIActiveIPClient_Impl() const
const Size & GetMargin() const
void AddSubShell(SfxShell &rShell)
virtual void libreOfficeKitViewCallbackWithViewId(int nType, const OString &pPayload, int nViewId) const override
virtual void MarginChanged()
void RemoveSubShell(SfxShell *pShell=nullptr)
virtual int getPart() const
See lok::Document::getPart().
virtual void UIDeactivated(SfxInPlaceClient *pClient)
void AddRemoveClipboardListener(const css::uno::Reference< css::datatransfer::clipboard::XClipboardListener > &, bool)
LOKDocumentFocusListener & GetLOKDocumentFocusListener()
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() 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)
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier *pNotifier, bool bParent=false)
void ReleaseLOKNotifier()
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
vcl::Window * GetFrameWindow() const
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual std::shared_ptr< SfxDialogController > GetController() override
struct _xmlTextWriter * xmlTextWriterPtr
OUString SVT_DLLPUBLIC getInstalledLocaleForSystemUILanguage(css::uno::Sequence< OUString > const &installed, bool bRequestInstallIfMissing, const OUString &rPreferredLocale=OUString())
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
bool createTemporaryHtmlDirectory(OUString **url)
enumrange< T >::Iterator begin(enumrange< T >)
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)
HashMap_OWString_Interface aMap
OUString SfxResId(TranslateId aId)
#define SFX_IMPL_SUPERCLASS_INTERFACE(Class, SuperClass)
#define ERRCODE_SO_NOVERBS
AsyncExecuteInfo(AsyncExecuteCmd eCmd, SfxClipboardChangeListener *pListener)
rtl::Reference< SfxClipboardChangeListener > m_xListener
bool m_bTiledSearching
Set if we are in the middle of a tiled search.
std::vector< SfxInPlaceClient * > & GetIPClients_Impl()
SfxViewShell_Impl(SfxViewShellFlags const nFlags, ViewShellDocId nDocId)
static sal_uInt32 m_nLastViewShellId
std::vector< SfxInPlaceClient * > maIPClients
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel
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
IMPL_STATIC_LINK(SfxClipboardChangeListener, AsyncExecuteHdl_Impl, void *, p, void)
static OUString impl_searchFormatTypeForApp(const css::uno::Reference< css::frame::XFrame > &xFrame, ETypeFamily eTypeFamily)
static bool ignoreLibreOfficeKitViewCallback(int nType, const SfxViewShell_Impl *pImpl)
#define DEFAULT_MARGIN_HEIGHT
#define DEFAULT_MARGIN_WIDTH