LibreOffice Module framework (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
framework::TitleHelper Class Referencefinal

can be used as implementation helper of interface css.frame.XTitle More...

#include <titlehelper.hxx>

Inheritance diagram for framework::TitleHelper:
[legend]
Collaboration diagram for framework::TitleHelper:
[legend]

Public Member Functions

 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 messages, exceptions. More...
 
virtual ~TitleHelper () override
 free all internally used resources. More...
 
virtual OUString SAL_CALL getTitle () override
 
virtual void SAL_CALL setTitle (const OUString &sTitle) override
 
virtual void SAL_CALL addTitleChangeListener (const css::uno::Reference< css::frame::XTitleChangeListener > &xListener) override
 
virtual void SAL_CALL removeTitleChangeListener (const css::uno::Reference< css::frame::XTitleChangeListener > &xListener) override
 
virtual void SAL_CALL titleChanged (const css::frame::TitleChangedEvent &aEvent) override
 
virtual void SAL_CALL documentEventOccured (const css::document::DocumentEvent &aEvent) override
 
virtual void SAL_CALL disposing (const css::lang::EventObject &aEvent) override
 
virtual void SAL_CALL frameAction (const css::frame::FrameActionEvent &aEvent) override
 

Private Member Functions

void impl_sendTitleChangedEvent ()
 
void impl_updateTitle (bool init=false)
 
void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel3 > &xModel, bool init)
 
void impl_updateTitleForController (const css::uno::Reference< css::frame::XController > &xController, bool init)
 
void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame > &xFrame, bool init)
 
void impl_startListeningForModel (const css::uno::Reference< css::frame::XModel > &xModel)
 
void impl_startListeningForController (const css::uno::Reference< css::frame::XController > &xController)
 
void impl_startListeningForFrame (const css::uno::Reference< css::frame::XFrame > &xFrame)
 
void impl_updateListeningForFrame (const css::uno::Reference< css::frame::XFrame > &xFrame)
 
void impl_appendComponentTitle (OUStringBuffer &sTitle, const css::uno::Reference< css::uno::XInterface > &xComponent)
 
void impl_appendProductName (OUStringBuffer &sTitle)
 
void impl_appendModuleName (OUStringBuffer &sTitle)
 
void impl_appendDebugVersion (OUStringBuffer &sTitle)
 
void impl_appendSafeMode (OUStringBuffer &sTitle)
 
void impl_setSubTitle (const css::uno::Reference< css::frame::XTitle > &xSubTitle)
 
OUString impl_convertURL2Title (std::u16string_view sURL)
 

Private Attributes

css::uno::Reference< css::uno::XComponentContext > m_xContext
 points to the global uno service manager. More...
 
css::uno::WeakReference< css::uno::XInterface > m_xOwner
 reference to the outside UNO class using this helper. More...
 
css::uno::WeakReference< css::frame::XUntitledNumbers > m_xUntitledNumbers
 used to know how an "Untitled X" string can be created right :-) More...
 
css::uno::WeakReference< css::frame::XTitle > m_xSubTitle
 provides parts of our own title and we listen there for changes too. More...
 
bool m_bExternalTitle
 if it's set to sal_True the member m_sTitle has not to be changed internally. More...
 
OUString m_sTitle
 the actual title value More...
 
::sal_Int32 m_nLeasedNumber
 knows the leased number which must be used for untitled components. More...
 
comphelper::OMultiTypeInterfaceContainerHelper2 m_aListener
 contains all title change listener More...
 
- Private Attributes inherited from cppu::BaseMutex
mutable::osl::Mutex m_aMutex
 

Detailed Description

can be used as implementation helper of interface css.frame.XTitle

@threadsafe

Definition at line 53 of file titlehelper.hxx.

Constructor & Destructor Documentation

◆ TitleHelper()

framework::TitleHelper::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 messages, exceptions.

It's holded weak only so we do not need any complex dispose sessions.

Note: Passing NULL as parameter will be allowed. It will reset the internal member reference only.

Parameters
xOwnerthe new owner of this collection.
xNumbersprovides the right string and number for an untitled component.

Definition at line 49 of file titlehelper.cxx.

References impl_startListeningForController(), impl_startListeningForFrame(), impl_startListeningForModel(), m_aListener, cppu::BaseMutex::m_aMutex, m_xOwner, m_xUntitledNumbers, xController, xFrame, and xModel.

◆ ~TitleHelper()

framework::TitleHelper::~TitleHelper ( )
overridevirtual

free all internally used resources.

