LibreOffice Module sfx2 (master) 1
newhelp.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#include "newhelp.hxx"
22#include <sfx2/sfxresid.hxx>
23#include "helpinterceptor.hxx"
24#include <helper.hxx>
25#include <srchdlg.hxx>
26#include <sfx2/sfxhelp.hxx>
27#include <sal/log.hxx>
28#include <tools/debug.hxx>
30#include <o3tl/string_view.hxx>
31
32#include <sfx2/strings.hrc>
33#include <helpids.h>
34#include <bitmaps.hlst>
35
36#include <rtl/ustrbuf.hxx>
39#include <comphelper/string.hxx>
41#include <com/sun/star/beans/PropertyValue.hpp>
42#include <com/sun/star/beans/XPropertySetInfo.hpp>
43#include <com/sun/star/container/XIndexAccess.hpp>
44#include <com/sun/star/frame/XComponentLoader.hpp>
45#include <com/sun/star/frame/XTitle.hpp>
46#include <com/sun/star/frame/XLayoutManager.hpp>
47#include <com/sun/star/frame/XController.hpp>
48#include <com/sun/star/frame/XDispatch.hpp>
49#include <com/sun/star/frame/XDispatchProvider.hpp>
50#include <com/sun/star/frame/Frame.hpp>
51#include <com/sun/star/i18n/XBreakIterator.hpp>
52#include <com/sun/star/i18n/WordType.hpp>
53#include <com/sun/star/lang/XComponent.hpp>
54#include <com/sun/star/style/XStyle.hpp>
55#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
56#include <com/sun/star/text/XText.hpp>
57#include <com/sun/star/text/XTextCursor.hpp>
58#include <com/sun/star/text/XTextDocument.hpp>
59#include <com/sun/star/text/XTextViewCursor.hpp>
60#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
61#include <com/sun/star/ucb/CommandAbortedException.hpp>
62#include <com/sun/star/util/URL.hpp>
63#include <com/sun/star/util/XSearchable.hpp>
64#include <com/sun/star/util/XSearchDescriptor.hpp>
65#include <com/sun/star/util/URLTransformer.hpp>
66#include <com/sun/star/util/XURLTransformer.hpp>
67#include <com/sun/star/util/XModifiable.hpp>
68#include <com/sun/star/util/XCloseable.hpp>
69#include <com/sun/star/util/CloseVetoException.hpp>
70#include <com/sun/star/view/XSelectionSupplier.hpp>
71#include <com/sun/star/view/XViewSettingsSupplier.hpp>
74#include <tools/urlobj.hxx>
75#include <svtools/imagemgr.hxx>
76#include <svtools/miscopt.hxx>
77#include <utility>
78#include <vcl/commandevent.hxx>
79#include <vcl/event.hxx>
80#include <vcl/i18nhelp.hxx>
81#include <vcl/settings.hxx>
82#include <vcl/svapp.hxx>
83#include <vcl/unohelp.hxx>
84#include <vcl/weld.hxx>
85
86#include <ucbhelper/content.hxx>
88
89#include <string_view>
90#include <unordered_map>
91#include <vector>
92
93using namespace ::ucbhelper;
94using namespace ::com::sun::star::ucb;
95
96using namespace ::com::sun::star;
97using namespace ::com::sun::star::beans;
98using namespace ::com::sun::star::container;
99using namespace ::com::sun::star::frame;
100using namespace ::com::sun::star::i18n;
101using namespace ::com::sun::star::lang;
102using namespace ::com::sun::star::style;
103using namespace ::com::sun::star::text;
104using namespace ::com::sun::star::uno;
105using namespace ::com::sun::star::util;
106using namespace ::com::sun::star::view;
107using namespace ::com::sun::star::ui;
108
109using namespace ::comphelper;
110
111// defines ---------------------------------------------------------------
112
113constexpr OUStringLiteral CONFIGNAME_HELPWIN = u"OfficeHelp";
114constexpr OUStringLiteral CONFIGNAME_INDEXWIN = u"OfficeHelpIndex";
115constexpr OUStringLiteral CONFIGNAME_SEARCHPAGE = u"OfficeHelpSearch";
116constexpr OUStringLiteral IMAGE_URL = u"private:factory/";
117
118constexpr OUStringLiteral PROPERTY_KEYWORDLIST = u"KeywordList";
119constexpr OUStringLiteral PROPERTY_KEYWORDREF = u"KeywordRef";
120constexpr OUStringLiteral PROPERTY_ANCHORREF = u"KeywordAnchorForRef";
121constexpr OUStringLiteral PROPERTY_TITLEREF = u"KeywordTitleForRef";
122constexpr OUStringLiteral PROPERTY_TITLE = u"Title";
123constexpr OUStringLiteral HELP_URL = u"vnd.sun.star.help://";
124constexpr OUStringLiteral HELP_SEARCH_TAG = u"/?Query=";
125constexpr OUStringLiteral USERITEM_NAME = u"UserItem";
126
127constexpr OUStringLiteral PACKAGE_SETUP = u"/org.openoffice.Setup";
128constexpr OUStringLiteral PATH_OFFICE_FACTORIES = u"Office/Factories/";
129constexpr OUStringLiteral KEY_HELP_ON_OPEN = u"ooSetupFactoryHelpOnOpen";
130constexpr OUStringLiteral KEY_UI_NAME = u"ooSetupFactoryUIName";
131
132namespace sfx2
133{
134
135
146 static OUString PrepareSearchString( const OUString& rSearchString,
147 const Reference< XBreakIterator >& xBreak, bool bForSearch )
148 {
149 OUStringBuffer sSearchStr;
150 sal_Int32 nStartPos = 0;
151 const lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale();
152 Boundary aBoundary = xBreak->getWordBoundary(
153 rSearchString, nStartPos, aLocale, WordType::ANYWORD_IGNOREWHITESPACES, true );
154
155 while ( aBoundary.startPos < aBoundary.endPos )
156 {
157 nStartPos = aBoundary.endPos;
158 OUString sSearchToken( rSearchString.copy(
159 static_cast<sal_uInt16>(aBoundary.startPos), static_cast<sal_uInt16>(aBoundary.endPos) - static_cast<sal_uInt16>(aBoundary.startPos) ) );
160 if ( !sSearchToken.isEmpty() && ( sSearchToken.getLength() > 1 || sSearchToken[0] != '.' ) )
161 {
162 if ( bForSearch && sSearchToken[ sSearchToken.getLength() - 1 ] != '*' )
163 sSearchToken += "*";
164
165 if ( sSearchToken.getLength() > 1 ||
166 ( sSearchToken.getLength() > 0 && sSearchToken[ 0 ] != '*' ) )
167 {
168 if ( !sSearchStr.isEmpty() )
169 {
170 if ( bForSearch )
171 sSearchStr.append(" ");
172 else
173 sSearchStr.append("|");
174 }
175 sSearchStr.append(sSearchToken);
176 }
177 }
178 aBoundary = xBreak->nextWord( rSearchString, nStartPos,
179 aLocale, WordType::ANYWORD_IGNOREWHITESPACES );
180 }
181
182 return sSearchStr.makeStringAndClear();
183 }
184
185// namespace sfx2
186}
187
188
189// struct IndexEntry_Impl ------------------------------------------------
190
191namespace {
192
193struct IndexEntry_Impl
194{
195 bool m_bSubEntry;
196 OUString m_aURL;
197
198 IndexEntry_Impl( OUString aURL, bool bSubEntry ) :
199 m_bSubEntry( bSubEntry ), m_aURL(std::move( aURL )) {}
200};
201
202// struct ContentEntry_Impl ----------------------------------------------
203
204struct ContentEntry_Impl
205{
206 OUString aURL;
207 bool bIsFolder;
208
209 ContentEntry_Impl( OUString _aURL, bool bFolder ) :
210 aURL(std::move( _aURL )), bIsFolder( bFolder ) {}
211};
212
213}
214
216{
217 std::vector< OUString > aList =
218 SfxContentHelper::GetHelpTreeViewContents( "vnd.sun.star.hier://com.sun.star.help.TreeView/" );
219
220 for (const OUString & aRow : aList)
221 {
222 sal_Int32 nIdx = 0;
223 OUString aTitle = aRow.getToken( 0, '\t', nIdx );
224 OUString aURL = aRow.getToken( 0, '\t', nIdx );
225 sal_Unicode cFolder = o3tl::getToken(aRow, 0, '\t', nIdx )[0];
226 bool bIsFolder = ( '1' == cFolder );
227 OUString sId;
228 if (bIsFolder)
229 sId = weld::toId(new ContentEntry_Impl(aURL, true));
230 m_xContentBox->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, true, m_xScratchIter.get());
232 }
233}
234
236{
237 std::unique_ptr<weld::TreeIter> xEntry = m_xContentBox->make_iterator(pParent);
238 bool bEntry = m_xContentBox->iter_children(*xEntry);
239 while (bEntry)
240 {
241 ClearChildren(xEntry.get());
242 delete weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_id(*xEntry));
243 bEntry = m_xContentBox->iter_next_sibling(*xEntry);
244 }
245
246}
247
248IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool)
249{
250 ContentEntry_Impl* pContentEntry = weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_id(rIter));
251 if (!m_xContentBox->iter_has_child(rIter))
252 {
253 try
254 {
255 if (pContentEntry)
256 {
257 std::vector<OUString > aList = SfxContentHelper::GetHelpTreeViewContents(pContentEntry->aURL);
258
259 for (const OUString & aRow : aList)
260 {
261 sal_Int32 nIdx = 0;
262 OUString aTitle = aRow.getToken( 0, '\t', nIdx );
263 OUString aURL = aRow.getToken( 0, '\t', nIdx );
264 sal_Unicode cFolder = o3tl::getToken(aRow, 0, '\t', nIdx )[0];
265 bool bIsFolder = ( '1' == cFolder );
266 if ( bIsFolder )
267 {
268 OUString sId = weld::toId(new ContentEntry_Impl(aURL, true));
269 m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, true, m_xScratchIter.get());
270 m_xContentBox->set_image(*m_xScratchIter, aClosedBookImage);
271 }
272 else
273 {
274 Any aAny( ::utl::UCBContentHelper::GetProperty( aURL, "TargetURL" ) );
275 OUString sId;
276 OUString aTargetURL;
277 if ( aAny >>= aTargetURL )
278 sId = weld::toId(new ContentEntry_Impl(aTargetURL, false));
279 m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, false, m_xScratchIter.get());
280 m_xContentBox->set_image(*m_xScratchIter, aDocumentImage);
281 }
282 }
283 }
284 }
285 catch (const Exception&)
286 {
287 TOOLS_WARN_EXCEPTION( "sfx.appl", "ContentListBox_Impl::RequestingChildren(): unexpected exception" );
288 }
289 }
290
291 if (!pContentEntry || pContentEntry->bIsFolder)
292 m_xContentBox->set_image(rIter, aOpenBookImage);
293
294 return true;
295}
296
297IMPL_LINK(ContentTabPage_Impl, CollapsingHdl, const weld::TreeIter&, rIter, bool)
298{
299 ContentEntry_Impl* pContentEntry = weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_id(rIter));
300 if (!pContentEntry || pContentEntry->bIsFolder)
301 m_xContentBox->set_image(rIter, aClosedBookImage);
302
303 return true;
304}
305
307{
308 OUString aRet;
309 ContentEntry_Impl* pEntry = weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_selected_id());
310 if (pEntry && !pEntry->bIsFolder)
311 aRet = pEntry->aURL;
312 return aRet;
313}
314
315// class HelpTabPage_Impl ------------------------------------------------
317 const OUString& rID, const OUString& rUIXMLDescription)
318 : BuilderPage(pParent, nullptr, rUIXMLDescription, rID)
319 , m_pIdxWin(pIdxWin)
320{
321}
322
324{
325}
326
327// class ContentTabPage_Impl ---------------------------------------------
329 : HelpTabPage_Impl(pParent, pIdxWin, "HelpContentPage",
330 "sfx/ui/helpcontentpage.ui")
331 , m_xContentBox(m_xBuilder->weld_tree_view("content"))
332 , m_xScratchIter(m_xContentBox->make_iterator())
333 , aOpenBookImage(BMP_HELP_CONTENT_BOOK_OPEN)
334 , aClosedBookImage(BMP_HELP_CONTENT_BOOK_CLOSED)
335 , aDocumentImage(BMP_HELP_CONTENT_DOC)
336{
337 m_xContentBox->set_size_request(m_xContentBox->get_approximate_digit_width() * 30,
338 m_xContentBox->get_height_rows(20));
339 m_xContentBox->connect_row_activated(LINK(this, ContentTabPage_Impl, DoubleClickHdl));
340 m_xContentBox->connect_expanding(LINK(this, ContentTabPage_Impl, ExpandingHdl));
341 m_xContentBox->connect_collapsing(LINK(this, ContentTabPage_Impl, CollapsingHdl));
342
343 InitRoot();
344}
345
347{
348 aDoubleClickHdl.Call(nullptr);
349 return false;
350}
351
353{
354 aDoubleClickHdl = rLink;
355}
356
358{
359 std::unique_ptr<weld::TreeIter> xEntry = m_xContentBox->make_iterator();
360 bool bEntry = m_xContentBox->get_iter_first(*xEntry);
361 while (bEntry)
362 {
363 ClearChildren(xEntry.get());
364 delete weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_id(*xEntry));
365 bEntry = m_xContentBox->iter_next_sibling(*xEntry);
366 }
367}
368
370{
371 sal_Int32 nPos = m_xIndexList->find_text(m_xIndexEntry->get_text());
372 if (nPos == -1)
373 return;
374
375 sal_Int32 nOldPos = nPos;
376 OUString aEntryText;
377 IndexEntry_Impl* pEntry = weld::fromId<IndexEntry_Impl*>(m_xIndexList->get_id(nPos));
378 sal_Int32 nCount = m_xIndexList->n_children();
379 while ( nPos < nCount && ( !pEntry || pEntry->m_aURL.isEmpty() ) )
380 {
381 pEntry = weld::fromId<IndexEntry_Impl*>(m_xIndexList->get_id(++nPos));
382 aEntryText = m_xIndexList->get_text(nPos);
383 }
384
385 if ( nOldPos != nPos )
386 m_xIndexEntry->set_text(aEntryText);
387}
388
389// class IndexTabPage_Impl -----------------------------------------------
391 : HelpTabPage_Impl(pParent, pIdxWin, "HelpIndexPage", "sfx/ui/helpindexpage.ui")
392 , m_xIndexEntry(m_xBuilder->weld_entry("termentry"))
393 , m_xIndexList(m_xBuilder->weld_tree_view("termlist"))
394 , m_xOpenBtn(m_xBuilder->weld_button("display"))
395 , aFactoryIdle("sfx2 appl IndexTabPage_Impl Factory")
396 , aAutoCompleteIdle("sfx2 appl IndexTabPage_Impl AutoComplete")
397 , aKeywordTimer("sfx2::IndexTabPage_Impl aKeywordTimer")
398 , bIsActivated(false)
399 , nRowHeight(m_xIndexList->get_height_rows(1))
400 , nAllHeight(0)
401 , nLastCharCode(0)
402{
403 m_xIndexList->set_size_request(m_xIndexList->get_approximate_digit_width() * 30, -1);
404
405 m_xOpenBtn->connect_clicked(LINK(this, IndexTabPage_Impl, OpenHdl));
407 aAutoCompleteIdle.SetInvokeHandler( LINK(this, IndexTabPage_Impl, AutoCompleteHdl ));
409 m_xIndexList->connect_row_activated(LINK(this, IndexTabPage_Impl, DoubleClickHdl));
410 m_xIndexList->connect_changed(LINK(this, IndexTabPage_Impl, TreeChangeHdl));
411 m_xIndexList->connect_custom_get_size(LINK(this, IndexTabPage_Impl, CustomGetSizeHdl));
412 m_xIndexList->connect_custom_render(LINK(this, IndexTabPage_Impl, CustomRenderHdl));
413 m_xIndexList->set_column_custom_renderer(0, true);
414 m_xIndexList->connect_size_allocate(LINK(this, IndexTabPage_Impl, ResizeHdl));
415 m_xIndexEntry->connect_key_press(LINK(this, IndexTabPage_Impl, KeyInputHdl));
416 m_xIndexEntry->connect_changed(LINK(this, IndexTabPage_Impl, EntryChangeHdl));
417 m_xIndexEntry->connect_activate(LINK(this, IndexTabPage_Impl, ActivateHdl));
418}
419
420IMPL_LINK(IndexTabPage_Impl, ResizeHdl, const Size&, rSize, void)
421{
422 nAllHeight = rSize.Height();
423}
424
426{
427 return Size(m_xIndexList->get_size_request().Width(), nRowHeight);
428}
429
431{
432 vcl::RenderContext& rRenderContext = std::get<0>(aPayload);
433 const ::tools::Rectangle& rRect = std::get<1>(aPayload);
434 bool bSelected = std::get<2>(aPayload);
435 const OUString& rId = std::get<3>(aPayload);
436
437 rRenderContext.Push(vcl::PushFlags::TEXTCOLOR);
438 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
439 if (bSelected)
440 rRenderContext.SetTextColor(rStyleSettings.GetHighlightTextColor());
441 else
442 rRenderContext.SetTextColor(rStyleSettings.GetDialogTextColor());
443
444 Point aPos(rRect.TopLeft());
445 aPos.AdjustY((rRect.GetHeight() - rRenderContext.GetTextHeight()) / 2);
446
447 int nIndex = m_xIndexList->find_id(rId);
448 OUString aEntry(m_xIndexList->get_text(nIndex));
449
450 IndexEntry_Impl* pEntry = weld::fromId<IndexEntry_Impl*>(rId);
451 if (pEntry && pEntry->m_bSubEntry)
452 {
453 // indent sub entries
454 aPos.AdjustX(8);
455 sal_Int32 nPos = aEntry.indexOf(';');
456 rRenderContext.DrawText(aPos, (nPos !=-1) ? aEntry.copy(nPos + 1) : aEntry);
457 }
458 else
459 rRenderContext.DrawText(aPos, aEntry);
460
461 rRenderContext.Pop();
462}
463
465{
466 m_xIndexEntry->set_text(m_xIndexList->get_selected_text());
467}
468
470{
471 switch (nLastCharCode)
472 {
473 case css::awt::Key::DELETE_WORD_BACKWARD:
474 case css::awt::Key::DELETE_WORD_FORWARD:
475 case css::awt::Key::DELETE_TO_BEGIN_OF_LINE:
476 case css::awt::Key::DELETE_TO_END_OF_LINE:
477 case KEY_BACKSPACE:
478 case KEY_DELETE:
479 aAutoCompleteIdle.Stop();
480 break;
481 default:
482 aAutoCompleteIdle.Start();
483 break;
484 }
485}
486
487IMPL_LINK(IndexTabPage_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
488{
489 const vcl::KeyCode& rKCode = rKEvt.GetKeyCode();
490 if (rKCode.GetModifier()) // only with no modifiers held
491 return false;
492
493 sal_uInt16 nCode = rKCode.GetCode();
494
495 if (nCode == KEY_UP || nCode == KEY_PAGEUP ||
496 nCode == KEY_DOWN || nCode == KEY_PAGEDOWN)
497 {
498// disable_notify_events();
499 sal_Int32 nIndex = m_xIndexList->get_selected_index();
500 sal_Int32 nOrigIndex = nIndex;
501 sal_Int32 nCount = m_xIndexList->n_children();
502 if (nIndex == -1)
503 {
504 m_xIndexList->set_cursor(0);
505 m_xIndexList->select(0);
506 m_xIndexEntry->set_text(m_xIndexList->get_selected_text());
507 }
508 else
509 {
510 if (nCode == KEY_UP)
511 --nIndex;
512 else if (nCode == KEY_DOWN)
513 ++nIndex;
514 else if (nCode == KEY_PAGEUP)
515 {
516 int nVisRows = nAllHeight / nRowHeight;
517 nIndex -= nVisRows;
518 }
519 else if (nCode == KEY_PAGEDOWN)
520 {
521 int nVisRows = nAllHeight / nRowHeight;
522 nIndex += nVisRows;
523 }
524
525 if (nIndex < 0)
526 nIndex = 0;
527 if (nIndex >= nCount)
528 nIndex = nCount - 1;
529
530 if (nIndex != nOrigIndex)
531 {
532 m_xIndexList->set_cursor(nIndex);
533 m_xIndexList->select(nIndex);
534 m_xIndexEntry->set_text(m_xIndexList->get_selected_text());
535 }
536
537// m_xIndexList->grab_focus();
538// g_signal_emit_by_name(pWidget, "key-press-event", pEvent, &ret);
539// m_xIndexEntry->set_text(m_xIndexList->get_selected_text());
540// m_xIndexEntry->grab_focus();
541 }
542 m_xIndexEntry->select_region(0, -1);
543// enable_notify_events();
544// m_bTreeChange = true;
545// m_pEntry->fire_signal_changed();
546// m_bTreeChange = false;
547 return true;
548 }
549
550 nLastCharCode = nCode;
551 return false;
552}
553
555{
556 ClearIndex();
557}
558
559namespace sfx2 {
560
561 typedef std::unordered_map< OUString, int > KeywordInfo;
562}
563
565{
567
568 // By now more than 256 equal entries are not allowed
569 sal_Unicode append[256];
570 for(sal_Unicode & k : append)
571 k = ' ';
572
573 sfx2::KeywordInfo aInfo;
574 m_xIndexList->freeze();
575
576 try
577 {
578 OUStringBuffer aURL(HELP_URL + sFactory);
579 AppendConfigToken(aURL, true);
580
581 Content aCnt( aURL.makeStringAndClear(), Reference< css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
582 css::uno::Reference< css::beans::XPropertySetInfo > xInfo = aCnt.getProperties();
583 if ( xInfo->hasPropertyByName( PROPERTY_ANCHORREF ) )
584 {
585 css::uno::Sequence< OUString > aPropSeq{ PROPERTY_KEYWORDLIST, PROPERTY_KEYWORDREF,
587
588 // abi: use one possibly remote call only
589 css::uno::Sequence< css::uno::Any > aAnySeq =
590 aCnt.getPropertyValues( aPropSeq );
591
592 css::uno::Sequence< OUString > aKeywordList;
593 css::uno::Sequence< css::uno::Sequence< OUString > > aKeywordRefList;
594 css::uno::Sequence< css::uno::Sequence< OUString > > aAnchorRefList;
595 css::uno::Sequence< css::uno::Sequence< OUString > > aTitleRefList;
596
597 if ( ( aAnySeq[0] >>= aKeywordList ) && ( aAnySeq[1] >>= aKeywordRefList ) &&
598 ( aAnySeq[2] >>= aAnchorRefList ) && ( aAnySeq[3] >>= aTitleRefList ) )
599 {
600 int ndx,tmp;
601 OUString aIndex, aTempString;
602 sfx2::KeywordInfo::iterator it;
603
604 for ( int i = 0; i < aKeywordList.getLength(); ++i )
605 {
606 // abi: Do not copy, but use references
607 const OUString& aKeywordPair = aKeywordList[i];
608 DBG_ASSERT( !aKeywordPair.isEmpty(), "invalid help index" );
609 const css::uno::Sequence< OUString >& aRefList = aKeywordRefList[i];
610 const css::uno::Sequence< OUString >& aAnchorList = aAnchorRefList[i];
611 const css::uno::Sequence< OUString >& aTitleList = aTitleRefList[i];
612
613 DBG_ASSERT( aRefList.getLength() == aAnchorList.getLength(),"reference list and title list of different length" );
614
615 ndx = aKeywordPair.indexOf( ';' );
616 const bool insert = ndx != -1;
617
618 OUString sId;
619
620 if ( insert )
621 {
622 aTempString = aKeywordPair.copy( 0, ndx );
623 if ( aIndex != aTempString )
624 {
625 aIndex = aTempString;
626 it = aInfo.emplace(aTempString, 0).first;
627 sId = weld::toId(new IndexEntry_Impl(OUString(), false));
628 if ( (tmp = it->second++) != 0)
629 m_xIndexList->append(
630 sId, aTempString + std::u16string_view(append, tmp));
631 else
632 m_xIndexList->append(sId, aTempString);
633 }
634 }
635 else
636 aIndex.clear();
637
638 sal_uInt32 nRefListLen = aRefList.getLength();
639
640 DBG_ASSERT( aAnchorList.hasElements(), "*IndexTabPage_Impl::InitializeIndex(): AnchorList is empty!" );
641 DBG_ASSERT( nRefListLen, "*IndexTabPage_Impl::InitializeIndex(): RefList is empty!" );
642
643 if ( aAnchorList.hasElements() && nRefListLen )
644 {
645 if ( aAnchorList[0].getLength() > 0 )
646 {
647 sId = weld::toId(new IndexEntry_Impl(aRefList[0] + "#" + aAnchorList[0], insert));
648 }
649 else
650 sId = weld::toId(new IndexEntry_Impl(aRefList[0], insert));
651 }
652
653 // Assume the token is trimmed
654 it = aInfo.emplace(aKeywordPair, 0).first;
655 if ((tmp = it->second++) != 0)
656 m_xIndexList->append(sId, aKeywordPair + std::u16string_view(append, tmp));
657 else
658 m_xIndexList->append(sId, aKeywordPair);
659
660 for ( sal_uInt32 j = 1; j < nRefListLen ; ++j )
661 {
662 aTempString = aKeywordPair + " - " + aTitleList[j];
663
664 if ( aAnchorList[j].getLength() > 0 )
665 sId = weld::toId(new IndexEntry_Impl(aRefList[j] + "#" + aAnchorList[j], insert));
666 else
667 sId = weld::toId(new IndexEntry_Impl(aRefList[j], insert));
668
669 it = aInfo.emplace(aTempString, 0).first;
670 if ( (tmp = it->second++) != 0 )
671 m_xIndexList->append(
672 sId, aTempString + std::u16string_view(append, tmp));
673 else
674 m_xIndexList->append(sId, aTempString);
675 }
676 }
677 }
678 }
679 }
680 catch( Exception& )
681 {
682 TOOLS_WARN_EXCEPTION( "sfx.appl", "IndexTabPage_Impl::InitializeIndex(): unexpected exception" );
683 }
684
685 m_xIndexList->thaw();
686
687 if ( !sKeyword.isEmpty() )
688 aKeywordLink.Call( *this );
689}
690
692{
693 const sal_Int32 nCount = m_xIndexList->n_children();
694 for ( sal_Int32 i = 0; i < nCount; ++i )
695 delete weld::fromId<IndexEntry_Impl*>(m_xIndexList->get_id(i));
696 m_xIndexList->clear();
697}
698
700{
701 aDoubleClickHdl.Call(nullptr);
702}
703
705{
706 aDoubleClickHdl.Call(nullptr);
707 return true;
708}
709
711{
712 aDoubleClickHdl.Call(nullptr);
713 return true;
714}
715
717{
718 InitializeIndex();
719}
720
721int IndexTabPage_Impl::starts_with(const OUString& rStr, int nStartRow, bool bCaseSensitive)
722{
724
725 int nRet = nStartRow;
726 int nCount = m_xIndexList->n_children();
727 while (nRet < nCount)
728 {
729 OUString aStr(m_xIndexList->get_text(nRet));
730 const bool bMatch = !bCaseSensitive ? rI18nHelper.MatchString(rStr, aStr) : aStr.startsWith(rStr);
731 if (bMatch)
732 return nRet;
733 ++nRet;
734 }
735
736 return -1;
737}
738
739IMPL_LINK_NOARG(IndexTabPage_Impl, AutoCompleteHdl, Timer*, void)
740{
741 OUString aStartText = m_xIndexEntry->get_text();
742 int nStartPos, nEndPos;
743 m_xIndexEntry->get_selection_bounds(nStartPos, nEndPos);
744 int nMaxSelection = std::max(nStartPos, nEndPos);
745 if (nMaxSelection != aStartText.getLength())
746 return;
747
748 int nActive = m_xIndexList->get_selected_index();
749 int nStart = nActive;
750
751 if (nStart == -1)
752 nStart = 0;
753
754 // Try match case insensitive from current position
755 int nPos = starts_with(aStartText, nStart, false);
756 if (nPos == -1 && nStart != 0)
757 {
758 // Try match case insensitive, but from start
759 nPos = starts_with(aStartText, 0, false);
760 }
761
762 if (nPos == -1)
763 {
764 // Try match case sensitive from current position
765 nPos = starts_with(aStartText, nStart, true);
766 if (nPos == -1 && nStart != 0)
767 {
768 // Try match case sensitive, but from start
769 nPos = starts_with(aStartText, 0, true);
770 }
771 }
772
773 if (nPos != -1)
774 {
775 m_xIndexList->set_cursor(nPos);
776 m_xIndexList->select(nPos);
777 OUString aText = m_xIndexList->get_text(nPos);
778 if (aText != aStartText)
779 m_xIndexEntry->set_text(aText);
780 m_xIndexEntry->select_region(aText.getLength(), aStartText.getLength());
781 }
782}
783
784IMPL_LINK( IndexTabPage_Impl, TimeoutHdl, Timer*, pTimer, void)
785{
786 if(&aKeywordTimer == pTimer && !sKeyword.isEmpty())
787 aKeywordLink.Call(*this);
788}
789
791{
792 if ( !bIsActivated )
793 {
794 bIsActivated = true;
796 }
797}
798
800{
801 aDoubleClickHdl = rLink;
802}
803
804void IndexTabPage_Impl::SetFactory( const OUString& rFactory )
805{
806 OUString sNewFactory( rFactory );
807 DBG_ASSERT( !sNewFactory.isEmpty(), "empty factory" );
808 bool bValid = m_pIdxWin->IsValidFactory( rFactory );
809
810 if ( sFactory.isEmpty() && !bValid )
811 {
812 sNewFactory = SfxHelp::GetDefaultHelpModule();
813 bValid = true;
814 }
815
816 if ( sNewFactory != sFactory && bValid )
817 {
818 sFactory = sNewFactory;
819 ClearIndex();
820 if ( bIsActivated )
822 }
823}
824
826{
827 OUString aRet;
828 IndexEntry_Impl* pEntry = weld::fromId<IndexEntry_Impl*>(m_xIndexList->get_id(m_xIndexList->find_text(m_xIndexEntry->get_text())));
829 if (pEntry)
830 aRet = pEntry->m_aURL;
831 return aRet;
832}
833
834void IndexTabPage_Impl::SetKeyword( const OUString& rKeyword )
835{
836 sKeyword = rKeyword;
837
838 if (m_xIndexList->n_children() > 0)
840 else if ( !bIsActivated )
842}
843
844
846{
847 bool bRet = false;
848 if ( !sKeyword.isEmpty() )
849 {
850 sal_Int32 nPos = m_xIndexList->find_text( sKeyword );
851 bRet = nPos != -1;
852 }
853
854 return bRet;
855}
856
857
859{
860 bool bRet = false;
861 if ( !sKeyword.isEmpty() )
862 {
863 sal_Int32 nEntries = m_xIndexList->n_children();
865 for ( sal_Int32 n = 0; n < nEntries; n++)
866 {
867 const OUString sIndexItem {m_xIndexList->get_text(n)};
868 if (rI18nHelper.MatchString( sIndexItem, sKeyword ))
869 {
870 sKeyword = sIndexItem;
871 bRet = true;
872 }
873 }
874 }
875
876 return bRet;
877}
878
880{
881 if ( !sKeyword.isEmpty() )
882 {
883 m_xIndexEntry->set_text(sKeyword);
884 aDoubleClickHdl.Call(nullptr);
885 sKeyword.clear();
886 }
887}
888
890{
891 Search();
892 return true;
893}
894
895// class SearchTabPage_Impl ----------------------------------------------
896
898 : HelpTabPage_Impl(pParent, pIdxWin, "HelpSearchPage",
899 "sfx/ui/helpsearchpage.ui")
900 , m_xSearchED(m_xBuilder->weld_combo_box("search"))
901 , m_xSearchBtn(m_xBuilder->weld_button("find"))
902 , m_xFullWordsCB(m_xBuilder->weld_check_button("completewords"))
903 , m_xScopeCB(m_xBuilder->weld_check_button("headings"))
904 , m_xResultsLB(m_xBuilder->weld_tree_view("results"))
905 , m_xOpenBtn(m_xBuilder->weld_button("display"))
906 , xBreakIterator(vcl::unohelper::CreateBreakIterator())
907{
908 m_xResultsLB->set_size_request(m_xResultsLB->get_approximate_digit_width() * 30,
909 m_xResultsLB->get_height_rows(15));
910
911 m_xSearchBtn->connect_clicked(LINK(this, SearchTabPage_Impl, ClickHdl));
912 m_xSearchED->connect_changed(LINK(this, SearchTabPage_Impl, ModifyHdl));
913 m_xSearchED->connect_entry_activate(LINK(this, SearchTabPage_Impl, ActivateHdl));
914 m_xOpenBtn->connect_clicked(LINK(this, SearchTabPage_Impl, OpenHdl));
915 m_xResultsLB->connect_row_activated(LINK(this, SearchTabPage_Impl, DoubleClickHdl));
916
917 SvtViewOptions aViewOpt( EViewType::TabPage, CONFIGNAME_SEARCHPAGE );
918 if ( aViewOpt.Exists() )
919 {
920 OUString aUserData;
921 Any aUserItem = aViewOpt.GetUserItem( USERITEM_NAME );
922 if ( aUserItem >>= aUserData )
923 {
924 sal_Int32 nIdx {0};
925 bool bChecked = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx)) == 1;
926 m_xFullWordsCB->set_active(bChecked);
927 bChecked = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx)) == 1;
928 m_xScopeCB->set_active(bChecked);
929
930 while ( nIdx > 0 )
931 {
933 o3tl::getToken(aUserData, 0, ';', nIdx),
935 }
936 }
937 }
938
939 ModifyHdl(*m_xSearchED);
940}
941
943{
944 SvtViewOptions aViewOpt( EViewType::TabPage, CONFIGNAME_SEARCHPAGE );
945 OUStringBuffer aUserData =
946 OUString::number(m_xFullWordsCB->get_active() ? 1 : 0) +
947 ";" +
948 OUString::number(m_xScopeCB->get_active() ? 1 : 0);
949 sal_Int32 nCount = std::min(m_xSearchED->get_count(), 10); // save only 10 entries
950
951 for ( sal_Int32 i = 0; i < nCount; ++i )
952 {
953 aUserData.append(";" +
955 m_xSearchED->get_text(i),
958 }
959
960 Any aUserItem( aUserData.makeStringAndClear() );
961 aViewOpt.SetUserItem( USERITEM_NAME, aUserItem );
962
963 m_xSearchED.reset();
964 m_xSearchBtn.reset();
965 m_xFullWordsCB.reset();
966 m_xScopeCB.reset();
967 m_xResultsLB.reset();
968 m_xOpenBtn.reset();
969}
970
972{
973 m_xResultsLB->clear();
974}
975
976void SearchTabPage_Impl::RememberSearchText( const OUString& rSearchText )
977{
978 for (sal_Int32 i = 0, nEntryCount = m_xSearchED->get_count(); i < nEntryCount; ++i)
979 {
980 if (rSearchText == m_xSearchED->get_text(i))
981 {
982 m_xSearchED->remove(i);
983 break;
984 }
985 }
986
987 m_xSearchED->insert_text(0, rSearchText);
988}
989
991{
992 Search();
993}
994
996{
997 OUString aSearchText = comphelper::string::strip(m_xSearchED->get_active_text(), ' ');
998 if ( aSearchText.isEmpty() )
999 return;
1000
1001 std::unique_ptr<weld::WaitObject> xWaitCursor(new weld::WaitObject(m_pIdxWin->GetFrameWeld()));
1003 RememberSearchText( aSearchText );
1004 OUStringBuffer aSearchURL(HELP_URL + aFactory + HELP_SEARCH_TAG);
1005 if (!m_xFullWordsCB->get_active())
1006 aSearchText = sfx2::PrepareSearchString( aSearchText, xBreakIterator, true );
1007 aSearchURL.append(aSearchText);
1008 AppendConfigToken(aSearchURL, false);
1009 if (m_xScopeCB->get_active())
1010 aSearchURL.append("&Scope=Heading");
1011 std::vector< OUString > aFactories = SfxContentHelper::GetResultSet(aSearchURL.makeStringAndClear());
1012 for (const OUString & rRow : aFactories)
1013 {
1014 sal_Int32 nIdx = 0;
1015 OUString aTitle = rRow.getToken(0, '\t', nIdx);
1016 OUString sURL(rRow.getToken(1, '\t', nIdx));
1017 m_xResultsLB->append(sURL, aTitle);
1018 }
1019 xWaitCursor.reset();
1020
1021 if ( aFactories.empty() )
1022 {
1023 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xContainer.get(),
1024 VclMessageType::Info, VclButtonsType::Ok,
1025 SfxResId(STR_INFO_NOSEARCHRESULTS)));
1026 xBox->run();
1027 }
1028}
1029
1031{
1032 aDoubleClickHdl.Call(nullptr);
1033}
1034
1035IMPL_LINK(SearchTabPage_Impl, ModifyHdl, weld::ComboBox&, rComboBox, void)
1036{
1037 OUString aSearchText = comphelper::string::strip(m_xSearchED->get_active_text(), ' ');
1038 m_xSearchBtn->set_sensitive(!aSearchText.isEmpty());
1039
1040 if (rComboBox.changed_by_direct_pick())
1041 Search();
1042}
1043
1045{
1046 aDoubleClickHdl.Call(nullptr);
1047 return true;
1048}
1049
1051{
1052 aDoubleClickHdl = rLink;
1053}
1054
1056{
1057 return m_xResultsLB->get_selected_id();
1058}
1059
1061{
1063 m_xSearchED->set_entry_text(OUString());
1064}
1065
1066bool SearchTabPage_Impl::OpenKeyword( const OUString& rKeyword )
1067{
1068 bool bRet = false;
1069 m_xSearchED->set_entry_text(rKeyword);
1070 Search();
1071 if (m_xResultsLB->n_children() > 0)
1072 {
1073 // found keyword -> open it
1074 m_xResultsLB->select(0);
1075 OpenHdl(*m_xOpenBtn);
1076 bRet = true;
1077 }
1078 return bRet;
1079}
1080
1081// class BookmarksTabPage_Impl -------------------------------------------
1082
1083void BookmarksTabPage_Impl::DoAction(std::u16string_view rAction)
1084{
1085 if (rAction == u"display")
1086 aDoubleClickHdl.Call(nullptr);
1087 else if (rAction == u"rename")
1088 {
1089 sal_Int32 nPos = m_xBookmarksBox->get_selected_index();
1090 if (nPos != -1)
1091 {
1093 aDlg.SetTitle(m_xBookmarksBox->get_text(nPos));
1094 if (aDlg.run() == RET_OK)
1095 {
1096 OUString sURL = m_xBookmarksBox->get_id(nPos);
1097 m_xBookmarksBox->remove(nPos);
1098 m_xBookmarksBox->append(sURL, aDlg.GetTitle(),
1100 m_xBookmarksBox->select(m_xBookmarksBox->n_children() - 1);
1101 }
1102 }
1103 }
1104 else if (rAction == u"delete")
1105 {
1106 sal_Int32 nPos = m_xBookmarksBox->get_selected_index();
1107 if (nPos != -1)
1108 {
1109 m_xBookmarksBox->remove(nPos);
1110 const sal_Int32 nCount = m_xBookmarksBox->n_children();
1111 if (nCount)
1112 {
1113 if (nPos >= nCount)
1114 nPos = nCount - 1;
1115 m_xBookmarksBox->select(nPos);
1116 }
1117 }
1118 }
1119}
1120
1121IMPL_LINK(BookmarksTabPage_Impl, CommandHdl, const CommandEvent&, rCEvt, bool)
1122{
1123 if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
1124 return false;
1125
1126 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xBookmarksBox.get(), "sfx/ui/bookmarkmenu.ui"));
1127 std::unique_ptr<weld::Menu> xMenu = xBuilder->weld_menu("menu");
1128
1129 OUString sIdent = xMenu->popup_at_rect(m_xBookmarksBox.get(), ::tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
1130 if (!sIdent.isEmpty())
1131 DoAction(sIdent);
1132 return true;
1133}
1134
1135IMPL_LINK(BookmarksTabPage_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
1136{
1137 bool bHandled = false;
1138 sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
1139 if (KEY_DELETE == nCode && m_xBookmarksBox->n_children() > 0)
1140 {
1141 DoAction(u"delete");
1142 bHandled = true;
1143 }
1144 return bHandled;
1145}
1146
1147// class BookmarksTabPage_Impl -------------------------------------------
1149 : HelpTabPage_Impl(pParent, _pIdxWin, "HelpBookmarkPage",
1150 "sfx/ui/helpbookmarkpage.ui")
1151 , m_xBookmarksBox(m_xBuilder->weld_tree_view("bookmarks"))
1152 , m_xBookmarksPB(m_xBuilder->weld_button("display"))
1153{
1154 m_xBookmarksBox->set_size_request(m_xBookmarksBox->get_approximate_digit_width() * 30,
1155 m_xBookmarksBox->get_height_rows(20));
1156
1157 m_xBookmarksPB->connect_clicked( LINK(this, BookmarksTabPage_Impl, OpenHdl));
1158 m_xBookmarksBox->connect_row_activated(LINK(this, BookmarksTabPage_Impl, DoubleClickHdl));
1159 m_xBookmarksBox->connect_popup_menu(LINK(this, BookmarksTabPage_Impl, CommandHdl));
1160 m_xBookmarksBox->connect_key_press(LINK(this, BookmarksTabPage_Impl, KeyInputHdl));
1161
1162 // load bookmarks from configuration
1163 const std::vector< SvtHistoryOptions::HistoryItem > aBookmarkSeq = SvtHistoryOptions::GetList( EHistoryType::HelpBookmarks );
1164 for ( const auto& rBookmark : aBookmarkSeq )
1165 {
1166 AddBookmarks( rBookmark.sTitle, rBookmark.sURL );
1167 }
1168}
1169
1171{
1172 // save bookmarks to configuration
1173 SvtHistoryOptions::Clear( EHistoryType::HelpBookmarks );
1174 const sal_Int32 nCount = m_xBookmarksBox->n_children();
1175 for (sal_Int32 i = 0; i < nCount; ++i)
1176 {
1177 SvtHistoryOptions::AppendItem(EHistoryType::HelpBookmarks, m_xBookmarksBox->get_id(i), "",
1178 m_xBookmarksBox->get_text(i), std::nullopt, std::nullopt);
1179 }
1180
1181 m_xBookmarksBox.reset();
1182 m_xBookmarksPB.reset();
1183}
1184
1186{
1187 aDoubleClickHdl.Call(nullptr);
1188}
1189
1191{
1192 aDoubleClickHdl.Call(nullptr);
1193 return true;
1194}
1195
1197{
1198 aDoubleClickHdl = rLink;
1199}
1200
1202{
1203 return m_xBookmarksBox->get_selected_id();
1204}
1205
1206void BookmarksTabPage_Impl::AddBookmarks(const OUString& rTitle, const OUString& rURL)
1207{
1208 const OUString aImageURL {IMAGE_URL + INetURLObject(rURL).GetHost()};
1209 m_xBookmarksBox->append(rURL, rTitle, SvFileInformationManager::GetImageId(INetURLObject(aImageURL)));
1210}
1211
1212OUString SfxHelpWindow_Impl::buildHelpURL(std::u16string_view sFactory ,
1213 std::u16string_view sContent ,
1214 std::u16string_view sAnchor)
1215{
1216 OUStringBuffer sHelpURL(256);
1217 sHelpURL.append(HELP_URL + sFactory + sContent);
1218 AppendConfigToken(sHelpURL, true/*bUseQuestionMark*/);
1219 if (!sAnchor.empty())
1220 sHelpURL.append(sAnchor);
1221 return sHelpURL.makeStringAndClear();
1222}
1223
1224void SfxHelpWindow_Impl::loadHelpContent(const OUString& sHelpURL, bool bAddToHistory)
1225{
1226 Reference< XComponentLoader > xLoader(getTextFrame(), UNO_QUERY);
1227 if (!xLoader.is())
1228 return;
1229
1230 // If a print job runs do not open a new page
1231 Reference< XFrame2 > xTextFrame = pTextWin->getFrame();
1232 Reference< XController > xTextController ;
1233 if (xTextFrame.is())
1234 xTextController = xTextFrame->getController ();
1235 if ( xTextController.is() && !xTextController->suspend( true ) )
1236 {
1237 xTextController->suspend( false );
1238 return;
1239 }
1240
1241 // save url to history
1242 if (bAddToHistory)
1243 pHelpInterceptor->addURL(sHelpURL);
1244
1245 if ( !IsWait() )
1246 EnterWait();
1247 bool bSuccess = false;
1248// TODO implement locale fallback ... see below while(true)
1249 {
1250 try
1251 {
1252 Reference< XComponent > xContent = xLoader->loadComponentFromURL(sHelpURL, "_self", 0, Sequence< PropertyValue >());
1253 if (xContent.is())
1254 {
1255 bSuccess = true;
1256 }
1257 }
1258 catch(const RuntimeException&)
1259 { throw; }
1260 catch(const Exception&)
1261 { /*break;*/ }
1262
1263 /* TODO try next locale ...
1264 no further locale available? => break loop and show error page
1265 */
1266 }
1267 openDone(sHelpURL, bSuccess);
1268 if ( IsWait() )
1269 LeaveWait();
1270}
1271
1272IMPL_LINK(SfxHelpIndexWindow_Impl, ActivatePageHdl, const OUString&, rPage, void)
1273{
1274 GetPage(rPage)->Activate();
1275}
1276
1278 : m_xBuilder(Application::CreateBuilder(pContainer, "sfx/ui/helpcontrol.ui"))
1279 , m_xContainer(m_xBuilder->weld_container("HelpControl"))
1280 , m_xActiveLB(m_xBuilder->weld_combo_box("active"))
1281 , m_xTabCtrl(m_xBuilder->weld_notebook("tabcontrol"))
1282 , aIdle("sfx2 appl SfxHelpIndexWindow_Impl")
1283 , aIndexKeywordLink(LINK(this, SfxHelpIndexWindow_Impl, KeywordHdl))
1284 , pParentWin(_pParent)
1285 , bIsInitDone(false)
1286{
1287 // create the pages
1289 GetIndexPage();
1290 GetSearchPage();
1292
1293 OUString sPageId("index");
1294 SvtViewOptions aViewOpt( EViewType::TabDialog, CONFIGNAME_INDEXWIN );
1295 if ( aViewOpt.Exists() )
1296 {
1297 OUString sSavedPageId = aViewOpt.GetPageID();
1298 if (m_xTabCtrl->get_page_index(sSavedPageId) != -1)
1299 sPageId = sSavedPageId;
1300 }
1301 m_xTabCtrl->set_current_page(sPageId);
1302 ActivatePageHdl(sPageId);
1303 m_xActiveLB->connect_changed(LINK(this, SfxHelpIndexWindow_Impl, SelectHdl));
1304
1305 m_xTabCtrl->connect_enter_page(LINK(this, SfxHelpIndexWindow_Impl, ActivatePageHdl));
1306
1308 aIdle.Start();
1309
1310 m_xContainer->show();
1311}
1312
1314{
1315 SvtViewOptions aViewOpt(EViewType::TabDialog, CONFIGNAME_INDEXWIN);
1316 aViewOpt.SetPageID(m_xTabCtrl->get_current_page_ident());
1317
1318 xCPage.reset();
1319 xIPage.reset();
1320 xSPage.reset();
1321 xBPage.reset();
1322}
1323
1325{
1326 OUStringBuffer aHelpURL(HELP_URL);
1327 AppendConfigToken(aHelpURL, true);
1328 std::vector<OUString> aFactories = SfxContentHelper::GetResultSet(aHelpURL.makeStringAndClear());
1329 for (const OUString & rRow : aFactories)
1330 {
1331 sal_Int32 nIdx = 0;
1332 OUString aTitle = rRow.getToken( 0, '\t', nIdx ); // token 0
1333 std::u16string_view aURL = o3tl::getToken(rRow, 1, '\t', nIdx ); // token 2
1334 OUString aFactory(INetURLObject(aURL).GetHost());
1335 m_xActiveLB->append(aFactory, aTitle);
1336 }
1337
1338 if (m_xActiveLB->get_active() == -1)
1340}
1341
1343{
1344 DBG_ASSERT( xIPage, "index page not initialized" );
1345 if (!bIsInitDone && !m_xActiveLB->get_count())
1346 {
1347 aIdle.Stop();
1348 InitHdl( nullptr );
1349 }
1350
1351 for (sal_Int32 i = 0, nEntryCount = m_xActiveLB->get_count(); i < nEntryCount; ++i)
1352 {
1353 OUString aFactory = m_xActiveLB->get_id(i);
1354 aFactory = aFactory.toAsciiLowerCase();
1355 if (aFactory == xIPage->GetFactory())
1356 {
1357 if (m_xActiveLB->get_active() != i)
1358 {
1359 m_xActiveLB->set_active(i);
1360 aSelectFactoryLink.Call(nullptr);
1361 }
1362 break;
1363 }
1364 }
1365}
1366
1368{
1369 HelpTabPage_Impl* pPage = nullptr;
1370
1371 if (rName == u"contents")
1372 pPage = GetContentPage();
1373 else if (rName == u"index")
1374 pPage = GetIndexPage();
1375 else if (rName == u"find")
1376 pPage = GetSearchPage();
1377 else if (rName == u"bookmarks")
1378 pPage = GetBookmarksPage();
1379
1380 assert(pPage && "SfxHelpIndexWindow_Impl::GetCurrentPage(): no current page");
1381
1382 return pPage;
1383}
1384
1386{
1387 aIdle.Start();
1388}
1389
1391{
1392 bIsInitDone = true;
1393 Initialize();
1394
1395 // now use the timer for selection
1396 aIdle.SetInvokeHandler( LINK( this, SfxHelpIndexWindow_Impl, SelectFactoryHdl ) );
1397 aIdle.SetPriority( TaskPriority::LOWEST );
1398}
1399
1401{
1402 OUString aFactory = m_xActiveLB->get_active_id();
1403 if (!aFactory.isEmpty())
1404 {
1405 SetFactory(aFactory.toAsciiLowerCase(), false);
1406 aSelectFactoryLink.Call(this);
1407 }
1408}
1409
1411{
1412 // keyword found on index?
1413 bool bIndex = xIPage->HasKeyword();
1414
1415 if( !bIndex)
1416 bIndex = xIPage->HasKeywordIgnoreCase();
1417 // then set index or search page as current.
1418 OUString sPageId = bIndex ? OUString("index") : OUString("find");
1419 if (sPageId != m_xTabCtrl->get_current_page_ident())
1420 m_xTabCtrl->set_current_page(sPageId);
1421
1422 // at last we open the keyword
1423 if ( bIndex )
1424 xIPage->OpenKeyword();
1425 else if ( !xSPage->OpenKeyword( sKeyword ) )
1426 pParentWin->ShowStartPage();
1427}
1428
1429IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, IndexTabPageDoubleClickHdl, LinkParamNone*, void)
1430{
1431 aPageDoubleClickLink.Call(nullptr);
1432}
1433
1435{
1436 aPageDoubleClickLink = rLink;
1437}
1438
1439IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, ContentTabPageDoubleClickHdl, LinkParamNone*, void)
1440{
1441 aPageDoubleClickLink.Call(nullptr);
1442}
1443
1445{
1446 aPageDoubleClickLink.Call(nullptr);
1447}
1448
1449void SfxHelpIndexWindow_Impl::SetFactory( const OUString& rFactory, bool bActive )
1450{
1451 if ( !rFactory.isEmpty() )
1452 {
1453 GetIndexPage()->SetFactory( rFactory );
1454 // the index page made a check if rFactory is valid,
1455 // so the index page always returns a valid factory
1457 if ( bActive )
1459 }
1460}
1461
1463{
1464 OUString sRet;
1465
1466 OUString sName(m_xTabCtrl->get_current_page_ident());
1467
1468 if (sName == "contents")
1469 {
1470 sRet = xCPage->GetSelectedEntry();
1471 }
1472 else if (sName == "index")
1473 {
1474 sRet = xIPage->GetSelectedEntry();
1475 }
1476 else if (sName == "find")
1477 {
1478 sRet = xSPage->GetSelectedEntry();
1479 }
1480 else if (sName == "bookmarks")
1481 {
1482 sRet = xBPage->GetSelectedEntry();
1483 }
1484
1485 return sRet;
1486}
1487
1488void SfxHelpIndexWindow_Impl::AddBookmarks( const OUString& rTitle, const OUString& rURL )
1489{
1490 GetBookmarksPage()->AddBookmarks( rTitle, rURL );
1491}
1492
1493bool SfxHelpIndexWindow_Impl::IsValidFactory( std::u16string_view _rFactory )
1494{
1495 bool bValid = false;
1496 for (sal_Int32 i = 0, nEntryCount = m_xActiveLB->get_count(); i < nEntryCount; ++i)
1497 {
1498 OUString aFactory = m_xActiveLB->get_id(i);
1499 if (aFactory == _rFactory)
1500 {
1501 bValid = true;
1502 break;
1503 }
1504 }
1505 return bValid;
1506}
1507
1509{
1510 if ( xSPage )
1511 xSPage->ClearPage();
1512}
1513
1515{
1516 OUString sName(m_xTabCtrl->get_current_page_ident());
1517
1518 if (sName == "contents" && xCPage)
1519 xCPage->SetFocusOnBox();
1520 else if (sName == "index" && xIPage)
1521 xIPage->SetFocusOnBox();
1522 else if (sName == "find" && xSPage)
1523 xSPage->SetFocusOnBox();
1524 else if (sName == "bookmarks" && xBPage)
1525 xBPage->SetFocusOnBox();
1526}
1527
1529{
1530 bool bRet = false;
1531 OUString sName(m_xTabCtrl->get_current_page_ident());
1532 if (sName == "index" && xIPage)
1533 bRet = xIPage->HasFocusOnEdit();
1534 else if (sName == "find" && xSPage)
1535 bRet = xSPage->HasFocusOnEdit();
1536 return bRet;
1537}
1538
1540{
1541 OUString sRet;
1542 OUString sName(m_xTabCtrl->get_current_page_ident());
1543 if (sName == "find" && xSPage)
1544 sRet = xSPage->GetSearchText();
1545 return sRet;
1546}
1547
1549{
1550 bool bRet = false;
1551 OUString sName(m_xTabCtrl->get_current_page_ident());
1552 if (sName == "find" && xSPage)
1553 bRet = xSPage->IsFullWordSearch();
1554 return bRet;
1555}
1556
1557void SfxHelpIndexWindow_Impl::OpenKeyword( const OUString& rKeyword )
1558{
1559 sKeyword = rKeyword;
1560 DBG_ASSERT( xIPage, "invalid index page" );
1561 xIPage->SetKeyword( sKeyword );
1562}
1563
1565{
1566 OUString sName(m_xTabCtrl->get_current_page_ident());
1567 if (sName == "index" && xIPage )
1568 xIPage->SelectExecutableEntry();
1569}
1570
1572{
1573 return pParentWin->GetFrameWeld();
1574}
1575
1576// class TextWin_Impl ----------------------------------------------------
1578{
1579}
1580
1582{
1583 if( ( rNEvt.GetType() == NotifyEventType::KEYINPUT ) && rNEvt.GetKeyEvent()->GetKeyCode().GetCode() == KEY_TAB )
1584 return GetParent()->EventNotify( rNEvt );
1585 else
1586 return DockingWindow::EventNotify( rNEvt );
1587}
1588
1589
1590// remove docking area acceptor from layoutmanager, so it will not layout anything further .-)
1591static void lcl_disableLayoutOfFrame(const Reference< XFrame2 >& xFrame)
1592{
1593 xFrame->setLayoutManager( Reference< XLayoutManager >() );
1594}
1595
1596// class SfxHelpTextWindow_Impl ------------------------------------------
1597
1599
1601
1602 xToolBox ( rBuilder.weld_toolbar("toolbar") ),
1603 xOnStartupCB ( rBuilder.weld_check_button("checkbutton") ),
1604 xMenu ( rBuilder.weld_menu("menu") ),
1605 aSelectIdle ( "sfx2 appl SfxHelpTextWindow_Impl Select" ),
1606 aIndexOnImage ( BMP_HELP_TOOLBOX_INDEX_ON ),
1607 aIndexOffImage ( BMP_HELP_TOOLBOX_INDEX_OFF ),
1608 aIndexOnText ( SfxResId( STR_HELP_BUTTON_INDEX_ON ) ),
1609 aIndexOffText ( SfxResId( STR_HELP_BUTTON_INDEX_OFF ) ),
1610 aOnStartupText ( SfxResId( RID_HELP_ONSTARTUP_TEXT ) ),
1611 xHelpWin ( pHelpWin ),
1612 pTextWin ( VclPtr<TextWin_Impl>::Create( this ) ),
1613 bIsDebug ( false ),
1614 bIsIndexOn ( false ),
1615 bIsInClose ( false ),
1616 bIsFullWordSearch ( false )
1617{
1618 xFrame = Frame::create( ::comphelper::getProcessComponentContext() );
1619 xFrame->initialize( VCLUnoHelper::GetInterface ( pTextWin ) );
1620 xFrame->setName( "OFFICE_HELP" );
1622
1623 xToolBox->set_help_id(HID_HELP_TOOLBOX);
1624
1625 xToolBox->set_item_tooltip_text("index", aIndexOffText );
1626 xToolBox->set_item_help_id("index", HID_HELP_TOOLBOXITEM_INDEX);
1627 xToolBox->set_item_help_id("backward", HID_HELP_TOOLBOXITEM_BACKWARD);
1628 xToolBox->set_item_help_id("forward", HID_HELP_TOOLBOXITEM_FORWARD);
1629 xToolBox->set_item_help_id("start", HID_HELP_TOOLBOXITEM_START);
1630 xToolBox->set_item_help_id("print", HID_HELP_TOOLBOXITEM_PRINT);
1631 xToolBox->set_item_help_id("bookmarks", HID_HELP_TOOLBOXITEM_BOOKMARKS );
1632 xToolBox->set_item_help_id("searchdialog", HID_HELP_TOOLBOXITEM_SEARCHDIALOG);
1633
1636 xOnStartupCB->connect_toggled(LINK(this, SfxHelpTextWindow_Impl, CheckHdl));
1637
1639 aSelectIdle.SetPriority( TaskPriority::LOWEST );
1640
1641 char* pEnv = getenv( "help_debug" );
1642 if ( pEnv )
1643 bIsDebug = true;
1644
1646}
1647
1649{
1650 disposeOnce();
1651}
1652
1654{
1655 bIsInClose = true;
1657 m_xSrchDlg.reset();
1658 xToolBox.reset();
1659 xOnStartupCB.reset();
1660 xHelpWin.clear();
1663}
1664
1666{
1667 // is there any selection in the text and not only a cursor?
1668 bool bRet = false;
1669 Reference < XTextRange > xRange = getCursor();
1670 if ( xRange.is() )
1671 {
1672 Reference < XText > xText = xRange->getText();
1673 Reference < XTextCursor > xCursor = xText->createTextCursorByRange( xRange );
1674 bRet = !xCursor->isCollapsed();
1675 }
1676
1677 return bRet;
1678}
1679
1681{
1682 xToolBox->set_item_icon_name("index", bIsIndexOn ? aIndexOffImage : aIndexOnImage);
1683}
1684
1686{
1688
1689 Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
1690 const OUString sPath { PATH_OFFICE_FACTORIES + sCurrentFactory };
1691
1692 // Attention: This check boy knows two states:
1693 // 1) Reading of the config key fails with an exception or by getting an empty Any (!) => check box must be hidden
1694 // 2) We read sal_True/sal_False => check box must be shown and enabled/disabled
1695
1696 bool bHideBox = true;
1697 bool bHelpAtStartup = false;
1698 try
1699 {
1700 xConfiguration = ConfigurationHelper::openConfig(
1701 xContext, PACKAGE_SETUP, EConfigurationModes::Standard );
1702 if ( xConfiguration.is() )
1703 {
1704 Any aAny = ConfigurationHelper::readRelativeKey( xConfiguration, sPath, KEY_HELP_ON_OPEN );
1705 if (aAny >>= bHelpAtStartup)
1706 bHideBox = false;
1707 }
1708 }
1709 catch( Exception& )
1710 {
1711 bHideBox = true;
1712 }
1713
1714 if ( bHideBox )
1715 xOnStartupCB->hide();
1716 else
1717 {
1718 // detect module name
1719 OUString sModuleName;
1720
1721 if ( xConfiguration.is() )
1722 {
1723 OUString sTemp;
1724 try
1725 {
1726 Any aAny = ConfigurationHelper::readRelativeKey( xConfiguration, sPath, KEY_UI_NAME );
1727 aAny >>= sTemp;
1728 }
1729 catch( Exception const & )
1730 {
1731 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpTextWindow_Impl::InitOnStartupBox()" );
1732 }
1733 sModuleName = sTemp;
1734 }
1735
1736 if ( !sModuleName.isEmpty() )
1737 {
1738 // set module name in checkbox text
1739 xOnStartupCB->set_label(aOnStartupText.replaceFirst("%MODULENAME", sModuleName));
1740 // and show it
1741 xOnStartupCB->show();
1742 // set check state
1743 xOnStartupCB->set_active(bHelpAtStartup);
1744 xOnStartupCB->save_state();
1745 }
1746 }
1747}
1748
1749Reference< XBreakIterator > const & SfxHelpTextWindow_Impl::GetBreakIterator()
1750{
1751 if ( !xBreakIterator.is() )
1753 DBG_ASSERT( xBreakIterator.is(), "Could not create BreakIterator" );
1754 return xBreakIterator;
1755}
1756
1757Reference< XTextRange > SfxHelpTextWindow_Impl::getCursor() const
1758{
1759 // return the current cursor
1760 Reference< XTextRange > xCursor;
1761
1762 try
1763 {
1764 Reference < XSelectionSupplier > xSelSup( xFrame->getController(), UNO_QUERY );
1765 if ( xSelSup.is() )
1766 {
1767 Any aAny = xSelSup->getSelection();
1768 Reference < XIndexAccess > xSelection;
1769 if ( aAny >>= xSelection )
1770 {
1771 if ( xSelection->getCount() == 1 )
1772 {
1773 aAny = xSelection->getByIndex(0);
1774 aAny >>= xCursor;
1775 }
1776 }
1777 }
1778 }
1779 catch( Exception& )
1780 {
1781 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpTextWindow_Impl::getCursor(): unexpected exception" );
1782 }
1783
1784 return xCursor;
1785}
1786
1787
1789{
1790 bool bRet = false;
1791 sal_uInt16 nCode = _rKeyCode.GetCode();
1792
1793 // the keys <CTRL><A> (select all), <CTRL><C> (copy),
1794 // <CTRL><F> (find), <CTRL><P> (print) and <CTRL><W> (close window)
1795 // were handled in help
1796 if ( _rKeyCode.IsMod1() &&
1797 ( KEY_A == nCode || KEY_C == nCode || KEY_F == nCode || KEY_P == nCode || KEY_W == nCode ) )
1798 {
1799 if ( KEY_F == nCode )
1800 DoSearch();
1801 else
1802 bRet = true;
1803 }
1804
1805 return bRet;
1806}
1807
1808
1810{
1811 try
1812 {
1813 // select the words, which are equal to the search text of the search page
1814 Reference < XController > xController = xFrame->getController();
1815 if ( xController.is() )
1816 {
1817 // get document
1818 Reference < XSearchable > xSearchable( xController->getModel(), UNO_QUERY );
1819 if ( xSearchable.is() )
1820 {
1821 // create descriptor, set string and find all words
1822 Reference < XSearchDescriptor > xSrchDesc = xSearchable->createSearchDescriptor();
1823 xSrchDesc->setPropertyValue( "SearchRegularExpression", Any( true ) );
1824 if ( bIsFullWordSearch )
1825 xSrchDesc->setPropertyValue( "SearchWords", Any( true ) );
1826
1827 xSrchDesc->setSearchString( sfx2::PrepareSearchString( aSearchText, GetBreakIterator(), false ) );
1828 Reference< XIndexAccess > xSelection = xSearchable->findAll( xSrchDesc );
1829
1830 // then select all found words
1831 Reference < XSelectionSupplier > xSelectionSup( xController, UNO_QUERY );
1832 if ( xSelectionSup.is() )
1833 {
1834 xSelectionSup->select( Any(xSelection) );
1835 }
1836 }
1837 }
1838 }
1839 catch( Exception& )
1840 {
1841 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpTextWindow_Impl::SelectHdl(): unexpected exception" );
1842 }
1843}
1844
1845
1847{
1848 InitToolBoxImages();
1849 Resize();
1850}
1851
1853{
1854 FindHdl(&rDlg);
1855}
1857{
1858 bool bWrapAround = ( nullptr == pDlg );
1859 if ( bWrapAround )
1860 pDlg = m_xSrchDlg.get();
1861 DBG_ASSERT( pDlg, "invalid search dialog" );
1862 try
1863 {
1864 // select the words, which are equal to the search text of the search page
1865 Reference < XController > xController = xFrame->getController();
1866 if ( xController.is() )
1867 {
1868 // get document
1869 Reference < XSearchable > xSearchable( xController->getModel(), UNO_QUERY );
1870 if ( xSearchable.is() )
1871 {
1872 // create descriptor, set string and find all words
1873 Reference < XSearchDescriptor > xSrchDesc = xSearchable->createSearchDescriptor();
1874 xSrchDesc->setPropertyValue( "SearchWords", Any(pDlg->IsOnlyWholeWords()) );
1875 xSrchDesc->setPropertyValue( "SearchCaseSensitive", Any(pDlg->IsMarchCase()) );
1876 xSrchDesc->setPropertyValue( "SearchBackwards", Any(pDlg->IsSearchBackwards()) );
1877 xSrchDesc->setSearchString( pDlg->GetSearchText() );
1878 Reference< XInterface > xSelection;
1879 Reference< XTextRange > xCursor = getCursor();
1880
1881 if ( xCursor.is() )
1882 {
1883 if ( pDlg->IsSearchBackwards() )
1884 xCursor = xCursor->getStart();
1885 xSelection = xSearchable->findNext( xCursor, xSrchDesc );
1886 }
1887 else
1888 xSelection = xSearchable->findFirst( xSrchDesc );
1889
1890 // then select the found word
1891 if ( xSelection.is() )
1892 {
1893 Reference < XSelectionSupplier > xSelectionSup( xController, UNO_QUERY );
1894 if ( xSelectionSup.is() )
1895 {
1896 xSelectionSup->select( Any(xSelection) );
1897 }
1898 }
1899 else if ( pDlg->IsWrapAround() && !bWrapAround )
1900 {
1901 Reference < text::XTextViewCursorSupplier > xCrsrSupp( xController, uno::UNO_QUERY );
1902 Reference < text::XTextViewCursor > xTVCrsr = xCrsrSupp->getViewCursor();
1903 if ( xTVCrsr.is() )
1904 {
1905 Reference < text::XTextDocument > xDoc( xController->getModel(), uno::UNO_QUERY );
1906 Reference < text::XText > xText = xDoc->getText();
1907 if ( xText.is() )
1908 {
1909 if ( pDlg->IsSearchBackwards() )
1910 xTVCrsr->gotoRange( xText->getEnd(), false );
1911 else
1912 xTVCrsr->gotoRange( xText->getStart(), false );
1913 FindHdl( nullptr );
1914 }
1915 }
1916 }
1917 else
1918 {
1919 assert(m_xSrchDlg && "no search dialog");
1920 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xSrchDlg->getDialog(),
1921 VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_INFO_NOSEARCHTEXTFOUND)));
1922 xBox->run();
1923 m_xSrchDlg->SetFocusOnEdit();
1924 }
1925 }
1926 }
1927 }
1928 catch( Exception& )
1929 {
1930 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpTextWindow_Impl::SelectHdl(): unexpected exception" );
1931 }
1932}
1933
1935{
1936 m_xSrchDlg.reset();
1937}
1938
1940{
1941 if ( !xConfiguration.is() )
1942 return;
1943
1944 bool bChecked = xOnStartupCB->get_active();
1945 try
1946 {
1947 ConfigurationHelper::writeRelativeKey(
1948 xConfiguration, PATH_OFFICE_FACTORIES + sCurrentFactory, KEY_HELP_ON_OPEN, Any( bChecked ) );
1949 ConfigurationHelper::flush( xConfiguration );
1950 }
1951 catch( Exception const & )
1952 {
1953 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpTextWindow_Impl::CheckHdl()" );
1954 }
1955}
1956
1958{
1959 Size aSize = GetOutputSizePixel();
1960 pTextWin->SetPosSizePixel( Point(0, 0), aSize );
1961}
1962
1964{
1965 bool bDone = false;
1966 NotifyEventType nType = rNEvt.GetType();
1967 if ( NotifyEventType::COMMAND == nType && rNEvt.GetCommandEvent() )
1968 {
1969 const CommandEvent* pCmdEvt = rNEvt.GetCommandEvent();
1970 vcl::Window* pCmdWin = rNEvt.GetWindow();
1971
1972 if ( pCmdEvt->GetCommand() == CommandEventId::ContextMenu && pCmdWin != this )
1973 {
1974 Point aPos;
1975 if ( pCmdEvt->IsMouseEvent() )
1976 aPos = pCmdEvt->GetMousePosPixel();
1977 else
1978 aPos = Point( pTextWin->GetPosPixel().X() + 20, 20 );
1979
1980 xMenu->clear();
1981
1982 if (bIsIndexOn)
1983 xMenu->append("index", aIndexOffText, BMP_HELP_TOOLBOX_INDEX_OFF);
1984 else
1985 xMenu->append("index", aIndexOnText, BMP_HELP_TOOLBOX_INDEX_ON);
1986
1987 xMenu->append_separator("separator1");
1988 xMenu->append("backward", SfxResId(STR_HELP_BUTTON_PREV), BMP_HELP_TOOLBOX_PREV);
1989 xMenu->set_sensitive("backward", xHelpWin->HasHistoryPredecessor());
1990 xMenu->append("forward", SfxResId(STR_HELP_BUTTON_NEXT), BMP_HELP_TOOLBOX_NEXT);
1991 xMenu->set_sensitive("forward", xHelpWin->HasHistorySuccessor());
1992 xMenu->append("start", SfxResId(STR_HELP_BUTTON_START), BMP_HELP_TOOLBOX_START);
1993 xMenu->append_separator("separator2");
1994 xMenu->append("print", SfxResId(STR_HELP_BUTTON_PRINT), BMP_HELP_TOOLBOX_PRINT);
1995 xMenu->append("bookmarks", SfxResId(STR_HELP_BUTTON_ADDBOOKMARK), BMP_HELP_TOOLBOX_BOOKMARKS);
1996 xMenu->append("searchdialog", SfxResId(STR_HELP_BUTTON_SEARCHDIALOG), BMP_HELP_TOOLBOX_SEARCHDIALOG);
1997 xMenu->append_separator("separator3");
1998 xMenu->append_check("selectionmode", SfxResId(STR_HELP_MENU_TEXT_SELECTION_MODE));
1999 URL aURL;
2000 aURL.Complete = ".uno:SelectTextMode";
2001 Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
2002 xTrans->parseStrict(aURL);
2003 Reference < XDispatch > xDisp = xFrame->queryDispatch( aURL, OUString(), 0 );
2004 if(xDisp.is())
2005 {
2007 new HelpStatusListener_Impl(xDisp, aURL );
2008 FeatureStateEvent rEvent = pStateListener->GetStateEvent();
2009 bool bCheck = false;
2010 rEvent.State >>= bCheck;
2011 xMenu->set_active("selectionmode", bCheck);
2012 }
2013 xMenu->append_separator("separator4");
2014 xMenu->append("copy", SfxResId(STR_HELP_MENU_TEXT_COPY), BMP_HELP_TOOLBOX_COPY);
2015 xMenu->set_sensitive("copy", HasSelection());
2016
2017 if ( bIsDebug )
2018 {
2019 xMenu->append_separator("separator5");
2020 xMenu->append("sourceview", SfxResId(STR_HELP_BUTTON_SOURCEVIEW));
2021 }
2022
2023 int x, y, width, height;
2024 weld::Window* pTopLevel = GetFrameWeld();
2025 xHelpWin->GetContainer()->get_extents_relative_to(*pTopLevel, x, y, width, height);
2026 aPos.AdjustX(x);
2027 aPos.AdjustY(y);
2028
2029 xHelpWin->DoAction(xMenu->popup_at_rect(pTopLevel, tools::Rectangle(aPos, Size(1,1))));
2030 bDone = true;
2031 }
2032 }
2033 else if ( NotifyEventType::KEYINPUT == nType && rNEvt.GetKeyEvent() )
2034 {
2035 const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
2036 const vcl::KeyCode& rKeyCode = pKEvt->GetKeyCode();
2037 sal_uInt16 nKeyGroup = rKeyCode.GetGroup();
2038 sal_uInt16 nKey = rKeyCode.GetCode();
2039 if ( KEYGROUP_ALPHA == nKeyGroup && !isHandledKey( rKeyCode ) )
2040 {
2041 // do nothing disables the writer accelerators
2042 bDone = true;
2043 }
2044 else if ( rKeyCode.IsMod1() && ( KEY_F4 == nKey || KEY_W == nKey ) )
2045 {
2046 // <CTRL><F4> or <CTRL><W> -> close top frame
2047 xHelpWin->CloseWindow();
2048 bDone = true;
2049 }
2050 else if ( KEY_TAB == nKey && xOnStartupCB->has_focus() )
2051 {
2052 xToolBox->grab_focus();
2053 bDone = true;
2054 }
2055 }
2056
2057 return bDone || Window::PreNotify( rNEvt );
2058}
2059
2060
2062{
2063 if ( bIsInClose )
2064 return;
2065
2066 try
2067 {
2068 if( xFrame.is() )
2069 {
2070 Reference< css::awt::XWindow > xWindow = xFrame->getComponentWindow();
2071 if( xWindow.is() )
2072 xWindow->setFocus();
2073 }
2074 }
2075 catch( Exception const & )
2076 {
2077 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpTextWindow_Impl::GetFocus()" );
2078 }
2079}
2080
2081
2083{
2084 Window::DataChanged( rDCEvt );
2085
2086 if ( ( ( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) ||
2087 ( rDCEvt.GetType() == DataChangedEventType::DISPLAY ) ) &&
2088 ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) )
2089 {
2090 SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFaceColor() ) );
2092 }
2093}
2094
2096{
2097 bIsIndexOn = bOn;
2098 if ( bIsIndexOn )
2099 {
2100 xToolBox->set_item_icon_name("index", aIndexOffImage);
2101 xToolBox->set_item_tooltip_text("index", aIndexOffText);
2102 }
2103 else
2104 {
2105 xToolBox->set_item_icon_name("index", aIndexOnImage);
2106 xToolBox->set_item_tooltip_text("index", aIndexOnText);
2107 }
2108}
2109
2110void SfxHelpTextWindow_Impl::SelectSearchText( const OUString& rSearchText, bool _bIsFullWordSearch )
2111{
2112 aSearchText = rSearchText;
2113 bIsFullWordSearch = _bIsFullWordSearch;
2115}
2116
2117
2119{
2120 bool bSetOff = false;
2121 // set off the pagestyle header to prevent print output of the help URL
2122 try
2123 {
2124 Reference < XController > xController = xFrame->getController();
2125 Reference < XSelectionSupplier > xSelSup( xController, UNO_QUERY );
2126 if ( xSelSup.is() )
2127 {
2128 Reference < XIndexAccess > xSelection;
2129 if ( xSelSup->getSelection() >>= xSelection )
2130 {
2131 Reference < XTextRange > xRange;
2132 if ( xSelection->getByIndex(0) >>= xRange )
2133 {
2134 Reference < XText > xText = xRange->getText();
2135 Reference < XPropertySet > xProps( xText->createTextCursorByRange( xRange ), UNO_QUERY );
2136 OUString sStyleName;
2137 if ( xProps->getPropertyValue( "PageStyleName" ) >>= sStyleName )
2138 {
2139 Reference < XStyleFamiliesSupplier > xStyles( xController->getModel(), UNO_QUERY );
2140 Reference < XNameContainer > xContainer;
2141 if ( xStyles->getStyleFamilies()->getByName( "PageStyles" )
2142 >>= xContainer )
2143 {
2144 Reference < XStyle > xStyle;
2145 if ( xContainer->getByName( sStyleName ) >>= xStyle )
2146 {
2147 Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
2148 xPropSet->setPropertyValue( "HeaderIsOn", Any( false ) );
2149
2150 Reference< XModifiable > xReset(xStyles, UNO_QUERY);
2151 xReset->setModified(false);
2152 bSetOff = true;
2153 }
2154 }
2155 }
2156 }
2157 }
2158 }
2159 }
2160 catch( Exception const & )
2161 {
2162 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpTextWindow_Impl::SetPageStyleHeaderOff()" );
2163 }
2164
2165 SAL_WARN_IF( !bSetOff, "sfx.appl", "SfxHelpTextWindow_Impl::SetPageStyleHeaderOff(): set off failed" );
2166}
2167
2168
2170{
2171 bIsInClose = true;
2172 try
2173 {
2174 css::uno::Reference< css::util::XCloseable > xCloseable ( xFrame, css::uno::UNO_QUERY );
2175 if (xCloseable.is())
2176 xCloseable->close(true);
2177 }
2178 catch( css::util::CloseVetoException& )
2179 {
2180 }
2181}
2182
2183
2185{
2186 if (m_xSrchDlg)
2187 return;
2188
2189 // create the search dialog
2190 m_xSrchDlg = std::make_shared<sfx2::SearchDialog>(pTextWin->GetFrameWeld(), "HelpSearchDialog");
2191 // set handler
2192 m_xSrchDlg->SetFindHdl( LINK( this, SfxHelpTextWindow_Impl, FindHdl ) );
2193 m_xSrchDlg->SetCloseHdl( LINK( this, SfxHelpTextWindow_Impl, CloseHdl ) );
2194 // get selected text of the help page to set it as the search text
2195 Reference< XTextRange > xCursor = getCursor();
2196 if ( xCursor.is() )
2197 {
2198 OUString sText = xCursor->getString();
2199 if ( !sText.isEmpty() )
2200 m_xSrchDlg->SetSearchText( sText );
2201 }
2203}
2204
2206{
2207 if (pTextWin)
2208 pTextWin->GrabFocus();
2209 else
2211}
2212
2214{
2215 Split();
2216
2217 m_xHelpPaneWindow->set_visible(bIndex);
2218}
2219
2220IMPL_LINK(SfxHelpWindow_Impl, ResizeHdl, const Size&, rSize, void)
2221{
2222 int nNewWidth = rSize.Width();
2223 if (!nNewWidth)
2224 return;
2225 if (bSplit)
2226 nIndexSize = round(m_xContainer->get_position() * 100.0 / nNewWidth);
2227 nWidth = nNewWidth;
2228 Split();
2229 nIndexSize = round(m_xContainer->get_position() * 100.0 / nWidth);
2230}
2231
2233{
2234 if (!nWidth)
2235 return;
2236 m_xContainer->set_position(nWidth * nIndexSize / 100);
2237 bSplit = true;
2238}
2239
2241{
2242 SvtViewOptions aViewOpt( EViewType::Window, CONFIGNAME_HELPWIN );
2243 if ( !aViewOpt.Exists() )
2244 return;
2245 bIndex = aViewOpt.IsVisible();
2246
2247 Any aUserItem = aViewOpt.GetUserItem( USERITEM_NAME );
2248 OUString aUserData;
2249 if ( aUserItem >>= aUserData )
2250 {
2251 DBG_ASSERT( comphelper::string::getTokenCount(aUserData, ';') == 6, "invalid user data" );
2252 sal_Int32 nIdx = 0;
2253 nIndexSize = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx ));
2254 o3tl::getToken(aUserData, 0, ';', nIdx); // ignore nTextSize
2255 sal_Int32 nOldWidth = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx ));
2256 sal_Int32 nOldHeight = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx ));
2257 aWinSize = Size(nOldWidth, nOldHeight);
2258 aWinPos.setX( o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx )) );
2259 aWinPos.setY( o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx )) );
2260 }
2261
2262 pTextWin->ToggleIndex( bIndex );
2263}
2264
2266{
2267 SvtViewOptions aViewOpt( EViewType::Window, CONFIGNAME_HELPWIN );
2268 sal_Int32 nW = 0, nH = 0;
2269
2270 if ( xWindow.is() )
2271 {
2272 css::awt::Rectangle aRect = xWindow->getPosSize();
2273 nW = aRect.Width;
2274 nH = aRect.Height;
2275 }
2276
2277 aViewOpt.SetVisible( bIndex );
2279 aWinPos = pScreenWin->GetWindowExtentsAbsolute().TopLeft();
2280 if (bSplit)
2281 nIndexSize = round(m_xContainer->get_position() * 100.0 / nWidth);
2282 const OUString aUserData = OUString::number( nIndexSize )
2283 + ";" + OUString::number( 100 - nIndexSize )
2284 + ";" + OUString::number( nW )
2285 + ";" + OUString::number( nH )
2286 + ";" + OUString::number( aWinPos.X() )
2287 + ";" + OUString::number( aWinPos.Y() );
2288
2289 aViewOpt.SetUserItem( USERITEM_NAME, Any( aUserData ) );
2290}
2291
2293{
2294 loadHelpContent(SfxHelpWindow_Impl::buildHelpURL(xIndexWin->GetFactory(), u"/start", u""));
2295}
2296
2297IMPL_LINK(SfxHelpWindow_Impl, SelectHdl, const OUString&, rCurItem, void)
2298{
2299 bGrabFocusToToolBox = pTextWin->GetToolBox().has_focus();
2300 DoAction(rCurItem);
2301}
2302
2304{
2305 xIndexWin->SelectExecutableEntry();
2306 OUString aEntry = xIndexWin->GetSelectedEntry();
2307
2308 if ( aEntry.isEmpty() )
2309 return;
2310
2311 OUString sHelpURL;
2312
2313 bool bComplete = aEntry.toAsciiLowerCase().match("vnd.sun.star.help");
2314
2315 if (bComplete)
2316 sHelpURL = aEntry;
2317 else
2318 {
2319 std::u16string_view aId;
2320 OUString aAnchor('#');
2321 if ( comphelper::string::getTokenCount(aEntry, '#') == 2 )
2322 {
2323 sal_Int32 nIdx{ 0 };
2324 aId = o3tl::getToken(aEntry, 0, '#', nIdx );
2325 aAnchor += o3tl::getToken(aEntry, 0, '#', nIdx );
2326 }
2327 else
2328 aId = aEntry;
2329
2330 sHelpURL = SfxHelpWindow_Impl::buildHelpURL(xIndexWin->GetFactory(), Concat2View(OUString::Concat("/") + aId), aAnchor);
2331 }
2332
2333 loadHelpContent(sHelpURL);
2334}
2335
2336IMPL_LINK( SfxHelpWindow_Impl, SelectFactoryHdl, SfxHelpIndexWindow_Impl* , pWin, void )
2337{
2338 if ( sTitle.isEmpty() )
2339 sTitle = GetParent()->GetText();
2340
2341 Reference< XTitle > xTitle(xFrame, UNO_QUERY);
2342 if (xTitle.is ())
2343 xTitle->setTitle(sTitle + " - " + xIndexWin->GetActiveFactoryTitle());
2344
2345 if ( pWin )
2346 ShowStartPage();
2347 xIndexWin->ClearSearchPage();
2348}
2349
2350
2351IMPL_LINK( SfxHelpWindow_Impl, ChangeHdl, HelpListener_Impl&, rListener, void )
2352{
2353 SetFactory( rListener.GetFactory() );
2354}
2355
2356
2357void SfxHelpWindow_Impl::openDone(std::u16string_view sURL ,
2358 bool bSuccess)
2359{
2360 INetURLObject aObj( sURL );
2361 if ( aObj.GetProtocol() == INetProtocol::VndSunStarHelp )
2362 SetFactory( aObj.GetHost() );
2363 if ( IsWait() )
2364 LeaveWait();
2365 if ( bGrabFocusToToolBox )
2366 {
2367 pTextWin->GetToolBox().grab_focus();
2368 bGrabFocusToToolBox = false;
2369 }
2370 else
2371 xIndexWin->GrabFocusBack();
2372 if ( !bSuccess )
2373 return;
2374
2375 // set some view settings: "prevent help tips" and "helpid == 68245"
2376 try
2377 {
2378 Reference < XController > xController = pTextWin->getFrame()->getController();
2379 if ( xController.is() )
2380 {
2381 Reference < XViewSettingsSupplier > xSettings( xController, UNO_QUERY );
2382 Reference < XPropertySet > xViewProps = xSettings->getViewSettings();
2383 Reference< XPropertySetInfo > xInfo = xViewProps->getPropertySetInfo();
2384 xViewProps->setPropertyValue( "ShowContentTips", Any( false ) );
2385 xViewProps->setPropertyValue( "ShowGraphics", Any( true ) );
2386 xViewProps->setPropertyValue( "ShowTables", Any( true ) );
2387 xViewProps->setPropertyValue( "HelpURL", Any( OUString("HID:SFX2_HID_HELP_ONHELP") ) );
2388 OUString sProperty( "IsExecuteHyperlinks" );
2389 if ( xInfo->hasPropertyByName( sProperty ) )
2390 xViewProps->setPropertyValue( sProperty, Any( true ) );
2391 xController->restoreViewData(Any());
2392 }
2393 }
2394 catch( Exception& )
2395 {
2396 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpWindow_Impl::OpenDoneHdl(): unexpected exception" );
2397 }
2398
2399 // When the SearchPage opens the help doc, then select all words, which are equal to its text
2400 OUString sSearchText = comphelper::string::strip(xIndexWin->GetSearchText(), ' ');
2401 if ( !sSearchText.isEmpty() )
2402 pTextWin->SelectSearchText( sSearchText, xIndexWin->IsFullWordSearch() );
2403
2404 // no page style header -> this prevents a print output of the URL
2405 pTextWin->SetPageStyleHeaderOff();
2406}
2407
2408
2410 const css::uno::Reference < css::frame::XFrame2 >& rFrame,
2411 vcl::Window* pParent ) :
2412
2413 ResizableDockingWindow(pParent),
2414
2415 xFrame ( rFrame ),
2416 pTextWin ( nullptr ),
2417 pHelpInterceptor ( new HelpInterceptor_Impl() ),
2418 pHelpListener ( new HelpListener_Impl( pHelpInterceptor ) ),
2419 bIndex ( true ),
2420 bGrabFocusToToolBox ( false ),
2421 bSplit ( false ),
2422 nWidth ( 0 ),
2423 nIndexSize ( 40 ), // % of width
2424 aWinPos ( 0, 0 ),
2425 aWinSize ( 0, 0 ),
2426 sTitle ( pParent->GetText() )
2427{
2429
2431
2432 m_xBuilder = Application::CreateInterimBuilder(m_xBox.get(), "sfx/ui/helpwindow.ui", false);
2433 m_xContainer = m_xBuilder->weld_paned("HelpWindow");
2434 m_xContainer->connect_size_allocate(LINK(this, SfxHelpWindow_Impl, ResizeHdl));
2435 m_xHelpPaneWindow = m_xBuilder->weld_container("helppanewindow");
2436 m_xHelpTextWindow = m_xBuilder->weld_container("helptextwindow");
2437 m_xHelpTextXWindow = m_xHelpTextWindow->CreateChildFrame();
2438
2440 xIndexWin.reset(new SfxHelpIndexWindow_Impl(this, m_xHelpPaneWindow.get()));
2441 xIndexWin->SetDoubleClickHdl( LINK( this, SfxHelpWindow_Impl, OpenHdl ) );
2442 xIndexWin->SetSelectFactoryHdl( LINK( this, SfxHelpWindow_Impl, SelectFactoryHdl ) );
2443
2445 Reference < XFrames > xFrames = rFrame->getFrames();
2446 xFrames->append( Reference<XFrame>(pTextWin->getFrame(), UNO_QUERY_THROW) );
2447 pTextWin->SetSelectHdl( LINK( this, SfxHelpWindow_Impl, SelectHdl ) );
2448 pTextWin->Show();
2449 pHelpInterceptor->setInterception( Reference<XFrame>(pTextWin->getFrame(), UNO_QUERY_THROW) );
2450 pHelpListener->SetChangeHdl( LINK( this, SfxHelpWindow_Impl, ChangeHdl ) );
2451 LoadConfig();
2452}
2453
2455{
2456 disposeOnce();
2457}
2458
2460{
2461 SaveConfig();
2462 xIndexWin.reset();
2463 pTextWin->CloseFrame();
2465
2466 m_xHelpTextXWindow->dispose();
2467 m_xHelpTextXWindow.clear();
2468 m_xHelpTextWindow.reset();
2469 m_xHelpPaneWindow.reset();
2470 m_xContainer.reset();
2471 m_xBuilder.reset();
2472
2474}
2475
2477{
2478 bool bHandled = false;
2479 if ( rNEvt.GetType() == NotifyEventType::KEYINPUT )
2480 {
2481 // Backward == <ALT><LEFT> or <BACKSPACE> Forward == <ALT><RIGHT>
2482 const vcl::KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode();
2483 sal_uInt16 nKey = rKeyCode.GetCode();
2484 if ( ( rKeyCode.IsMod2() && ( KEY_LEFT == nKey || KEY_RIGHT == nKey ) ) ||
2485 ( !rKeyCode.GetModifier() && KEY_BACKSPACE == nKey && !xIndexWin->HasFocusOnEdit() ) )
2486 {
2487 DoAction( rKeyCode.GetCode() == KEY_RIGHT ? u"forward" : u"backward" );
2488 bHandled = true;
2489 }
2490 else if ( rKeyCode.IsMod1() && ( KEY_F4 == nKey || KEY_W == nKey ) )
2491 {
2492 // <CTRL><F4> or <CTRL><W> -> close top frame
2493 CloseWindow();
2494 bHandled = true;
2495 }
2496 }
2497 return bHandled || Window::PreNotify( rNEvt );
2498}
2499
2500void SfxHelpWindow_Impl::setContainerWindow( const Reference < css::awt::XWindow >& xWin )
2501{
2502 xWindow = xWin;
2503 MakeLayout();
2504 if (xWindow.is())
2505 {
2507 if (aWinSize.Width() && aWinSize.Height())
2508 pScreenWin->SetPosSizePixel(aWinPos, aWinSize);
2509 else
2510 pScreenWin->SetPosPixel(aWinPos);
2511 }
2512}
2513
2514void SfxHelpWindow_Impl::SetFactory( const OUString& rFactory )
2515{
2516 xIndexWin->SetFactory( rFactory, true );
2517}
2518
2519void SfxHelpWindow_Impl::SetHelpURL( std::u16string_view rURL )
2520{
2521 INetURLObject aObj( rURL );
2522 if ( aObj.GetProtocol() == INetProtocol::VndSunStarHelp )
2523 SetFactory( aObj.GetHost() );
2524}
2525
2526void SfxHelpWindow_Impl::DoAction(std::u16string_view rActionId)
2527{
2528 if (rActionId == u"index")
2529 {
2530 bIndex = !bIndex;
2531 MakeLayout();
2532 pTextWin->ToggleIndex( bIndex );
2533 }
2534 else if (rActionId == u"start")
2535 {
2536 ShowStartPage();
2537 }
2538 else if (rActionId == u"backward" || rActionId == u"forward")
2539 {
2540 URL aURL;
2541 aURL.Complete = ".uno:Backward";
2542 if (rActionId == u"forward")
2543 aURL.Complete = ".uno:Forward";
2544 Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
2545 xTrans->parseStrict(aURL);
2546 pHelpInterceptor->dispatch( aURL, Sequence < PropertyValue >() );
2547 }
2548 else if (rActionId == u"searchdialog")
2549 {
2550 pTextWin->DoSearch();
2551 }
2552 else if (rActionId == u"print" || rActionId == u"sourceview" || rActionId == u"copy" || rActionId == u"selectionmode")
2553 {
2554 Reference < XDispatchProvider > xProv = pTextWin->getFrame();
2555 if ( xProv.is() )
2556 {
2557 URL aURL;
2558 if (rActionId == u"print")
2559 aURL.Complete = ".uno:Print";
2560 else if (rActionId == u"sourceview")
2561 aURL.Complete = ".uno:SourceView";
2562 else if (rActionId == u"copy")
2563 aURL.Complete = ".uno:Copy";
2564 else // rActionId == "selectionmode"
2565 aURL.Complete = ".uno:SelectTextMode";
2566 Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
2567 xTrans->parseStrict(aURL);
2568 Reference < XDispatch > xDisp = xProv->queryDispatch( aURL, OUString(), 0 );
2569 if ( xDisp.is() )
2570 xDisp->dispatch( aURL, Sequence < PropertyValue >() );
2571 }
2572 }
2573 else if (rActionId == u"bookmarks")
2574 {
2575 OUString aURL = pHelpInterceptor->GetCurrentURL();
2576 if ( !aURL.isEmpty() )
2577 {
2578 try
2579 {
2580 Content aCnt( aURL, Reference< css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
2581 css::uno::Reference< css::beans::XPropertySetInfo > xInfo = aCnt.getProperties();
2582 if ( xInfo->hasPropertyByName( PROPERTY_TITLE ) )
2583 {
2584 css::uno::Any aAny = aCnt.getPropertyValue( PROPERTY_TITLE );
2585 OUString aValue;
2586 if ( aAny >>= aValue )
2587 {
2589 aDlg.SetTitle(aValue);
2590 if (aDlg.run() == RET_OK )
2591 {
2592 xIndexWin->AddBookmarks( aDlg.GetTitle(), aURL );
2593 }
2594 }
2595 }
2596 }
2597 catch( Exception& )
2598 {
2599 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpWindow_Impl::DoAction(): unexpected exception" );
2600 }
2601 }
2602 }
2603}
2604
2606{
2607 try
2608 {
2609 // search for top frame
2610 Reference< XFramesSupplier > xCreator = getTextFrame()->getCreator();
2611 while ( xCreator.is() && !xCreator->isTop() )
2612 {
2613 xCreator = xCreator->getCreator();
2614 }
2615
2616 // when found, close it
2617 if ( xCreator.is() && xCreator->isTop() )
2618 {
2619 Reference < XCloseable > xCloser( xCreator, UNO_QUERY );
2620 if ( xCloser.is() )
2621 xCloser->close( false );
2622 }
2623 }
2624 catch( Exception const & )
2625 {
2626 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxHelpWindow_Impl::CloseWindow()" );
2627 }
2628}
2629
2630
2632{
2633 pTextWin->GetToolBox().set_item_sensitive("backward", pHelpInterceptor->HasHistoryPred());
2634 pTextWin->GetToolBox().set_item_sensitive("forward", pHelpInterceptor->HasHistorySucc());
2635}
2636
2637
2639{
2641}
2642
2643
2645{
2647}
2648
2649// class SfxAddHelpBookmarkDialog_Impl -----------------------------------
2650
2652 : GenericDialogController(pParent, "sfx/ui/bookmarkdialog.ui", "BookmarkDialog")
2653 , m_xTitleED(m_xBuilder->weld_entry("entry"))
2654 , m_xAltTitle(m_xBuilder->weld_label("alttitle"))
2655{
2656 if (bRename)
2657 m_xDialog->set_title(m_xAltTitle->get_label());
2658}
2659
2661{
2662 m_xTitleED->set_text(rTitle);
2663 m_xTitleED->select_region(0, -1);
2664}
2665
2666/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::util::URL m_aURL
const vcl::I18nHelper & GetUILocaleI18nHelper() const
const vcl::I18nHelper & GetLocaleI18nHelper() const
const LanguageTag & GetUILanguageTag() const
const StyleSettings & GetStyleSettings() const
static std::unique_ptr< weld::Builder > CreateInterimBuilder(vcl::Window *pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId=0)
static const AllSettings & GetSettings()
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
BookmarksTabPage_Impl(weld::Widget *pParent, SfxHelpIndexWindow_Impl *pIdxWin)
Definition: newhelp.cxx:1148
std::unique_ptr< weld::TreeView > m_xBookmarksBox
Definition: newhelp.hxx:194
void SetDoubleClickHdl(const Link< LinkParamNone *, void > &rLink)
Definition: newhelp.cxx:1196
OUString GetSelectedEntry() const
Definition: newhelp.cxx:1201
std::unique_ptr< weld::Button > m_xBookmarksPB
Definition: newhelp.hxx:195
virtual ~BookmarksTabPage_Impl() override
Definition: newhelp.cxx:1170
Link< LinkParamNone *, void > aDoubleClickHdl
Definition: newhelp.hxx:197
void AddBookmarks(const OUString &rTitle, const OUString &rURL)
Definition: newhelp.cxx:1206
void DoAction(std::u16string_view rAction)
Definition: newhelp.cxx:1083
std::unique_ptr< weld::Container > m_xContainer
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
bool IsMouseEvent() const
OUString aClosedBookImage
Definition: newhelp.hxx:67
std::unique_ptr< weld::TreeIter > m_xScratchIter
Definition: newhelp.hxx:65
void SetDoubleClickHdl(const Link< LinkParamNone *, void > &rLink)
Definition: newhelp.cxx:352
ContentTabPage_Impl(weld::Widget *pParent, SfxHelpIndexWindow_Impl *_pIdxWin)
Definition: newhelp.cxx:328
void ClearChildren(const weld::TreeIter *pParent)
Definition: newhelp.cxx:235
Link< LinkParamNone *, void > aDoubleClickHdl
Definition: newhelp.hxx:70
std::unique_ptr< weld::TreeView > m_xContentBox
Definition: newhelp.hxx:64
virtual ~ContentTabPage_Impl() override
Definition: newhelp.cxx:357
OUString GetSelectedEntry() const
Definition: newhelp.cxx:306
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
virtual bool EventNotify(NotifyEvent &rNEvt) override
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
void setInterception(const css::uno::Reference< css::frame::XFrame > &xFrame)
void addURL(const OUString &rURL)
bool HasHistorySucc() const
const OUString & GetCurrentURL() const
bool HasHistoryPred() const
void InitWaiter(SfxHelpWindow_Impl *pWindow)
HelpTabPage_Impl(weld::Widget *pParent, SfxHelpIndexWindow_Impl *_pIdxWin, const OUString &rID, const OUString &rUIXMLDescription)
Definition: newhelp.cxx:316
SfxHelpIndexWindow_Impl * m_pIdxWin
Definition: newhelp.hxx:51
virtual ~HelpTabPage_Impl() override
Definition: newhelp.cxx:323
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
OUString GetHost(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
static OUString encode(std::u16string_view rText, Part ePart, EncodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
virtual void Start(bool bStartTimer=true) override
void SelectExecutableEntry()
Definition: newhelp.cxx:369
OUString GetSelectedEntry() const
Definition: newhelp.cxx:825
Link< IndexTabPage_Impl &, void > aKeywordLink
Definition: newhelp.hxx:97
std::unique_ptr< weld::TreeView > m_xIndexList
Definition: newhelp.hxx:91
std::unique_ptr< weld::Button > m_xOpenBtn
Definition: newhelp.hxx:92
OUString sKeyword
Definition: newhelp.hxx:100
Idle aAutoCompleteIdle
Definition: newhelp.hxx:95
bool HasKeyword() const
Definition: newhelp.cxx:845
Link< LinkParamNone *, void > aDoubleClickHdl
Definition: newhelp.hxx:110
bool HasKeywordIgnoreCase()
Definition: newhelp.cxx:858
void InitializeIndex()
Definition: newhelp.cxx:564
OUString sFactory
Definition: newhelp.hxx:99
void SetDoubleClickHdl(const Link< LinkParamNone *, void > &rLink)
Definition: newhelp.cxx:799
int starts_with(const OUString &rStr, int nStartRow, bool bCaseSensitive)
Definition: newhelp.cxx:721
std::unique_ptr< weld::Entry > m_xIndexEntry
Definition: newhelp.hxx:90
void OpenKeyword()
Definition: newhelp.cxx:879
virtual void Activate() override
Definition: newhelp.cxx:790
void SetFactory(const OUString &rFactory)
Definition: newhelp.cxx:804
virtual ~IndexTabPage_Impl() override
Definition: newhelp.cxx:554
Timer aKeywordTimer
Definition: newhelp.hxx:96
IndexTabPage_Impl(weld::Widget *pParent, SfxHelpIndexWindow_Impl *pIdxWin)
Definition: newhelp.cxx:390
void SetKeyword(const OUString &rKeyword)
Definition: newhelp.cxx:834
const vcl::KeyCode & GetKeyCode() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
const KeyEvent * GetKeyEvent() const
vcl::Window * GetWindow() const
const CommandEvent * GetCommandEvent() const
NotifyEventType GetType() const
void SetTextColor(const Color &rColor)
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
VclPtr< vcl::Window > m_xBox
virtual void dispose() override
std::unique_ptr< weld::Button > m_xOpenBtn
Definition: newhelp.hxx:157
OUString aFactory
Definition: newhelp.hxx:161
std::unique_ptr< weld::CheckButton > m_xFullWordsCB
Definition: newhelp.hxx:154
Link< LinkParamNone *, void > aDoubleClickHdl
Definition: newhelp.hxx:159
void ClearSearchResults()
Definition: newhelp.cxx:971
void SetFactory(const OUString &rFactory)
Definition: newhelp.hxx:181
void RememberSearchText(const OUString &rSearchText)
Definition: newhelp.cxx:976
std::unique_ptr< weld::Button > m_xSearchBtn
Definition: newhelp.hxx:153
std::unique_ptr< weld::CheckButton > m_xScopeCB
Definition: newhelp.hxx:155
OUString GetSelectedEntry() const
Definition: newhelp.cxx:1055
std::unique_ptr< weld::ComboBox > m_xSearchED
Definition: newhelp.hxx:152
void SetDoubleClickHdl(const Link< LinkParamNone *, void > &rLink)
Definition: newhelp.cxx:1050
SearchTabPage_Impl(weld::Widget *pParent, SfxHelpIndexWindow_Impl *pIdxWin)
Definition: newhelp.cxx:897
css::uno::Reference< css::i18n::XBreakIterator > xBreakIterator
Definition: newhelp.hxx:164
virtual ~SearchTabPage_Impl() override
Definition: newhelp.cxx:942
bool OpenKeyword(const OUString &rKeyword)
Definition: newhelp.cxx:1066
std::unique_ptr< weld::TreeView > m_xResultsLB
Definition: newhelp.hxx:156
SfxAddHelpBookmarkDialog_Impl(weld::Widget *pParent, bool bRename)
Definition: newhelp.cxx:2651
std::unique_ptr< weld::Entry > m_xTitleED
Definition: newhelp.hxx:497
std::unique_ptr< weld::Label > m_xAltTitle
Definition: newhelp.hxx:498
OUString GetTitle() const
Definition: newhelp.hxx:503
void SetTitle(const OUString &rTitle)
Definition: newhelp.cxx:2660
static std::vector< OUString > GetResultSet(const OUString &rURL)
Definition: helper.cxx:47
static std::vector< OUString > GetHelpTreeViewContents(const OUString &rURL)
Definition: helper.cxx:102
HelpTabPage_Impl * GetPage(std::u16string_view)
Definition: newhelp.cxx:1367
void OpenKeyword(const OUString &rKeyword)
Definition: newhelp.cxx:1557
BookmarksTabPage_Impl * GetBookmarksPage()
Definition: newhelp.hxx:318
SearchTabPage_Impl * GetSearchPage()
Definition: newhelp.hxx:308
bool HasFocusOnEdit() const
Definition: newhelp.cxx:1528
Link< LinkParamNone *, void > aPageDoubleClickLink
Definition: newhelp.hxx:231
std::unique_ptr< weld::Notebook > m_xTabCtrl
Definition: newhelp.hxx:226
std::unique_ptr< weld::Container > m_xContainer
Definition: newhelp.hxx:224
Link< SfxHelpIndexWindow_Impl *, void > aSelectFactoryLink
Definition: newhelp.hxx:230
std::unique_ptr< ContentTabPage_Impl > xCPage
Definition: newhelp.hxx:237
bool IsFullWordSearch() const
Definition: newhelp.cxx:1548
void AddBookmarks(const OUString &rTitle, const OUString &rURL)
Definition: newhelp.cxx:1488
void SetFactory(const OUString &rFactory, bool bActive)
Definition: newhelp.cxx:1449
std::unique_ptr< SearchTabPage_Impl > xSPage
Definition: newhelp.hxx:239
ContentTabPage_Impl * GetContentPage()
Definition: newhelp.hxx:287
SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl *pParent, weld::Container *pContainer)
Definition: newhelp.cxx:1277
OUString GetSelectedEntry() const
Definition: newhelp.cxx:1462
IndexTabPage_Impl * GetIndexPage()
Definition: newhelp.hxx:297
VclPtr< SfxHelpWindow_Impl > pParentWin
Definition: newhelp.hxx:235
std::unique_ptr< BookmarksTabPage_Impl > xBPage
Definition: newhelp.hxx:240
std::unique_ptr< weld::ComboBox > m_xActiveLB
Definition: newhelp.hxx:225
std::unique_ptr< IndexTabPage_Impl > xIPage
Definition: newhelp.hxx:238
weld::Window * GetFrameWeld() const
Definition: newhelp.cxx:1571
OUString const & GetFactory() const
Definition: newhelp.hxx:269
void SetDoubleClickHdl(const Link< LinkParamNone *, void > &rLink)
Definition: newhelp.cxx:1434
bool IsValidFactory(std::u16string_view _rFactory)
Definition: newhelp.cxx:1493
OUString GetSearchText() const
Definition: newhelp.cxx:1539
virtual void GetFocus() override
Definition: newhelp.cxx:2061
css::uno::Reference< css::frame::XFrame2 > xFrame
Definition: newhelp.hxx:361
bool HasSelection() const
Definition: newhelp.cxx:1665
virtual void Resize() override
Definition: newhelp.cxx:1957
void FindHdl(sfx2::SearchDialog *)
Definition: newhelp.cxx:1856
SfxHelpTextWindow_Impl(SfxHelpWindow_Impl *pHelpWin, weld::Builder &rBuilder, vcl::Window *pParent)
Definition: newhelp.cxx:1598
std::shared_ptr< sfx2::SearchDialog > m_xSrchDlg
Definition: newhelp.hxx:359
VclPtr< vcl::Window > pTextWin
Definition: newhelp.hxx:358
bool isHandledKey(const vcl::KeyCode &_rKeyCode)
Definition: newhelp.cxx:1788
void SelectSearchText(const OUString &rSearchText, bool _bIsFullWordSearch)
Definition: newhelp.cxx:2110
void SetPageStyleHeaderOff() const
Definition: newhelp.cxx:2118
void ToggleIndex(bool bOn)
Definition: newhelp.cxx:2095
virtual ~SfxHelpTextWindow_Impl() override
Definition: newhelp.cxx:1648
OUString sCurrentFactory
Definition: newhelp.hxx:355
css::uno::Reference< css::text::XTextRange > getCursor() const
Definition: newhelp.cxx:1757
VclPtr< SfxHelpWindow_Impl > xHelpWin
Definition: newhelp.hxx:357
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIterator()
Definition: newhelp.cxx:1749
css::uno::Reference< css::uno::XInterface > xConfiguration
Definition: newhelp.hxx:365
std::unique_ptr< weld::Toolbar > xToolBox
Definition: newhelp.hxx:345
virtual void dispose() override
Definition: newhelp.cxx:1653
css::uno::Reference< css::i18n::XBreakIterator > xBreakIterator
Definition: newhelp.hxx:363
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: newhelp.cxx:2082
std::unique_ptr< weld::Menu > xMenu
Definition: newhelp.hxx:347
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: newhelp.cxx:1963
std::unique_ptr< weld::CheckButton > xOnStartupCB
Definition: newhelp.hxx:346
bool HasHistorySuccessor() const
Definition: newhelp.cxx:2644
css::uno::Reference< css::awt::XWindow > m_xHelpTextXWindow
Definition: newhelp.hxx:423
std::unique_ptr< SfxHelpIndexWindow_Impl > xIndexWin
Definition: newhelp.hxx:430
void SetFactory(const OUString &rFactory)
Definition: newhelp.cxx:2514
virtual void GetFocus() override
Definition: newhelp.cxx:2205
virtual ~SfxHelpWindow_Impl() override
Definition: newhelp.cxx:2454
friend class SfxHelpIndexWindow_Impl
Definition: newhelp.hxx:417
std::unique_ptr< weld::Paned > m_xContainer
Definition: newhelp.hxx:420
HelpInterceptor_Impl * pHelpInterceptor
Definition: newhelp.hxx:432
std::unique_ptr< weld::Container > m_xHelpPaneWindow
Definition: newhelp.hxx:421
void SetHelpURL(std::u16string_view rURL)
Definition: newhelp.cxx:2519
std::unique_ptr< weld::Builder > m_xBuilder
Definition: newhelp.hxx:419
void openDone(std::u16string_view sURL, bool bSuccess)
Definition: newhelp.cxx:2357
css::uno::Reference< css::awt::XWindow > xWindow
Definition: newhelp.hxx:426
std::unique_ptr< weld::Container > m_xHelpTextWindow
Definition: newhelp.hxx:422
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: newhelp.cxx:2476
static OUString buildHelpURL(std::u16string_view sFactory, std::u16string_view sContent, std::u16string_view sAnchor)
Definition: newhelp.cxx:1212
void DoAction(std::u16string_view rAction)
Definition: newhelp.cxx:2526
virtual void dispose() override
Definition: newhelp.cxx:2459
void loadHelpContent(const OUString &sHelpURL, bool bAddToHistory=true)
Definition: newhelp.cxx:1224
css::uno::Reference< css::frame::XFrame2 > const & getTextFrame() const
Definition: newhelp.hxx:468
void setContainerWindow(const css::uno::Reference< css::awt::XWindow > &xWin)
Definition: newhelp.cxx:2500
bool bGrabFocusToToolBox
Definition: newhelp.hxx:436
rtl::Reference< HelpListener_Impl > pHelpListener
Definition: newhelp.hxx:433
bool HasHistoryPredecessor() const
Definition: newhelp.cxx:2638
SfxHelpWindow_Impl(const css::uno::Reference< css::frame::XFrame2 > &rFrame, vcl::Window *pParent)
Definition: newhelp.cxx:2409
VclPtr< SfxHelpTextWindow_Impl > pTextWin
Definition: newhelp.hxx:431
static OUString GetCurrentModuleIdentifier()
Definition: sfxhelp.cxx:1391
static OUString GetDefaultHelpModule()
Definition: sfxhelp.cxx:1386
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetDialogTextColor() const
const Color & GetHighlightTextColor() const
static SVT_DLLPUBLIC OUString GetImageId(const INetURLObject &rURL, bool bBig=false)
void RemoveListenerLink(const Link< LinkParamNone *, void > &rLink)
void AddListenerLink(const Link< LinkParamNone *, void > &rLink)
void SetPageID(const OUString &rID)
css::uno::Any GetUserItem(const OUString &sName) const
void SetUserItem(const OUString &sName, const css::uno::Any &aValue)
bool IsVisible() const
OUString GetPageID() const
void SetVisible(bool bState)
bool Exists() const
void SetPriority(TaskPriority ePriority)
void Stop()
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: newhelp.cxx:1581
TextWin_Impl(vcl::Window *pParent)
Definition: newhelp.cxx:1577
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
void disposeAndClear()
void clear()
reference_type * get() const
static VclPtr< reference_type > Create(Arg &&... arg)
bool IsOnlyWholeWords() const
Definition: srchdlg.hxx:60
bool IsWrapAround() const
Definition: srchdlg.hxx:62
OUString GetSearchText() const
Definition: srchdlg.hxx:58
bool IsMarchCase() const
Definition: srchdlg.hxx:61
bool IsSearchBackwards() const
Definition: srchdlg.hxx:63
static void runAsync(const std::shared_ptr< SearchDialog > &rController)
Definition: srchdlg.cxx:128
bool MatchString(const OUString &rStr1, const OUString &rStr2) const
sal_uInt16 GetGroup() const
bool IsMod1() const
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
bool IsMod2() const
virtual void dispose() override
void SetStyle(WinBits nStyle)
virtual void GetFocus()
vcl::Window * GetParent() const
void LeaveWait()
WinBits GetStyle() const
const AllSettings & GetSettings() const
bool IsWait() const
Size GetOutputSizePixel() const
void EnterWait()
weld::Window * GetFrameWeld() const
virtual bool EventNotify(NotifyEvent &rNEvt)
void SetHelpId(const OUString &)
void SetBackground()
virtual short run()
std::shared_ptr< weld::Dialog > m_xDialog
std::tuple< vcl::RenderContext &, const tools::Rectangle &, bool, const OUString & > render_args
std::pair< vcl::RenderContext &, const OUString & > get_size_args
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
URL aURL
float u
float y
float x
NotifyEventType
std::deque< AttacherIndex_Impl > aIndex
OUString sName
constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_INDEX
Definition: helpids.h:35
constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_BACKWARD
Definition: helpids.h:37
constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_PRINT
Definition: helpids.h:39
constexpr OUStringLiteral HID_HELP_WINDOW
Definition: helpids.h:33
constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_SEARCHDIALOG
Definition: helpids.h:41
constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_START
Definition: helpids.h:36
constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_BOOKMARKS
Definition: helpids.h:40
constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_FORWARD
Definition: helpids.h:38
constexpr OUStringLiteral HID_HELP_TOOLBOX
Definition: helpids.h:34
sal_Int32 nIndex
void * p
sal_Int64 n
constexpr sal_uInt16 KEYGROUP_ALPHA
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_F4
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_A
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_F
constexpr sal_uInt16 KEY_DELETE
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_PAGEUP
constexpr sal_uInt16 KEY_C
constexpr sal_uInt16 KEY_W
constexpr sal_uInt16 KEY_P
constexpr sal_uInt16 KEY_BACKSPACE
sal_uInt16 nPos
Definition: linksrc.cxx:118
#define SAL_WARN_IF(condition, area, stream)
aStr
Definition: mgetempl.cxx:407
void Clear(EHistoryType eHistory)
std::vector< HistoryItem > GetList(EHistoryType eHistory)
void AppendItem(EHistoryType eHistory, const OUString &sURL, const OUString &sFilter, const OUString &sTitle, const std::optional< OUString > &sThumbnail, ::std::optional< bool > const oIsReadOnly)
double getLength(const B2DPolygon &rCandidate)
@ Exception
OString strip(const OString &rIn, char c)
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
Reference< XComponentContext > getProcessComponentContext()
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
std::unordered_map< OUString, int > KeywordInfo
Definition: newhelp.cxx:561
static OUString PrepareSearchString(const OUString &rSearchString, const Reference< XBreakIterator > &xBreak, bool bForSearch)
Prepare a search string for searching or selecting.
Definition: newhelp.cxx:146
VCL_DLLPUBLIC css::uno::Reference< css::i18n::XBreakIterator > CreateBreakIterator()
OUString toId(const void *pValue)
IMPL_LINK_NOARG(ContentTabPage_Impl, DoubleClickHdl, weld::TreeView &, bool)
Definition: newhelp.cxx:346
constexpr OUStringLiteral PROPERTY_TITLE
Definition: newhelp.cxx:122
constexpr OUStringLiteral KEY_HELP_ON_OPEN
Definition: newhelp.cxx:129
constexpr OUStringLiteral PROPERTY_TITLEREF
Definition: newhelp.cxx:121
constexpr OUStringLiteral PROPERTY_KEYWORDREF
Definition: newhelp.cxx:119
constexpr OUStringLiteral PROPERTY_KEYWORDLIST
Definition: newhelp.cxx:118
constexpr OUStringLiteral CONFIGNAME_SEARCHPAGE
Definition: newhelp.cxx:115
constexpr OUStringLiteral PROPERTY_ANCHORREF
Definition: newhelp.cxx:120
constexpr OUStringLiteral PATH_OFFICE_FACTORIES
Definition: newhelp.cxx:128
constexpr OUStringLiteral USERITEM_NAME
Definition: newhelp.cxx:125
constexpr OUStringLiteral HELP_SEARCH_TAG
Definition: newhelp.cxx:124
constexpr OUStringLiteral IMAGE_URL
Definition: newhelp.cxx:116
constexpr OUStringLiteral CONFIGNAME_HELPWIN
Definition: newhelp.cxx:113
constexpr OUStringLiteral PACKAGE_SETUP
Definition: newhelp.cxx:127
constexpr OUStringLiteral KEY_UI_NAME
Definition: newhelp.cxx:130
constexpr OUStringLiteral HELP_URL
Definition: newhelp.cxx:123
static void lcl_disableLayoutOfFrame(const Reference< XFrame2 > &xFrame)
Definition: newhelp.cxx:1591
IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter &, rIter, bool)
Definition: newhelp.cxx:248
constexpr OUStringLiteral CONFIGNAME_INDEXWIN
Definition: newhelp.cxx:114
void AppendConfigToken(OUStringBuffer &rURL, bool bQuestionMark)
Appends ?Language=xy&System=abc to the help URL in rURL.
Definition: sfxhelp.cxx:267
Reference< XNameAccess > m_xContainer
QPRO_FUNC_TYPE nType
OUString SfxResId(TranslateId aId)
Definition: sfxresid.cxx:22
bool bSubEntry
Reference< XController > xController
Reference< XFrame > xFrame
sal_uInt16 sal_Unicode
OUString aTargetURL
OUString sId
RET_OK
WinBits const WB_DIALOGCONTROL
WinBits const WB_DOCKABLE
WinBits const WB_TABSTOP
WinBits const WB_CLIPCHILDREN