20#include <config_java.h>
32#include <com/sun/star/awt/FontDescriptor.hpp>
33#include <com/sun/star/awt/Point.hpp>
34#include <com/sun/star/awt/Size.hpp>
35#include <com/sun/star/util/URLTransformer.hpp>
36#include <com/sun/star/util/XURLTransformer.hpp>
37#include <com/sun/star/frame/XFrame.hpp>
38#include <com/sun/star/frame/status/FontHeight.hpp>
39#include <com/sun/star/frame/status/ItemStatus.hpp>
40#include <com/sun/star/frame/status/ItemState.hpp>
41#include <com/sun/star/frame/status/Template.hpp>
42#include <com/sun/star/frame/DispatchResultState.hpp>
43#include <com/sun/star/frame/status/Visibility.hpp>
45#include <uno/current_context.hxx>
49#include <boost/property_tree/json_parser.hpp>
60#include <sfx2/sfxsids.hrc>
65#include <rtl/ustring.hxx>
72#include <LibreOfficeKit/LibreOfficeKitEnums.h>
117 css::lang::EventObject aObject;
118 aObject.Source = getXWeak();
119 std::unique_lock aGuard(
maMutex);
125 std::unique_lock aGuard(
maMutex);
130 [&rEvent](
const css::uno::Reference<css::frame::XStatusListener>& xListener)
132 xListener->statusChanged(rEvent);
142 const css::util::URL&,
143 const css::uno::Sequence< css::beans::PropertyValue >&,
144 const css::uno::Reference< css::frame::XDispatchResultListener >& )
155 std::unique_lock aGuard(
maMutex);
158 if (
aURL.Complete ==
".uno:LifeTime" )
160 css::frame::FeatureStateEvent
aEvent;
162 aEvent.Source =
static_cast<css::frame::XDispatch*
>(
this);
165 aListener->statusChanged(
aEvent );
171 std::unique_lock aGuard(
maMutex);
194 pImpl->UnBindController();
212std::unique_ptr< css::uno::ContextLayer > EnsureJavaContext()
214 css::uno::Reference< css::uno::XCurrentContext > xContext(css::uno::getCurrentContext());
217 css::uno::Reference< css::task::XInteractionHandler > xHandler;
218 xContext->getValueByName(JAVA_INTERACTION_HANDLER_NAME) >>= xHandler;
222 return std::make_unique< css::uno::ContextLayer >(
new svt::JavaContext(xContext));
233 std::unique_ptr< css::uno::ContextLayer > layer(EnsureJavaContext());
236 bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault(
"OnMainThread",
false);
245 css::uno::Reference<css::frame::XDispatchResultListener>());
251 css::uno::Reference<css::frame::XDispatchResultListener>());
257 const css::uno::Sequence< css::beans::PropertyValue >& aArgs,
258 const css::uno::Reference< css::frame::XDispatchResultListener >& rListener )
264 std::unique_ptr< css::uno::ContextLayer > layer(EnsureJavaContext());
266 pImpl->dispatch(
aURL, aArgs, rListener );
273 std::unique_lock aGuard(
maMutex);
274 maListeners.addInterface( aGuard,
aURL.Complete, aListener );
279 pImpl->addStatusListener( aListener,
aURL );
285 return pImpl->GetDispatcher();
302 pImpl->setMasterSlaveCommand( bSet );
308 return aURL.Protocol ==
".uno:" && (
aURL.Path.indexOf(
'.' ) > 0 );
313 OUString aMasterCommand;
321 return aMasterCommand;
329 css::util::URL aURL )
330 : aDispatchURL(
std::move(
aURL ))
331 , pDispatcher( pDispat )
333 , pLastState( nullptr )
335 , bMasterSlave( false )
341 Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
370 if (rHint.
GetId() == SfxHintId::Dying)
417 sal_Int32 nQueryIndex =
aURL.Complete.indexOf(
'?' );
418 if ( nQueryIndex <= 0 )
421 OUString aParamString(
aURL.Complete.copy( nQueryIndex+1 ));
425 OUString aToken = aParamString.getToken( 0,
'&',
nIndex );
427 sal_Int32 nParmIndex = 0;
429 OUString aParamName = aToken.getToken( 0,
'=', nParmIndex );
430 OUString aValue = aToken.getToken( 0,
'=', nParmIndex );
432 if ( !aParamName.isEmpty() )
436 aParamName = aToken.getToken( 0,
':', nParmIndex );
437 aParamType = aToken.getToken( 0,
':', nParmIndex );
440 sal_Int32 nLen = rArgs.getLength();
441 rArgs.realloc( nLen+1 );
442 auto pArgs = rArgs.getArray();
443 pArgs[nLen].Name = aParamName;
445 if ( aParamType.isEmpty() )
448 pArgs[nLen].Value <<= aValue.toInt32();
450 else if ( aParamType.equalsAsciiL(
URLTypeNames[URLType_BOOL], 4 ))
453 pArgs[nLen].Value <<= aValue.toBoolean();
455 else if ( aParamType.equalsAsciiL(
URLTypeNames[URLType_BYTE], 4 ))
458 pArgs[nLen].Value <<=
sal_Int8( aValue.toInt32() );
460 else if ( aParamType.equalsAsciiL(
URLTypeNames[URLType_LONG], 4 ))
463 pArgs[nLen].Value <<= aValue.toInt32();
465 else if ( aParamType.equalsAsciiL(
URLTypeNames[URLType_SHORT], 5 ))
468 pArgs[nLen].Value <<= sal_Int16( aValue.toInt32() );
470 else if ( aParamType.equalsAsciiL(
URLTypeNames[URLType_HYPER], 5 ))
473 pArgs[nLen].Value <<= aValue.toInt64();
475 else if ( aParamType.equalsAsciiL(
URLTypeNames[URLType_FLOAT], 5 ))
478 pArgs[nLen].Value <<= aValue.toFloat();
480 else if ( aParamType.equalsAsciiL(
URLTypeNames[URLType_STRING], 6 ))
485 else if ( aParamType.equalsAsciiL(
URLTypeNames[URLType_DOUBLE], 6))
488 pArgs[nLen].Value <<= aValue.toDouble();
496 sal_uInt16 nWhich = rPool.
GetWhich( nSlotId );
502 OUString aSlaveCommand;
503 sal_Int32
nIndex = rURL.Path.indexOf(
'.' );
504 if ((
nIndex > 0 ) && (
nIndex < rURL.Path.getLength() ))
505 aSlaveCommand = rURL.Path.copy(
nIndex+1 );
506 return aSlaveCommand;
511void collectUIInformation(
const util::URL& rURL,
const css::uno::Sequence< css::beans::PropertyValue >& rArgs)
513 static const char* pFile = std::getenv(
"LO_COLLECT_UIINFO");
518 Concat2View(
"Send UNO Command (\"" + rURL.Complete +
"\") "), rArgs);
524 const css::uno::Sequence< css::beans::PropertyValue >& aArgs,
525 const css::uno::Reference< css::frame::XDispatchResultListener >& rListener )
527 if (
aURL.Protocol ==
".uno:")
531 collectUIInformation(
aURL, aArgs);
539 aTree.
put(
"code",
"");
540 aTree.
put(
"kind",
"BlockedCommand");
541 aTree.
put(
"cmd",
aURL.Complete);
542 aTree.
put(
"message",
"Blocked feature");
561 css::uno::Sequence< css::beans::PropertyValue > lNewArgs;
562 sal_Int32
nCount = aArgs.getLength();
571 sal_Int32 nMarkArg = -1;
574 sal_uInt16 nModifier(0);
575 std::vector< css::beans::PropertyValue > aAddArgs;
578 const css::beans::PropertyValue& rProp = aArgs[
n];
579 if( rProp.Name ==
"SynchronMode" )
582 if( rProp.Value >>= bTemp )
585 else if( rProp.Name ==
"Bookmark" )
588 aAddArgs.push_back( aArgs[
n] );
590 else if( rProp.Name ==
"KeyModifier" )
591 rProp.Value >>= nModifier;
593 aAddArgs.push_back( aArgs[
n] );
597 sal_uInt32 nAddArgs = aAddArgs.size();
600 sal_uInt32
nIndex( lNewArgs.getLength() );
602 lNewArgs.realloc(
nIndex + nAddArgs );
603 std::copy(aAddArgs.begin(), aAddArgs.end(), std::next(lNewArgs.getArray(),
nIndex));
607 if ( rListener.is() )
610 if(
GetId() == SID_JUMPTOMARK && nMarkArg == - 1 )
614 lNewArgs.realloc( lNewArgs.getLength()+1 );
615 auto& el = lNewArgs.getArray()[lNewArgs.getLength()-1];
616 el.Name =
"Bookmark";
617 el.Value <<=
aURL.Mark;
620 css::uno::Reference< css::frame::XFrame > xFrameRef(
xFrame.get(), css::uno::UNO_QUERY);
628 bool bSuccess =
false;
630 MapUnit eMapUnit( MapUnit::Map100thMM );
648 const SfxSlot *pSlot =
nullptr;
655 sal_Int32
nIndex = lNewArgs.getLength();
656 lNewArgs.realloc(
nIndex+1 );
657 auto plNewArgs = lNewArgs.getArray();
663 std::optional<SfxAllItemSet> xSet(pShell->
GetPool());
669 if ( pItem !=
nullptr )
672 bSuccess = pBoolItem->GetValue();
690 bSuccess = aReq.
IsDone() || pItem !=
nullptr;
694 SAL_INFO(
"sfx.control",
"MacroPlayer: Unknown slot dispatched!");
722 bSuccess = (pItem !=
nullptr);
726 if ( !rListener.is() )
729 css::frame::DispatchResultEvent
aEvent;
731 aEvent.State = css::frame::DispatchResultState::SUCCESS;
733 aEvent.State = css::frame::DispatchResultState::FAILURE;
736 if ( bSuccess && pItem && !pItem->
IsVoidItem() )
738 sal_uInt16 nSubId( 0 );
739 if ( eMapUnit == MapUnit::MapTwip )
744 rListener->dispatchFinished(
aEvent );
761 css::uno::Any aState;
766 if ( eState == SfxItemState::DONTCARE )
769 css::frame::status::ItemStatus aItemStatus;
770 aItemStatus.State = css::frame::status::ItemState::DONT_CARE;
771 aState <<= aItemStatus;
774 css::frame::FeatureStateEvent
aEvent;
780 aEvent.IsEnabled = eState != SfxItemState::DISABLED;
785 css::frame::status::Visibility aVisibilityStatus;
786 aVisibilityStatus.bVisible =
false;
791 aEvent.State <<= aVisibilityStatus;
794 aListener->statusChanged(
aEvent );
799 pDispatch->sendStatusChanged(rURL, rEvent);
814 bVisible = pVisibilityItem->GetValue();
819 bNotify =
typeid(*pState) !=
typeid(*pLastState) || *pState != *
pLastState;
836 css::uno::Any aState;
840 sal_uInt16 nSubId( 0 );
841 MapUnit eMapUnit( MapUnit::Map100thMM );
853 if ( eMapUnit == MapUnit::MapTwip )
858 else if ( eState == SfxItemState::DONTCARE )
861 css::frame::status::ItemStatus aItemStatus;
862 aItemStatus.State = css::frame::status::ItemState::DONT_CARE;
863 aState <<= aItemStatus;
866 css::frame::FeatureStateEvent
aEvent;
869 aEvent.IsEnabled = eState != SfxItemState::DISABLED;
878 const std::vector<OUString> aContainedTypes =
pDispatch->getContainedTypes();
879 for (
const OUString& rName: aContainedTypes)
898 if (
aEvent.FeatureURL.Path ==
"Bold" ||
899 aEvent.FeatureURL.Path ==
"CenterPara" ||
900 aEvent.FeatureURL.Path ==
"CharBackgroundExt" ||
901 aEvent.FeatureURL.Path ==
"ControlCodes" ||
902 aEvent.FeatureURL.Path ==
"DefaultBullet" ||
903 aEvent.FeatureURL.Path ==
"DefaultNumbering" ||
904 aEvent.FeatureURL.Path ==
"Italic" ||
905 aEvent.FeatureURL.Path ==
"JustifyPara" ||
906 aEvent.FeatureURL.Path ==
"LeftPara" ||
907 aEvent.FeatureURL.Path ==
"OutlineFont" ||
908 aEvent.FeatureURL.Path ==
"RightPara" ||
909 aEvent.FeatureURL.Path ==
"Shadowed" ||
910 aEvent.FeatureURL.Path ==
"SpellOnline" ||
911 aEvent.FeatureURL.Path ==
"OnlineAutoFormat" ||
912 aEvent.FeatureURL.Path ==
"SubScript" ||
913 aEvent.FeatureURL.Path ==
"SuperScript" ||
914 aEvent.FeatureURL.Path ==
"Strikeout" ||
915 aEvent.FeatureURL.Path ==
"Underline" ||
916 aEvent.FeatureURL.Path ==
"ModifiedStatus" ||
917 aEvent.FeatureURL.Path ==
"TrackChanges" ||
918 aEvent.FeatureURL.Path ==
"ShowTrackedChanges" ||
919 aEvent.FeatureURL.Path ==
"NextTrackedChange" ||
920 aEvent.FeatureURL.Path ==
"PreviousTrackedChange" ||
921 aEvent.FeatureURL.Path ==
"AlignLeft" ||
922 aEvent.FeatureURL.Path ==
"AlignHorizontalCenter" ||
923 aEvent.FeatureURL.Path ==
"AlignRight" ||
924 aEvent.FeatureURL.Path ==
"DocumentRepair" ||
925 aEvent.FeatureURL.Path ==
"ObjectAlignLeft" ||
926 aEvent.FeatureURL.Path ==
"ObjectAlignRight" ||
927 aEvent.FeatureURL.Path ==
"AlignCenter" ||
928 aEvent.FeatureURL.Path ==
"AlignUp" ||
929 aEvent.FeatureURL.Path ==
"AlignMiddle" ||
930 aEvent.FeatureURL.Path ==
"AlignDown" ||
931 aEvent.FeatureURL.Path ==
"TraceChangeMode" ||
932 aEvent.FeatureURL.Path ==
"FormatPaintbrush" ||
933 aEvent.FeatureURL.Path ==
"FreezePanes" ||
934 aEvent.FeatureURL.Path ==
"Sidebar" ||
935 aEvent.FeatureURL.Path ==
"SpacePara1" ||
936 aEvent.FeatureURL.Path ==
"SpacePara15" ||
937 aEvent.FeatureURL.Path ==
"SpacePara2" ||
938 aEvent.FeatureURL.Path ==
"DataFilterAutoFilter")
944 else if (
aEvent.FeatureURL.Path ==
"CharFontName")
946 css::awt::FontDescriptor aFontDesc;
947 aEvent.State >>= aFontDesc;
948 aBuffer.append(aFontDesc.Name);
950 else if (
aEvent.FeatureURL.Path ==
"FontHeight")
952 css::frame::status::FontHeight aFontHeight;
953 aEvent.State >>= aFontHeight;
954 aBuffer.append(aFontHeight.Height);
956 else if (
aEvent.FeatureURL.Path ==
"StyleApply")
958 css::frame::status::Template aTemplate;
959 aEvent.State >>= aTemplate;
960 aBuffer.append(aTemplate.StyleName);
962 else if (
aEvent.FeatureURL.Path ==
"BackColor" ||
963 aEvent.FeatureURL.Path ==
"BackgroundColor" ||
964 aEvent.FeatureURL.Path ==
"CharBackColor" ||
965 aEvent.FeatureURL.Path ==
"Color" ||
966 aEvent.FeatureURL.Path ==
"FontColor" ||
967 aEvent.FeatureURL.Path ==
"FrameLineColor" ||
968 aEvent.FeatureURL.Path ==
"GlowColor")
970 sal_Int32 nColor = -1;
974 else if (
aEvent.FeatureURL.Path ==
"Undo" ||
975 aEvent.FeatureURL.Path ==
"Redo")
978 if ( pUndoConflict && pUndoConflict->
GetValue() > 0 )
984 aBuffer.append(
aEvent.IsEnabled ? std::u16string_view(
u"enabled") : std::u16string_view(
u"disabled"));
987 else if (
aEvent.FeatureURL.Path ==
"Cut" ||
988 aEvent.FeatureURL.Path ==
"Copy" ||
989 aEvent.FeatureURL.Path ==
"Paste" ||
990 aEvent.FeatureURL.Path ==
"SelectAll" ||
991 aEvent.FeatureURL.Path ==
"InsertAnnotation" ||
992 aEvent.FeatureURL.Path ==
"DeleteAnnotation" ||
993 aEvent.FeatureURL.Path ==
"ResolveAnnotation" ||
994 aEvent.FeatureURL.Path ==
"ResolveAnnotationThread" ||
995 aEvent.FeatureURL.Path ==
"InsertRowsBefore" ||
996 aEvent.FeatureURL.Path ==
"InsertRowsAfter" ||
997 aEvent.FeatureURL.Path ==
"InsertColumnsBefore" ||
998 aEvent.FeatureURL.Path ==
"InsertColumnsAfter" ||
999 aEvent.FeatureURL.Path ==
"MergeCells" ||
1000 aEvent.FeatureURL.Path ==
"InsertObjectChart" ||
1001 aEvent.FeatureURL.Path ==
"InsertSection" ||
1002 aEvent.FeatureURL.Path ==
"InsertAnnotation" ||
1003 aEvent.FeatureURL.Path ==
"InsertPagebreak" ||
1004 aEvent.FeatureURL.Path ==
"InsertColumnBreak" ||
1005 aEvent.FeatureURL.Path ==
"HyperlinkDialog" ||
1006 aEvent.FeatureURL.Path ==
"InsertSymbol" ||
1007 aEvent.FeatureURL.Path ==
"InsertPage" ||
1008 aEvent.FeatureURL.Path ==
"DeletePage" ||
1009 aEvent.FeatureURL.Path ==
"DuplicatePage" ||
1010 aEvent.FeatureURL.Path ==
"DeleteRows" ||
1011 aEvent.FeatureURL.Path ==
"DeleteColumns" ||
1012 aEvent.FeatureURL.Path ==
"DeleteTable" ||
1013 aEvent.FeatureURL.Path ==
"SelectTable" ||
1014 aEvent.FeatureURL.Path ==
"EntireRow" ||
1015 aEvent.FeatureURL.Path ==
"EntireColumn" ||
1016 aEvent.FeatureURL.Path ==
"EntireCell" ||
1017 aEvent.FeatureURL.Path ==
"SortAscending" ||
1018 aEvent.FeatureURL.Path ==
"SortDescending" ||
1019 aEvent.FeatureURL.Path ==
"AcceptAllTrackedChanges" ||
1020 aEvent.FeatureURL.Path ==
"RejectAllTrackedChanges" ||
1021 aEvent.FeatureURL.Path ==
"AcceptTrackedChange" ||
1022 aEvent.FeatureURL.Path ==
"RejectTrackedChange" ||
1023 aEvent.FeatureURL.Path ==
"NextTrackedChange" ||
1024 aEvent.FeatureURL.Path ==
"PreviousTrackedChange" ||
1025 aEvent.FeatureURL.Path ==
"FormatGroup" ||
1026 aEvent.FeatureURL.Path ==
"ObjectBackOne" ||
1027 aEvent.FeatureURL.Path ==
"SendToBack" ||
1028 aEvent.FeatureURL.Path ==
"ObjectForwardOne" ||
1029 aEvent.FeatureURL.Path ==
"BringToFront" ||
1030 aEvent.FeatureURL.Path ==
"WrapRight" ||
1031 aEvent.FeatureURL.Path ==
"WrapThrough" ||
1032 aEvent.FeatureURL.Path ==
"WrapLeft" ||
1033 aEvent.FeatureURL.Path ==
"WrapIdeal" ||
1034 aEvent.FeatureURL.Path ==
"WrapOn" ||
1035 aEvent.FeatureURL.Path ==
"WrapOff" ||
1036 aEvent.FeatureURL.Path ==
"UpdateCurIndex" ||
1037 aEvent.FeatureURL.Path ==
"InsertCaptionDialog" ||
1038 aEvent.FeatureURL.Path ==
"MergeCells" ||
1039 aEvent.FeatureURL.Path ==
"SplitTable" ||
1040 aEvent.FeatureURL.Path ==
"SplitCell" ||
1041 aEvent.FeatureURL.Path ==
"DeleteNote" ||
1042 aEvent.FeatureURL.Path ==
"AcceptChanges" ||
1043 aEvent.FeatureURL.Path ==
"SetDefault" ||
1044 aEvent.FeatureURL.Path ==
"ParaLeftToRight" ||
1045 aEvent.FeatureURL.Path ==
"ParaRightToLeft" ||
1046 aEvent.FeatureURL.Path ==
"ParaspaceIncrease" ||
1047 aEvent.FeatureURL.Path ==
"ParaspaceDecrease" ||
1048 aEvent.FeatureURL.Path ==
"TableDialog" ||
1049 aEvent.FeatureURL.Path ==
"FormatCellDialog" ||
1050 aEvent.FeatureURL.Path ==
"FontDialog" ||
1051 aEvent.FeatureURL.Path ==
"ParagraphDialog" ||
1052 aEvent.FeatureURL.Path ==
"OutlineBullet" ||
1053 aEvent.FeatureURL.Path ==
"InsertIndexesEntry" ||
1054 aEvent.FeatureURL.Path ==
"TransformDialog" ||
1055 aEvent.FeatureURL.Path ==
"EditRegion" ||
1056 aEvent.FeatureURL.Path ==
"ThesaurusDialog" ||
1057 aEvent.FeatureURL.Path ==
"OutlineRight" ||
1058 aEvent.FeatureURL.Path ==
"OutlineLeft" ||
1059 aEvent.FeatureURL.Path ==
"OutlineDown" ||
1060 aEvent.FeatureURL.Path ==
"OutlineUp" ||
1061 aEvent.FeatureURL.Path ==
"FormatArea" ||
1062 aEvent.FeatureURL.Path ==
"FormatLine" ||
1063 aEvent.FeatureURL.Path ==
"FormatColumns" ||
1064 aEvent.FeatureURL.Path ==
"Watermark" ||
1065 aEvent.FeatureURL.Path ==
"InsertBreak" ||
1066 aEvent.FeatureURL.Path ==
"InsertEndnote" ||
1067 aEvent.FeatureURL.Path ==
"InsertFootnote" ||
1068 aEvent.FeatureURL.Path ==
"InsertReferenceField" ||
1069 aEvent.FeatureURL.Path ==
"InsertBookmark" ||
1070 aEvent.FeatureURL.Path ==
"InsertAuthoritiesEntry" ||
1071 aEvent.FeatureURL.Path ==
"InsertMultiIndex" ||
1072 aEvent.FeatureURL.Path ==
"InsertField" ||
1073 aEvent.FeatureURL.Path ==
"PageNumberWizard" ||
1074 aEvent.FeatureURL.Path ==
"InsertPageNumberField" ||
1075 aEvent.FeatureURL.Path ==
"InsertPageCountField" ||
1076 aEvent.FeatureURL.Path ==
"InsertDateField" ||
1077 aEvent.FeatureURL.Path ==
"InsertTitleField" ||
1078 aEvent.FeatureURL.Path ==
"InsertFieldCtrl" ||
1079 aEvent.FeatureURL.Path ==
"CharmapControl" ||
1080 aEvent.FeatureURL.Path ==
"EnterGroup" ||
1081 aEvent.FeatureURL.Path ==
"LeaveGroup" ||
1082 aEvent.FeatureURL.Path ==
"Combine" ||
1083 aEvent.FeatureURL.Path ==
"Merge" ||
1084 aEvent.FeatureURL.Path ==
"Dismantle" ||
1085 aEvent.FeatureURL.Path ==
"Substract" ||
1086 aEvent.FeatureURL.Path ==
"DistributeSelection" ||
1087 aEvent.FeatureURL.Path ==
"Intersect" ||
1088 aEvent.FeatureURL.Path ==
"ResetAttributes" ||
1089 aEvent.FeatureURL.Path ==
"IncrementIndent" ||
1090 aEvent.FeatureURL.Path ==
"DecrementIndent" ||
1091 aEvent.FeatureURL.Path ==
"EditHeaderAndFooter" ||
1092 aEvent.FeatureURL.Path ==
"InsertSparkline" ||
1093 aEvent.FeatureURL.Path ==
"DeleteSparkline" ||
1094 aEvent.FeatureURL.Path ==
"DeleteSparklineGroup" ||
1095 aEvent.FeatureURL.Path ==
"EditSparklineGroup" ||
1096 aEvent.FeatureURL.Path ==
"EditSparkline" ||
1097 aEvent.FeatureURL.Path ==
"GroupSparklines" ||
1098 aEvent.FeatureURL.Path ==
"UngroupSparklines" ||
1099 aEvent.FeatureURL.Path ==
"FormatSparklineMenu" ||
1100 aEvent.FeatureURL.Path ==
"NumberFormatDecDecimals" ||
1101 aEvent.FeatureURL.Path ==
"NumberFormatIncDecimals" ||
1102 aEvent.FeatureURL.Path ==
"Protect" ||
1103 aEvent.FeatureURL.Path ==
"UnsetCellsReadOnly" ||
1104 aEvent.FeatureURL.Path ==
"ContentControlProperties" ||
1105 aEvent.FeatureURL.Path ==
"InsertCheckboxContentControl" ||
1106 aEvent.FeatureURL.Path ==
"InsertContentControl" ||
1107 aEvent.FeatureURL.Path ==
"InsertDateContentControl" ||
1108 aEvent.FeatureURL.Path ==
"InsertDropdownContentControl" ||
1109 aEvent.FeatureURL.Path ==
"InsertPlainTextContentControl" ||
1110 aEvent.FeatureURL.Path ==
"InsertPictureContentControl")
1112 aBuffer.append(
aEvent.IsEnabled ? std::u16string_view(
u"enabled") : std::u16string_view(
u"disabled"));
1114 else if (
aEvent.FeatureURL.Path ==
"AssignLayout" ||
1115 aEvent.FeatureURL.Path ==
"StatusSelectionMode" ||
1116 aEvent.FeatureURL.Path ==
"Signature" ||
1117 aEvent.FeatureURL.Path ==
"SelectionMode" ||
1118 aEvent.FeatureURL.Path ==
"StatusBarFunc")
1127 else if (
aEvent.FeatureURL.Path ==
"TransformPosX" ||
1128 aEvent.FeatureURL.Path ==
"TransformPosY" ||
1129 aEvent.FeatureURL.Path ==
"TransformWidth" ||
1130 aEvent.FeatureURL.Path ==
"TransformHeight")
1135 boost::property_tree::ptree aTree;
1136 boost::property_tree::ptree aState;
1139 aTree.put(
"commandName",
aStr.toUtf8().getStr());
1141 aTree.add_child(
"state", aState);
1144 std::stringstream aStream;
1145 boost::property_tree::write_json(aStream, aTree);
1146 aBuffer.appendAscii(aStream.str().c_str());
1149 else if (
aEvent.FeatureURL.Path ==
"StatusDocPos" ||
1150 aEvent.FeatureURL.Path ==
"RowColSelCount" ||
1151 aEvent.FeatureURL.Path ==
"StatusPageStyle" ||
1152 aEvent.FeatureURL.Path ==
"StateWordCount" ||
1153 aEvent.FeatureURL.Path ==
"PageStyleName" ||
1154 aEvent.FeatureURL.Path ==
"PageStatus" ||
1155 aEvent.FeatureURL.Path ==
"LayoutStatus" ||
1156 aEvent.FeatureURL.Path ==
"Scale" ||
1157 aEvent.FeatureURL.Path ==
"Context")
1166 else if (
aEvent.FeatureURL.Path ==
"StateTableCell")
1171 aBuffer.append(pSvxStatusItem->GetValue());
1174 else if (
aEvent.FeatureURL.Path ==
"InsertMode" ||
1175 aEvent.FeatureURL.Path ==
"WrapText" ||
1176 aEvent.FeatureURL.Path ==
"NumberFormatCurrency" ||
1177 aEvent.FeatureURL.Path ==
"NumberFormatPercent" ||
1178 aEvent.FeatureURL.Path ==
"NumberFormatDecimal" ||
1179 aEvent.FeatureURL.Path ==
"NumberFormatDate" ||
1180 aEvent.FeatureURL.Path ==
"ShowResolvedAnnotations")
1186 aBuffer.append(OUString::boolean(aBool));
1189 else if (
aEvent.FeatureURL.Path ==
"ToggleMergeCells" ||
1190 aEvent.FeatureURL.Path ==
"SheetRightToLeft")
1196 aBuffer.append(OUString::boolean(aBool));
1203 else if (
aEvent.FeatureURL.Path ==
"Position" ||
1204 aEvent.FeatureURL.Path ==
"FreezePanesColumn" ||
1205 aEvent.FeatureURL.Path ==
"FreezePanesRow")
1207 css::awt::Point aPoint;
1211 aBuffer.append( OUString::number(aPoint.X) +
" / " + OUString::number(aPoint.Y));
1214 else if (
aEvent.FeatureURL.Path ==
"Size")
1216 css::awt::Size aSize;
1220 aBuffer.append( OUString::number(aSize.Width) +
" x " + OUString::number(aSize.Height) );
1223 else if (
aEvent.FeatureURL.Path ==
"LanguageStatus" ||
1224 aEvent.FeatureURL.Path ==
"StatePageNumber")
1226 css::uno::Sequence< OUString >
aSeq;
1231 if (
aEvent.State >>= sValue)
1241 else if (
aEvent.FeatureURL.Path ==
"InsertPageHeader" ||
1242 aEvent.FeatureURL.Path ==
"InsertPageFooter")
1246 css::uno::Sequence< OUString >
aSeq;
1250 for (sal_Int32 itSeq = 0; itSeq <
aSeq.getLength(); itSeq++)
1253 if (itSeq !=
aSeq.getLength() - 1)
1262 else if (
aEvent.FeatureURL.Path ==
"TableColumWidth" ||
1263 aEvent.FeatureURL.Path ==
"TableRowHeight")
1268 float nScaleValue = 1000.0;
1271 aBuffer.append(nConvertedValue / nScaleValue);
1282 OUString payload =
aBuffer.makeStringAndClear();
1284 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8());
SfxApplication * SfxGetpApp()
void TransformParameters(sal_uInt16 nSlotId, const uno::Sequence< beans::PropertyValue > &rArgs, SfxAllItemSet &rSet, const SfxSlot *pSlot)
sal_uInt32 GetValue() const
static void logUnoCommand(SAL_UNUSED_PARAMETER const OUString &)
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
static SfxApplication * Get()
SAL_DLLPRIVATE SfxDispatcher * GetDispatcher_Impl()
void QueryControlState(sal_uInt16 nSID, boost::property_tree::ptree &rState)
SAL_DLLPRIVATE const SfxPoolItem * Execute_Impl(sal_uInt16 nSlot, const SfxPoolItem **pArgs, sal_uInt16 nModi, SfxCallMode nCall, const SfxPoolItem **pInternalArgs, bool bGlobalOnly=false)
SAL_DLLPRIVATE void BindInternal_Impl(sal_uInt16 nNewId, SfxBindings *)
SfxBindings & GetBindings()
MapUnit GetCoreMetric() const
void SetId(sal_uInt16 nItemId)
void sendStatusChanged(const OUString &rURL, const css::frame::FeatureStateEvent &rEvent)
css::uno::WeakReference< css::frame::XFrame > xFrame
void setMasterSlaveCommand(bool bSet)
static OUString getSlaveCommand(const css::util::URL &rURL)
virtual ~SfxDispatchController_Impl() override
SfxDispatcher * pDispatcher
SfxDispatcher * GetDispatcher()
const SfxPoolItem * pLastState
static void addParametersToArgs(const css::util::URL &aURL, css::uno::Sequence< css::beans::PropertyValue > &rArgs)
void SetFrame(const css::uno::Reference< css::frame::XFrame > &xFrame)
void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState, SfxSlotServer const *pServ)
void dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs, const css::uno::Reference< css::frame::XDispatchResultListener > &rListener)
void addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL)
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
css::util::URL aDispatchURL
SfxDispatchController_Impl(SfxOfficeDispatch *pDisp, SfxBindings *pBind, SfxDispatcher *pDispat, const SfxSlot *pSlot, css::util::URL aURL)
SfxOfficeDispatch * pDispatch
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
Method to execute a <SfxSlot>s over the Slot-Id.
SfxBindings * GetBindings() const
This method returns a pointer to the <SfxBinding> Instance on which the SfxDispatcher is currently bo...
bool IsLocked() const
With this method it can be determined whether the SfxDispatcher is locked or unlocked.
SfxViewFrame * GetFrame() const
Returns a pointer to the <SfxViewFrame> instance, which belongs to this SfxDispatcher.
SfxShell * GetShell(sal_uInt16 nIdx) const
Returns a pointer to the <SfxShell> which is at the position nIdx (from the top, last pushed is 0) on...
SAL_DLLPRIVATE bool GetShellAndSlot_Impl(sal_uInt16 nSlot, SfxShell **ppShell, const SfxSlot **ppSlot, bool bOwnShellsOnly, bool bRealSlot)
This method searches in SfxDispatcher after <SfxShell> , from the Slot Id nSlot currently being handl...
SfxItemState QueryState(sal_uInt16 nSID, const SfxPoolItem *&rpState)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
static void sendUnoStatus(const SfxViewShell *pShell, const SfxPoolItem *pItem)
Emits a LOK_CALLBACK_STATE_CHANGED.
virtual ~SfxOfficeDispatch() override
std::unique_ptr< SfxDispatchController_Impl > pImpl
SfxDispatcher * GetDispatcher_Impl()
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
void SetFrame(const css::uno::Reference< css::frame::XFrame > &xFrame)
void SetMasterUnoCommand(bool bSet)
SfxOfficeDispatch(SfxBindings &rBind, SfxDispatcher *pDispat, const SfxSlot *pSlot, const css::util::URL &rURL)
static OUString GetMasterUnoCommand(const css::util::URL &aURL)
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
static bool IsMasterUnoCommand(const css::util::URL &aURL)
virtual void SAL_CALL dispatchWithNotification(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs, const css::uno::Reference< css::frame::XDispatchResultListener > &rListener) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
virtual bool IsVoidItem() const
const SfxPoolItem * GetReturnValue() const
void SetModifier(sal_uInt16 nModi)
void SetInternalArgs_Impl(const SfxAllItemSet &rArgs)
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.
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
sal_uInt16 GetShellLevel() const
sal_uInt16 GetSlotId() const
SFX2_DLLPUBLIC OUString GetCommand() const
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
void sendStatusChanged(const OUString &rURL, const css::frame::FeatureStateEvent &rEvent)
virtual void SAL_CALL dispatchWithNotification(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs, const css::uno::Reference< css::frame::XDispatchResultListener > &rListener) override
SfxStatusDispatcher_Impl_ListenerContainer maListeners
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
SfxBindings & GetBindings()
SfxFrame & GetFrame() const
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
bool isLOKMobilePhone() const
Check if the lok client is running on a mobile device.
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
Invokes the registered callback, if there are any.
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
void logCommand(std::u16string_view rAction, const css::uno::Sequence< css::beans::PropertyValue > &rArgs)
static UITestLogger & getInstance()
void forEach(std::unique_lock< std::mutex > &rGuard, FuncT const &func) const
sal_Int32 removeInterface(::std::unique_lock<::std::mutex > &rGuard, const key &rKey, const css::uno::Reference< listener > &rListener)
sal_Int32 addInterface(::std::unique_lock<::std::mutex > &rGuard, const key &rKey, const css::uno::Reference< listener > &rListener)
void disposeAndClear(std::unique_lock< std::mutex > &rGuard, const css::lang::EventObject &rEvt)
OInterfaceContainerHelper4< listener > * getContainer(std::unique_lock< std::mutex > &rGuard, const key &rKey) const
Sequence< sal_Int8 > aSeq
#define SAL_INFO(area, stream)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
auto syncExecute(FuncT const &func) -> decltype(func())
bool IsInvalidItem(const SfxPoolItem *pItem)
Reference< XFrame > xFrame
const char *const URLTypeNames[URLType_COUNT]
static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame *pViewFrame, const css::frame::FeatureStateEvent &aEvent, const SfxPoolItem *pState)
std::unique_ptr< char[]> aBuffer