Definition at line 89 of file titlehelper.cxx.

Member Function Documentation

◆ addTitleChangeListener()

void SAL_CALL framework::TitleHelper::addTitleChangeListener ( const css::uno::Reference< css::frame::XTitleChangeListener > &  xListener)
overridevirtual
See also
XTitleChangeBroadcaster

Definition at line 129 of file titlehelper.cxx.

References comphelper::OMultiTypeInterfaceContainerHelper2::addInterface(), and m_aListener.

◆ disposing()

void SAL_CALL framework::TitleHelper::disposing ( const css::lang::EventObject &  aEvent)
overridevirtual
See also
css.lang.XEventListener

Definition at line 212 of file titlehelper.cxx.

References aEvent, cppu::BaseMutex::m_aMutex, m_nLeasedNumber, m_sTitle, m_xOwner, m_xUntitledNumbers, and xFrame.

◆ documentEventOccured()

void SAL_CALL framework::TitleHelper::documentEventOccured ( const css::document::DocumentEvent &  aEvent)
overridevirtual
See also
css.document.XDocumentEventListener

Definition at line 158 of file titlehelper.cxx.

References aEvent, impl_updateTitle(), cppu::BaseMutex::m_aMutex, and m_xOwner.

◆ frameAction()

void SAL_CALL framework::TitleHelper::frameAction ( const css::frame::FrameActionEvent &  aEvent)
overridevirtual
See also
css.frame.XFrameActionListener

Definition at line 185 of file titlehelper.cxx.

References aEvent, impl_updateListeningForFrame(), impl_updateTitle(), cppu::BaseMutex::m_aMutex, and m_xOwner.

◆ getTitle()

OUString SAL_CALL framework::TitleHelper::getTitle ( )
overridevirtual
See also
XTitle

Definition at line 93 of file titlehelper.cxx.

References impl_updateTitle(), cppu::BaseMutex::m_aMutex, m_bExternalTitle, and m_sTitle.

◆ impl_appendComponentTitle()

void framework::TitleHelper::impl_appendComponentTitle ( OUStringBuffer &  sTitle,
const css::uno::Reference< css::uno::XInterface > &  xComponent 
)
private

Definition at line 525 of file titlehelper.cxx.

Referenced by impl_updateTitleForFrame().

◆ impl_appendDebugVersion()

void framework::TitleHelper::impl_appendDebugVersion ( OUStringBuffer &  sTitle)
private

◆ impl_appendModuleName()

void framework::TitleHelper::impl_appendModuleName ( OUStringBuffer &  sTitle)
private

◆ impl_appendProductName()

void framework::TitleHelper::impl_appendProductName ( OUStringBuffer &  sTitle)
private

Definition at line 535 of file titlehelper.cxx.

References FwkResId(), utl::ConfigManager::getProductName(), name, and separator.

Referenced by impl_updateTitleForFrame().

◆ impl_appendSafeMode()

void framework::TitleHelper::impl_appendSafeMode ( OUStringBuffer &  sTitle)
private

Definition at line 600 of file titlehelper.cxx.

References FwkResId(), and Application::IsSafeModeEnabled().

Referenced by impl_updateTitleForFrame().

◆ impl_convertURL2Title()

OUString framework::TitleHelper::impl_convertURL2Title ( std::u16string_view  sURL)
private

Definition at line 661 of file titlehelper.cxx.

References aURL, INetURLObject::LAST_SEGMENT, and INetURLObject::WithCharset.

Referenced by impl_updateTitleForModel().

◆ impl_sendTitleChangedEvent()

void framework::TitleHelper::impl_sendTitleChangedEvent ( )
private

◆ impl_setSubTitle()

void framework::TitleHelper::impl_setSubTitle ( const css::uno::Reference< css::frame::XTitle > &  xSubTitle)
private

◆ impl_startListeningForController()

void framework::TitleHelper::impl_startListeningForController ( const css::uno::Reference< css::frame::XController > &  xController)
private

Definition at line 615 of file titlehelper.cxx.

References impl_setSubTitle(), and xController.

Referenced by TitleHelper().

◆ impl_startListeningForFrame()

void framework::TitleHelper::impl_startListeningForFrame ( const css::uno::Reference< css::frame::XFrame > &  xFrame)
private

Definition at line 622 of file titlehelper.cxx.

References impl_updateListeningForFrame(), and xFrame.

Referenced by TitleHelper().

◆ impl_startListeningForModel()

void framework::TitleHelper::impl_startListeningForModel ( const css::uno::Reference< css::frame::XModel > &  xModel)
private

