sd/source/ui/annotations/annotationmanager.cxx | 44 ++++++++++--------------- sd/source/ui/annotations/annotationwindow.cxx | 24 +++++-------- 2 files changed, 28 insertions(+), 40 deletions(-)
New commits: commit 698a58bf2a6ca61a6646abce98e0bb171e10f49a Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Jun 17 12:07:17 2024 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Jun 17 08:55:40 2024 +0200 annot: remove too much "using namespace ..." declarations Change-Id: Ief36190e10dc03246497d4fd9475d9141dd1d7b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168975 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index e45c35894450..c4d10f78f00b 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -95,15 +95,7 @@ #include <memory> -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::drawing; -using namespace ::com::sun::star::document; -using namespace ::com::sun::star::geometry; -using namespace ::com::sun::star::text; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui; -using namespace ::com::sun::star::office; +using namespace css; namespace sd { @@ -148,7 +140,7 @@ css::util::DateTime getCurrentDateTime() aCurrentDate.GetYear(), false ); } -OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotation ) +OUString getAnnotationDateTimeString(const uno::Reference<office::XAnnotation>& xAnnotation) { OUString sRet; if( xAnnotation.is() ) @@ -209,20 +201,20 @@ void AnnotationManagerImpl::init() try { addListener(); - mxView.set(mrBase.GetController(), UNO_QUERY); + mxView.set(mrBase.GetController(), uno::UNO_QUERY); } - catch( Exception& ) + catch (uno::Exception&) { TOOLS_WARN_EXCEPTION( "sd", "sd::AnnotationManagerImpl::AnnotationManagerImpl()" ); } try { - Reference<XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW ); - Reference<XEventListener> xListener( this ); + uno::Reference<document::XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), uno::UNO_QUERY_THROW); + uno::Reference<document::XEventListener> xListener( this ); xModel->addEventListener( xListener ); } - catch( Exception& ) + catch (uno::Exception&) { } } @@ -232,11 +224,11 @@ void AnnotationManagerImpl::disposing (std::unique_lock<std::mutex>&) { try { - Reference<XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW ); - Reference<XEventListener> xListener( this ); + uno::Reference<document::XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), uno::UNO_QUERY_THROW); + uno::Reference<document::XEventListener> xListener( this ); xModel->removeEventListener( xListener ); } - catch( Exception& ) + catch (uno::Exception&) { } @@ -266,7 +258,7 @@ void SAL_CALL AnnotationManagerImpl::notifyEvent( const css::document::EventObje // consists of only one event - 'OnAnnotationRemoved' if ( aEvent.EventName == "OnAnnotationRemoved" ) { - Reference< XAnnotation > xAnnotation( aEvent.Source, uno::UNO_QUERY ); + uno::Reference<office::XAnnotation> xAnnotation( aEvent.Source, uno::UNO_QUERY ); if ( auto pAnnotation = dynamic_cast<sd::Annotation*>(xAnnotation.get()) ) { LOKCommentNotify(sdr::annotation::CommentNotificationType::Remove, &mrBase, *pAnnotation); @@ -393,7 +385,7 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest const & rReq) const SfxPoolItem* pPoolItem = nullptr; if( SfxItemState::SET == pArgs->GetItemState( SID_DELETE_POSTIT, true, &pPoolItem ) ) { - uno::Reference<XAnnotation> xTmpAnnotation; + uno::Reference<office::XAnnotation> xTmpAnnotation; if (static_cast<const SfxUnoAnyItem*>(pPoolItem)->GetValue() >>= xTmpAnnotation) { xAnnotation = dynamic_cast<sdr::annotation::Annotation*>(xTmpAnnotation.get()); @@ -465,7 +457,7 @@ void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq) if (!sText.isEmpty()) { // TODO: Not allow other authors to change others' comments ? - Reference<XText> xText(xAnnotation->getTextRange()); + uno::Reference<text::XText> xText(xAnnotation->getTextRange()); xText->setString(sText); } @@ -505,7 +497,7 @@ void AnnotationManagerImpl::InsertAnnotation(const OUString& rText) for (const auto& rxAnnotation : aAnnotations) { - RealPoint2D aRealPoint2D(rxAnnotation->getPosition()); + geometry::RealPoint2D aRealPoint2D(rxAnnotation->getPosition()); Point aPoint(::tools::Long(aRealPoint2D.X * 100.0), ::tools::Long(aRealPoint2D.Y * 100.0)); Size aSize(fWidth, fHeight); @@ -546,7 +538,7 @@ void AnnotationManagerImpl::InsertAnnotation(const OUString& rText) if (!rText.isEmpty()) { - Reference<XText> xText(xAnnotation->getTextRange()); + uno::Reference<text::XText> xText(xAnnotation->getTextRange()); xText->setString(rText); } @@ -556,7 +548,7 @@ void AnnotationManagerImpl::InsertAnnotation(const OUString& rText) xAnnotation->setDateTime( getCurrentDateTime() ); // set position - RealPoint2D aPosition(x / 100.0, y / 100.0); + geometry::RealPoint2D aPosition(x / 100.0, y / 100.0); xAnnotation->setPosition(aPosition); xAnnotation->setSize({5.0, 5.0}); @@ -588,7 +580,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq ) } else if( SfxItemState::SET == pArgs->GetItemState( rReq.GetSlot(), true, &pPoolItem ) ) { - uno::Reference<XAnnotation> xTmpAnnotation; + uno::Reference<office::XAnnotation> xTmpAnnotation; if (static_cast<const SfxUnoAnyItem*>(pPoolItem)->GetValue() >>= xTmpAnnotation) { xAnnotation = dynamic_cast<Annotation*>(xTmpAnnotation.get()); @@ -1149,7 +1141,7 @@ IMPL_LINK(AnnotationManagerImpl,EventMultiplexerListener, break; case EventMultiplexerEventId::MainViewAdded: - mxView.set( mrBase.GetController(), UNO_QUERY ); + mxView.set(mrBase.GetController(), uno::UNO_QUERY); onSelectionChanged(); break; diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index a2f17a1a53cb..a0bfe018023f 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -59,11 +59,7 @@ #include <memory> -using namespace ::sd; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::office; -using namespace ::com::sun::star::text; +using namespace css; #define METABUTTON_WIDTH 16 #define METABUTTON_HEIGHT 18 @@ -209,7 +205,7 @@ void AnnotationTextWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) // see SwAnnotationWin in sw for something similar AnnotationWindow::AnnotationWindow(weld::Window* pParent, const ::tools::Rectangle& rRect, DrawDocShell* pDocShell, - const Reference<XAnnotation>& xAnnotation) + const uno::Reference<office::XAnnotation>& xAnnotation) : mxBuilder(Application::CreateBuilder(pParent, u"modules/simpress/ui/annotation.ui"_ustr)) , mxPopover(mxBuilder->weld_popover(u"Annotation"_ustr)) , mxContainer(mxBuilder->weld_widget(u"container"_ustr)) @@ -307,13 +303,13 @@ IMPL_LINK(AnnotationWindow, MenuItemSelectedHdl, const OUString&, rIdent, void) if (rIdent == ".uno:ReplyToAnnotation") { - const SfxUnoAnyItem aItem( SID_REPLYTO_POSTIT, Any( mxAnnotation ) ); + const SfxUnoAnyItem aItem(SID_REPLYTO_POSTIT, uno::Any(mxAnnotation)); pDispatcher->ExecuteList(SID_REPLYTO_POSTIT, SfxCallMode::ASYNCHRON, { &aItem }); } else if (rIdent == ".uno:DeleteAnnotation") { - const SfxUnoAnyItem aItem( SID_DELETE_POSTIT, Any( mxAnnotation ) ); + const SfxUnoAnyItem aItem(SID_DELETE_POSTIT, uno::Any(mxAnnotation)); pDispatcher->ExecuteList(SID_DELETE_POSTIT, SfxCallMode::ASYNCHRON, { &aItem }); } @@ -484,17 +480,17 @@ IMPL_LINK(AnnotationWindow, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, v GetOutlinerView()->Scroll( 0, nDiff ); } -sdr::annotation::TextApiObject* getTextApiObject( const Reference< XAnnotation >& xAnnotation ) +sdr::annotation::TextApiObject* getTextApiObject(const uno::Reference<office::XAnnotation>& xAnnotation) { if( xAnnotation.is() ) { - Reference< XText > xText( xAnnotation->getTextRange() ); + uno::Reference<text::XText> xText( xAnnotation->getTextRange() ); return sdr::annotation::TextApiObject::getImplementation(xText); } return nullptr; } -void AnnotationWindow::setAnnotation( const Reference< XAnnotation >& xAnnotation ) +void AnnotationWindow::setAnnotation(const uno::Reference<office::XAnnotation>& xAnnotation) { if( (xAnnotation == mxAnnotation) || !xAnnotation.is() ) return; @@ -567,7 +563,7 @@ void AnnotationWindow::SetColor() void AnnotationWindow::SaveToDocument() { - Reference< XAnnotation > xAnnotation( mxAnnotation ); + uno::Reference<office::XAnnotation> xAnnotation(mxAnnotation); // write changed text back to annotation if (mpOutliner->IsModified()) @@ -735,13 +731,13 @@ bool AnnotationTextWindow::Command(const CommandEvent& rCEvt) if (sId == ".uno:ReplyToAnnotation") { - const SfxUnoAnyItem aItem( SID_REPLYTO_POSTIT, Any( xAnnotation ) ); + const SfxUnoAnyItem aItem(SID_REPLYTO_POSTIT, uno::Any(xAnnotation)); pDispatcher->ExecuteList(SID_REPLYTO_POSTIT, SfxCallMode::ASYNCHRON, { &aItem }); } else if (sId == ".uno:DeleteAnnotation") { - const SfxUnoAnyItem aItem( SID_DELETE_POSTIT, Any( xAnnotation ) ); + const SfxUnoAnyItem aItem(SID_DELETE_POSTIT, uno::Any(xAnnotation)); pDispatcher->ExecuteList(SID_DELETE_POSTIT, SfxCallMode::ASYNCHRON, { &aItem }); }