LibreOffice Module framework (master) 1
titlehelper.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
21#include <classes/fwkresid.hxx>
22#include <strings.hrc>
23#include <properties.h>
24
25#include <com/sun/star/frame/UntitledNumbersConst.hpp>
26#include <com/sun/star/frame/XStorable.hpp>
27#include <com/sun/star/frame/ModuleManager.hpp>
28#include <com/sun/star/frame/XUntitledNumbers.hpp>
29#include <com/sun/star/frame/XModel3.hpp>
30#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
31
36#include <rtl/ustrbuf.hxx>
37#include <osl/mutex.hxx>
38#include <tools/urlobj.hxx>
39#include <utility>
40#include <vcl/svapp.hxx>
41
42
43using namespace css;
44using namespace css::uno;
45using namespace css::frame;
46
47namespace framework{
48
49TitleHelper::TitleHelper(css::uno::Reference< css::uno::XComponentContext > xContext,
50 const css::uno::Reference< css::uno::XInterface >& xOwner,
51 const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers)
52 : ::cppu::BaseMutex ()
53 , m_xContext (std::move(xContext))
54 , m_bExternalTitle (false)
55 , m_nLeasedNumber (css::frame::UntitledNumbersConst::INVALID_NUMBER)
57{
58 // SYNCHRONIZED ->
59 {
60 osl::MutexGuard aLock(m_aMutex);
61
62 m_xOwner = xOwner;
63 m_xUntitledNumbers = xNumbers;
64 }
65 // <- SYNCHRONIZED
66
67 css::uno::Reference< css::frame::XModel > xModel(xOwner, css::uno::UNO_QUERY);
68 if (xModel.is ())
69 {
71 return;
72 }
73
74 css::uno::Reference< css::frame::XController > xController(xOwner, css::uno::UNO_QUERY);
75 if (xController.is ())
76 {
78 return;
79 }
80
81 css::uno::Reference< css::frame::XFrame > xFrame(xOwner, css::uno::UNO_QUERY);
82 if (xFrame.is ())
83 {
85 return;
86 }
87}
88
90{
91}
92
93OUString SAL_CALL TitleHelper::getTitle()
94{
95 // SYNCHRONIZED ->
96 osl::MutexGuard aLock(m_aMutex);
97
98 // An external title will win always and disable all internal logic about
99 // creating/using a title value.
100 // Even an empty string will be accepted as valid title !
102 return m_sTitle;
103
104 // Title seems to be up-to-date. Return it directly.
105 if (!m_sTitle.isEmpty())
106 return m_sTitle;
107
108 // Title seems to be unused till now ... do bootstrapping
109 impl_updateTitle (true);
110
111 return m_sTitle;
112 // <- SYNCHRONIZED
113}
114
115void SAL_CALL TitleHelper::setTitle(const OUString& sTitle)
116{
117 // SYNCHRONIZED ->
118 {
119 osl::MutexGuard aLock(m_aMutex);
120
121 m_bExternalTitle = true;
122 m_sTitle = sTitle;
123 }
124 // <- SYNCHRONIZED
125
127}
128
129void SAL_CALL TitleHelper::addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
130{
131 // container is threadsafe by himself
133}
134
135void SAL_CALL TitleHelper::removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
136{
137 // container is threadsafe by himself
139}
140
141void SAL_CALL TitleHelper::titleChanged(const css::frame::TitleChangedEvent& aEvent)
142{
143 css::uno::Reference< css::frame::XTitle > xSubTitle;
144 // SYNCHRONIZED ->
145 {
146 osl::MutexGuard aLock(m_aMutex);
147
148 xSubTitle.set(m_xSubTitle.get (), css::uno::UNO_QUERY);
149 }
150 // <- SYNCHRONIZED
151
152 if (aEvent.Source != xSubTitle)
153 return;
154
156}
157
158void SAL_CALL TitleHelper::documentEventOccured(const css::document::DocumentEvent& aEvent)
159{
160 if ( ! aEvent.EventName.equalsIgnoreAsciiCase("OnSaveAsDone")
161 && ! aEvent.EventName.equalsIgnoreAsciiCase("OnModeChanged")
162 && ! aEvent.EventName.equalsIgnoreAsciiCase("OnTitleChanged"))
163 return;
164
165 css::uno::Reference< css::frame::XModel > xOwner;
166 // SYNCHRONIZED ->
167 {
168 osl::MutexGuard aLock(m_aMutex);
169
170 xOwner.set(m_xOwner.get (), css::uno::UNO_QUERY);
171 }
172 // <- SYNCHRONIZED
173
174 if (aEvent.Source != xOwner
175 || ((aEvent.EventName.equalsIgnoreAsciiCase("OnModeChanged")
176 || aEvent.EventName.equalsIgnoreAsciiCase("OnTitleChanged"))
177 && !xOwner.is()))
178 {
179 return;
180 }
181
183}
184
185void SAL_CALL TitleHelper::frameAction(const css::frame::FrameActionEvent& aEvent)
186{
187 css::uno::Reference< css::frame::XFrame > xOwner;
188 // SYNCHRONIZED ->
189 {
190 osl::MutexGuard aLock(m_aMutex);
191
192 xOwner.set(m_xOwner.get (), css::uno::UNO_QUERY);
193 }
194 // <- SYNCHRONIZED
195
196 if (aEvent.Source != xOwner)
197 return;
198
199 // we are interested on events only, which must trigger a title bar update
200 // because component was changed.
201 if (
202 (aEvent.Action == css::frame::FrameAction_COMPONENT_ATTACHED ) ||
203 (aEvent.Action == css::frame::FrameAction_COMPONENT_REATTACHED) ||
204 (aEvent.Action == css::frame::FrameAction_COMPONENT_DETACHING )
205 )
206 {
209 }
210}
211
212void SAL_CALL TitleHelper::disposing(const css::lang::EventObject& aEvent)
213{
214 css::uno::Reference< css::uno::XInterface > xOwner;
215 css::uno::Reference< css::frame::XUntitledNumbers > xNumbers;
216 ::sal_Int32 nLeasedNumber;
217 // SYNCHRONIZED ->
218 {
219 osl::MutexGuard aLock(m_aMutex);
220
221 xOwner = m_xOwner;
222 xNumbers.set(m_xUntitledNumbers.get(), css::uno::UNO_QUERY);
223 nLeasedNumber = m_nLeasedNumber;
224 }
225 // <- SYNCHRONIZED
226
227 if ( ! xOwner.is ())
228 return;
229
230 css::uno::Reference< css::frame::XFrame > xFrame(xOwner, css::uno::UNO_QUERY);
231 if (xFrame.is())
232 xFrame->removeFrameActionListener(this);
233
234 if (xOwner != aEvent.Source)
235 return;
236
237 if (
238 (xNumbers.is () ) &&
239 (nLeasedNumber != css::frame::UntitledNumbersConst::INVALID_NUMBER)
240 )
241 xNumbers->releaseNumber (nLeasedNumber);
242
243 // SYNCHRONIZED ->
244 {
245 osl::MutexGuard aLock(m_aMutex);
246
247 m_xOwner.clear();
248 m_sTitle = OUString ();
249 m_nLeasedNumber = css::frame::UntitledNumbersConst::INVALID_NUMBER;
250 }
251 // <- SYNCHRONIZED
252}
253
255{
256 css::uno::Reference<css::uno::XInterface> xOwner;
257 // SYNCHRONIZED ->
258 {
259 osl::MutexGuard aLock(m_aMutex);
260
261 xOwner = m_xOwner;
262 }
263 // <- SYNCHRONIZED
264
265 css::frame::TitleChangedEvent aEvent(xOwner, m_sTitle);
266
267 if( ! aEvent.Source.is() )
268 return;
269
271 if ( ! pContainer)
272 return;
273
274 comphelper::OInterfaceIteratorHelper2 pIt( *pContainer );
275 while ( pIt.hasMoreElements() )
276 {
277 try
278 {
279 static_cast<css::frame::XTitleChangeListener*>(pIt.next())->titleChanged( aEvent );
280 }
281 catch(const css::uno::Exception&)
282 {
283 pIt.remove();
284 }
285 }
286}
287
289{
290 css::uno::Reference< css::frame::XModel3 > xModel;
291 css::uno::Reference< css::frame::XController > xController;
292 css::uno::Reference< css::frame::XFrame > xFrame;
293 // SYNCHRONIZED ->
294 {
295 osl::MutexGuard aLock(m_aMutex);
296
297 xModel.set (m_xOwner.get(), css::uno::UNO_QUERY);
298 xController.set(m_xOwner.get(), css::uno::UNO_QUERY);
299 xFrame.set (m_xOwner.get(), css::uno::UNO_QUERY);
300 }
301 // <- SYNCHRONIZED
302
303 if (xModel.is ())
304 {
306 }
307 else if (xController.is ())
308 {
310 }
311 else if (xFrame.is ())
312 {
314 }
315}
316
317void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel3 >& xModel, bool init)
318{
319 css::uno::Reference< css::uno::XInterface > xOwner;
320 css::uno::Reference< css::frame::XUntitledNumbers > xNumbers;
321 ::sal_Int32 nLeasedNumber;
322 // SYNCHRONIZED ->
323 {
324 osl::MutexGuard aLock(m_aMutex);
325
326 // external title won't be updated internally!
327 // It has to be set from outside new.
329 return;
330
331 xOwner = m_xOwner;
332 xNumbers.set (m_xUntitledNumbers.get(), css::uno::UNO_QUERY);
333 nLeasedNumber = m_nLeasedNumber;
334 }
335 // <- SYNCHRONIZED
336
337 if (
338 ( ! xOwner.is ()) ||
339 ( ! xNumbers.is ()) ||
340 ( ! xModel.is ())
341 )
342 return;
343
344 OUString sTitle;
345 OUString sURL;
346
347 css::uno::Reference< css::frame::XStorable > xURLProvider(xModel , css::uno::UNO_QUERY);
348 if (xURLProvider.is())
349 sURL = xURLProvider->getLocation ();
350
351 utl::MediaDescriptor aDescriptor(xModel->getArgs2( { utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME } ));
352 const OUString sSuggestedSaveAsName = aDescriptor.getUnpackedValueOrDefault(
354
355 if (!sURL.isEmpty())
356 {
357 sTitle = impl_convertURL2Title(sURL);
358 if (nLeasedNumber != css::frame::UntitledNumbersConst::INVALID_NUMBER)
359 xNumbers->releaseNumber (nLeasedNumber);
360 nLeasedNumber = css::frame::UntitledNumbersConst::INVALID_NUMBER;
361 }
362 else if (!sSuggestedSaveAsName.isEmpty())
363 {
364 // tdf#121537 Use suggested save as name for title if file has not yet been saved
365 sTitle = sSuggestedSaveAsName;
366 }
367 else
368 {
369 if (nLeasedNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER)
370 nLeasedNumber = xNumbers->leaseNumber (xOwner);
371
372 if (nLeasedNumber != css::frame::UntitledNumbersConst::INVALID_NUMBER)
373 sTitle = xNumbers->getUntitledPrefix() + OUString::number(nLeasedNumber);
374 else
375 sTitle = xNumbers->getUntitledPrefix() + "?";
376 }
377
378 bool bChanged;
379 // SYNCHRONIZED ->
380 {
381 osl::MutexGuard aLock(m_aMutex);
382
383 // WORKAROUND: the notification is currently sent always,
384 // can be changed after shared mode is supported per UNO API
385 bChanged = !init; // && m_sTitle != sTitle
386
387 m_sTitle = sTitle;
388 m_nLeasedNumber = nLeasedNumber;
389 }
390 // <- SYNCHRONIZED
391
392 if (bChanged)
394}
395
396void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController, bool init)
397{
398 css::uno::Reference< css::uno::XInterface > xOwner;
399 css::uno::Reference< css::frame::XUntitledNumbers > xNumbers;
400 ::sal_Int32 nLeasedNumber;
401 // SYNCHRONIZED ->
402 {
403 osl::MutexGuard aLock(m_aMutex);
404
405 // external title won't be updated internally!
406 // It has to be set from outside new.
408 return;
409
410 xOwner = m_xOwner;
411 xNumbers.set (m_xUntitledNumbers.get(), css::uno::UNO_QUERY);
412 nLeasedNumber = m_nLeasedNumber;
413 }
414 // <- SYNCHRONIZED
415
416 if (
417 ( ! xOwner.is ()) ||
418 ( ! xNumbers.is ()) ||
419 ( ! xController.is ())
420 )
421 return;
422
423 OUStringBuffer sTitle(256);
424
425 if (nLeasedNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER)
426 nLeasedNumber = xNumbers->leaseNumber (xOwner);
427
428 css::uno::Reference< css::frame::XTitle > xModelTitle(xController->getModel (), css::uno::UNO_QUERY);
429 css::uno::Reference< css::frame::XModel > xModel = xController->getModel ();
430 if (!xModelTitle.is ())
431 xModelTitle.set(xController, css::uno::UNO_QUERY);
432 if (xModelTitle.is ())
433 {
434 sTitle.append (xModelTitle->getTitle ());
435 if ( nLeasedNumber > 1 )
436 {
437 sTitle.append(" : " + OUString::number(nLeasedNumber));
438 }
439 if (xModel.is ())
440 {
441 INetURLObject aURL (xModel->getURL ());
442 if (aURL.GetProtocol () != INetProtocol::File
443 && aURL.GetProtocol () != INetProtocol::NotValid)
444 {
445 OUString sRemoteText (FwkResId (STR_REMOTE_TITLE));
446 sTitle.append (sRemoteText);
447 }
448 }
449 }
450 else
451 {
452 sTitle.append (xNumbers->getUntitledPrefix ());
453 if ( nLeasedNumber > 1 )
454 {
455 sTitle.append(nLeasedNumber );
456 }
457 }
458
459 bool bChanged;
460 // SYNCHRONIZED ->
461 {
462 osl::MutexGuard aLock(m_aMutex);
463
464 OUString sNewTitle = sTitle.makeStringAndClear ();
465 bChanged = !init && m_sTitle != sNewTitle;
466 m_sTitle = sNewTitle;
467 m_nLeasedNumber = nLeasedNumber;
468 }
469 // <- SYNCHRONIZED
470
471 if (bChanged)
473}
474
475void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame, bool init)
476{
477 if ( ! xFrame.is ())
478 return;
479
480 // SYNCHRONIZED ->
481 {
482 osl::MutexGuard aLock(m_aMutex);
483
484 // external title won't be updated internally!
485 // It has to be set from outside new.
487 return;
488 }
489 // <- SYNCHRONIZED
490
491 css::uno::Reference< css::uno::XInterface > xComponent = xFrame->getController ();
492 if ( ! xComponent.is ())
493 xComponent = xFrame->getComponentWindow ();
494
495 OUStringBuffer sTitle (256);
496
497 impl_appendComponentTitle (sTitle, xComponent);
498#ifndef MACOSX
500 {
501 // fdo#70376: We want the window title to contain just the
502 // document name (from the above "component title").
503 impl_appendProductName (sTitle);
504 impl_appendModuleName (sTitle);
506 }
507#endif
508 impl_appendSafeMode (sTitle);
509
510 bool bChanged;
511 // SYNCHRONIZED ->
512 {
513 osl::MutexGuard aLock(m_aMutex);
514
515 OUString sNewTitle = sTitle.makeStringAndClear ();
516 bChanged = !init && m_sTitle != sNewTitle;
517 m_sTitle = sNewTitle;
518 }
519 // <- SYNCHRONIZED
520
521 if (bChanged)
523}
524
525void TitleHelper::impl_appendComponentTitle ( OUStringBuffer& sTitle ,
526 const css::uno::Reference< css::uno::XInterface >& xComponent)
527{
528 css::uno::Reference< css::frame::XTitle > xTitle(xComponent, css::uno::UNO_QUERY);
529
530 // Note: Title has to be used (even if it's empty) if the right interface is supported.
531 if (xTitle.is ())
532 sTitle.append (xTitle->getTitle ());
533}
534
535void TitleHelper::impl_appendProductName (OUStringBuffer& sTitle)
536{
538 if (!name.isEmpty())
539 {
540 if (!sTitle.isEmpty())
541 {
542 OUString separator (FwkResId (STR_EMDASH_SEPARATOR));
543 sTitle.append(separator);
544 }
545 sTitle.append(name);
546 }
547}
548
549void TitleHelper::impl_appendModuleName (OUStringBuffer& sTitle)
550{
551 css::uno::Reference< css::uno::XInterface > xOwner;
552 css::uno::Reference< css::uno::XComponentContext > xContext;
553 // SYNCHRONIZED ->
554 {
555 osl::MutexGuard aLock(m_aMutex);
556
557 xOwner = m_xOwner.get();
558 xContext = m_xContext;
559 }
560 // <- SYNCHRONIZED
561
562 try
563 {
564 css::uno::Reference< css::frame::XModuleManager2 > xModuleManager =
565 css::frame::ModuleManager::create(xContext);
566
567 const OUString sID = xModuleManager->identify(xOwner);
568 ::comphelper::SequenceAsHashMap lProps = xModuleManager->getByName (sID);
569 const OUString sUIName = lProps.getUnpackedValueOrDefault (OFFICEFACTORY_PROPNAME_ASCII_UINAME, OUString());
570
571 // An UIname property is an optional value !
572 // So please add it to the title in case it does really exists only.
573 if (!sUIName.isEmpty())
574 {
575 sTitle.append (" " );
576 sTitle.append (sUIName);
577 }
578 }
579 catch(const css::uno::Exception&)
580 {}
581}
582
583#ifdef DBG_UTIL
584void TitleHelper::impl_appendDebugVersion (OUStringBuffer& sTitle)
585{
586 OUString version(utl::ConfigManager::getProductVersion());
587 sTitle.append(' ');
588 sTitle.append(version);
589 OUString sVersion = ::utl::Bootstrap::getBuildIdData("development");
590 sTitle.append(" [");
591 sTitle.append(sVersion);
592 sTitle.append("]");
593}
594#else
595void TitleHelper::impl_appendDebugVersion (OUStringBuffer&)
596{
597}
598#endif
599
600void TitleHelper::impl_appendSafeMode (OUStringBuffer& sTitle)
601{
603 sTitle.append(FwkResId (STR_SAFEMODE_TITLE));
604}
605
606void TitleHelper::impl_startListeningForModel (const css::uno::Reference< css::frame::XModel >& xModel)
607{
608 css::uno::Reference< css::document::XDocumentEventBroadcaster > xBroadcaster(xModel, css::uno::UNO_QUERY);
609 if ( ! xBroadcaster.is ())
610 return;
611
612 xBroadcaster->addDocumentEventListener (static_cast< css::document::XDocumentEventListener* >(this));
613}
614
615void TitleHelper::impl_startListeningForController (const css::uno::Reference< css::frame::XController >& xController)
616{
617 xController->addEventListener (static_cast< css::lang::XEventListener* > (static_cast< css::frame::XFrameActionListener* > (this) ) );
618 css::uno::Reference< css::frame::XTitle > xSubTitle(xController->getModel (), css::uno::UNO_QUERY);
619 impl_setSubTitle (xSubTitle);
620}
621
622void TitleHelper::impl_startListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame)
623{
624 xFrame->addFrameActionListener(this );
626}
627
628void TitleHelper::impl_updateListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame)
629{
630 css::uno::Reference< css::frame::XTitle > xSubTitle(xFrame->getController (), css::uno::UNO_QUERY);
631 impl_setSubTitle (xSubTitle);
632}
633
634void TitleHelper::impl_setSubTitle (const css::uno::Reference< css::frame::XTitle >& xSubTitle)
635{
636 css::uno::Reference< css::frame::XTitle > xOldSubTitle;
637 // SYNCHRONIZED ->
638 {
639 osl::MutexGuard aLock(m_aMutex);
640
641 // ignore duplicate calls. Makes outside using of this helper more easy :-)
642 xOldSubTitle.set(m_xSubTitle.get(), css::uno::UNO_QUERY);
643 if (xOldSubTitle == xSubTitle)
644 return;
645
646 m_xSubTitle = xSubTitle;
647 }
648 // <- SYNCHRONIZED
649
650 css::uno::Reference< css::frame::XTitleChangeBroadcaster > xOldBroadcaster(xOldSubTitle , css::uno::UNO_QUERY );
651 css::uno::Reference< css::frame::XTitleChangeBroadcaster > xNewBroadcaster(xSubTitle , css::uno::UNO_QUERY );
652 css::uno::Reference< css::frame::XTitleChangeListener > xThis(this);
653
654 if (xOldBroadcaster.is())
655 xOldBroadcaster->removeTitleChangeListener (xThis);
656
657 if (xNewBroadcaster.is())
658 xNewBroadcaster->addTitleChangeListener (xThis);
659}
660
661OUString TitleHelper::impl_convertURL2Title(std::u16string_view sURL)
662{
663 INetURLObject aURL (sURL);
664 OUString sTitle;
665
666 if (aURL.GetProtocol() == INetProtocol::File)
667 {
668 if (aURL.HasMark())
669 aURL = INetURLObject(aURL.GetURLNoMark());
670
672 }
673 else
674 {
675 if (aURL.hasExtension())
677
678 if ( sTitle.isEmpty() )
680
681 if ( sTitle.isEmpty() )
683 }
684
685 return sTitle;
686}
687
688} // namespace framework
689
690/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sSuggestedSaveAsName
AnyEventRef aEvent
FILE * init(int, char **)
static bool IsSafeModeEnabled()
css::uno::XInterface * next()
OInterfaceContainerHelper2 * getContainer(const css::uno::Type &rKey) const
sal_Int32 removeInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &rxIFace)
sal_Int32 addInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &r)
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
mutable::osl::Mutex m_aMutex
void impl_startListeningForModel(const css::uno::Reference< css::frame::XModel > &xModel)
virtual void SAL_CALL removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener > &xListener) override
TitleHelper(css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::uno::XInterface > &xOwner, const css::uno::Reference< css::frame::XUntitledNumbers > &xNumbers)
set an outside component which uses this container and must be set as source of all broadcasted messa...
Definition: titlehelper.cxx:49
void impl_startListeningForController(const css::uno::Reference< css::frame::XController > &xController)
comphelper::OMultiTypeInterfaceContainerHelper2 m_aListener
contains all title change listener
::sal_Int32 m_nLeasedNumber
knows the leased number which must be used for untitled components.
virtual ~TitleHelper() override
free all internally used resources.
Definition: titlehelper.cxx:89
void impl_appendProductName(OUStringBuffer &sTitle)
css::uno::Reference< css::uno::XComponentContext > m_xContext
points to the global uno service manager.
void impl_updateTitle(bool init=false)
virtual OUString SAL_CALL getTitle() override
Definition: titlehelper.cxx:93
void impl_updateListeningForFrame(const css::uno::Reference< css::frame::XFrame > &xFrame)
bool m_bExternalTitle
if it's set to sal_True the member m_sTitle has not to be changed internally.
css::uno::WeakReference< css::frame::XTitle > m_xSubTitle
provides parts of our own title and we listen there for changes too.
virtual void SAL_CALL documentEventOccured(const css::document::DocumentEvent &aEvent) override
virtual void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
void impl_updateTitleForController(const css::uno::Reference< css::frame::XController > &xController, bool init)
void impl_updateTitleForModel(const css::uno::Reference< css::frame::XModel3 > &xModel, bool init)
OUString impl_convertURL2Title(std::u16string_view sURL)
void impl_appendDebugVersion(OUStringBuffer &sTitle)
void impl_startListeningForFrame(const css::uno::Reference< css::frame::XFrame > &xFrame)
virtual void SAL_CALL addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener > &xListener) override
void impl_appendComponentTitle(OUStringBuffer &sTitle, const css::uno::Reference< css::uno::XInterface > &xComponent)
void impl_setSubTitle(const css::uno::Reference< css::frame::XTitle > &xSubTitle)
css::uno::WeakReference< css::uno::XInterface > m_xOwner
reference to the outside UNO class using this helper.
void impl_appendModuleName(OUStringBuffer &sTitle)
void impl_updateTitleForFrame(const css::uno::Reference< css::frame::XFrame > &xFrame, bool init)
virtual void SAL_CALL setTitle(const OUString &sTitle) override
css::uno::WeakReference< css::frame::XUntitledNumbers > m_xUntitledNumbers
used to know how an "Untitled X" string can be created right :-)
void impl_appendSafeMode(OUStringBuffer &sTitle)
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent &aEvent) override
OUString m_sTitle
the actual title value
virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent &aEvent) override
static OUString getBuildIdData(OUString const &_sDefault)
static OUString getProductVersion()
static OUString getProductName()
static bool IsFuzzing()
static constexpr OUStringLiteral PROP_SUGGESTEDSAVEASNAME
WeakReference< XFlushListener > m_aListener
URL aURL
OUString FwkResId(TranslateId aId)
Definition: fwkresid.cxx:22
css::uno::Reference< css::uno::XComponentContext > m_xContext
const char * name
constexpr OUStringLiteral OFFICEFACTORY_PROPNAME_ASCII_UINAME
properties for office module config (Setup.xcu)
Definition: properties.h:92
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel
std::mutex m_aMutex