diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-07-12 21:13:57 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-07-13 06:58:14 +0000 |
commit | 2970ec843820a72d73a91cc11fc353e5b9fde5fd (patch) | |
tree | f2cee9aa4ff219d1456f2d2f79404cf58f5bb845 /sd | |
parent | 26ac3ee8b2f8cb3bd298d98f9a94c9e305f6c304 (diff) |
editeng: make Link<> usage typed
Change-Id: Iec36c7e4f4fbc2ee2ee25d4d0c8488340ba7d8c4
Reviewed-on: https://gerrit.libreoffice.org/16968
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/sdmod.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod2.cxx | 407 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsfil.cxx | 22 | ||||
-rw-r--r-- | sd/source/ui/inc/OutlineView.hxx | 16 | ||||
-rw-r--r-- | sd/source/ui/inc/View.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/outlview.cxx | 188 | ||||
-rw-r--r-- | sd/source/ui/view/sdview.cxx | 6 |
7 files changed, 314 insertions, 331 deletions
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx index dfb9c6a62c76..a113a00fda0d 100644 --- a/sd/inc/sdmod.hxx +++ b/sd/inc/sdmod.hxx @@ -80,7 +80,7 @@ class SdModule : public SfxModule, public SfxListener public: TYPEINFO_OVERRIDE(); SFX_DECL_INTERFACE(SD_IF_SDAPP) - DECL_LINK( CalcFieldValueHdl, EditFieldInfo* ); + DECL_LINK_TYPED( CalcFieldValueHdl, EditFieldInfo*, void ); private: /// SfxInterface initializer. diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index a69beb88c18c..2b4866d680fa 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -142,268 +142,265 @@ static SdPage* GetCurrentPage( sd::ViewShell* pViewSh, EditFieldInfo* pInfo, boo /** * Link for CalcFieldValue of Outliners */ -IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo) +IMPL_LINK_TYPED(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) { - if (pInfo) - { - const SvxFieldData* pField = pInfo->GetField().GetField(); - ::sd::DrawDocShell* pDocShell = NULL; - SdDrawDocument* pDoc = 0; + if (!pInfo) + return; - SdrOutliner* pSdrOutliner = dynamic_cast< SdrOutliner* >( pInfo->GetOutliner() ); - if( pSdrOutliner ) - { - const SdrTextObj* pTextObj = pSdrOutliner->GetTextObj(); + const SvxFieldData* pField = pInfo->GetField().GetField(); + ::sd::DrawDocShell* pDocShell = NULL; + SdDrawDocument* pDoc = 0; - if( pTextObj ) - pDoc = dynamic_cast< SdDrawDocument* >( pTextObj->GetModel() ); + SdrOutliner* pSdrOutliner = dynamic_cast< SdrOutliner* >( pInfo->GetOutliner() ); + if( pSdrOutliner ) + { + const SdrTextObj* pTextObj = pSdrOutliner->GetTextObj(); - if( pDoc ) - pDocShell = pDoc->GetDocSh(); - } + if( pTextObj ) + pDoc = dynamic_cast< SdDrawDocument* >( pTextObj->GetModel() ); + + if( pDoc ) + pDocShell = pDoc->GetDocSh(); + } - if( !pDocShell ) - pDocShell = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); + if( !pDocShell ) + pDocShell = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); - const SvxDateField* pDateField = 0; - const SvxExtTimeField* pExtTimeField = 0; - const SvxExtFileField* pExtFileField = 0; - const SvxAuthorField* pAuthorField = 0; - const SvxURLField* pURLField = 0; + const SvxDateField* pDateField = 0; + const SvxExtTimeField* pExtTimeField = 0; + const SvxExtFileField* pExtFileField = 0; + const SvxAuthorField* pAuthorField = 0; + const SvxURLField* pURLField = 0; - if( (pDateField = dynamic_cast< const SvxDateField* >(pField)) != 0 ) + if( (pDateField = dynamic_cast< const SvxDateField* >(pField)) != 0 ) + { + LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); + pInfo->SetRepresentation( pDateField->GetFormatted( *GetNumberFormatter(), eLang ) ); + } + else if( (pExtTimeField = dynamic_cast< const SvxExtTimeField *>(pField)) != 0 ) + { + LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); + pInfo->SetRepresentation( pExtTimeField->GetFormatted( *GetNumberFormatter(), eLang ) ); + } + else if( (pExtFileField = dynamic_cast< const SvxExtFileField * >(pField)) != 0 ) + { + if( pDocShell && (pExtFileField->GetType() != SVXFILETYPE_FIX) ) { - LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); - pInfo->SetRepresentation( pDateField->GetFormatted( *GetNumberFormatter(), eLang ) ); + OUString aName; + if( pDocShell->HasName() ) + aName = pDocShell->GetMedium()->GetName(); + else + aName = pDocShell->GetName(); + + const_cast< SvxExtFileField* >(pExtFileField)->SetFile( aName ); } - else if( (pExtTimeField = dynamic_cast< const SvxExtTimeField *>(pField)) != 0 ) + pInfo->SetRepresentation( pExtFileField->GetFormatted() ); + + } + else if( (pAuthorField = dynamic_cast< const SvxAuthorField* >( pField )) != 0 ) + { + if( pAuthorField->GetType() != SVXAUTHORTYPE_FIX ) { - LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); - pInfo->SetRepresentation( pExtTimeField->GetFormatted( *GetNumberFormatter(), eLang ) ); + SvtUserOptions aUserOptions; + SvxAuthorField aAuthorField( + aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID(), + pAuthorField->GetType(), pAuthorField->GetFormat() ); + + *(const_cast< SvxAuthorField* >(pAuthorField)) = aAuthorField; } - else if( (pExtFileField = dynamic_cast< const SvxExtFileField * >(pField)) != 0 ) - { - if( pDocShell && (pExtFileField->GetType() != SVXFILETYPE_FIX) ) - { - OUString aName; - if( pDocShell->HasName() ) - aName = pDocShell->GetMedium()->GetName(); - else - aName = pDocShell->GetName(); + pInfo->SetRepresentation( pAuthorField->GetFormatted() ); - const_cast< SvxExtFileField* >(pExtFileField)->SetFile( aName ); - } - pInfo->SetRepresentation( pExtFileField->GetFormatted() ); + } + else if( dynamic_cast< const SvxPageField* >(pField) ) + { + OUString aRepresentation(" "); - } - else if( (pAuthorField = dynamic_cast< const SvxAuthorField* >( pField )) != 0 ) + ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; + if(pViewSh == NULL) { - if( pAuthorField->GetType() != SVXAUTHORTYPE_FIX ) - { - SvtUserOptions aUserOptions; - SvxAuthorField aAuthorField( - aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID(), - pAuthorField->GetType(), pAuthorField->GetFormat() ); + ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); + if(pBase) + pViewSh = pBase->GetMainViewShell().get(); + } + if( !pDoc && pViewSh ) + pDoc = pViewSh->GetDoc(); - *(const_cast< SvxAuthorField* >(pAuthorField)) = aAuthorField; - } - pInfo->SetRepresentation( pAuthorField->GetFormatted() ); + bool bMasterView; + SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); - } - else if( dynamic_cast< const SvxPageField* >(pField) ) + if( pPage && pDoc && !bMasterView ) { - OUString aRepresentation(" "); + int nPgNum; - ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; - if(pViewSh == NULL) + if( (pPage->GetPageKind() == PK_HANDOUT) && pViewSh ) { - ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); - if(pBase) - pViewSh = pBase->GetMainViewShell().get(); + nPgNum = pViewSh->GetPrintedHandoutPageNum(); } - if( !pDoc && pViewSh ) - pDoc = pViewSh->GetDoc(); - - bool bMasterView; - SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); - - if( pPage && pDoc && !bMasterView ) + else { - int nPgNum; - - if( (pPage->GetPageKind() == PK_HANDOUT) && pViewSh ) - { - nPgNum = pViewSh->GetPrintedHandoutPageNum(); - } - else - { - nPgNum = (pPage->GetPageNum() - 1) / 2 + 1; - } - aRepresentation = pDoc->CreatePageNumValue((sal_uInt16)nPgNum); + nPgNum = (pPage->GetPageNum() - 1) / 2 + 1; } - else - aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_NUMBER).toString(); - - pInfo->SetRepresentation( aRepresentation ); + aRepresentation = pDoc->CreatePageNumValue((sal_uInt16)nPgNum); } + else + aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_NUMBER).toString(); - else if( dynamic_cast< const SvxPageTitleField* >(pField) ) - { - OUString aRepresentation(" "); + pInfo->SetRepresentation( aRepresentation ); + } - ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; - if(pViewSh == NULL) - { - ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); - if(pBase) - pViewSh = pBase->GetMainViewShell().get(); - } - if( !pDoc && pViewSh ) - pDoc = pViewSh->GetDoc(); + else if( dynamic_cast< const SvxPageTitleField* >(pField) ) + { + OUString aRepresentation(" "); - bool bMasterView; - SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); + ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; + if(pViewSh == NULL) + { + ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); + if(pBase) + pViewSh = pBase->GetMainViewShell().get(); + } + if( !pDoc && pViewSh ) + pDoc = pViewSh->GetDoc(); - if( pPage && pDoc && !bMasterView ) - { - aRepresentation = pPage->GetName(); - } - else - { - DocumentType eDocType = pDoc ? pDoc->GetDocumentType() : DOCUMENT_TYPE_IMPRESS; - aRepresentation = ( ( eDocType == DOCUMENT_TYPE_IMPRESS ) - ? SdResId(STR_FIELD_PLACEHOLDER_SLIDENAME).toString() - : SdResId(STR_FIELD_PLACEHOLDER_PAGENAME).toString() ); - } + bool bMasterView; + SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); - pInfo->SetRepresentation( aRepresentation ); + if( pPage && pDoc && !bMasterView ) + { + aRepresentation = pPage->GetName(); } - else if( dynamic_cast< const SvxPagesField* >(pField) ) + else { - OUString aRepresentation(" "); + aRepresentation = ( ( pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ) + ? SdResId(STR_FIELD_PLACEHOLDER_SLIDENAME).toString() + : SdResId(STR_FIELD_PLACEHOLDER_PAGENAME).toString() ); + } - ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; - if(pViewSh == NULL) - { - ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); - if(pBase) - pViewSh = pBase->GetMainViewShell().get(); - } - if( !pDoc && pViewSh ) - pDoc = pViewSh->GetDoc(); + pInfo->SetRepresentation( aRepresentation ); + } + else if( dynamic_cast< const SvxPagesField* >(pField) ) + { + OUString aRepresentation(" "); - bool bMasterView; - SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); + ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; + if(pViewSh == NULL) + { + ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); + if(pBase) + pViewSh = pBase->GetMainViewShell().get(); + } + if( !pDoc && pViewSh ) + pDoc = pViewSh->GetDoc(); - sal_uInt16 nPageCount = 0; + bool bMasterView; + SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); - if( !bMasterView ) - { - if( pPage && (pPage->GetPageKind() == PK_HANDOUT) && pViewSh ) - { - nPageCount = pViewSh->GetPrintedHandoutPageCount(); - } - else if( pDoc ) - { - nPageCount = (sal_uInt16)pDoc->GetActiveSdPageCount(); - } - } + sal_uInt16 nPageCount = 0; - if( nPageCount > 0 ) - aRepresentation = pDoc->CreatePageNumValue(nPageCount); - else - aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_COUNT).toString(); - - pInfo->SetRepresentation( aRepresentation ); - } - else if( (pURLField = dynamic_cast< const SvxURLField* >(pField)) != 0 ) + if( !bMasterView ) { - switch ( pURLField->GetFormat() ) + if( pPage && (pPage->GetPageKind() == PK_HANDOUT) && pViewSh ) { - case SVXURLFORMAT_APPDEFAULT: //!!! adjustable at App??? - case SVXURLFORMAT_REPR: - pInfo->SetRepresentation( pURLField->GetRepresentation() ); - break; - - case SVXURLFORMAT_URL: - pInfo->SetRepresentation( pURLField->GetURL() ); - break; + nPageCount = pViewSh->GetPrintedHandoutPageCount(); } + else if( pDoc ) + { + nPageCount = (sal_uInt16)pDoc->GetActiveSdPageCount(); + } + } - OUString aURL = pURLField->GetURL(); + if( nPageCount > 0 ) + aRepresentation = pDoc->CreatePageNumValue(nPageCount); + else + aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_COUNT).toString(); - svtools::ColorConfig aConfig; - svtools::ColorConfigEntry eEntry = - INetURLHistory::GetOrCreate()->QueryUrl( aURL ) ? svtools::LINKSVISITED : svtools::LINKS; - pInfo->SetTextColor( aConfig.GetColorValue(eEntry).nColor ); - } - else if ( dynamic_cast< const SdrMeasureField* >(pField)) + pInfo->SetRepresentation( aRepresentation ); + } + else if( (pURLField = dynamic_cast< const SvxURLField* >(pField)) != 0 ) + { + switch ( pURLField->GetFormat() ) { - pInfo->ClearFieldColor(); + case SVXURLFORMAT_APPDEFAULT: //!!! adjustable at App??? + case SVXURLFORMAT_REPR: + pInfo->SetRepresentation( pURLField->GetRepresentation() ); + break; + + case SVXURLFORMAT_URL: + pInfo->SetRepresentation( pURLField->GetURL() ); + break; } - else - { - OUString aRepresentation; - bool bHeaderField = dynamic_cast< const SvxHeaderField* >( pField ) != 0; - bool bFooterField = !bHeaderField && (dynamic_cast< const SvxFooterField* >( pField ) != 0 ); - bool bDateTimeField = !bHeaderField && !bFooterField && (dynamic_cast< const SvxDateTimeField* >( pField ) != 0); + OUString aURL = pURLField->GetURL(); + + svtools::ColorConfig aConfig; + svtools::ColorConfigEntry eEntry = + INetURLHistory::GetOrCreate()->QueryUrl( aURL ) ? svtools::LINKSVISITED : svtools::LINKS; + pInfo->SetTextColor( aConfig.GetColorValue(eEntry).nColor ); + } + else if ( dynamic_cast< const SdrMeasureField* >(pField)) + { + pInfo->ClearFieldColor(); + } + else + { + OUString aRepresentation; + + bool bHeaderField = dynamic_cast< const SvxHeaderField* >( pField ) != 0; + bool bFooterField = !bHeaderField && (dynamic_cast< const SvxFooterField* >( pField ) != 0 ); + bool bDateTimeField = !bHeaderField && !bFooterField && (dynamic_cast< const SvxDateTimeField* >( pField ) != 0); + + if( bHeaderField || bFooterField || bDateTimeField ) + { + sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; + bool bMasterView = false; + SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); - if( bHeaderField || bFooterField || bDateTimeField ) + if( (pPage == NULL) || bMasterView ) { - sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; - bool bMasterView = false; - SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); + if( bHeaderField ) + aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_HEADER).toString(); + else if (bFooterField ) + aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_FOOTER).toString(); + else if (bDateTimeField ) + aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_DATETIME).toString(); + } + else + { + const sd::HeaderFooterSettings &rSettings = pPage->getHeaderFooterSettings(); - if( (pPage == NULL) || bMasterView ) + if( bHeaderField ) { - if( bHeaderField ) - aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_HEADER).toString(); - else if (bFooterField ) - aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_FOOTER).toString(); - else if (bDateTimeField ) - aRepresentation = SdResId(STR_FIELD_PLACEHOLDER_DATETIME).toString(); + aRepresentation = rSettings.maHeaderText; } - else + else if( bFooterField ) { - const sd::HeaderFooterSettings &rSettings = pPage->getHeaderFooterSettings(); - - if( bHeaderField ) - { - aRepresentation = rSettings.maHeaderText; - } - else if( bFooterField ) + aRepresentation = rSettings.maFooterText; + } + else if( bDateTimeField ) + { + if( rSettings.mbDateTimeIsFixed ) { - aRepresentation = rSettings.maFooterText; + aRepresentation = rSettings.maDateTimeText; } - else if( bDateTimeField ) + else { - if( rSettings.mbDateTimeIsFixed ) - { - aRepresentation = rSettings.maDateTimeText; - } - else - { - Date aDate( Date::SYSTEM ); - tools::Time aTime( tools::Time::SYSTEM ); - LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); - aRepresentation = SvxDateTimeField::GetFormatted( aDate, aTime, (SvxDateFormat)rSettings.meDateTimeFormat, *GetNumberFormatter(), eLang ); - } + Date aDate( Date::SYSTEM ); + tools::Time aTime( tools::Time::SYSTEM ); + LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); + aRepresentation = SvxDateTimeField::GetFormatted( aDate, aTime, (SvxDateFormat)rSettings.meDateTimeFormat, *GetNumberFormatter(), eLang ); } } } - else - { - OSL_FAIL("sd::SdModule::CalcFieldValueHdl(), unknown field type!"); - } - - if( aRepresentation.isEmpty() ) // TODO: Edit engine doesn't handle empty fields? - aRepresentation = " "; - pInfo->SetRepresentation( aRepresentation ); } - } + else + { + OSL_FAIL("sd::SdModule::CalcFieldValueHdl(), unknown field type!"); + } - return 0; + if( aRepresentation.isEmpty() ) // TODO: Edit engine doesn't handle empty fields? + aRepresentation = " "; + pInfo->SetRepresentation( aRepresentation ); + } } /** diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 414ea1ac7ba5..213365d60168 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -694,19 +694,19 @@ bool FuInsertFile::InsSDDinOlMode(SfxMedium* pMedium) ::Outliner* pOutliner = pOlView->GetViewByWindow(mpWindow)->GetOutliner(); // cut notification links temporarily - Link<> aOldParagraphInsertedHdl = pOutliner->GetParaInsertedHdl(); - pOutliner->SetParaInsertedHdl( Link<>(NULL, NULL)); - Link<> aOldParagraphRemovingHdl = pOutliner->GetParaRemovingHdl(); - pOutliner->SetParaRemovingHdl( Link<>(NULL, NULL)); - Link<> aOldDepthChangedHdl = pOutliner->GetDepthChangedHdl(); - pOutliner->SetDepthChangedHdl( Link<>(NULL, NULL)); - Link<> aOldBeginMovingHdl = pOutliner->GetBeginMovingHdl(); - pOutliner->SetBeginMovingHdl( Link<>(NULL, NULL)); - Link<> aOldEndMovingHdl = pOutliner->GetEndMovingHdl(); - pOutliner->SetEndMovingHdl( Link<>(NULL, NULL)); + Link<::Outliner*,void> aOldParagraphInsertedHdl = pOutliner->GetParaInsertedHdl(); + pOutliner->SetParaInsertedHdl( Link<::Outliner*,void>()); + Link<::Outliner*,void> aOldParagraphRemovingHdl = pOutliner->GetParaRemovingHdl(); + pOutliner->SetParaRemovingHdl( Link<::Outliner*,void>()); + Link<::Outliner*,void> aOldDepthChangedHdl = pOutliner->GetDepthChangedHdl(); + pOutliner->SetDepthChangedHdl( Link<::Outliner*,void>()); + Link<::Outliner*,void> aOldBeginMovingHdl = pOutliner->GetBeginMovingHdl(); + pOutliner->SetBeginMovingHdl( Link<::Outliner*,void>()); + Link<::Outliner*,void> aOldEndMovingHdl = pOutliner->GetEndMovingHdl(); + pOutliner->SetEndMovingHdl( Link<::Outliner*,void>()); Link<> aOldStatusEventHdl = pOutliner->GetStatusEventHdl(); - pOutliner->SetStatusEventHdl(Link<>(NULL, NULL)); + pOutliner->SetStatusEventHdl(Link<>()); pOutliner->Clear(); pOlView->FillOutliner(); diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx index 68756dc14e73..495a4d7b4fc6 100644 --- a/sd/source/ui/inc/OutlineView.hxx +++ b/sd/source/ui/inc/OutlineView.hxx @@ -95,17 +95,17 @@ public: void Paint (const Rectangle& rRect, ::sd::Window* pWin); // Callbacks fuer LINKs - DECL_LINK( ParagraphInsertedHdl, Outliner * ); - DECL_LINK( ParagraphRemovingHdl, Outliner * ); - DECL_LINK( DepthChangedHdl, Outliner * ); + DECL_LINK_TYPED( ParagraphInsertedHdl, Outliner *, void ); + DECL_LINK_TYPED( ParagraphRemovingHdl, Outliner *, void ); + DECL_LINK_TYPED( DepthChangedHdl, Outliner *, void ); DECL_LINK( StatusEventHdl, void * ); - DECL_LINK( BeginMovingHdl, Outliner * ); - DECL_LINK( EndMovingHdl, Outliner * ); - DECL_LINK(RemovingPagesHdl, void *); - DECL_LINK( IndentingPagesHdl, OutlinerView * ); + DECL_LINK_TYPED( BeginMovingHdl, Outliner *, void ); + DECL_LINK_TYPED( EndMovingHdl, Outliner *, void ); + DECL_LINK_TYPED( RemovingPagesHdl, OutlinerView *, bool ); + DECL_LINK_TYPED( IndentingPagesHdl, OutlinerView *, long ); DECL_LINK( BeginDropHdl, void * ); DECL_LINK( EndDropHdl, void * ); - DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo* ); + DECL_LINK_TYPED( PaintingFirstLineHdl, PaintFirstLineInfo*, void ); sal_uLong GetPaperWidth() { return mnPaperWidth;} diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index 1b2e223a8d25..f2509c52194a 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -258,8 +258,8 @@ public: SdrObject* GetSelectedSingleObject(SdPage* pPage); protected: - DECL_LINK( OnParagraphInsertedHdl, ::Outliner * ); - DECL_LINK( OnParagraphRemovingHdl, ::Outliner * ); + DECL_LINK_TYPED( OnParagraphInsertedHdl, ::Outliner *, void ); + DECL_LINK_TYPED( OnParagraphRemovingHdl, ::Outliner *, void ); virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos ) SAL_OVERRIDE; virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos ) SAL_OVERRIDE; diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index bc3c87b1e197..19f38f0181b9 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -363,7 +363,7 @@ Paragraph* OutlineView::GetNextTitle(const Paragraph* pPara) /** * Handler for inserting pages (paragraphs) */ -IMPL_LINK( OutlineView, ParagraphInsertedHdl, ::Outliner *, pOutliner ) +IMPL_LINK_TYPED( OutlineView, ParagraphInsertedHdl, ::Outliner *, pOutliner, void ) { // we get calls to this handler during binary insert of drag and drop contents but // we ignore it here and handle it later in OnEndPasteOrDrop() @@ -384,8 +384,6 @@ IMPL_LINK( OutlineView, ParagraphInsertedHdl, ::Outliner *, pOutliner ) InsertSlideForParagraph( pPara ); } } - - return 0; } /** creates and inserts an empty slide for the given paragraph */ @@ -505,7 +503,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) /** * Handler for deleting pages (paragraphs) */ -IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner ) +IMPL_LINK_TYPED( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner, void ) { DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::ParagraphRemovingHdl(), model change without undo?!" ); @@ -556,15 +554,13 @@ IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner ) } pOutliner->UpdateFields(); } - - return 0; } /** * Handler for changing the indentation depth of paragraphs (requires inserting * or deleting of pages in some cases) */ -IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner ) +IMPL_LINK_TYPED( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner, void ) { DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::DepthChangedHdl(), no undo for model change?!" ); @@ -773,8 +769,6 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner ) } } } - - return 0; } /** @@ -821,7 +815,7 @@ IMPL_LINK_NOARG(OutlineView, EndDropHdl) /** * Handler for the start of a paragraph movement */ -IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner ) +IMPL_LINK_TYPED( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner, void ) { OutlineViewPageChangesGuard aGuard(this); @@ -857,14 +851,12 @@ IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner ) } pPara = pOutliner->GetParagraph( ++nParaPos ); } - - return 0; } /** * Handler for the end of a paragraph movement */ -IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner ) +IMPL_LINK_TYPED( OutlineView, EndMovingHdl, ::Outliner *, pOutliner, void ) { OutlineViewPageChangesGuard aGuard(this); @@ -924,8 +916,6 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner ) maSelectedParas.clear(); maOldParaOrder.clear(); - - return 0; } /** @@ -1181,7 +1171,7 @@ void OutlineView::FillOutliner() /** * Handler for deleting of level 0 paragraphs (pages): Warning */ -IMPL_LINK_NOARG(OutlineView, RemovingPagesHdl) +IMPL_LINK_NOARG_TYPED(OutlineView, RemovingPagesHdl, OutlinerView*, bool) { sal_Int32 nNumOfPages = mrOutliner.GetSelPageCount(); @@ -1198,13 +1188,13 @@ IMPL_LINK_NOARG(OutlineView, RemovingPagesHdl) } mrOutliner.UpdateFields(); - return 1; + return true; } /** * Handler for indenting level 0 paragraphs (pages): Warning */ -IMPL_LINK( OutlineView, IndentingPagesHdl, OutlinerView *, pOutlinerView ) +IMPL_LINK_TYPED( OutlineView, IndentingPagesHdl, OutlinerView *, pOutlinerView, long ) { return RemovingPagesHdl(pOutlinerView); } @@ -1374,17 +1364,17 @@ void OutlineView::SetLinks() void OutlineView::ResetLinks() const { Link<> aEmptyLink; - mrOutliner.SetParaInsertedHdl(aEmptyLink); - mrOutliner.SetParaRemovingHdl(aEmptyLink); - mrOutliner.SetDepthChangedHdl(aEmptyLink); - mrOutliner.SetBeginMovingHdl(aEmptyLink); - mrOutliner.SetEndMovingHdl(aEmptyLink); + mrOutliner.SetParaInsertedHdl(Link<::Outliner*,void>()); + mrOutliner.SetParaRemovingHdl(Link<::Outliner*,void>()); + mrOutliner.SetDepthChangedHdl(Link<::Outliner*,void>()); + mrOutliner.SetBeginMovingHdl(Link<::Outliner*,void>()); + mrOutliner.SetEndMovingHdl(Link<::Outliner*,void>()); mrOutliner.SetStatusEventHdl(aEmptyLink); - mrOutliner.SetRemovingPagesHdl(aEmptyLink); - mrOutliner.SetIndentingPagesHdl(aEmptyLink); + mrOutliner.SetRemovingPagesHdl(Link<OutlinerView*,bool>()); + mrOutliner.SetIndentingPagesHdl(Link<OutlinerView*,long>()); mrOutliner.SetDrawPortionHdl(Link<DrawPortionInfo*,void>()); - mrOutliner.SetBeginPasteOrDropHdl(aEmptyLink); - mrOutliner.SetEndPasteOrDropHdl(aEmptyLink); + mrOutliner.SetBeginPasteOrDropHdl(Link<PasteOrDropInfos*,void>()); + mrOutliner.SetEndPasteOrDropHdl(Link<PasteOrDropInfos*,void>()); } sal_Int8 OutlineView::AcceptDrop( const AcceptDropEvent&, DropTargetHelper&, ::sd::Window*, sal_uInt16, sal_uInt16) @@ -1659,94 +1649,92 @@ void OutlineView::TryToMergeUndoActions() } } -IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo) +IMPL_LINK_TYPED(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo, void) { - if( pInfo ) - { - Paragraph* pPara = mrOutliner.GetParagraph( pInfo->mnPara ); - EditEngine& rEditEngine = const_cast< EditEngine& >( mrOutliner.GetEditEngine() ); + if( !pInfo ) + return; + + Paragraph* pPara = mrOutliner.GetParagraph( pInfo->mnPara ); + EditEngine& rEditEngine = const_cast< EditEngine& >( mrOutliner.GetEditEngine() ); - Size aImageSize( pInfo->mpOutDev->PixelToLogic( maSlideImage.GetSizePixel() ) ); - Size aOffset( 100, 100 ); + Size aImageSize( pInfo->mpOutDev->PixelToLogic( maSlideImage.GetSizePixel() ) ); + Size aOffset( 100, 100 ); - // paint slide number - if( pPara && ::Outliner::HasParaFlag(pPara,ParaFlag::ISPAGE) ) + // paint slide number + if( pPara && ::Outliner::HasParaFlag(pPara,ParaFlag::ISPAGE) ) + { + long nPage = 0; // todo, printing?? + for ( sal_Int32 n = 0; n <= pInfo->mnPara; n++ ) { - long nPage = 0; // todo, printing?? - for ( sal_Int32 n = 0; n <= pInfo->mnPara; n++ ) - { - Paragraph* p = mrOutliner.GetParagraph( n ); - if ( ::Outliner::HasParaFlag(p,ParaFlag::ISPAGE) ) - nPage++; - } + Paragraph* p = mrOutliner.GetParagraph( n ); + if ( ::Outliner::HasParaFlag(p,ParaFlag::ISPAGE) ) + nPage++; + } - long nBulletHeight = (long)mrOutliner.GetLineHeight( pInfo->mnPara ); - long nFontHeight = 0; - if ( !rEditEngine.IsFlatMode() ) - { - nFontHeight = nBulletHeight / 5; - } - else - { - nFontHeight = (nBulletHeight * 10) / 25; - } + long nBulletHeight = (long)mrOutliner.GetLineHeight( pInfo->mnPara ); + long nFontHeight = 0; + if ( !rEditEngine.IsFlatMode() ) + { + nFontHeight = nBulletHeight / 5; + } + else + { + nFontHeight = (nBulletHeight * 10) / 25; + } - Size aFontSz( 0, nFontHeight ); + Size aFontSz( 0, nFontHeight ); - Size aOutSize( 2000, nBulletHeight ); + Size aOutSize( 2000, nBulletHeight ); - const float fImageHeight = ((float)aOutSize.Height() * (float)4) / (float)7; - if (aImageSize.Width() != 0) - { - const float fImageRatio = (float)aImageSize.Height() / (float)aImageSize.Width(); - aImageSize.Width() = (long)( fImageRatio * fImageHeight ); - } - aImageSize.Height() = (long)( fImageHeight ); - - Point aImagePos( pInfo->mrStartPos ); - aImagePos.X() += aOutSize.Width() - aImageSize.Width() - aOffset.Width() ; - aImagePos.Y() += (aOutSize.Height() - aImageSize.Height()) / 2; - - pInfo->mpOutDev->DrawImage( aImagePos, aImageSize, maSlideImage ); - - const bool bVertical = mrOutliner.IsVertical(); - const bool bRightToLeftPara = rEditEngine.IsRightToLeft( pInfo->mnPara ); - - LanguageType eLang = rEditEngine.GetDefaultLanguage(); - - Point aTextPos( aImagePos.X() - aOffset.Width(), pInfo->mrStartPos.Y() ); - vcl::Font aNewFont( OutputDevice::GetDefaultFont( DefaultFontType::SANS_UNICODE, eLang, GetDefaultFontFlags::NONE ) ); - aNewFont.SetSize( aFontSz ); - aNewFont.SetVertical( bVertical ); - aNewFont.SetOrientation( bVertical ? 2700 : 0 ); - aNewFont.SetColor( COL_AUTO ); - pInfo->mpOutDev->SetFont( aNewFont ); - OUString aPageText = OUString::number( nPage ); - Size aTextSz; - aTextSz.Width() = pInfo->mpOutDev->GetTextWidth( aPageText ); - aTextSz.Height() = pInfo->mpOutDev->GetTextHeight(); - if ( !bVertical ) + const float fImageHeight = ((float)aOutSize.Height() * (float)4) / (float)7; + if (aImageSize.Width() != 0) + { + const float fImageRatio = (float)aImageSize.Height() / (float)aImageSize.Width(); + aImageSize.Width() = (long)( fImageRatio * fImageHeight ); + } + aImageSize.Height() = (long)( fImageHeight ); + + Point aImagePos( pInfo->mrStartPos ); + aImagePos.X() += aOutSize.Width() - aImageSize.Width() - aOffset.Width() ; + aImagePos.Y() += (aOutSize.Height() - aImageSize.Height()) / 2; + + pInfo->mpOutDev->DrawImage( aImagePos, aImageSize, maSlideImage ); + + const bool bVertical = mrOutliner.IsVertical(); + const bool bRightToLeftPara = rEditEngine.IsRightToLeft( pInfo->mnPara ); + + LanguageType eLang = rEditEngine.GetDefaultLanguage(); + + Point aTextPos( aImagePos.X() - aOffset.Width(), pInfo->mrStartPos.Y() ); + vcl::Font aNewFont( OutputDevice::GetDefaultFont( DefaultFontType::SANS_UNICODE, eLang, GetDefaultFontFlags::NONE ) ); + aNewFont.SetSize( aFontSz ); + aNewFont.SetVertical( bVertical ); + aNewFont.SetOrientation( bVertical ? 2700 : 0 ); + aNewFont.SetColor( COL_AUTO ); + pInfo->mpOutDev->SetFont( aNewFont ); + OUString aPageText = OUString::number( nPage ); + Size aTextSz; + aTextSz.Width() = pInfo->mpOutDev->GetTextWidth( aPageText ); + aTextSz.Height() = pInfo->mpOutDev->GetTextHeight(); + if ( !bVertical ) + { + aTextPos.Y() += (aOutSize.Height() - aTextSz.Height()) / 2; + if ( !bRightToLeftPara ) { - aTextPos.Y() += (aOutSize.Height() - aTextSz.Height()) / 2; - if ( !bRightToLeftPara ) - { - aTextPos.X() -= aTextSz.Width(); - } - else - { - aTextPos.X() += aTextSz.Width(); - } + aTextPos.X() -= aTextSz.Width(); } else { - aTextPos.Y() -= aTextSz.Width(); - aTextPos.X() += nBulletHeight / 2; + aTextPos.X() += aTextSz.Width(); } - pInfo->mpOutDev->DrawText( aTextPos, aPageText ); } + else + { + aTextPos.Y() -= aTextSz.Width(); + aTextPos.X() += nBulletHeight / 2; + } + pInfo->mpOutDev->DrawText( aTextPos, aPageText ); } - - return 0; } void OutlineView::UpdateParagraph( sal_Int32 nPara ) diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index b424cf7db4d5..18fbf2e7e68b 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -1075,7 +1075,7 @@ void View::onAccessibilityOptionsChanged() } } -IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner ) +IMPL_LINK_TYPED( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner, void ) { Paragraph* pPara = pOutliner->GetHdlParagraph(); SdrObject* pObj = GetTextEditObject(); @@ -1086,13 +1086,12 @@ IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner ) if( pPage ) pPage->onParagraphInserted( pOutliner, pPara, pObj ); } - return 0; } /** * Handler for the deletion of the pages (paragraphs). */ -IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner ) +IMPL_LINK_TYPED( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner, void ) { Paragraph* pPara = pOutliner->GetHdlParagraph(); SdrObject* pObj = GetTextEditObject(); @@ -1103,7 +1102,6 @@ IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner ) if( pPage ) pPage->onParagraphRemoving( pOutliner, pPara, pObj ); } - return 0; } bool View::isRecordingUndo() const |