Definition at line 606 of file titlehelper.cxx.

References xModel.

Referenced by TitleHelper().

◆ impl_updateListeningForFrame()

void framework::TitleHelper::impl_updateListeningForFrame ( const css::uno::Reference< css::frame::XFrame > &  xFrame)
private

Definition at line 628 of file titlehelper.cxx.

References impl_setSubTitle(), and xFrame.

Referenced by frameAction(), and impl_startListeningForFrame().

◆ impl_updateTitle()

void framework::TitleHelper::impl_updateTitle ( bool  init = false)
private

◆ impl_updateTitleForController()

void framework::TitleHelper::impl_updateTitleForController ( const css::uno::Reference< css::frame::XController > &  xController,
bool  init 
)
private

◆ impl_updateTitleForFrame()

void framework::TitleHelper::impl_updateTitleForFrame ( const css::uno::Reference< css::frame::XFrame > &  xFrame,
bool  init 
)
private

◆ impl_updateTitleForModel()

void framework::TitleHelper::impl_updateTitleForModel ( const css::uno::Reference< css::frame::XModel3 > &  xModel,
bool  init 
)
private

◆ removeTitleChangeListener()

void SAL_CALL framework::TitleHelper::removeTitleChangeListener ( const css::uno::Reference< css::frame::XTitleChangeListener > &  xListener)
overridevirtual
See also
XTitleChangeBroadcaster

Definition at line 135 of file titlehelper.cxx.

References m_aListener, and comphelper::OMultiTypeInterfaceContainerHelper2::removeInterface().

◆ setTitle()

void SAL_CALL framework::TitleHelper::setTitle ( const OUString &  sTitle)
overridevirtual
See also
XTitle

Definition at line 115 of file titlehelper.cxx.

References impl_sendTitleChangedEvent(), cppu::BaseMutex::m_aMutex, m_bExternalTitle, and m_sTitle.

◆ titleChanged()

void SAL_CALL framework::TitleHelper::titleChanged ( const css::frame::TitleChangedEvent &  aEvent)
overridevirtual
See also
XTitleChangeListener

Definition at line 141 of file titlehelper.cxx.

References aEvent, impl_updateTitle(), cppu::BaseMutex::m_aMutex, and m_xSubTitle.

Referenced by impl_sendTitleChangedEvent().

Member Data Documentation

◆ m_aListener

comphelper::OMultiTypeInterfaceContainerHelper2 framework::TitleHelper::m_aListener
private

contains all title change listener

Definition at line 174 of file titlehelper.hxx.

Referenced by addTitleChangeListener(), impl_sendTitleChangedEvent(), and removeTitleChangeListener().

◆ m_bExternalTitle

bool framework::TitleHelper::m_bExternalTitle
private

if it's set to sal_True the member m_sTitle has not to be changed internally.

It was set from outside and so outside code has to make sure it will be updated.

Definition at line 165 of file titlehelper.hxx.

Referenced by getTitle(), impl_updateTitleForController(), impl_updateTitleForFrame(), impl_updateTitleForModel(), and setTitle().

◆ m_nLeasedNumber

::sal_Int32 framework::TitleHelper::m_nLeasedNumber
private

knows the leased number which must be used for untitled components.

Definition at line 171 of file titlehelper.hxx.

Referenced by disposing(), impl_updateTitleForController(), and impl_updateTitleForModel().

◆ m_sTitle

OUString framework::TitleHelper::m_sTitle
private

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext> framework::TitleHelper::m_xContext
private

points to the global uno service manager.

Definition at line 150 of file titlehelper.hxx.

Referenced by impl_appendModuleName().

◆ m_xOwner

css::uno::WeakReference< css::uno::XInterface > framework::TitleHelper::m_xOwner
private

◆ m_xSubTitle

css::uno::WeakReference< css::frame::XTitle > framework::TitleHelper::m_xSubTitle
private

provides parts of our own title and we listen there for changes too.

Definition at line 159 of file titlehelper.hxx.

Referenced by impl_setSubTitle(), and titleChanged().

◆ m_xUntitledNumbers

css::uno::WeakReference< css::frame::XUntitledNumbers > framework::TitleHelper::m_xUntitledNumbers
private

used to know how an "Untitled X" string can be created right :-)

Definition at line 156 of file titlehelper.hxx.

Referenced by disposing(), impl_updateTitleForController(), impl_updateTitleForModel(), and TitleHelper().


The documentation for this class was generated from the following files: