[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source sfx2/source
desktop/source/lib/init.cxx |3 ++- sfx2/source/control/unoctitm.cxx |3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) New commits: commit f3c956ae8825abab59e7dbc1e39da4f5d4a1658c Author: Pranam Lashkari AuthorDate: Wed Jul 26 16:39:49 2023 +0700 Commit: Pranam Lashkari CommitDate: Wed Oct 18 22:54:06 2023 +0200 LOK: send state of protected cells Change-Id: I432a3af50b6089faa80a28804d95d816af6cd278 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154936 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-by: Pranam Lashkari diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 5b50b0d8181c..d4b507004a9d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3846,7 +3846,8 @@ static void doc_iniUnoCommands () OUString(".uno:InsertDropdownContentControl"), OUString(".uno:InsertPlainTextContentControl"), OUString(".uno:InsertPictureContentControl"), -OUString(".uno:DataFilterAutoFilter") +OUString(".uno:DataFilterAutoFilter"), +OUString(".uno:CellProtection") }; util::URL aCommandURL; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index fad61699db90..73d2d88ddc1b 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -951,7 +951,8 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra aEvent.FeatureURL.Path == "SpacePara1" || aEvent.FeatureURL.Path == "SpacePara15" || aEvent.FeatureURL.Path == "SpacePara2" || -aEvent.FeatureURL.Path == "DataFilterAutoFilter") +aEvent.FeatureURL.Path == "DataFilterAutoFilter" || +aEvent.FeatureURL.Path == "CellProtection") { bool bTemp = false; aEvent.State >>= bTemp;
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source sfx2/source svx/source
desktop/source/lib/init.cxx |2 sfx2/source/view/viewsh.cxx | 133 --- svx/source/accessibility/ChildrenManagerImpl.cxx |8 - 3 files changed, 125 insertions(+), 18 deletions(-) New commits: commit b6807298c8dce696152c52447d8fe7759a6f683a Author: Marco Cecchetti AuthorDate: Tue Oct 3 12:34:45 2023 +0200 Commit: Tomaž Vajngerl CommitDate: Wed Oct 11 00:02:54 2023 +0200 lok: a11y: impress: screen reader support for text shape editing Now accessibility support can be enabled in Impress. Fixed an issue that prevented to receive accessibility event when a shape text content was edited. Some rectangles overlapping check is performed for excluding not visible shapes from the a11y tree Anyway client and core visible area can differ some shape was wrongly pruned from the a11y tree. The problem has been fixed by not performing the overlapping test in the LOK case: we already do the same for shape area invalidation. In order to avoid the screen reader to report no more focused paragraph we send an empty paragraph to clear the editable area when shape selection state changes. When shape ediding becomes active the text content of the shape is sent to the client. Change-Id: Ia9ee08d060162891725d26efd2aa36e47b38ed50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157525 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 3bd6fa10fe68..5b50b0d8181c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -7182,7 +7182,7 @@ static void doc_setAccessibilityState(SAL_UNUSED_PARAMETER LibreOfficeKitDocumen SolarMutexGuard aGuard; int nDocType = getDocumentType(pThis); -if (nDocType != LOK_DOCTYPE_TEXT) +if (!(nDocType == LOK_DOCTYPE_TEXT || nDocType == LOK_DOCTYPE_PRESENTATION)) return; SfxLokHelper::setAccessibilityState(nId, nEnabled); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 8ad4fe841c88..7fcb8c1920d8 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -267,6 +267,28 @@ bool isFocused(const accessibility::AccessibleEventObject& aEvent) return hasState(aEvent, accessibility::AccessibleStateType::FOCUSED); } +sal_Int16 getParentRole(const uno::Reference& xAccObject) +{ +if (!xAccObject.is()) +return 0; + +uno::Reference xContext(xAccObject, uno::UNO_QUERY); +if (xContext.is()) +{ +uno::Reference xParent = xContext->getAccessibleParent(); +if (xParent.is()) +{ +uno::Reference xParentContext(xParent, + uno::UNO_QUERY); +if (xParentContext.is()) +{ +return xParentContext->getAccessibleRole(); +} +} +} +return 0; +} + // Put in rAncestorList all ancestors of xTable up to xAncestorTable or // up to the first not-a-table ancestor if xAncestorTable is not an ancestor. // xTable is included in the list, xAncestorTable is not included. @@ -360,6 +382,16 @@ void aboutEvent(std::string msg, const accessibility::AccessibleEventObject& aEv << "\n parent: " << xContext->getAccessibleParent().get() << "\n child count: " << xContext->getAccessibleChildCount()); } +else +{ +SAL_INFO("lok.a11y", msg << ": event id: " << aEvent.EventId + << ", no accessible context!"); +} +} +else +{ +SAL_INFO("lok.a11y", msg << ": event id: " << aEvent.EventId + << ", no accessible source!"); } uno::Reference< accessibility::XAccessible > xOldValue; aEvent.OldValue >>= xOldValue; @@ -687,6 +719,7 @@ private: bool force, std::string msg = ""); void updateAndNotifyParagraph(const uno::Reference& xAccText, bool force, std::string msg = ""); +void resetParagraphInfo(); }; LOKDocumentFocusListener::LOKDocumentFocusListener(const SfxViewShell* pViewShell) @@ -887,6 +920,20 @@ bool LOKDocumentFocusListener::updateParagraphInfo(const uno::ReferencegetSelectionEnd(); m_nListPrefixLength = getListPrefixSize(xAccText); +// Inside a text shape when there is no selection, selection-start and selection-end are +// set to current caret position instead of -1. Moreover, inside a text shape pressing +// delete or backspace with an empty selection really deletes text and not only the empty +// selection as it occurs in a text paragraph in Writer. +// So whenever selection-start == selection-end,
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source sfx2/source uui/source
desktop/source/lib/lokinteractionhandler.cxx | 21 + desktop/source/lib/lokinteractionhandler.hxx |1 + sfx2/source/doc/sfxbasemodel.cxx |4 +++- uui/source/iahndl.cxx|2 +- 4 files changed, 26 insertions(+), 2 deletions(-) New commits: commit 413e7a2e6f0c363938a0a5ee5bd6eb5d56d5a8d8 Author: Szymon Kłos AuthorDate: Fri Sep 22 11:11:06 2023 +0200 Commit: Ashod Nakashian CommitDate: Sat Sep 23 14:48:58 2023 +0200 lok: add broken package interaction handler in case of repair don't use template flag to not make file readonly so we can overwrite it and upload to storage updated version Change-Id: Ia460009fc3b77582dde06dd6f94a85aef3aee11b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157168 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx index 8495ac2c8179..8ac3dc7c2aae 100644 --- a/desktop/source/lib/lokinteractionhandler.cxx +++ b/desktop/source/lib/lokinteractionhandler.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -371,6 +372,23 @@ bool LOKInteractionHandler::handleLoadReadOnlyRequest(const uno::Reference& xRequest) +{ +uno::Any const request(xRequest->getRequest()); + +document::BrokenPackageRequest aBrokenPackageRequest; +if (request >>= aBrokenPackageRequest) +{ +auto xInteraction(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr)); + +if (xInteraction.is()) +xInteraction->handleInteractionRequest(xRequest); + +return true; +} +return false; +} + bool LOKInteractionHandler::handleFilterOptionsRequest(const uno::Reference& xRequest) { document::FilterOptionsRequest aFilterOptionsRequest; @@ -413,6 +431,9 @@ sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest( if (handleLoadReadOnlyRequest(xRequest)) return true; +if (handlePackageReparationRequest(xRequest)) +return true; + // TODO: perform more interactions 'for real' like the above selectApproved(rContinuations); diff --git a/desktop/source/lib/lokinteractionhandler.hxx b/desktop/source/lib/lokinteractionhandler.hxx index f92b88cf11f9..ded410ae5742 100644 --- a/desktop/source/lib/lokinteractionhandler.hxx +++ b/desktop/source/lib/lokinteractionhandler.hxx @@ -79,6 +79,7 @@ private: static bool handleFilterOptionsRequest(const ::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& Request); static bool handleLoadReadOnlyRequest(const css::uno::Reference& xRequest); +static bool handlePackageReparationRequest(const css::uno::Reference& xRequest); public: void SetPassword(char const* pPassword); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index f5759950d29b..30454ce31d3b 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1956,9 +1956,11 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA xHandler->handle( aRequest.GetRequest() ); if( aRequest.isApproved() ) { +// lok: we want to overwrite file in jail, so don't use template flag +bool bIsLOK = comphelper::LibreOfficeKit::isActive(); // broken package: try second loading and allow repair pMedium->GetItemSet()->Put( SfxBoolItem( SID_REPAIRPACKAGE, true ) ); -pMedium->GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, true ) ); +pMedium->GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, !bIsLOK ) ); pMedium->GetItemSet()->Put( SfxStringItem( SID_DOCINFO_TITLE, aDocName ) ); // the error must be reset and the storage must be reopened in new mode diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 7bd3fb7104d4..cefb794f7fb2 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -950,7 +950,7 @@ executeMessageBox( SolarMutexGuard aGuard; std::unique_ptr xBox(Application::CreateMessageDialog(pParent, eMessageType, -eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : VclButtonsType::Ok, rMessage)); +eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : VclButtonsType::Ok, rMessage, GetpApp())); xBox->set_title(rTitle); short nMessResult = xBox->run();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source sfx2/source
desktop/source/lib/init.cxx | 21 + sfx2/source/doc/sfxbasemodel.cxx | 18 +- 2 files changed, 38 insertions(+), 1 deletion(-) New commits: commit b95739d70806c121cdc38e4e3eb86683e1581c57 Author: Jaume Pujantell AuthorDate: Fri Jul 14 09:11:07 2023 +0200 Commit: Caolán McNamara CommitDate: Fri Jul 28 10:05:03 2023 +0200 Added possibility to set password on save throug arguments Change-Id: I579ed7487f87515a21d83912d9c0d12e9edc5eea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154433 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c1ebf5d934ea..112b134b5e84 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3308,6 +3308,23 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha bool bFullSheetPreview = sFullSheetPreview == u"true"; +OUString filePassword; +if ((aIndex = aFilterOptions.indexOf(",Password=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDEND"); +filePassword = aFilterOptions.subView(aIndex + 10, bIndex - (aIndex + 10)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 11); +} +OUString filePasswordToModify; +if ((aIndex = aFilterOptions.indexOf(",PasswordToModify=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDTOMODIFYEND"); +filePassword = aFilterOptions.subView(aIndex + 18, bIndex - (aIndex + 18)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 19); +} + // Select a pdf version if specified a valid one. If not specified then ignore. // If invalid then fail. sal_Int32 pdfVer = 0; @@ -3382,6 +3399,10 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha { aSaveMediaDescriptor["FilterData"] <<= aFilterDataMap.getAsConstPropertyValueList(); } +if (!filePassword.isEmpty()) +aSaveMediaDescriptor["Password"] <<= filePassword; +if (!filePasswordToModify.isEmpty()) +aSaveMediaDescriptor["PasswordToModify"] <<= filePasswordToModify; // add interaction handler too if (gImpl) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 8a539f660409..f5759950d29b 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -129,6 +129,7 @@ #include #include "printhelper.hxx" #include +#include #include #include #include @@ -3023,13 +3024,13 @@ void SfxBaseModel::impl_store( const OUString& sURL throw frame::IllegalArgumentIOException(); bool bSaved = false; +::comphelper::SequenceAsHashMap aArgHash(seqArguments); if ( !bSaveTo && m_pData->m_pObjectShell.is() && !sURL.isEmpty() && !sURL.startsWith( "private:stream" ) && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) ) { // this is the same file URL as the current document location, try to use storeOwn if possible -::comphelper::SequenceAsHashMap aArgHash( seqArguments ); static const OUStringLiteral aFilterString( u"FilterName" ); const OUString aFilterName( aArgHash.getUnpackedValueOrDefault( aFilterString, OUString() ) ); if ( !aFilterName.isEmpty() ) @@ -3099,11 +3100,26 @@ void SfxBaseModel::impl_store( const OUString& sURL SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDoc : SfxEventHintId::SaveAsDoc, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), m_pData->m_pObjectShell.get() ) ); +const OUString aFilterName(aArgHash.getUnpackedValueOrDefault("FilterName", OUString())); +OUString aPassword, aPasswordToModify; +if (!aArgHash.getUnpackedValueOrDefault("EncryptionData", Sequence()) + .hasElements()) +aPassword = aArgHash.getUnpackedValueOrDefault("Password", OUString()); +if (!aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", Sequence()) + .hasElements() +&& aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", static_cast(0)) == 0) +aPasswordToModify = aArgHash.getUnpackedValueOrDefault("PasswordToModify", OUString()); +aArgHash.erase("PasswordToModify"); + std::optional pItemSet(SfxGetpApp()->GetPool()); pItemSet->Put(SfxStringItem(SID_FILE_NAME, sURL)); if ( bSaveTo ) pItemSet->Put(SfxBoolItem(SID_SAVETO, true)); +if (!aFilterName.isEmpty() && (!aPassword.isEmpty() ||
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source sfx2/source
desktop/source/lib/init.cxx |3 +++ sfx2/source/control/unoctitm.cxx |3 +++ 2 files changed, 6 insertions(+) New commits: commit b62f9f484a0fc9215e34153daac4a8bdb9698d4b Author: Aron Budea AuthorDate: Mon Jul 17 03:37:05 2023 +0200 Commit: Aron Budea CommitDate: Thu Jul 20 12:38:50 2023 +0200 Send Calc pivot table command state changes to LOK Change-Id: I0d9e04b0a0452f66cb9703d9f34fe6cb44d724c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154506 Tested-by: Jenkins CollaboraOffice Reviewed-by: Aron Budea diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 45bd9e608e70..81f797e5f197 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3588,6 +3588,9 @@ static void doc_iniUnoCommands () OUString(".uno:GroupSparklines"), OUString(".uno:UngroupSparklines"), OUString(".uno:FormatSparklineMenu"), +OUString(".uno:DataDataPilotRun"), +OUString(".uno:RecalcPivotTable"), +OUString(".uno:DeletePivotTable"), OUString(".uno:Protect"), OUString(".uno:UnsetCellsReadOnly"), OUString(".uno:ContentControlProperties"), diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 99bbc2afa7bf..20de9bb29ad3 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1120,6 +1120,9 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra aEvent.FeatureURL.Path == "GroupSparklines" || aEvent.FeatureURL.Path == "UngroupSparklines" || aEvent.FeatureURL.Path == "FormatSparklineMenu" || + aEvent.FeatureURL.Path == "DataDataPilotRun" || + aEvent.FeatureURL.Path == "RecalcPivotTable" || + aEvent.FeatureURL.Path == "DeletePivotTable" || aEvent.FeatureURL.Path == "NumberFormatDecDecimals" || aEvent.FeatureURL.Path == "NumberFormatIncDecimals" || aEvent.FeatureURL.Path == "Protect" ||
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source sfx2/source
desktop/source/lib/init.cxx |3 ++- sfx2/source/control/unoctitm.cxx |3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) New commits: commit b83c86b5474f5d760adaed198dfcd842053c5599 Author: Pranam Lashkari AuthorDate: Fri Jun 23 23:31:10 2023 +0700 Commit: Aron Budea CommitDate: Mon Jun 26 20:44:55 2023 +0200 LOK: send state of DataFilterAutoFilter Change-Id: Ib71dcdb6b02f3c1e9e1c552a718cb03e7cd9a4b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153532 Tested-by: Jenkins CollaboraOffice Reviewed-by: Aron Budea diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 874e3ac1ffb2..5d957a9c89be 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3594,7 +3594,8 @@ static void doc_iniUnoCommands () OUString(".uno:InsertDateContentControl"), OUString(".uno:InsertDropdownContentControl"), OUString(".uno:InsertPlainTextContentControl"), -OUString(".uno:InsertPictureContentControl") +OUString(".uno:InsertPictureContentControl"), +OUString(".uno:DataFilterAutoFilter") }; util::URL aCommandURL; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index fa131fe09ff6..99bbc2afa7bf 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -951,7 +951,8 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra aEvent.FeatureURL.Path == "SheetRightToLeft" || aEvent.FeatureURL.Path == "SpacePara1" || aEvent.FeatureURL.Path == "SpacePara15" || -aEvent.FeatureURL.Path == "SpacePara2") +aEvent.FeatureURL.Path == "SpacePara2" || +aEvent.FeatureURL.Path == "DataFilterAutoFilter") { bool bTemp = false;
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source sfx2/source
desktop/source/lib/init.cxx |1 sfx2/source/view/viewsh.cxx | 556 +--- 2 files changed, 371 insertions(+), 186 deletions(-) New commits: commit cd726ba43c22e723b243dd6dfd5e3c253e81000b Author: Marco Cecchetti AuthorDate: Mon May 22 16:32:50 2023 +0200 Commit: Marco Cecchetti CommitDate: Tue May 30 15:53:34 2023 +0200 lok: a11y: paragraph notifyied on text change, even coming from another view Debug code has been re-organized. Paragraph content is notifyied on any text change. That fixed issues related to fast typing. Paragraph content is also notified on text changed performed in another view. A paragraph is regarded as focused whenever the cursor position is valid. Change-Id: I33a187ced368b74824e55265be921804a492349c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152363 Reviewed-by: Michael Meeks Tested-by: Marco Cecchetti diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 1472bbeb6747..560d6bf990b1 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -6987,7 +6987,6 @@ static void doc_setViewTimezone(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*p static void doc_setAccessibilityState(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* pThis, int nId, bool nEnabled) { SolarMutexGuard aGuard; -SetLastExceptionMsg(); int nDocType = getDocumentType(pThis); if (nDocType != LOK_DOCTYPE_TEXT) diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index b19da3d1ee23..061a8efc09da 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -235,6 +236,247 @@ void SAL_CALL SfxClipboardChangeListener::changedContents( const datatransfer::c delete pInfo; } +namespace +{ + +bool hasState(const accessibility::AccessibleEventObject& aEvent, ::sal_Int64 nState) +{ +bool res = false; +uno::Reference< accessibility::XAccessibleContext > xContext(aEvent.Source, uno::UNO_QUERY); +if (xContext.is()) +{ +::sal_Int64 nStateSet = xContext->getAccessibleStateSet(); +res = (nStateSet & nState) != 0; +} +return res; +} + +bool isFocused(const accessibility::AccessibleEventObject& aEvent) +{ +return hasState(aEvent, accessibility::AccessibleStateType::FOCUSED); +} + +std::string stateSetToString(::sal_Int64 stateSet) +{ +static const std::string states[34] = { +"ACTIVE", "ARMED", "BUSY", "CHECKED", "DEFUNC", +"EDITABLE", "ENABLED", "EXPANDABLE", "EXPANDED", "FOCUSABLE", +"FOCUSED", "HORIZONTAL", "ICONIFIED", "INDETERMINATE", "MANAGES_DESCENDANTS", +"MODAL", "MULTI_LINE", "MULTI_SELECTABLE", "OPAQUE", "PRESSED", +"RESIZABLE", "SELECTABLE", "SELECTED", "SENSITIVE", "SHOWING", +"SINGLE_LINE", "STALE", "TRANSIENT", "VERTICAL", "VISIBLE", +"MOVEABLE", "DEFAULT", "OFFSCREEN", "COLLAPSE" +}; + +if (stateSet == 0) +return "INVALID"; +::sal_Int64 state = 1; +std::string s; +for (int i = 0; i < 34; ++i) +{ +if (stateSet & state) +{ +s += states[i]; +s += "|"; +} +state <<= 1; +} +return s; +} + +void aboutView(std::string msg, const void* pInstance, const SfxViewShell* pViewShell) +{ +if (!pViewShell) +return; + +SAL_INFO("lok.a11y", ">>> " << msg << ": instance: " << pInstance +<< ", VIED ID: " << pViewShell->GetViewShellId().get() << " <<<"); +} + +void aboutEvent(std::string msg, const accessibility::AccessibleEventObject& aEvent) +{ +try +{ +uno::Reference< accessibility::XAccessible > xSource(aEvent.Source, uno::UNO_QUERY); +if (xSource.is()) +{ +uno::Reference< accessibility::XAccessibleContext > xContext = +xSource->getAccessibleContext(); + +if (xContext.is()) +{ +SAL_INFO("lok.a11y", msg << ": event id: " << aEvent.EventId +<< "\n xSource: " << xSource.get() +<< "\n role: " << xContext->getAccessibleRole() +<< "\n name: " << xContext->getAccessibleName() +<< "\n index in parent: " << xContext->getAccessibleIndexInParent() +<< "\n state set: " << stateSetToString(xContext->getAccessibleStateSet()) +<< "\n parent: " << xContext->getAccessibleParent().get() +<< "\n child count: " << xContext->getAccessibleChildCount()); +} +} +uno::Reference< accessibility::XAccessible > xOldValue; +aEvent.OldValue >>= xOldValue; +if (xOldValue.is()) +{ +uno::Reference< accessibility::XAccessibleContext > xContext = +