diff options
Diffstat (limited to 'sd/source')
35 files changed, 2840 insertions, 2837 deletions
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index c76303f338c4..bf23f1a30cdb 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -881,19 +881,19 @@ namespace { } pPageToPrint = rDocument.GetSdPage(mnSecondPageIndex, mePageKind); - if( pPageToPrint ) - { - aMap.SetOrigin(maSecondOffset); - rPrinter.SetMapMode(aMap); - PrintPage( - rPrinter, - rPrintView, - *pPageToPrint, - pView, - mbPrintMarkedOnly, - rVisibleLayers, - rPrintableLayers); - } + if( !pPageToPrint ) + return; + + aMap.SetOrigin(maSecondOffset); + rPrinter.SetMapMode(aMap); + PrintPage( + rPrinter, + rPrintView, + *pPageToPrint, + pView, + mbPrintMarkedOnly, + rVisibleLayers, + rPrintableLayers); } private: @@ -1375,82 +1375,82 @@ private: PrintInfo aInfo (mpPrinter, mpOptions->IsPrintMarkedOnly()); - if (aInfo.mpPrinter!=nullptr && pShell!=nullptr) - { + if (!(aInfo.mpPrinter!=nullptr && pShell!=nullptr)) +return; - MapMode aMap (aInfo.mpPrinter->GetMapMode()); - aMap.SetMapUnit(MapUnit::Map100thMM); - aInfo.maMap = aMap; - mpPrinter->SetMapMode(aMap); - ::Outliner& rOutliner = mrBase.GetDocument()->GetDrawOutliner(); - const EEControlBits nSavedControlWord (rOutliner.GetControlWord()); - EEControlBits nCntrl = nSavedControlWord; - nCntrl &= ~EEControlBits::MARKFIELDS; - nCntrl &= ~EEControlBits::ONLINESPELLING; - rOutliner.SetControlWord( nCntrl ); + MapMode aMap (aInfo.mpPrinter->GetMapMode()); + aMap.SetMapUnit(MapUnit::Map100thMM); + aInfo.maMap = aMap; + mpPrinter->SetMapMode(aMap); - // When in outline view then apply all pending changes to the model. - if( auto pOutlineViewShell = dynamic_cast< OutlineViewShell *>( pShell ) ) - pOutlineViewShell->PrepareClose (false); + ::Outliner& rOutliner = mrBase.GetDocument()->GetDrawOutliner(); + const EEControlBits nSavedControlWord (rOutliner.GetControlWord()); + EEControlBits nCntrl = nSavedControlWord; + nCntrl &= ~EEControlBits::MARKFIELDS; + nCntrl &= ~EEControlBits::ONLINESPELLING; + rOutliner.SetControlWord( nCntrl ); - // Collect some frequently used data. - if (mpOptions->IsDate()) - { - aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getDate( Date( Date::SYSTEM ) ); - aInfo.msTimeDate += " "; - } + // When in outline view then apply all pending changes to the model. + if( auto pOutlineViewShell = dynamic_cast< OutlineViewShell *>( pShell ) ) + pOutlineViewShell->PrepareClose (false); + + // Collect some frequently used data. + if (mpOptions->IsDate()) + { + aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getDate( Date( Date::SYSTEM ) ); + aInfo.msTimeDate += " "; + } - if (mpOptions->IsTime()) - aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getTime( ::tools::Time( ::tools::Time::SYSTEM ), false ); + if (mpOptions->IsTime()) + aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getTime( ::tools::Time( ::tools::Time::SYSTEM ), false ); - // Draw and Notes should usually use specified paper size when printing - if (!mpOptions->IsPrinterPreferred()) - { - aInfo.maPrintSize = mrBase.GetDocument()->GetSdPage(0, PageKind::Standard)->GetSize(); - maPrintSize = awt::Size(aInfo.maPrintSize.Width(), - aInfo.maPrintSize.Height()); - } - else - { - aInfo.maPrintSize = aInfo.mpPrinter->GetOutputSize(); - maPrintSize = awt::Size( - aInfo.mpPrinter->GetPaperSize().Width(), - aInfo.mpPrinter->GetPaperSize().Height()); - } + // Draw and Notes should usually use specified paper size when printing + if (!mpOptions->IsPrinterPreferred()) + { + aInfo.maPrintSize = mrBase.GetDocument()->GetSdPage(0, PageKind::Standard)->GetSize(); + maPrintSize = awt::Size(aInfo.maPrintSize.Width(), + aInfo.maPrintSize.Height()); + } + else + { + aInfo.maPrintSize = aInfo.mpPrinter->GetOutputSize(); + maPrintSize = awt::Size( + aInfo.mpPrinter->GetPaperSize().Width(), + aInfo.mpPrinter->GetPaperSize().Height()); + } - switch (mpOptions->GetOutputQuality()) - { - case 1: // Grayscale - aInfo.mnDrawMode = DrawModeFlags::GrayLine | DrawModeFlags::GrayFill - | DrawModeFlags::GrayText | DrawModeFlags::GrayBitmap - | DrawModeFlags::GrayGradient; - break; - - case 2: // Black & White - aInfo.mnDrawMode = DrawModeFlags::BlackLine | DrawModeFlags::WhiteFill - | DrawModeFlags::BlackText | DrawModeFlags::GrayBitmap - | DrawModeFlags::WhiteGradient; - break; - - default: - aInfo.mnDrawMode = DrawModeFlags::Default; - } + switch (mpOptions->GetOutputQuality()) + { + case 1: // Grayscale + aInfo.mnDrawMode = DrawModeFlags::GrayLine | DrawModeFlags::GrayFill + | DrawModeFlags::GrayText | DrawModeFlags::GrayBitmap + | DrawModeFlags::GrayGradient; + break; - if (mpOptions->IsDraw()) - PrepareStdOrNotes(PageKind::Standard, aInfo); - if (mpOptions->IsNotes()) - PrepareStdOrNotes(PageKind::Notes, aInfo); - if (mpOptions->IsHandout()) - { - InitHandoutTemplate(); - PrepareHandout(aInfo); - } - if (mpOptions->IsOutline()) - PrepareOutline(aInfo); + case 2: // Black & White + aInfo.mnDrawMode = DrawModeFlags::BlackLine | DrawModeFlags::WhiteFill + | DrawModeFlags::BlackText | DrawModeFlags::GrayBitmap + | DrawModeFlags::WhiteGradient; + break; - rOutliner.SetControlWord(nSavedControlWord); + default: + aInfo.mnDrawMode = DrawModeFlags::Default; + } + + if (mpOptions->IsDraw()) + PrepareStdOrNotes(PageKind::Standard, aInfo); + if (mpOptions->IsNotes()) + PrepareStdOrNotes(PageKind::Notes, aInfo); + if (mpOptions->IsHandout()) + { + InitHandoutTemplate(); + PrepareHandout(aInfo); } + if (mpOptions->IsOutline()) + PrepareOutline(aInfo); + + rOutliner.SetControlWord(nSavedControlWord); } /** Create the page objects of the handout template. When the actual @@ -2080,20 +2080,20 @@ private: else nPaperBin = rInfo.mpPrinter->GetPaperBin(); - if ( CheckForFrontBackPages( nPageIndex ) ) - { - maPrinterPages.push_back( - std::shared_ptr<PrinterPage>( - new TiledPrinterPage( - sal::static_int_cast<sal_uInt16>(nPageIndex), - ePageKind, - rInfo.mbPrintMarkedOnly, - rInfo.msPageString, - rInfo.mpPrinter->GetPageOffset(), - rInfo.mnDrawMode, - rInfo.meOrientation, - nPaperBin))); - } + if ( !CheckForFrontBackPages( nPageIndex ) ) + return; + + maPrinterPages.push_back( + std::shared_ptr<PrinterPage>( + new TiledPrinterPage( + sal::static_int_cast<sal_uInt16>(nPageIndex), + ePageKind, + rInfo.mbPrintMarkedOnly, + rInfo.msPageString, + rInfo.mpPrinter->GetPageOffset(), + rInfo.mnDrawMode, + rInfo.meOrientation, + nPaperBin))); } /** Print one standard slide or notes page on one to many printer diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx index 4bd6e928000d..8116b2a3359d 100644 --- a/sd/source/ui/view/FormShellManager.cxx +++ b/sd/source/ui/view/FormShellManager.cxx @@ -82,44 +82,44 @@ FormShellManager::~FormShellManager() void FormShellManager::SetFormShell (FmFormShell* pFormShell) { - if (mpFormShell != pFormShell) + if (mpFormShell == pFormShell) + return; + + // Disconnect from the old form shell. + if (mpFormShell != nullptr) { - // Disconnect from the old form shell. - if (mpFormShell != nullptr) - { - mpFormShell->SetControlActivationHandler(Link<LinkParamNone*,void>()); - EndListening(*mpFormShell); - mpFormShell->SetView(nullptr); - } + mpFormShell->SetControlActivationHandler(Link<LinkParamNone*,void>()); + EndListening(*mpFormShell); + mpFormShell->SetView(nullptr); + } - mpFormShell = pFormShell; + mpFormShell = pFormShell; - // Connect to the new form shell. - if (mpFormShell != nullptr) + // Connect to the new form shell. + if (mpFormShell != nullptr) + { + mpFormShell->SetControlActivationHandler( + LINK( + this, + FormShellManager, + FormControlActivated)); + StartListening(*mpFormShell); + + ViewShell* pMainViewShell = mrBase.GetMainViewShell().get(); + if (pMainViewShell != nullptr) { - mpFormShell->SetControlActivationHandler( - LINK( - this, - FormShellManager, - FormControlActivated)); - StartListening(*mpFormShell); - - ViewShell* pMainViewShell = mrBase.GetMainViewShell().get(); - if (pMainViewShell != nullptr) - { - // Prevent setting the view twice at the FmFormShell. - FmFormView* pFormView = static_cast<FmFormView*>(pMainViewShell->GetView()); - if (mpFormShell->GetFormView() != pFormView) - mpFormShell->SetView(pFormView); - } + // Prevent setting the view twice at the FmFormShell. + FmFormView* pFormView = static_cast<FmFormView*>(pMainViewShell->GetView()); + if (mpFormShell->GetFormView() != pFormView) + mpFormShell->SetView(pFormView); } - - // Tell the ViewShellManager where on the stack to place the form shell. - mrBase.GetViewShellManager()->SetFormShell( - mrBase.GetMainViewShell().get(), - mpFormShell, - mbFormShellAboveViewShell); } + + // Tell the ViewShellManager where on the stack to place the form shell. + mrBase.GetViewShellManager()->SetFormShell( + mrBase.GetMainViewShell().get(), + mpFormShell, + mbFormShellAboveViewShell); } void FormShellManager::RegisterAtCenterPane() @@ -259,20 +259,20 @@ IMPL_LINK(FormShellManager, WindowEventHandler, VclWindowEvent&, rEvent, void) void FormShellManager::Notify(SfxBroadcaster&, const SfxHint& rHint) { - if (rHint.GetId()==SfxHintId::Dying) + if (rHint.GetId()!=SfxHintId::Dying) + return; + + // If all goes well this listener is called after the + // FormShellManager was notified about the dying form shell by the + // FormShellManagerFactory. + OSL_ASSERT(mpFormShell==nullptr); + if (mpFormShell != nullptr) { - // If all goes well this listener is called after the - // FormShellManager was notified about the dying form shell by the - // FormShellManagerFactory. - OSL_ASSERT(mpFormShell==nullptr); - if (mpFormShell != nullptr) - { - mpFormShell = nullptr; - mrBase.GetViewShellManager()->SetFormShell( - mrBase.GetMainViewShell().get(), - nullptr, - false); - } + mpFormShell = nullptr; + mrBase.GetViewShellManager()->SetFormShell( + mrBase.GetMainViewShell().get(), + nullptr, + false); } } diff --git a/sd/source/ui/view/MediaObjectBar.cxx b/sd/source/ui/view/MediaObjectBar.cxx index 22c6ecf12062..fef4899810ef 100644 --- a/sd/source/ui/view/MediaObjectBar.cxx +++ b/sd/source/ui/view/MediaObjectBar.cxx @@ -108,38 +108,38 @@ void MediaObjectBar::GetState( SfxItemSet& rSet ) void MediaObjectBar::Execute( SfxRequest const & rReq ) { - if( SID_AVMEDIA_TOOLBOX == rReq.GetSlot() ) - { - const SfxItemSet* pArgs = rReq.GetArgs(); - const SfxPoolItem* pItem; + if( SID_AVMEDIA_TOOLBOX != rReq.GetSlot() ) + return; - if( !pArgs || ( SfxItemState::SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) ) - pItem = nullptr; + const SfxItemSet* pArgs = rReq.GetArgs(); + const SfxPoolItem* pItem; - if( pItem ) - { - std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( mpView->GetMarkedObjectList() )); + if( !pArgs || ( SfxItemState::SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) ) + pItem = nullptr; - if( 1 == pMarkList->GetMarkCount() ) - { - SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj(); + if( !pItem ) + return; - if( dynamic_cast< SdrMediaObj *>( pObj ) ) - { - static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem( - static_cast< const ::avmedia::MediaItem& >( *pItem ) ); + std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( mpView->GetMarkedObjectList() )); + if( 1 != pMarkList->GetMarkCount() ) + return; - //if only changing state then don't set modified flag (e.g. playing a video) - if( !(static_cast< const ::avmedia::MediaItem& >( *pItem ).getMaskSet() & AVMediaSetMask::STATE)) - { - //fdo #32598: after changing playback opts, set document's modified flag - SdDrawDocument& rDoc = mpView->GetDoc(); - rDoc.SetChanged(); - } - } - } - } + SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj(); + + if( !dynamic_cast< SdrMediaObj *>( pObj ) ) + return; + + static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem( + static_cast< const ::avmedia::MediaItem& >( *pItem ) ); + + + //if only changing state then don't set modified flag (e.g. playing a video) + if( !(static_cast< const ::avmedia::MediaItem& >( *pItem ).getMaskSet() & AVMediaSetMask::STATE)) + { + //fdo #32598: after changing playback opts, set document's modified flag + SdDrawDocument& rDoc = mpView->GetDoc(); + rDoc.SetChanged(); } } diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index ed25f27e2d34..0c98800946b0 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1010,33 +1010,33 @@ void SdOutliner::RestoreStartPosition() if (pViewShell == nullptr) bRestore = false; - if (bRestore) + if (!bRestore) + return; + + if( nullptr != dynamic_cast< const sd::DrawViewShell *>( pViewShell.get() )) { - if( nullptr != dynamic_cast< const sd::DrawViewShell *>( pViewShell.get() )) + std::shared_ptr<sd::DrawViewShell> pDrawViewShell ( + std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell)); + SetViewMode (meStartViewMode); + if (pDrawViewShell != nullptr) { - std::shared_ptr<sd::DrawViewShell> pDrawViewShell ( - std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell)); - SetViewMode (meStartViewMode); - if (pDrawViewShell != nullptr) + SetPage (meStartEditMode, mnStartPageIndex); + mpObj = mpStartEditedObject; + if (mpObj) { - SetPage (meStartEditMode, mnStartPageIndex); - mpObj = mpStartEditedObject; - if (mpObj) - { - PutTextIntoOutliner(); - EnterEditMode(false); - if (OutlinerView* pOutlinerView = mpImpl->GetOutlinerView()) - pOutlinerView->SetSelection(maStartSelection); - } + PutTextIntoOutliner(); + EnterEditMode(false); + if (OutlinerView* pOutlinerView = mpImpl->GetOutlinerView()) + pOutlinerView->SetSelection(maStartSelection); } } - else if( nullptr != dynamic_cast< const sd::OutlineViewShell *>( pViewShell.get() )) - { - // Set cursor to its old position. - OutlinerView* pView = GetView(0); - if (pView != nullptr) - pView->SetSelection (maStartSelection); - } + } + else if( nullptr != dynamic_cast< const sd::OutlineViewShell *>( pViewShell.get() )) + { + // Set cursor to its old position. + OutlinerView* pView = GetView(0); + if (pView != nullptr) + pView->SetSelection (maStartSelection); } } @@ -1285,45 +1285,45 @@ void SdOutliner::PrepareSpellCheck() EESpellState eState = HasSpellErrors(); DBG_ASSERT(eState != EESpellState::NoSpeller, "No SpellChecker"); - if (eState != EESpellState::Ok) + if (eState == EESpellState::Ok) + return; + + // When spell checking we have to test whether we have processed the + // whole document and have reached the start page again. + if (meMode == SPELL) { - // When spell checking we have to test whether we have processed the - // whole document and have reached the start page again. - if (meMode == SPELL) + if (maSearchStartPosition == sd::outliner::Iterator()) + // Remember the position of the first text object so that we + // know when we have processed the whole document. + maSearchStartPosition = maObjectIterator; + else if (maSearchStartPosition == maObjectIterator) { - if (maSearchStartPosition == sd::outliner::Iterator()) - // Remember the position of the first text object so that we - // know when we have processed the whole document. - maSearchStartPosition = maObjectIterator; - else if (maSearchStartPosition == maObjectIterator) - { - mbEndOfSearch = true; - } + mbEndOfSearch = true; } - - EnterEditMode( false ); } + + EnterEditMode( false ); } void SdOutliner::PrepareSearchAndReplace() { - if (HasText( *mpSearchItem )) - { - // Set the object now that we know it matches. - mpObj = SetObject(maCurrentPosition); + if (!HasText( *mpSearchItem )) + return; - mbStringFound = true; - mbMatchMayExist = true; + // Set the object now that we know it matches. + mpObj = SetObject(maCurrentPosition); - EnterEditMode(false); + mbStringFound = true; + mbMatchMayExist = true; - mpDrawDocument->GetDocSh()->SetWaitCursor( false ); - // Start search at the right end of the current object's text - // depending on the search direction. - OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); - if (pOutlinerView != nullptr) - pOutlinerView->SetSelection (GetSearchStartPosition ()); - } + EnterEditMode(false); + + mpDrawDocument->GetDocSh()->SetWaitCursor( false ); + // Start search at the right end of the current object's text + // depending on the search direction. + OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); + if (pOutlinerView != nullptr) + pOutlinerView->SetSelection (GetSearchStartPosition ()); } void SdOutliner::SetViewMode (PageKind ePageKind) @@ -1331,63 +1331,63 @@ void SdOutliner::SetViewMode (PageKind ePageKind) std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock()); std::shared_ptr<sd::DrawViewShell> pDrawViewShell( std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell)); - if (pDrawViewShell != nullptr && ePageKind != pDrawViewShell->GetPageKind()) - { - // Restore old edit mode. - pDrawViewShell->ChangeEditMode(mpImpl->meOriginalEditMode, false); - - SetStatusEventHdl(Link<EditStatus&,void>()); - OUString sViewURL; - switch (ePageKind) - { - case PageKind::Standard: - default: - sViewURL = sd::framework::FrameworkHelper::msImpressViewURL; - break; - case PageKind::Notes: - sViewURL = sd::framework::FrameworkHelper::msNotesViewURL; - break; - case PageKind::Handout: - sViewURL = sd::framework::FrameworkHelper::msHandoutViewURL; - break; - } - // The text object iterator is destroyed when the shells are - // switched but we need it so save it and restore it afterwards. - sd::outliner::Iterator aIterator (maObjectIterator); - bool bMatchMayExist = mbMatchMayExist; - - sd::ViewShellBase& rBase = pViewShell->GetViewShellBase(); - SetViewShell(std::shared_ptr<sd::ViewShell>()); - sd::framework::FrameworkHelper::Instance(rBase)->RequestView( - sViewURL, - sd::framework::FrameworkHelper::msCenterPaneURL); - - // Force (well, request) a synchronous update of the configuration. - // In a better world we would handle the asynchronous view update - // instead. But that would involve major restructuring of the - // Outliner code. - sd::framework::FrameworkHelper::Instance(rBase)->RequestSynchronousUpdate(); - SetViewShell(rBase.GetMainViewShell()); - - // Switching to another view shell has intermediatly called - // EndSpelling(). A PrepareSpelling() is pending, so call that now. - PrepareSpelling(); - - // Update the number of pages so that - // <member>DetectChange()</member> has the correct value to compare - // to. - mnPageCount = mpDrawDocument->GetSdPageCount(ePageKind); + if (!(pDrawViewShell != nullptr && ePageKind != pDrawViewShell->GetPageKind())) + return; - maObjectIterator = aIterator; - mbMatchMayExist = bMatchMayExist; + // Restore old edit mode. + pDrawViewShell->ChangeEditMode(mpImpl->meOriginalEditMode, false); - // Save edit mode so that it can be restored when switching the view - // shell again. - pDrawViewShell = std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell); - OSL_ASSERT(pDrawViewShell != nullptr); - if (pDrawViewShell != nullptr) - mpImpl->meOriginalEditMode = pDrawViewShell->GetEditMode(); + SetStatusEventHdl(Link<EditStatus&,void>()); + OUString sViewURL; + switch (ePageKind) + { + case PageKind::Standard: + default: + sViewURL = sd::framework::FrameworkHelper::msImpressViewURL; + break; + case PageKind::Notes: + sViewURL = sd::framework::FrameworkHelper::msNotesViewURL; + break; + case PageKind::Handout: + sViewURL = sd::framework::FrameworkHelper::msHandoutViewURL; + break; } + // The text object iterator is destroyed when the shells are + // switched but we need it so save it and restore it afterwards. + sd::outliner::Iterator aIterator (maObjectIterator); + bool bMatchMayExist = mbMatchMayExist; + + sd::ViewShellBase& rBase = pViewShell->GetViewShellBase(); + SetViewShell(std::shared_ptr<sd::ViewShell>()); + sd::framework::FrameworkHelper::Instance(rBase)->RequestView( + sViewURL, + sd::framework::FrameworkHelper::msCenterPaneURL); + + // Force (well, request) a synchronous update of the configuration. + // In a better world we would handle the asynchronous view update + // instead. But that would involve major restructuring of the + // Outliner code. + sd::framework::FrameworkHelper::Instance(rBase)->RequestSynchronousUpdate(); + SetViewShell(rBase.GetMainViewShell()); + + // Switching to another view shell has intermediatly called + // EndSpelling(). A PrepareSpelling() is pending, so call that now. + PrepareSpelling(); + + // Update the number of pages so that + // <member>DetectChange()</member> has the correct value to compare + // to. + mnPageCount = mpDrawDocument->GetSdPageCount(ePageKind); + + maObjectIterator = aIterator; + mbMatchMayExist = bMatchMayExist; + + // Save edit mode so that it can be restored when switching the view + // shell again. + pDrawViewShell = std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell); + OSL_ASSERT(pDrawViewShell != nullptr); + if (pDrawViewShell != nullptr) + mpImpl->meOriginalEditMode = pDrawViewShell->GetEditMode(); } void SdOutliner::SetPage (EditMode eEditMode, sal_uInt16 nPageIndex) @@ -1409,33 +1409,33 @@ void SdOutliner::SetPage (EditMode eEditMode, sal_uInt16 nPageIndex) void SdOutliner::EnterEditMode (bool bGrabFocus) { OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); - if (pOutlinerView && mpSearchSpellTextObj) - { - pOutlinerView->SetOutputArea( ::tools::Rectangle( Point(), Size(1, 1))); - SetPaperSize( mpSearchSpellTextObj->GetLogicRect().GetSize() ); - SdrPageView* pPV = mpView->GetSdrPageView(); + if (!(pOutlinerView && mpSearchSpellTextObj)) + return; - // Make FuText the current function. - SfxUInt16Item aItem (SID_TEXTEDIT, 1); - std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock()); - pViewShell->GetDispatcher()->ExecuteList(SID_TEXTEDIT, - SfxCallMode::SYNCHRON | SfxCallMode::RECORD, { &aItem }); + pOutlinerView->SetOutputArea( ::tools::Rectangle( Point(), Size(1, 1))); + SetPaperSize( mpSearchSpellTextObj->GetLogicRect().GetSize() ); + SdrPageView* pPV = mpView->GetSdrPageView(); - // To be consistent with the usual behaviour in the Office the text - // object that is put into edit mode would have also to be selected. - // Starting the text edit mode is not enough so we do it here by - // hand. - mpView->UnmarkAllObj (pPV); - mpView->MarkObj (mpSearchSpellTextObj, pPV); + // Make FuText the current function. + SfxUInt16Item aItem (SID_TEXTEDIT, 1); + std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock()); + pViewShell->GetDispatcher()->ExecuteList(SID_TEXTEDIT, + SfxCallMode::SYNCHRON | SfxCallMode::RECORD, { &aItem }); - mpSearchSpellTextObj->setActiveText( mnText ); + // To be consistent with the usual behaviour in the Office the text + // object that is put into edit mode would have also to be selected. + // Starting the text edit mode is not enough so we do it here by + // hand. + mpView->UnmarkAllObj (pPV); + mpView->MarkObj (mpSearchSpellTextObj, pPV); - // Turn on the edit mode for the text object. - mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this, pOutlinerView, true, true, bGrabFocus); + mpSearchSpellTextObj->setActiveText( mnText ); - SetUpdateMode(true); - mbFoundObject = true; - } + // Turn on the edit mode for the text object. + mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this, pOutlinerView, true, true, bGrabFocus); + + SetUpdateMode(true); + mbFoundObject = true; } ESelection SdOutliner::GetSearchStartPosition() @@ -1514,29 +1514,29 @@ SdrObject* SdOutliner::SetObject ( void SdOutliner::SetViewShell (const std::shared_ptr<sd::ViewShell>& rpViewShell) { std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock()); - if (pViewShell != rpViewShell) + if (pViewShell == rpViewShell) + return; + + // Set the new view shell. + mpWeakViewShell = rpViewShell; + // When the outline view is not owned by us then we have to clear + // that pointer so that the current one for the new view shell will + // be used (in ProvideOutlinerView). + if (rpViewShell) { - // Set the new view shell. - mpWeakViewShell = rpViewShell; - // When the outline view is not owned by us then we have to clear - // that pointer so that the current one for the new view shell will - // be used (in ProvideOutlinerView). - if (rpViewShell) - { - mpView = rpViewShell->GetView(); + mpView = rpViewShell->GetView(); - mpWindow = rpViewShell->GetActiveWindow(); + mpWindow = rpViewShell->GetActiveWindow(); - mpImpl->ProvideOutlinerView(*this, rpViewShell, mpWindow); - OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); - if (pOutlinerView != nullptr) - pOutlinerView->SetWindow(mpWindow); - } - else - { - mpView = nullptr; - mpWindow = nullptr; - } + mpImpl->ProvideOutlinerView(*this, rpViewShell, mpWindow); + OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); + if (pOutlinerView != nullptr) + pOutlinerView->SetWindow(mpWindow); + } + else + { + mpView = nullptr; + mpWindow = nullptr; } } @@ -1544,22 +1544,22 @@ void SdOutliner::HandleChangedSelection() { maMarkListCopy.clear(); mbRestrictSearchToSelection = mpView->AreObjectsMarked(); - if (mbRestrictSearchToSelection) + if (!mbRestrictSearchToSelection) + return; + + // Make a copy of the current mark list. + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + const size_t nCount = rMarkList.GetMarkCount(); + if (nCount > 0) { - // Make a copy of the current mark list. - const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); - const size_t nCount = rMarkList.GetMarkCount(); - if (nCount > 0) - { - maMarkListCopy.clear(); - maMarkListCopy.reserve (nCount); - for (size_t i=0; i<nCount; ++i) - maMarkListCopy.emplace_back(rMarkList.GetMark(i)->GetMarkedSdrObj ()); - } - else - // No marked object. Is this case possible? - mbRestrictSearchToSelection = false; + maMarkListCopy.clear(); + maMarkListCopy.reserve (nCount); + for (size_t i=0; i<nCount; ++i) + maMarkListCopy.emplace_back(rMarkList.GetMark(i)->GetMarkedSdrObj ()); } + else + // No marked object. Is this case possible? + mbRestrictSearchToSelection = false; } void SdOutliner::StartConversion( LanguageType nSourceLanguage, LanguageType nTargetLanguage, @@ -1751,62 +1751,62 @@ void SdOutliner::Implementation::ProvideOutlinerView ( const std::shared_ptr<sd::ViewShell>& rpViewShell, vcl::Window* pWindow) { - if (rpViewShell != nullptr) + if (rpViewShell == nullptr) + return; + + switch (rpViewShell->GetShellType()) { - switch (rpViewShell->GetShellType()) + case sd::ViewShell::ST_DRAW: + case sd::ViewShell::ST_IMPRESS: + case sd::ViewShell::ST_NOTES: + case sd::ViewShell::ST_HANDOUT: { - case sd::ViewShell::ST_DRAW: - case sd::ViewShell::ST_IMPRESS: - case sd::ViewShell::ST_NOTES: - case sd::ViewShell::ST_HANDOUT: + // Create a new outline view to do the search on. + bool bInsert = false; + if (mpOutlineView != nullptr && !mbOwnOutlineView) + mpOutlineView = nullptr; + + if (mpOutlineView == nullptr || !rOutliner.GetEditEngine().HasView(&mpOutlineView->GetEditView())) { - // Create a new outline view to do the search on. - bool bInsert = false; - if (mpOutlineView != nullptr && !mbOwnOutlineView) - mpOutlineView = nullptr; + delete mpOutlineView; + mpOutlineView = new OutlinerView(&rOutliner, pWindow); + mbOwnOutlineView = true; + bInsert = true; + } + else + mpOutlineView->SetWindow(pWindow); - if (mpOutlineView == nullptr || !rOutliner.GetEditEngine().HasView(&mpOutlineView->GetEditView())) - { - delete mpOutlineView; - mpOutlineView = new OutlinerView(&rOutliner, pWindow); - mbOwnOutlineView = true; - bInsert = true; - } - else - mpOutlineView->SetWindow(pWindow); + EVControlBits nStat = mpOutlineView->GetControlWord(); + nStat &= ~EVControlBits::AUTOSCROLL; + mpOutlineView->SetControlWord(nStat); - EVControlBits nStat = mpOutlineView->GetControlWord(); - nStat &= ~EVControlBits::AUTOSCROLL; - mpOutlineView->SetControlWord(nStat); + if (bInsert) + rOutliner.InsertView( mpOutlineView ); - if (bInsert) - rOutliner.InsertView( mpOutlineView ); + rOutliner.SetUpdateMode(false); + mpOutlineView->SetOutputArea (::tools::Rectangle (Point(), Size(1, 1))); + rOutliner.SetPaperSize( Size(1, 1) ); + rOutliner.SetText(OUString(), rOutliner.GetParagraph(0)); - rOutliner.SetUpdateMode(false); - mpOutlineView->SetOutputArea (::tools::Rectangle (Point(), Size(1, 1))); - rOutliner.SetPaperSize( Size(1, 1) ); - rOutliner.SetText(OUString(), rOutliner.GetParagraph(0)); + meOriginalEditMode = + std::static_pointer_cast<sd::DrawViewShell>(rpViewShell)->GetEditMode(); + } + break; - meOriginalEditMode = - std::static_pointer_cast<sd::DrawViewShell>(rpViewShell)->GetEditMode(); - } - break; + case sd::ViewShell::ST_OUTLINE: + { + if (mpOutlineView!=nullptr && mbOwnOutlineView) + delete mpOutlineView; + mpOutlineView = rOutliner.GetView(0); + mbOwnOutlineView = false; + } + break; - case sd::ViewShell::ST_OUTLINE: - { - if (mpOutlineView!=nullptr && mbOwnOutlineView) - delete mpOutlineView; - mpOutlineView = rOutliner.GetView(0); - mbOwnOutlineView = false; - } + default: + case sd::ViewShell::ST_NONE: + case sd::ViewShell::ST_PRESENTATION: + // Ignored break; - - default: - case sd::ViewShell::ST_NONE: - case sd::ViewShell::ST_PRESENTATION: - // Ignored - break; - } } } diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx index ba4d5cf8940c..7064b00fae00 100644 --- a/sd/source/ui/view/OutlinerIterator.cxx +++ b/sd/source/ui/view/OutlinerIterator.cxx @@ -785,19 +785,19 @@ void DocumentIteratorImpl::GotoNextText() bViewChanged = true; } - if (bViewChanged) - { - // Get new page count; - sal_Int32 nPageCount; - if (maPosition.meEditMode == EditMode::Page) - nPageCount = mpDocument->GetSdPageCount (maPosition.mePageKind); - else - nPageCount = mpDocument->GetMasterSdPageCount(maPosition.mePageKind); + if (!bViewChanged) + return; - // Now that we know the number of pages we can set the current page index. - if (bSetToOnePastLastPage) - SetPage (nPageCount); - } + // Get new page count; + sal_Int32 nPageCount; + if (maPosition.meEditMode == EditMode::Page) + nPageCount = mpDocument->GetSdPageCount (maPosition.mePageKind); + else + nPageCount = mpDocument->GetMasterSdPageCount(maPosition.mePageKind); + + // Now that we know the number of pages we can set the current page index. + if (bSetToOnePastLastPage) + SetPage (nPageCount); } } } // end of namespace ::sd::outliner diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 55320e8fc407..adb91f6d400a 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -562,37 +562,37 @@ void ToolBarManager::Implementation::SetValid (bool bValid) { ::osl::MutexGuard aGuard(maMutex); - if (mbIsValid != bValid) - { - UpdateLockImplementation aUpdateLock (*this); + if (mbIsValid == bValid) + return; - mbIsValid = bValid; - if (mbIsValid) - { - Reference<frame::XFrame> xFrame; - if (mrBase.GetViewFrame() != nullptr) - xFrame = mrBase.GetViewFrame()->GetFrame().GetFrameInterface(); - try - { - Reference<beans::XPropertySet> xFrameProperties (xFrame, UNO_QUERY_THROW); - Any aValue (xFrameProperties->getPropertyValue("LayoutManager")); - aValue >>= mxLayouter; - // tdf#119997 if mpSynchronousLayouterLock was created before mxLayouter was - // set then update it now that its available - if (mpSynchronousLayouterLock && !mpSynchronousLayouterLock->is()) - mpSynchronousLayouterLock.reset(new LayouterLock(mxLayouter)); - } - catch (const RuntimeException&) - { - } + UpdateLockImplementation aUpdateLock (*this); - GetToolBarRules().Update(mrBase); + mbIsValid = bValid; + if (mbIsValid) + { + Reference<frame::XFrame> xFrame; + if (mrBase.GetViewFrame() != nullptr) + xFrame = mrBase.GetViewFrame()->GetFrame().GetFrameInterface(); + try + { + Reference<beans::XPropertySet> xFrameProperties (xFrame, UNO_QUERY_THROW); + Any aValue (xFrameProperties->getPropertyValue("LayoutManager")); + aValue >>= mxLayouter; + // tdf#119997 if mpSynchronousLayouterLock was created before mxLayouter was + // set then update it now that its available + if (mpSynchronousLayouterLock && !mpSynchronousLayouterLock->is()) + mpSynchronousLayouterLock.reset(new LayouterLock(mxLayouter)); } - else + catch (const RuntimeException&) { - ResetAllToolBars(); - mxLayouter = nullptr; } + + GetToolBarRules().Update(mrBase); + } + else + { + ResetAllToolBars(); + mxLayouter = nullptr; } } @@ -674,59 +674,59 @@ void ToolBarManager::Implementation::PreUpdate() { ::osl::MutexGuard aGuard(maMutex); - if (mbIsValid + if (!(mbIsValid && mbPreUpdatePending - && mxLayouter.is()) - { - mbPreUpdatePending = false; + && mxLayouter.is())) + return; - SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PreUpdate ["); + mbPreUpdatePending = false; - // Get the list of tool bars that are not used anymore and are to be - // deactivated. - std::vector<OUString> aToolBars; - maToolBarList.GetToolBarsToDeactivate(aToolBars); + SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PreUpdate ["); - // Turn off the tool bars. - for (auto& aToolBar : aToolBars) - { - OUString sFullName (GetToolBarResourceName(aToolBar)); - SAL_INFO("sd.view", OSL_THIS_FUNC << ": turning off tool bar " << sFullName); - mxLayouter->destroyElement(sFullName); - maToolBarList.MarkToolBarAsNotActive(aToolBar); - } + // Get the list of tool bars that are not used anymore and are to be + // deactivated. + std::vector<OUString> aToolBars; + maToolBarList.GetToolBarsToDeactivate(aToolBars); - SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PreUpdate ]"); + // Turn off the tool bars. + for (auto& aToolBar : aToolBars) + { + OUString sFullName (GetToolBarResourceName(aToolBar)); + SAL_INFO("sd.view", OSL_THIS_FUNC << ": turning off tool bar " << sFullName); + mxLayouter->destroyElement(sFullName); + maToolBarList.MarkToolBarAsNotActive(aToolBar); } + + SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PreUpdate ]"); } void ToolBarManager::Implementation::PostUpdate() { ::osl::MutexGuard aGuard(maMutex); - if (mbIsValid + if (!(mbIsValid && mbPostUpdatePending - && mxLayouter.is()) - { - mbPostUpdatePending = false; + && mxLayouter.is())) + return; - // Create the list of requested tool bars. - std::vector<OUString> aToolBars; - maToolBarList.GetToolBarsToActivate(aToolBars); + mbPostUpdatePending = false; - SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate ["); + // Create the list of requested tool bars. + std::vector<OUString> aToolBars; + maToolBarList.GetToolBarsToActivate(aToolBars); - // Turn on the tool bars that are visible in the new context. - for (auto& aToolBar : aToolBars) - { - OUString sFullName (GetToolBarResourceName(aToolBar)); - SAL_INFO("sd.view", OSL_THIS_FUNC << ": turning on tool bar " << sFullName); - mxLayouter->requestElement(sFullName); - maToolBarList.MarkToolBarAsActive(aToolBar); - } + SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate ["); - SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate ]"); + // Turn on the tool bars that are visible in the new context. + for (auto& aToolBar : aToolBars) + { + OUString sFullName (GetToolBarResourceName(aToolBar)); + SAL_INFO("sd.view", OSL_THIS_FUNC << ": turning on tool bar " << sFullName); + mxLayouter->requestElement(sFullName); + maToolBarList.MarkToolBarAsActive(aToolBar); } + + SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate ]"); } void ToolBarManager::Implementation::LockViewShellManager() @@ -769,69 +769,69 @@ void ToolBarManager::Implementation::Update ( { // When the lock is released and there are pending changes to the set of // tool bars then update this set now. - if (mnLockCount == 0) + if (mnLockCount != 0) + return; + + // During creation of ViewShellBase we may have the situation that + // the controller has already been created and attached to the frame + // but that the ToolBarManager has not yet completed its + // initialization (by initializing the mxLayouter member.) We do + // this here so that we do not have to wait for the next Update() + // call to show the tool bars. + if (mnPendingSetValidCall != nullptr) { - // During creation of ViewShellBase we may have the situation that - // the controller has already been created and attached to the frame - // but that the ToolBarManager has not yet completed its - // initialization (by initializing the mxLayouter member.) We do - // this here so that we do not have to wait for the next Update() - // call to show the tool bars. - if (mnPendingSetValidCall != nullptr) - { - Application::RemoveUserEvent(mnPendingSetValidCall); - mnPendingSetValidCall = nullptr; - SetValid(true); - } + Application::RemoveUserEvent(mnPendingSetValidCall); + mnPendingSetValidCall = nullptr; + SetValid(true); + } + + if (mbIsValid && mxLayouter.is() && (mbPreUpdatePending || mbPostUpdatePending)) + { + // 1) Release UNO tool bars that are no longer used. Do this + // now so that they are not updated when the SFX shell stack is + // modified. + if (mbPreUpdatePending) + PreUpdate(); - if (mbIsValid && mxLayouter.is() && (mbPreUpdatePending || mbPostUpdatePending)) + // 2) Update the requested shells that represent tool bar + // functionality. Those that are not used anymore are + // deactivated now. Those that are missing are activated in the + // next step together with the view shells. + if (mpViewShellManagerLock == nullptr) + mpViewShellManagerLock.reset( + new ViewShellManager::UpdateLock(mrBase.GetViewShellManager())); + maToolBarShellList.UpdateShells( + mrBase.GetMainViewShell(), + mrBase.GetViewShellManager()); + + // 3) Unlock the ViewShellManager::UpdateLock. This updates the + // shell stack. + mpViewShellManagerLock.reset(); + + // 4) Make the UNO tool bars visible. The outstanding call to + // PostUpdate() is done via PostUserEvent() so that it is + // guaranteed to be executed when the SFX shell stack has been + // updated (under the assumption that our lock to the + // ViewShellManager was the only one open. If that is not the + // case then all should still be well but not as fast.) + + // Note that the lock count may have been increased since + // entering this method. In that case one of the next + // UnlockUpdate() calls will post the UpdateCallback. + if (mnLockCount==0) { - // 1) Release UNO tool bars that are no longer used. Do this - // now so that they are not updated when the SFX shell stack is - // modified. - if (mbPreUpdatePending) - PreUpdate(); - - // 2) Update the requested shells that represent tool bar - // functionality. Those that are not used anymore are - // deactivated now. Those that are missing are activated in the - // next step together with the view shells. - if (mpViewShellManagerLock == nullptr) - mpViewShellManagerLock.reset( - new ViewShellManager::UpdateLock(mrBase.GetViewShellManager())); - maToolBarShellList.UpdateShells( - mrBase.GetMainViewShell(), - mrBase.GetViewShellManager()); - - // 3) Unlock the ViewShellManager::UpdateLock. This updates the - // shell stack. - mpViewShellManagerLock.reset(); - - // 4) Make the UNO tool bars visible. The outstanding call to - // PostUpdate() is done via PostUserEvent() so that it is - // guaranteed to be executed when the SFX shell stack has been - // updated (under the assumption that our lock to the - // ViewShellManager was the only one open. If that is not the - // case then all should still be well but not as fast.) - - // Note that the lock count may have been increased since - // entering this method. In that case one of the next - // UnlockUpdate() calls will post the UpdateCallback. - if (mnLockCount==0) + mpAsynchronousLayouterLock = std::move(pLocalLayouterLock); + if (mnPendingUpdateCall==nullptr) { - mpAsynchronousLayouterLock = std::move(pLocalLayouterLock); - if (mnPendingUpdateCall==nullptr) - { - mnPendingUpdateCall = Application::PostUserEvent( - LINK(this,ToolBarManager::Implementation,UpdateCallback)); - } + mnPendingUpdateCall = Application::PostUserEvent( + LINK(this,ToolBarManager::Implementation,UpdateCallback)); } } - else - { - mpViewShellManagerLock.reset(); - pLocalLayouterLock.reset(); - } + } + else + { + mpViewShellManagerLock.reset(); + pLocalLayouterLock.reset(); } } @@ -1365,37 +1365,37 @@ void ToolBarShellList::UpdateShells ( const std::shared_ptr<ViewShell>& rpMainViewShell, const std::shared_ptr<ViewShellManager>& rpManager) { - if (rpMainViewShell != nullptr) - { - GroupedShellList aList; - - // Deactivate shells that are in maCurrentList, but not in - // maNewList. - ::std::set_difference(maCurrentList.begin(), maCurrentList.end(), - maNewList.begin(), maNewList.end(), - std::insert_iterator<GroupedShellList>(aList,aList.begin())); - for (const auto& rShell : aList) - { - SAL_INFO("sd.view", OSL_THIS_FUNC << ": deactivating tool bar shell " << static_cast<sal_uInt32>(rShell.mnId)); - rpManager->DeactivateSubShell(*rpMainViewShell, rShell.mnId); - } + if (rpMainViewShell == nullptr) + return; - // Activate shells that are in maNewList, but not in - // maCurrentList. - aList.clear(); - ::std::set_difference(maNewList.begin(), maNewList.end(), - maCurrentList.begin(), maCurrentList.end(), - std::insert_iterator<GroupedShellList>(aList,aList.begin())); - for (const auto& rShell : aList) - { - SAL_INFO("sd.view", OSL_THIS_FUNC << ": activating tool bar shell " << static_cast<sal_uInt32>(rShell.mnId)); - rpManager->ActivateSubShell(*rpMainViewShell, rShell.mnId); - } + GroupedShellList aList; + + // Deactivate shells that are in maCurrentList, but not in + // maNewList. + ::std::set_difference(maCurrentList.begin(), maCurrentList.end(), + maNewList.begin(), maNewList.end(), + std::insert_iterator<GroupedShellList>(aList,aList.begin())); + for (const auto& rShell : aList) + { + SAL_INFO("sd.view", OSL_THIS_FUNC << ": deactivating tool bar shell " << static_cast<sal_uInt32>(rShell.mnId)); + rpManager->DeactivateSubShell(*rpMainViewShell, rShell.mnId); + } - // The maNewList now reflects the current state and thus is made - // maCurrentList. - maCurrentList = maNewList; + // Activate shells that are in maNewList, but not in + // maCurrentList. + aList.clear(); + ::std::set_difference(maNewList.begin(), maNewList.end(), + maCurrentList.begin(), maCurrentList.end(), + std::insert_iterator<GroupedShellList>(aList,aList.begin())); + for (const auto& rShell : aList) + { + SAL_INFO("sd.view", OSL_THIS_FUNC << ": activating tool bar shell " << static_cast<sal_uInt32>(rShell.mnId)); + rpManager->ActivateSubShell(*rpMainViewShell, rShell.mnId); } + + // The maNewList now reflects the current state and thus is made + // maCurrentList. + maCurrentList = maNewList; } } // end of anonymous namespace diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 417a3f65fb3f..260afc29d8fe 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -701,43 +701,43 @@ void ViewShellBase::ReadUserDataSequence ( { // Forward call to main sub shell. ViewShell* pShell = GetMainViewShell().get(); - if (pShell != nullptr) - { - pShell->ReadUserDataSequence (rSequence); + if (pShell == nullptr) + return; + + pShell->ReadUserDataSequence (rSequence); - // For certain shell types ReadUserDataSequence may have changed the - // type to another one. Make sure that the center pane shows the - // right view shell. - switch (pShell->GetShellType()) + // For certain shell types ReadUserDataSequence may have changed the + // type to another one. Make sure that the center pane shows the + // right view shell. + switch (pShell->GetShellType()) + { + case ViewShell::ST_IMPRESS: + case ViewShell::ST_NOTES: + case ViewShell::ST_HANDOUT: { - case ViewShell::ST_IMPRESS: - case ViewShell::ST_NOTES: - case ViewShell::ST_HANDOUT: + OUString sViewURL; + switch (dynamic_cast<DrawViewShell&>(*pShell).GetPageKind()) { - OUString sViewURL; - switch (dynamic_cast<DrawViewShell&>(*pShell).GetPageKind()) - { - default: - case PageKind::Standard: - sViewURL = framework::FrameworkHelper::msImpressViewURL; - break; - case PageKind::Notes: - sViewURL = framework::FrameworkHelper::msNotesViewURL; - break; - case PageKind::Handout: - sViewURL = framework::FrameworkHelper::msHandoutViewURL; - break; - } - if (!sViewURL.isEmpty()) - framework::FrameworkHelper::Instance(*this)->RequestView( - sViewURL, - framework::FrameworkHelper::msCenterPaneURL); + default: + case PageKind::Standard: + sViewURL = framework::FrameworkHelper::msImpressViewURL; + break; + case PageKind::Notes: + sViewURL = framework::FrameworkHelper::msNotesViewURL; + break; + case PageKind::Handout: + sViewURL = framework::FrameworkHelper::msHandoutViewURL; + break; } - break; - - default: - break; + if (!sViewURL.isEmpty()) + framework::FrameworkHelper::Instance(*this)->RequestView( + sViewURL, + framework::FrameworkHelper::msCenterPaneURL); } + break; + + default: + break; } } @@ -829,18 +829,18 @@ void ViewShellBase::UpdateBorder ( bool bForce /* = false */ ) // We have to check the existence of the window, too. // The SfxViewFrame accesses the window without checking it. ViewShell* pMainViewShell = GetMainViewShell().get(); - if (pMainViewShell != nullptr && GetWindow()!=nullptr) - { - SvBorder aCurrentBorder (GetBorderPixel()); - bool bOuterResize ( ! GetDocShell()->IsInPlaceActive()); - SvBorder aBorder (GetBorder(bOuterResize)); - aBorder += pMainViewShell->GetBorder(); + if (!(pMainViewShell != nullptr && GetWindow()!=nullptr)) + return; - if (bForce || (aBorder != aCurrentBorder)) - { - SetBorderPixel (aBorder); - InvalidateBorder(); - } + SvBorder aCurrentBorder (GetBorderPixel()); + bool bOuterResize ( ! GetDocShell()->IsInPlaceActive()); + SvBorder aBorder (GetBorder(bOuterResize)); + aBorder += pMainViewShell->GetBorder(); + + if (bForce || (aBorder != aCurrentBorder)) + { + SetBorderPixel (aBorder); + InvalidateBorder(); } } @@ -1065,26 +1065,26 @@ void ViewShellBase::Implementation::LateInit() void ViewShellBase::Implementation::ProcessRestoreEditingViewSlot() { ViewShell* pViewShell = mrBase.GetMainViewShell().get(); - if (pViewShell != nullptr) - { - FrameView* pFrameView = pViewShell->GetFrameView(); - if (pFrameView != nullptr) - { - // Set view shell, edit mode, and page kind. - // pFrameView->SetViewShEditMode( - // pFrameView->GetViewShEditModeOnLoad(), - // pFrameView->GetPageKindOnLoad()); - pFrameView->SetViewShEditMode( - pFrameView->GetViewShEditModeOnLoad() ); - pFrameView->SetPageKind( - pFrameView->GetPageKindOnLoad()); - std::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(mrBase)); - pHelper->RequestView( - FrameworkHelper::GetViewURL(pFrameView->GetViewShellTypeOnLoad()), - FrameworkHelper::msCenterPaneURL); - pHelper->RunOnConfigurationEvent("ConfigurationUpdateEnd", CurrentPageSetter(mrBase)); - } - } + if (pViewShell == nullptr) + return; + + FrameView* pFrameView = pViewShell->GetFrameView(); + if (pFrameView == nullptr) + return; + + // Set view shell, edit mode, and page kind. + // pFrameView->SetViewShEditMode( + // pFrameView->GetViewShEditModeOnLoad(), + // pFrameView->GetPageKindOnLoad()); + pFrameView->SetViewShEditMode( + pFrameView->GetViewShEditModeOnLoad() ); + pFrameView->SetPageKind( + pFrameView->GetPageKindOnLoad()); + std::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(mrBase)); + pHelper->RequestView( + FrameworkHelper::GetViewURL(pFrameView->GetViewShellTypeOnLoad()), + FrameworkHelper::msCenterPaneURL); + pHelper->RunOnConfigurationEvent("ConfigurationUpdateEnd", CurrentPageSetter(mrBase)); } void ViewShellBase::Implementation::SetUserWantsTabBar(bool inValue) @@ -1369,44 +1369,44 @@ void CurrentPageSetter::operator() (bool) pFrameView = mrBase.GetMainViewShell()->GetFrameView(); } - if (pFrameView!=nullptr) + if (pFrameView==nullptr) + return; + + try { - try - { - // Get the current page either from the DrawPagesSupplier or the - // MasterPagesSupplier. - Any aPage; - if (pFrameView->GetViewShEditModeOnLoad() == EditMode::Page) - { - Reference<drawing::XDrawPagesSupplier> xPagesSupplier ( - mrBase.GetController()->getModel(), UNO_QUERY_THROW); - Reference<container::XIndexAccess> xPages ( - xPagesSupplier->getDrawPages(), UNO_QUERY_THROW); - aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad()); - } - else - { - Reference<drawing::XMasterPagesSupplier> xPagesSupplier ( - mrBase.GetController()->getModel(), UNO_QUERY_THROW); - Reference<container::XIndexAccess> xPages ( - xPagesSupplier->getMasterPages(), UNO_QUERY_THROW); - aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad()); - } - // Switch to the page last edited by setting the CurrentPage - // property. - Reference<beans::XPropertySet> xSet (mrBase.GetController(), UNO_QUERY_THROW); - xSet->setPropertyValue ("CurrentPage", aPage); - } - catch (const RuntimeException&) + // Get the current page either from the DrawPagesSupplier or the + // MasterPagesSupplier. + Any aPage; + if (pFrameView->GetViewShEditModeOnLoad() == EditMode::Page) { - // We have not been able to set the current page at the main view. - // This is sad but still leaves us in a valid state. Therefore, - // this exception is silently ignored. + Reference<drawing::XDrawPagesSupplier> xPagesSupplier ( + mrBase.GetController()->getModel(), UNO_QUERY_THROW); + Reference<container::XIndexAccess> xPages ( + xPagesSupplier->getDrawPages(), UNO_QUERY_THROW); + aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad()); } - catch (const beans::UnknownPropertyException&) + else { - SAL_WARN("sd.view", "CurrentPage property unknown"); + Reference<drawing::XMasterPagesSupplier> xPagesSupplier ( + mrBase.GetController()->getModel(), UNO_QUERY_THROW); + Reference<container::XIndexAccess> xPages ( + xPagesSupplier->getMasterPages(), UNO_QUERY_THROW); + aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad()); } + // Switch to the page last edited by setting the CurrentPage + // property. + Reference<beans::XPropertySet> xSet (mrBase.GetController(), UNO_QUERY_THROW); + xSet->setPropertyValue ("CurrentPage", aPage); + } + catch (const RuntimeException&) + { + // We have not been able to set the current page at the main view. + // This is sad but still leaves us in a valid state. Therefore, + // this exception is silently ignored. + } + catch (const beans::UnknownPropertyException&) + { + SAL_WARN("sd.view", "CurrentPage property unknown"); } } diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index 08fe5dbc8505..c5dd15eb9922 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -246,35 +246,35 @@ void ViewShell::Implementation::AssignLayout ( SfxRequest const & rRequest, Page if( pPage == nullptr ) pPage = mrViewShell.getCurrentPage(); - if( pPage ) - { - AutoLayout eLayout = pPage->GetAutoLayout(); + if( !pPage ) + return; - if( pWhatLayout ) - eLayout = static_cast< AutoLayout >( pWhatLayout->GetValue() ); + AutoLayout eLayout = pPage->GetAutoLayout(); - // Transform the given request into the four argument form that is - // understood by ProcessModifyPageSlot(). - SdrLayerAdmin& rLayerAdmin (mrViewShell.GetViewShellBase().GetDocument()->GetLayerAdmin()); - SdrLayerID aBackground (rLayerAdmin.GetLayerID(sUNO_LayerName_background)); - SdrLayerID aBackgroundObject (rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects)); + if( pWhatLayout ) + eLayout = static_cast< AutoLayout >( pWhatLayout->GetValue() ); - SdrLayerIDSet aVisibleLayers; + // Transform the given request into the four argument form that is + // understood by ProcessModifyPageSlot(). + SdrLayerAdmin& rLayerAdmin (mrViewShell.GetViewShellBase().GetDocument()->GetLayerAdmin()); + SdrLayerID aBackground (rLayerAdmin.GetLayerID(sUNO_LayerName_background)); + SdrLayerID aBackgroundObject (rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects)); - if( pPage->GetPageKind() == PageKind::Handout ) - aVisibleLayers.SetAll(); - else - aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); + SdrLayerIDSet aVisibleLayers; - SfxRequest aRequest (mrViewShell.GetViewShellBase().GetViewFrame(), SID_MODIFYPAGE); - aRequest.AppendItem(SfxStringItem (ID_VAL_PAGENAME, pPage->GetName())); - aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, eLayout)); - aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground))); - aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEOBJ, aVisibleLayers.IsSet(aBackgroundObject))); + if( pPage->GetPageKind() == PageKind::Handout ) + aVisibleLayers.SetAll(); + else + aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); - // Forward the call with the new arguments. - ProcessModifyPageSlot( aRequest, pPage, pPage->GetPageKind()); - } + SfxRequest aRequest (mrViewShell.GetViewShellBase().GetViewFrame(), SID_MODIFYPAGE); + aRequest.AppendItem(SfxStringItem (ID_VAL_PAGENAME, pPage->GetName())); + aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, eLayout)); + aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground))); + aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEOBJ, aVisibleLayers.IsSet(aBackgroundObject))); + + // Forward the call with the new arguments. + ProcessModifyPageSlot( aRequest, pPage, pPage->GetPageKind()); } SfxInterfaceId ViewShell::Implementation::GetViewId() diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index d2c2975499c4..e562dfa93284 100644 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -439,26 +439,26 @@ void ViewShellManager::Implementation::DeactivateViewShell (const ViewShell& rSh maActiveViewShells.begin(), maActiveViewShells.end(), IsShell(&rShell))); - if (iShell != maActiveViewShells.end()) - { - UpdateLock aLocker (*this); + if (iShell == maActiveViewShells.end()) + return; - ShellDescriptor aDescriptor(*iShell); - mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell)); - maActiveViewShells.erase(iShell); - TakeShellsFromStack(aDescriptor.mpShell); + UpdateLock aLocker (*this); - // Deactivate sub shells. - SubShellList::iterator iList (maActiveSubShells.find(&rShell)); - if (iList != maActiveSubShells.end()) - { - SubShellSubList& rList (iList->second); - while ( ! rList.empty()) - DeactivateSubShell(rShell, rList.front().mnId); - } + ShellDescriptor aDescriptor(*iShell); + mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell)); + maActiveViewShells.erase(iShell); + TakeShellsFromStack(aDescriptor.mpShell); - DestroyViewShell(aDescriptor); + // Deactivate sub shells. + SubShellList::iterator iList (maActiveSubShells.find(&rShell)); + if (iList != maActiveSubShells.end()) + { + SubShellSubList& rList (iList->second); + while ( ! rList.empty()) + DeactivateSubShell(rShell, rList.front().mnId); } + + DestroyViewShell(aDescriptor); } void ViewShellManager::Implementation::ActivateShell (SfxShell& rShell) @@ -489,26 +489,26 @@ void ViewShellManager::Implementation::DeactivateShell (const SfxShell& rShell) maActiveViewShells.begin(), maActiveViewShells.end(), IsShell(&rShell))); - if (iShell != maActiveViewShells.end()) - { - UpdateLock aLocker (*this); + if (iShell == maActiveViewShells.end()) + return; - ShellDescriptor aDescriptor(*iShell); - mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell)); - maActiveViewShells.erase(iShell); - TakeShellsFromStack(aDescriptor.mpShell); + UpdateLock aLocker (*this); - // Deactivate sub shells. - SubShellList::iterator iList (maActiveSubShells.find(&rShell)); - if (iList != maActiveSubShells.end()) - { - SubShellSubList& rList (iList->second); - while ( ! rList.empty()) - DeactivateSubShell(rShell, rList.front().mnId); - } + ShellDescriptor aDescriptor(*iShell); + mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell)); + maActiveViewShells.erase(iShell); + TakeShellsFromStack(aDescriptor.mpShell); - DestroyViewShell(aDescriptor); + // Deactivate sub shells. + SubShellList::iterator iList (maActiveSubShells.find(&rShell)); + if (iList != maActiveSubShells.end()) + { + SubShellSubList& rList (iList->second); + while ( ! rList.empty()) + DeactivateSubShell(rShell, rList.front().mnId); } + + DestroyViewShell(aDescriptor); } void ViewShellManager::Implementation::ActivateSubShell ( @@ -817,38 +817,38 @@ void ViewShellManager::Implementation::TakeShellsFromStack (const SfxShell* pShe break; } - if (pShell != nullptr) + if (pShell == nullptr) + return; + + // 1. Deactivate our shells on the stack before they are removed so + // that during the Deactivation() calls the stack is still intact. + for (sal_uInt16 nIndex=0; true; nIndex++) { - // 1. Deactivate our shells on the stack before they are removed so - // that during the Deactivation() calls the stack is still intact. - for (sal_uInt16 nIndex=0; true; nIndex++) - { - SfxShell* pShellOnStack = mrBase.GetSubShell(nIndex); - Deactivate(pShellOnStack); - if (pShellOnStack == pShell) - break; - } + SfxShell* pShellOnStack = mrBase.GetSubShell(nIndex); + Deactivate(pShellOnStack); + if (pShellOnStack == pShell) + break; + } - // 2. Remove the shells from the stack. - while (true) - { - SfxShell* pShellOnStack = mrBase.GetSubShell(0); - SAL_INFO("sd.view", OSL_THIS_FUNC << "removing shell " << pShellOnStack << " from stack"); - mrBase.RemoveSubShell(pShellOnStack); - if (pShellOnStack == pShell) - break; - } + // 2. Remove the shells from the stack. + while (true) + { + SfxShell* pShellOnStack = mrBase.GetSubShell(0); + SAL_INFO("sd.view", OSL_THIS_FUNC << "removing shell " << pShellOnStack << " from stack"); + mrBase.RemoveSubShell(pShellOnStack); + if (pShellOnStack == pShell) + break; + } - // 3. Update the stack. - if (mrBase.GetDispatcher() != nullptr) - mrBase.GetDispatcher()->Flush(); + // 3. Update the stack. + if (mrBase.GetDispatcher() != nullptr) + mrBase.GetDispatcher()->Flush(); - // Update the pointer to the top-most shell and set its undo manager - // to the one of the previous top-most shell. - mpTopShell = mrBase.GetSubShell(0); - if (mpTopShell!=nullptr && pUndoManager!=nullptr && mpTopShell->GetUndoManager()==nullptr) - mpTopShell->SetUndoManager(pUndoManager); - } + // Update the pointer to the top-most shell and set its undo manager + // to the one of the previous top-most shell. + mpTopShell = mrBase.GetSubShell(0); + if (mpTopShell!=nullptr && pUndoManager!=nullptr && mpTopShell->GetUndoManager()==nullptr) + mpTopShell->SetUndoManager(pUndoManager); #if OSL_DEBUG_LEVEL >= 2 SAL_INFO("sd.view", OSL_THIS_FUNC << "Sfx shell stack is:"); diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 2efe1d1bb5bb..d9663930a1da 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -497,17 +497,17 @@ void ViewTabBar::UpdateActiveButton() if (mpViewShellBase != nullptr) xView = FrameworkHelper::Instance(*mpViewShellBase)->GetView( mxViewTabBarId->getAnchor()); - if (xView.is()) + if (!xView.is()) + return; + + Reference<XResourceId> xViewId (xView->getResourceId()); + for (size_t nIndex=0; nIndex<maTabBarButtons.size(); ++nIndex) { - Reference<XResourceId> xViewId (xView->getResourceId()); - for (size_t nIndex=0; nIndex<maTabBarButtons.size(); ++nIndex) + if (maTabBarButtons[nIndex].ResourceId->compareTo(xViewId) == 0) { - if (maTabBarButtons[nIndex].ResourceId->compareTo(xViewId) == 0) - { - mpTabControl->SetCurPageId(nIndex+1); - mpTabControl->::TabControl::ActivatePage(); - break; - } + mpTabControl->SetCurPageId(nIndex+1); + mpTabControl->::TabControl::ActivatePage(); + break; } } } diff --git a/sd/source/ui/view/WindowUpdater.cxx b/sd/source/ui/view/WindowUpdater.cxx index a49928184dd8..1d00dd849bca 100644 --- a/sd/source/ui/view/WindowUpdater.cxx +++ b/sd/source/ui/view/WindowUpdater.cxx @@ -85,33 +85,33 @@ void WindowUpdater::Update ( void WindowUpdater::UpdateWindow (OutputDevice* pDevice) const { - if (pDevice != nullptr) - { - SvtCTLOptions::TextNumerals aNumeralMode (maCTLOptions.GetCTLTextNumerals()); - - LanguageType aLanguage; - // Now this is a bit confusing. The numerals in arabic languages - // are Hindi numerals and what the western world generally uses are - // arabic numerals. The digits used in the Hindi language are not - // used at all. - switch (aNumeralMode) - { - case SvtCTLOptions::NUMERALS_HINDI: - aLanguage = LANGUAGE_ARABIC_SAUDI_ARABIA; - break; - - case SvtCTLOptions::NUMERALS_SYSTEM: - aLanguage = LANGUAGE_SYSTEM; - break; - - case SvtCTLOptions::NUMERALS_ARABIC: - default: - aLanguage = LANGUAGE_ENGLISH; - break; - } + if (pDevice == nullptr) + return; - pDevice->SetDigitLanguage (aLanguage); + SvtCTLOptions::TextNumerals aNumeralMode (maCTLOptions.GetCTLTextNumerals()); + + LanguageType aLanguage; + // Now this is a bit confusing. The numerals in arabic languages + // are Hindi numerals and what the western world generally uses are + // arabic numerals. The digits used in the Hindi language are not + // used at all. + switch (aNumeralMode) + { + case SvtCTLOptions::NUMERALS_HINDI: + aLanguage = LANGUAGE_ARABIC_SAUDI_ARABIA; + break; + + case SvtCTLOptions::NUMERALS_SYSTEM: + aLanguage = LANGUAGE_SYSTEM; + break; + + case SvtCTLOptions::NUMERALS_ARABIC: + default: + aLanguage = LANGUAGE_ENGLISH; + break; } + + pDevice->SetDigitLanguage (aLanguage); } void WindowUpdater::ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index ec8cdbb1e273..a981863a090f 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -337,177 +337,177 @@ bool DrawViewShell::PrepareClose( bool bUI ) void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) { - if (meEditMode != eEMode || mbIsLayerModeActive != bIsLayerModeActive) - { - ViewShellManager::UpdateLock aLock (GetViewShellBase().GetViewShellManager()); - - sal_uInt16 nActualPageId = maTabControl->GetPageId(0); - - if (mePageKind == PageKind::Handout) - { - // at handouts only allow MasterPage - eEMode = EditMode::MasterPage; - } - - GetViewShellBase().GetDrawController().FireChangeEditMode (eEMode == EditMode::MasterPage); - GetViewShellBase().GetDrawController().FireChangeLayerMode (bIsLayerModeActive); + if (meEditMode == eEMode && mbIsLayerModeActive == bIsLayerModeActive) + return; - if ( mpDrawView->IsTextEdit() ) - { - mpDrawView->SdrEndTextEdit(); - } + ViewShellManager::UpdateLock aLock (GetViewShellBase().GetViewShellManager()); - LayerTabBar* pLayerBar = GetLayerTabControl(); - if (pLayerBar != nullptr) - pLayerBar->EndEditMode(); - maTabControl->EndEditMode(); + sal_uInt16 nActualPageId = maTabControl->GetPageId(0); - GetViewShellBase().GetDrawController().BroadcastContextChange(); + if (mePageKind == PageKind::Handout) + { + // at handouts only allow MasterPage + eEMode = EditMode::MasterPage; + } - meEditMode = eEMode; + GetViewShellBase().GetDrawController().FireChangeEditMode (eEMode == EditMode::MasterPage); + GetViewShellBase().GetDrawController().FireChangeLayerMode (bIsLayerModeActive); - if(pLayerBar) - { - // #i87182# only switch activation mode of LayerTabBar when there is one, - // else it will not get initialized with the current set of Layers as needed - mbIsLayerModeActive = bIsLayerModeActive; - } + if ( mpDrawView->IsTextEdit() ) + { + mpDrawView->SdrEndTextEdit(); + } - // Determine whether to show the master view toolbar. The master - // page mode has to be active and the shell must not be a handout - // view. - bool bShowMasterViewToolbar (meEditMode == EditMode::MasterPage - && GetShellType() != ViewShell::ST_HANDOUT); - bool bShowPresentationToolbar (meEditMode != EditMode::MasterPage - && GetShellType() != ViewShell::ST_HANDOUT - && GetShellType() != ViewShell::ST_DRAW); - - // If the master view toolbar is not shown we hide it before - // switching the edit mode. - if (::sd::ViewShell::mpImpl->mbIsInitialized - && IsMainViewShell()) - { - if ( !bShowMasterViewToolbar ) - GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::ToolBarGroup::MasterMode); - if ( !bShowPresentationToolbar ) - GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::ToolBarGroup::CommonTask); - } + LayerTabBar* pLayerBar = GetLayerTabControl(); + if (pLayerBar != nullptr) + pLayerBar->EndEditMode(); + maTabControl->EndEditMode(); - ConfigureAppBackgroundColor(); + GetViewShellBase().GetDrawController().BroadcastContextChange(); - if (meEditMode == EditMode::Page) - { - /****************************************************************** - * PAGEMODE - ******************************************************************/ + meEditMode = eEMode; - maTabControl->Clear(); + if(pLayerBar) + { + // #i87182# only switch activation mode of LayerTabBar when there is one, + // else it will not get initialized with the current set of Layers as needed + mbIsLayerModeActive = bIsLayerModeActive; + } - SdPage* pPage; - sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); + // Determine whether to show the master view toolbar. The master + // page mode has to be active and the shell must not be a handout + // view. + bool bShowMasterViewToolbar (meEditMode == EditMode::MasterPage + && GetShellType() != ViewShell::ST_HANDOUT); + bool bShowPresentationToolbar (meEditMode != EditMode::MasterPage + && GetShellType() != ViewShell::ST_HANDOUT + && GetShellType() != ViewShell::ST_DRAW); + + // If the master view toolbar is not shown we hide it before + // switching the edit mode. + if (::sd::ViewShell::mpImpl->mbIsInitialized + && IsMainViewShell()) + { + if ( !bShowMasterViewToolbar ) + GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::ToolBarGroup::MasterMode); + if ( !bShowPresentationToolbar ) + GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::ToolBarGroup::CommonTask); + } - for (sal_uInt16 i = 0; i < nPageCnt; i++) - { - pPage = GetDoc()->GetSdPage(i, mePageKind); - OUString aPageName = pPage->GetName(); - maTabControl->InsertPage(pPage->getPageId(), aPageName); + ConfigureAppBackgroundColor(); - if ( pPage->IsSelected() ) - { - nActualPageId = pPage->getPageId(); - } - } + if (meEditMode == EditMode::Page) + { + /****************************************************************** + * PAGEMODE + ******************************************************************/ - maTabControl->SetCurPageId(nActualPageId); + maTabControl->Clear(); - SwitchPage(maTabControl->GetPagePos(nActualPageId)); + SdPage* pPage; + sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); - //tdf#102343 re-enable common undo on switch back from master mode - mpDrawView->GetModel()->SetDisableTextEditUsesCommonUndoManager(false); - } - else + for (sal_uInt16 i = 0; i < nPageCnt; i++) { - /****************************************************************** - * MASTERPAGE - ******************************************************************/ - GetViewFrame()->SetChildWindow( - AnimationChildWindow::GetChildWindowId(), false ); + pPage = GetDoc()->GetSdPage(i, mePageKind); + OUString aPageName = pPage->GetName(); + maTabControl->InsertPage(pPage->getPageId(), aPageName); - if (!mpActualPage) + if ( pPage->IsSelected() ) { - // as long as there is no mpActualPage, take first - mpActualPage = GetDoc()->GetSdPage(0, mePageKind); + nActualPageId = pPage->getPageId(); } + } - maTabControl->Clear(); - sal_uInt16 nActualMasterPageId = maTabControl->GetPageId(0); - sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); - - for (sal_uInt16 i = 0; i < nMasterPageCnt; i++) - { - SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind); - OUString aLayoutName = pMaster->GetLayoutName(); - sal_Int32 nPos = aLayoutName.indexOf(SD_LT_SEPARATOR); - if (nPos != -1) - aLayoutName = aLayoutName.copy(0, nPos); + maTabControl->SetCurPageId(nActualPageId); - maTabControl->InsertPage(pMaster->getPageId(), aLayoutName); + SwitchPage(maTabControl->GetPagePos(nActualPageId)); - if (&(mpActualPage->TRG_GetMasterPage()) == pMaster) - { - nActualMasterPageId = pMaster->getPageId(); - } - } - - maTabControl->SetCurPageId(nActualMasterPageId); - SwitchPage(maTabControl->GetPagePos(nActualMasterPageId)); - - //tdf#102343 changing attributes of textboxes in master typically - //changes the stylesheet they are linked to, so if the common - //undo manager is in use, those stylesheet changes are thrown - //away at present - mpDrawView->GetModel()->SetDisableTextEditUsesCommonUndoManager(true); - } + //tdf#102343 re-enable common undo on switch back from master mode + mpDrawView->GetModel()->SetDisableTextEditUsesCommonUndoManager(false); + } + else + { + /****************************************************************** + * MASTERPAGE + ******************************************************************/ + GetViewFrame()->SetChildWindow( + AnimationChildWindow::GetChildWindowId(), false ); - // If the master view toolbar is to be shown we turn it on after the - // edit mode has been changed. - if (::sd::ViewShell::mpImpl->mbIsInitialized - && IsMainViewShell()) + if (!mpActualPage) { - if (bShowMasterViewToolbar) - GetViewShellBase().GetToolBarManager()->SetToolBar( - ToolBarManager::ToolBarGroup::MasterMode, - ToolBarManager::msMasterViewToolBar); - if (bShowPresentationToolbar) - GetViewShellBase().GetToolBarManager()->SetToolBar( - ToolBarManager::ToolBarGroup::CommonTask, - ToolBarManager::msCommonTaskToolBar); + // as long as there is no mpActualPage, take first + mpActualPage = GetDoc()->GetSdPage(0, mePageKind); } - if ( ! mbIsLayerModeActive) + maTabControl->Clear(); + sal_uInt16 nActualMasterPageId = maTabControl->GetPageId(0); + sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); + + for (sal_uInt16 i = 0; i < nMasterPageCnt; i++) { - maTabControl->Show(); - // Set the tab control only for draw pages. For master page - // this has been done already above. - if (meEditMode == EditMode::Page) - maTabControl->SetCurPageId (nActualPageId); + SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind); + OUString aLayoutName = pMaster->GetLayoutName(); + sal_Int32 nPos = aLayoutName.indexOf(SD_LT_SEPARATOR); + if (nPos != -1) + aLayoutName = aLayoutName.copy(0, nPos); + + maTabControl->InsertPage(pMaster->getPageId(), aLayoutName); + + if (&(mpActualPage->TRG_GetMasterPage()) == pMaster) + { + nActualMasterPageId = pMaster->getPageId(); + } } - ResetActualLayer(); + maTabControl->SetCurPageId(nActualMasterPageId); + SwitchPage(maTabControl->GetPagePos(nActualMasterPageId)); + + //tdf#102343 changing attributes of textboxes in master typically + //changes the stylesheet they are linked to, so if the common + //undo manager is in use, those stylesheet changes are thrown + //away at present + mpDrawView->GetModel()->SetDisableTextEditUsesCommonUndoManager(true); + } - Invalidate( SID_PAGEMODE ); - Invalidate( SID_LAYERMODE ); - Invalidate( SID_MASTERPAGE ); - Invalidate( SID_DELETE_MASTER_PAGE ); - Invalidate( SID_DELETE_PAGE ); - Invalidate( SID_SLIDE_MASTER_MODE ); - Invalidate( SID_NOTES_MASTER_MODE ); - Invalidate( SID_HANDOUT_MASTER_MODE ); - InvalidateWindows(); + // If the master view toolbar is to be shown we turn it on after the + // edit mode has been changed. + if (::sd::ViewShell::mpImpl->mbIsInitialized + && IsMainViewShell()) + { + if (bShowMasterViewToolbar) + GetViewShellBase().GetToolBarManager()->SetToolBar( + ToolBarManager::ToolBarGroup::MasterMode, + ToolBarManager::msMasterViewToolBar); + if (bShowPresentationToolbar) + GetViewShellBase().GetToolBarManager()->SetToolBar( + ToolBarManager::ToolBarGroup::CommonTask, + ToolBarManager::msCommonTaskToolBar); + } - SetContextName(GetSidebarContextName()); + if ( ! mbIsLayerModeActive) + { + maTabControl->Show(); + // Set the tab control only for draw pages. For master page + // this has been done already above. + if (meEditMode == EditMode::Page) + maTabControl->SetCurPageId (nActualPageId); } + ResetActualLayer(); + + Invalidate( SID_PAGEMODE ); + Invalidate( SID_LAYERMODE ); + Invalidate( SID_MASTERPAGE ); + Invalidate( SID_DELETE_MASTER_PAGE ); + Invalidate( SID_DELETE_PAGE ); + Invalidate( SID_SLIDE_MASTER_MODE ); + Invalidate( SID_NOTES_MASTER_MODE ); + Invalidate( SID_HANDOUT_MASTER_MODE ); + InvalidateWindows(); + + SetContextName(GetSidebarContextName()); + } /** @@ -1140,107 +1140,107 @@ bool DrawViewShell::IsSwitchPageAllowed() const void DrawViewShell::ResetActualLayer() { LayerTabBar* pLayerBar = GetLayerTabControl(); - if (pLayerBar != nullptr) + if (pLayerBar == nullptr) + return; + + // remember old tab count and current tab id + // this is needed when one layer is renamed to + // restore current tab + sal_uInt16 nOldLayerCnt = pLayerBar->GetPageCount(); // actually it is tab count + sal_uInt16 nOldLayerPos = pLayerBar->GetCurPageId(); // actually it is a tab nId + + /** + * Update for LayerTab + */ + pLayerBar->Clear(); + + OUString aName; // a real layer name + OUString aActiveLayer = mpDrawView->GetActiveLayer(); + sal_uInt16 nActiveLayerPos = SDRLAYERPOS_NOTFOUND; + SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin(); + sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount(); + + for ( sal_uInt16 nLayerPos = 0; nLayerPos < nLayerCnt; nLayerPos++ ) { - // remember old tab count and current tab id - // this is needed when one layer is renamed to - // restore current tab - sal_uInt16 nOldLayerCnt = pLayerBar->GetPageCount(); // actually it is tab count - sal_uInt16 nOldLayerPos = pLayerBar->GetCurPageId(); // actually it is a tab nId - - /** - * Update for LayerTab - */ - pLayerBar->Clear(); - - OUString aName; // a real layer name - OUString aActiveLayer = mpDrawView->GetActiveLayer(); - sal_uInt16 nActiveLayerPos = SDRLAYERPOS_NOTFOUND; - SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin(); - sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount(); - - for ( sal_uInt16 nLayerPos = 0; nLayerPos < nLayerCnt; nLayerPos++ ) - { - aName = rLayerAdmin.GetLayer(nLayerPos)->GetName(); + aName = rLayerAdmin.GetLayer(nLayerPos)->GetName(); - if ( aName == aActiveLayer ) - { - nActiveLayerPos = nLayerPos; - } + if ( aName == aActiveLayer ) + { + nActiveLayerPos = nLayerPos; + } - if ( aName != sUNO_LayerName_background ) // layer "background" has never a tab + if ( aName != sUNO_LayerName_background ) // layer "background" has never a tab + { + if (meEditMode == EditMode::MasterPage) { - if (meEditMode == EditMode::MasterPage) - { - // don't show page layer onto the masterpage - if (aName != sUNO_LayerName_layout && - aName != sUNO_LayerName_controls && - aName != sUNO_LayerName_measurelines) - { - TabBarPageBits nBits = TabBarPageBits::NONE; - SdrPageView* pPV = mpDrawView->GetSdrPageView(); - if (pPV) - { - if (!pPV->IsLayerVisible(aName)) - { - nBits |= TabBarPageBits::Blue; - } - if (pPV->IsLayerLocked(aName)) - { - nBits |= TabBarPageBits::Italic; - } - if (!pPV->IsLayerPrintable(aName)) - { - nBits |= TabBarPageBits::Underline; - } - } - - pLayerBar->InsertPage(nLayerPos+1, aName, nBits); // why +1? It is a nId, not a position. Position is APPEND. - } - } - else + // don't show page layer onto the masterpage + if (aName != sUNO_LayerName_layout && + aName != sUNO_LayerName_controls && + aName != sUNO_LayerName_measurelines) { - // don't show masterpage layer onto the page - if (aName != sUNO_LayerName_background_objects) + TabBarPageBits nBits = TabBarPageBits::NONE; + SdrPageView* pPV = mpDrawView->GetSdrPageView(); + if (pPV) { - TabBarPageBits nBits = TabBarPageBits::NONE; - if (!mpDrawView->GetSdrPageView()->IsLayerVisible(aName)) + if (!pPV->IsLayerVisible(aName)) { - nBits = TabBarPageBits::Blue; + nBits |= TabBarPageBits::Blue; } - if (mpDrawView->GetSdrPageView()->IsLayerLocked(aName)) + if (pPV->IsLayerLocked(aName)) { nBits |= TabBarPageBits::Italic; } - if (!mpDrawView->GetSdrPageView()->IsLayerPrintable(aName)) + if (!pPV->IsLayerPrintable(aName)) { nBits |= TabBarPageBits::Underline; } - - pLayerBar->InsertPage(nLayerPos+1, aName, nBits);// why +1? } - } - } - } - if ( nActiveLayerPos == SDRLAYERPOS_NOTFOUND ) - { - if( nOldLayerCnt == pLayerBar->GetPageCount() ) - { - nActiveLayerPos = nOldLayerPos - 1; + pLayerBar->InsertPage(nLayerPos+1, aName, nBits); // why +1? It is a nId, not a position. Position is APPEND. + } } else { - nActiveLayerPos = ( meEditMode == EditMode::MasterPage ) ? 2 : 0; + // don't show masterpage layer onto the page + if (aName != sUNO_LayerName_background_objects) + { + TabBarPageBits nBits = TabBarPageBits::NONE; + if (!mpDrawView->GetSdrPageView()->IsLayerVisible(aName)) + { + nBits = TabBarPageBits::Blue; + } + if (mpDrawView->GetSdrPageView()->IsLayerLocked(aName)) + { + nBits |= TabBarPageBits::Italic; + } + if (!mpDrawView->GetSdrPageView()->IsLayerPrintable(aName)) + { + nBits |= TabBarPageBits::Underline; + } + + pLayerBar->InsertPage(nLayerPos+1, aName, nBits);// why +1? + } } + } + } - mpDrawView->SetActiveLayer( pLayerBar->GetLayerName(nActiveLayerPos + 1) );// why +1? + if ( nActiveLayerPos == SDRLAYERPOS_NOTFOUND ) + { + if( nOldLayerCnt == pLayerBar->GetPageCount() ) + { + nActiveLayerPos = nOldLayerPos - 1; + } + else + { + nActiveLayerPos = ( meEditMode == EditMode::MasterPage ) ? 2 : 0; } - pLayerBar->SetCurPageId(nActiveLayerPos + 1); - GetViewFrame()->GetBindings().Invalidate( SID_MODIFYLAYER ); - GetViewFrame()->GetBindings().Invalidate( SID_DELETE_LAYER ); + mpDrawView->SetActiveLayer( pLayerBar->GetLayerName(nActiveLayerPos + 1) );// why +1? } + + pLayerBar->SetCurPageId(nActiveLayerPos + 1); + GetViewFrame()->GetBindings().Invalidate( SID_MODIFYLAYER ); + GetViewFrame()->GetBindings().Invalidate( SID_DELETE_LAYER ); } /** diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 90ec37b63b08..30495a1e3b5a 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -1046,24 +1046,24 @@ void DrawViewShell::GetSnapItemState( SfxItemSet &rSet ) Size(FuPoor::HITPIX,0)).Width()); sal_uInt16 nHelpLine; - if ( mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) - { - const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine]; + if ( !mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) + return; - if ( rHelpLine.GetKind() == SdrHelpLineKind::Point ) - { - rSet.Put( SfxStringItem( SID_SET_SNAPITEM, - SdResId( STR_POPUP_EDIT_SNAPPOINT)) ); - rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM, - SdResId( STR_POPUP_DELETE_SNAPPOINT)) ); - } - else - { - rSet.Put( SfxStringItem( SID_SET_SNAPITEM, - SdResId( STR_POPUP_EDIT_SNAPLINE)) ); - rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM, - SdResId( STR_POPUP_DELETE_SNAPLINE)) ); - } + const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine]; + + if ( rHelpLine.GetKind() == SdrHelpLineKind::Point ) + { + rSet.Put( SfxStringItem( SID_SET_SNAPITEM, + SdResId( STR_POPUP_EDIT_SNAPPOINT)) ); + rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM, + SdResId( STR_POPUP_DELETE_SNAPPOINT)) ); + } + else + { + rSet.Put( SfxStringItem( SID_SET_SNAPITEM, + SdResId( STR_POPUP_EDIT_SNAPLINE)) ); + rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM, + SdResId( STR_POPUP_DELETE_SNAPLINE)) ); } } diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 70d49670ea7d..30d36ce8ee68 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -291,20 +291,20 @@ void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt, if ( bIsOleActive && PopupMenu::IsInExecute() ) return; - if ( !IsInputLocked() ) - { - ViewShell::MouseButtonDown(rMEvt, pWin); + if ( IsInputLocked() ) + return; - //If object is marked , the corresponding entry is set true , - //else the corresponding entry is set false . - FreshNavigatrTree(); - if (mbPipette) - { - SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()); - SvxBmpMask* pBmpMask = pWnd ? static_cast<SvxBmpMask*>(pWnd->GetWindow()) : nullptr; - if (pBmpMask) - pBmpMask->PipetteClicked(); - } + ViewShell::MouseButtonDown(rMEvt, pWin); + + //If object is marked , the corresponding entry is set true , + //else the corresponding entry is set false . + FreshNavigatrTree(); + if (mbPipette) + { + SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()); + SvxBmpMask* pBmpMask = pWnd ? static_cast<SvxBmpMask*>(pWnd->GetWindow()) : nullptr; + if (pBmpMask) + pBmpMask->PipetteClicked(); } } @@ -313,111 +313,111 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) if ( IsMouseButtonDown() ) mbMouseSelecting = true; - if ( !IsInputLocked() ) + if ( IsInputLocked() ) + return; + + if ( mpDrawView->IsAction() ) { - if ( mpDrawView->IsAction() ) + ::tools::Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel()); + + if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) ) { - ::tools::Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel()); + bool bInsideOtherWindow = false; - if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) ) + if (mpContentWindow.get() != nullptr) { - bool bInsideOtherWindow = false; + aOutputArea = ::tools::Rectangle(Point(0,0), + mpContentWindow->GetOutputSizePixel()); - if (mpContentWindow.get() != nullptr) - { - aOutputArea = ::tools::Rectangle(Point(0,0), - mpContentWindow->GetOutputSizePixel()); - - Point aPos = mpContentWindow->GetPointerPosPixel(); - if ( aOutputArea.IsInside(aPos) ) - bInsideOtherWindow = true; - } + Point aPos = mpContentWindow->GetPointerPosPixel(); + if ( aOutputArea.IsInside(aPos) ) + bInsideOtherWindow = true; + } - if (! GetActiveWindow()->HasFocus ()) - { - GetActiveWindow()->ReleaseMouse (); - mpDrawView->BrkAction (); - return; - } - else if ( bInsideOtherWindow ) - { - GetActiveWindow()->ReleaseMouse(); - pWin->CaptureMouse (); - } + if (! GetActiveWindow()->HasFocus ()) + { + GetActiveWindow()->ReleaseMouse (); + mpDrawView->BrkAction (); + return; + } + else if ( bInsideOtherWindow ) + { + GetActiveWindow()->ReleaseMouse(); + pWin->CaptureMouse (); } - else if ( pWin != GetActiveWindow() ) - pWin->CaptureMouse(); } + else if ( pWin != GetActiveWindow() ) + pWin->CaptureMouse(); + } - // Since the next MouseMove may execute a IsSolidDraggingNow() in - // SdrCreateView::MovCreateObj and there the ApplicationBackgroundColor - // is needed it is necessary to set it here. - if (GetDoc()) - { - ConfigureAppBackgroundColor(); - mpDrawView->SetApplicationBackgroundColor( mnAppBackgroundColor ); - } + // Since the next MouseMove may execute a IsSolidDraggingNow() in + // SdrCreateView::MovCreateObj and there the ApplicationBackgroundColor + // is needed it is necessary to set it here. + if (GetDoc()) + { + ConfigureAppBackgroundColor(); + mpDrawView->SetApplicationBackgroundColor( mnAppBackgroundColor ); + } - ViewShell::MouseMove(rMEvt, pWin); + ViewShell::MouseMove(rMEvt, pWin); - if( !mbMousePosFreezed ) - maMousePos = rMEvt.GetPosPixel(); + if( !mbMousePosFreezed ) + maMousePos = rMEvt.GetPosPixel(); - ::tools::Rectangle aRect; + ::tools::Rectangle aRect; - if ( mbIsRulerDrag ) - { - Point aLogPos = GetActiveWindow()->PixelToLogic(maMousePos); - mpDrawView->MovAction(aLogPos); - } + if ( mbIsRulerDrag ) + { + Point aLogPos = GetActiveWindow()->PixelToLogic(maMousePos); + mpDrawView->MovAction(aLogPos); + } - if ( mpDrawView->IsAction() ) - { - mpDrawView->TakeActionRect(aRect); - aRect = GetActiveWindow()->LogicToPixel(aRect); - } - else - { - aRect = ::tools::Rectangle(maMousePos, maMousePos); - } + if ( mpDrawView->IsAction() ) + { + mpDrawView->TakeActionRect(aRect); + aRect = GetActiveWindow()->LogicToPixel(aRect); + } + else + { + aRect = ::tools::Rectangle(maMousePos, maMousePos); + } - ShowMousePosInfo(aRect, pWin); + ShowMousePosInfo(aRect, pWin); - SvxBmpMask* pBmpMask = nullptr; - if (mbPipette && GetViewFrame()->HasChildWindow(SvxBmpMaskChildWindow::GetChildWindowId())) - { - SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()); - pBmpMask = pWnd ? static_cast<SvxBmpMask*>(pWnd->GetWindow()) : nullptr; - } + SvxBmpMask* pBmpMask = nullptr; + if (mbPipette && GetViewFrame()->HasChildWindow(SvxBmpMaskChildWindow::GetChildWindowId())) + { + SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()); + pBmpMask = pWnd ? static_cast<SvxBmpMask*>(pWnd->GetWindow()) : nullptr; + } - if (pBmpMask) - { - const long nStartX = maMousePos.X() - PIPETTE_RANGE; - const long nEndX = maMousePos.X() + PIPETTE_RANGE; - const long nStartY = maMousePos.Y() - PIPETTE_RANGE; - const long nEndY = maMousePos.Y() + PIPETTE_RANGE; - long nRed = 0; - long nGreen = 0; - long nBlue = 0; - const double fDiv = ( ( PIPETTE_RANGE << 1 ) + 1 ) * ( ( PIPETTE_RANGE << 1 ) + 1 ); - - for ( long nY = nStartY; nY <= nEndY; nY++ ) - { - for( long nX = nStartX; nX <= nEndX; nX++ ) - { - const Color aCol( pWin->GetPixel( pWin->PixelToLogic( Point( nX, nY ) ) ) ); + if (!pBmpMask) + return; - nRed += aCol.GetRed(); - nGreen += aCol.GetGreen(); - nBlue += aCol.GetBlue(); - } - } + const long nStartX = maMousePos.X() - PIPETTE_RANGE; + const long nEndX = maMousePos.X() + PIPETTE_RANGE; + const long nStartY = maMousePos.Y() - PIPETTE_RANGE; + const long nEndY = maMousePos.Y() + PIPETTE_RANGE; + long nRed = 0; + long nGreen = 0; + long nBlue = 0; + const double fDiv = ( ( PIPETTE_RANGE << 1 ) + 1 ) * ( ( PIPETTE_RANGE << 1 ) + 1 ); + + for ( long nY = nStartY; nY <= nEndY; nY++ ) + { + for( long nX = nStartX; nX <= nEndX; nX++ ) + { + const Color aCol( pWin->GetPixel( pWin->PixelToLogic( Point( nX, nY ) ) ) ); - pBmpMask->SetColor( Color( static_cast<sal_uInt8>( nRed / fDiv + .5 ), - static_cast<sal_uInt8>( nGreen / fDiv + .5 ), - static_cast<sal_uInt8>( nBlue / fDiv + .5 ) ) ); + nRed += aCol.GetRed(); + nGreen += aCol.GetGreen(); + nBlue += aCol.GetBlue(); } } + + pBmpMask->SetColor( Color( static_cast<sal_uInt8>( nRed / fDiv + .5 ), + static_cast<sal_uInt8>( nGreen / fDiv + .5 ), + static_cast<sal_uInt8>( nBlue / fDiv + .5 ) ) ); } void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) @@ -480,317 +480,317 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) return; } - if ( !IsInputLocked() ) - { - if( GetView() &&GetView()->getSmartTags().Command(rCEvt) ) - return; + if ( IsInputLocked() ) + return; - const bool bNativeShow (SlideShow::IsRunning(GetViewShellBase())); + if( GetView() &&GetView()->getSmartTags().Command(rCEvt) ) + return; - if( rCEvt.GetCommand() == CommandEventId::PasteSelection && !bNativeShow ) - { - TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSelection( GetActiveWindow() ) ); + const bool bNativeShow (SlideShow::IsRunning(GetViewShellBase())); - if( aDataHelper.GetTransferable().is() ) - { - Point aPos; - sal_Int8 nDnDAction = DND_ACTION_COPY; + if( rCEvt.GetCommand() == CommandEventId::PasteSelection && !bNativeShow ) + { + TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSelection( GetActiveWindow() ) ); - if( GetActiveWindow() ) - aPos = GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() ); + if( aDataHelper.GetTransferable().is() ) + { + Point aPos; + sal_Int8 nDnDAction = DND_ACTION_COPY; + + if( GetActiveWindow() ) + aPos = GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() ); - if( !mpDrawView->InsertData( aDataHelper, aPos, nDnDAction, false ) ) + if( !mpDrawView->InsertData( aDataHelper, aPos, nDnDAction, false ) ) + { + INetBookmark aINetBookmark( "", "" ); + + if( ( aDataHelper.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ) && + aDataHelper.GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aINetBookmark ) ) || + ( aDataHelper.HasFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ) && + aDataHelper.GetINetBookmark( SotClipboardFormatId::FILEGRPDESCRIPTOR, aINetBookmark ) ) || + ( aDataHelper.HasFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) && + aDataHelper.GetINetBookmark( SotClipboardFormatId::UNIFORMRESOURCELOCATOR, aINetBookmark ) ) ) { - INetBookmark aINetBookmark( "", "" ); - - if( ( aDataHelper.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ) && - aDataHelper.GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aINetBookmark ) ) || - ( aDataHelper.HasFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ) && - aDataHelper.GetINetBookmark( SotClipboardFormatId::FILEGRPDESCRIPTOR, aINetBookmark ) ) || - ( aDataHelper.HasFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) && - aDataHelper.GetINetBookmark( SotClipboardFormatId::UNIFORMRESOURCELOCATOR, aINetBookmark ) ) ) - { - InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), "" ); - } + InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), "" ); } } } - else if( rCEvt.GetCommand() == CommandEventId::ContextMenu && !bNativeShow && - pWin != nullptr && !mpDrawView->IsAction() && !SD_MOD()->GetWaterCan() ) + } + else if( rCEvt.GetCommand() == CommandEventId::ContextMenu && !bNativeShow && + pWin != nullptr && !mpDrawView->IsAction() && !SD_MOD()->GetWaterCan() ) + { + OUString aPopupId; // Resource name for popup menu + + // is there a snap object under the cursor? + SdrPageView* pPV; + Point aMPos = pWin->PixelToLogic( maMousePos ); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic( + Size(FuPoor::HITPIX, 0 ) ).Width()); + sal_uInt16 nHelpLine; + // for glue points + SdrObject* pObj = nullptr; + sal_uInt16 nPickId = 0; + // for field command + OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); + const SvxFieldItem* pFldItem = nullptr; + if( pOLV ) + pFldItem = pOLV->GetFieldAtSelection(); + + // helper line + if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) { - OUString aPopupId; // Resource name for popup menu - - // is there a snap object under the cursor? - SdrPageView* pPV; - Point aMPos = pWin->PixelToLogic( maMousePos ); - sal_uInt16 nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic( - Size(FuPoor::HITPIX, 0 ) ).Width()); - sal_uInt16 nHelpLine; - // for glue points - SdrObject* pObj = nullptr; - sal_uInt16 nPickId = 0; - // for field command - OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); - const SvxFieldItem* pFldItem = nullptr; - if( pOLV ) - pFldItem = pOLV->GetFieldAtSelection(); - - // helper line - if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) - { - ShowSnapLineContextMenu(*pPV, nHelpLine, rCEvt.GetMousePosPixel()); - return; - } - // is glue point under cursor marked? - else if( mpDrawView->PickGluePoint( aMPos, pObj, nPickId, pPV ) && - mpDrawView->IsGluePointMarked( pObj, nPickId ) ) + ShowSnapLineContextMenu(*pPV, nHelpLine, rCEvt.GetMousePosPixel()); + return; + } + // is glue point under cursor marked? + else if( mpDrawView->PickGluePoint( aMPos, pObj, nPickId, pPV ) && + mpDrawView->IsGluePointMarked( pObj, nPickId ) ) + { + aPopupId = "gluepoint"; + } + // field command? + else if( pFldItem && (nullptr != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) || + nullptr != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) || + nullptr != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) || + nullptr != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) ) ) + { + LanguageType eLanguage( LANGUAGE_SYSTEM ); + + // Format popup with outliner language, if possible + if( pOLV->GetOutliner() ) { - aPopupId = "gluepoint"; + ESelection aSelection( pOLV->GetSelection() ); + eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos ); } - // field command? - else if( pFldItem && (nullptr != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) || - nullptr != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) || - nullptr != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) || - nullptr != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) ) ) - { - LanguageType eLanguage( LANGUAGE_SYSTEM ); - // Format popup with outliner language, if possible - if( pOLV->GetOutliner() ) - { - ESelection aSelection( pOLV->GetSelection() ); - eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos ); - } + //fdo#44998 if the outliner has captured the mouse events release the lock + //so the SdFieldPopup can get them + pOLV->ReleaseMouse(); + ScopedVclPtrInstance<SdFieldPopup> aFieldPopup( pFldItem->GetField(), eLanguage ); - //fdo#44998 if the outliner has captured the mouse events release the lock - //so the SdFieldPopup can get them - pOLV->ReleaseMouse(); - ScopedVclPtrInstance<SdFieldPopup> aFieldPopup( pFldItem->GetField(), eLanguage ); - - if ( rCEvt.IsMouseEvent() ) - aMPos = rCEvt.GetMousePosPixel(); - else - aMPos = Point( 20, 20 ); - aFieldPopup->Execute( pWin, aMPos ); + if ( rCEvt.IsMouseEvent() ) + aMPos = rCEvt.GetMousePosPixel(); + else + aMPos = Point( 20, 20 ); + aFieldPopup->Execute( pWin, aMPos ); - std::unique_ptr<SvxFieldData> pField(aFieldPopup->GetField()); - if( pField ) + std::unique_ptr<SvxFieldData> pField(aFieldPopup->GetField()); + if( pField ) + { + SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD ); + // select field, so that it will be deleted on insert + ESelection aSel = pOLV->GetSelection(); + bool bSel = true; + if( aSel.nStartPos == aSel.nEndPos ) { - SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD ); - // select field, so that it will be deleted on insert - ESelection aSel = pOLV->GetSelection(); - bool bSel = true; - if( aSel.nStartPos == aSel.nEndPos ) - { - bSel = false; - aSel.nEndPos++; - } - pOLV->SetSelection( aSel ); + bSel = false; + aSel.nEndPos++; + } + pOLV->SetSelection( aSel ); - pOLV->InsertField( aFieldItem ); + pOLV->InsertField( aFieldItem ); - // reset selection back to original state - if( !bSel ) - aSel.nEndPos--; - pOLV->SetSelection( aSel ); - } + // reset selection back to original state + if( !bSel ) + aSel.nEndPos--; + pOLV->SetSelection( aSel ); } - else + } + else + { + // is something selected? + if (mpDrawView->AreObjectsMarked() && + mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 ) { - // is something selected? - if (mpDrawView->AreObjectsMarked() && - mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 ) + pObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + if( HasCurrentFunction(SID_BEZIER_EDIT) && (dynamic_cast< SdrPathObj * >( pObj ) != nullptr ) ) { - pObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); - if( HasCurrentFunction(SID_BEZIER_EDIT) && (dynamic_cast< SdrPathObj * >( pObj ) != nullptr ) ) - { - aPopupId = "bezier"; - } - else + aPopupId = "bezier"; + } + else + { + if( mpDrawView->GetTextEditObject() ) { - if( mpDrawView->GetTextEditObject() ) + OutlinerView* pOutlinerView = mpDrawView->GetTextEditOutlinerView(); + Point aPos(rCEvt.GetMousePosPixel()); + + if ( pOutlinerView ) { - OutlinerView* pOutlinerView = mpDrawView->GetTextEditOutlinerView(); - Point aPos(rCEvt.GetMousePosPixel()); + if( ( rCEvt.IsMouseEvent() && pOutlinerView->IsWrongSpelledWordAtPos(aPos) ) || + ( !rCEvt.IsMouseEvent() && pOutlinerView->IsCursorAtWrongSpelledWord() ) ) + { + // Popup for Online-Spelling now handled by DrawDocShell + Link<SpellCallbackInfo&,void> aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback); - if ( pOutlinerView ) + if( !rCEvt.IsMouseEvent() ) + { + aPos = GetActiveWindow()->LogicToPixel( pOutlinerView->GetEditView().GetCursor()->GetPos() ); + } + // While showing the spell context menu + // we lock the input so that another + // context menu can not be opened during + // that time (crash #i43235#). In order + // to not lock the UI completely we + // first release the mouse. + GetActiveWindow()->ReleaseMouse(); + LockInput(); + pOutlinerView->ExecuteSpellPopup(aPos, &aLink); + pOutlinerView->GetEditView().Invalidate(); + UnlockInput(); + } + else { - if( ( rCEvt.IsMouseEvent() && pOutlinerView->IsWrongSpelledWordAtPos(aPos) ) || - ( !rCEvt.IsMouseEvent() && pOutlinerView->IsCursorAtWrongSpelledWord() ) ) + if( (pObj->GetObjInventor() == SdrInventor::Default) && (pObj->GetObjIdentifier() == OBJ_TABLE) ) { - // Popup for Online-Spelling now handled by DrawDocShell - Link<SpellCallbackInfo&,void> aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback); - - if( !rCEvt.IsMouseEvent() ) - { - aPos = GetActiveWindow()->LogicToPixel( pOutlinerView->GetEditView().GetCursor()->GetPos() ); - } - // While showing the spell context menu - // we lock the input so that another - // context menu can not be opened during - // that time (crash #i43235#). In order - // to not lock the UI completely we - // first release the mouse. - GetActiveWindow()->ReleaseMouse(); - LockInput(); - pOutlinerView->ExecuteSpellPopup(aPos, &aLink); - pOutlinerView->GetEditView().Invalidate(); - UnlockInput(); + aPopupId = "tabletext"; } else { - if( (pObj->GetObjInventor() == SdrInventor::Default) && (pObj->GetObjIdentifier() == OBJ_TABLE) ) - { - aPopupId = "tabletext"; - } - else - { - aPopupId = "drawtext"; - } + aPopupId = "drawtext"; } } } - else - { - SdrInventor nInv = pObj->GetObjInventor(); - sal_uInt16 nId = pObj->GetObjIdentifier(); + } + else + { + SdrInventor nInv = pObj->GetObjInventor(); + sal_uInt16 nId = pObj->GetObjIdentifier(); - if (nInv == SdrInventor::Default) + if (nInv == SdrInventor::Default) + { + switch ( nId ) { - switch ( nId ) - { - case OBJ_OUTLINETEXT: - case OBJ_CAPTION: - case OBJ_TITLETEXT: - case OBJ_TEXT: - aPopupId = "textbox"; - break; - - case OBJ_PATHLINE: - case OBJ_PLIN: - aPopupId = "curve"; - break; - - case OBJ_FREELINE: - case OBJ_EDGE: - aPopupId = "connector"; - break; - - case OBJ_LINE: - aPopupId = "line"; - break; - - case OBJ_MEASURE: - aPopupId = "measure"; - break; - - case OBJ_RECT: - case OBJ_CIRC: - case OBJ_FREEFILL: - case OBJ_PATHFILL: - case OBJ_POLY: - case OBJ_SECT: - case OBJ_CARC: - case OBJ_CCUT: - case OBJ_CUSTOMSHAPE: - aPopupId = "draw"; - break; - - case OBJ_GRUP: - aPopupId = "group"; - break; - - case OBJ_GRAF: - aPopupId = "graphic"; - break; - - case OBJ_OLE2: - aPopupId = "oleobject"; - break; - case OBJ_MEDIA: - aPopupId = "media"; - break; - case OBJ_TABLE: - aPopupId = "table"; - break; - } + case OBJ_OUTLINETEXT: + case OBJ_CAPTION: + case OBJ_TITLETEXT: + case OBJ_TEXT: + aPopupId = "textbox"; + break; + + case OBJ_PATHLINE: + case OBJ_PLIN: + aPopupId = "curve"; + break; + + case OBJ_FREELINE: + case OBJ_EDGE: + aPopupId = "connector"; + break; + + case OBJ_LINE: + aPopupId = "line"; + break; + + case OBJ_MEASURE: + aPopupId = "measure"; + break; + + case OBJ_RECT: + case OBJ_CIRC: + case OBJ_FREEFILL: + case OBJ_PATHFILL: + case OBJ_POLY: + case OBJ_SECT: + case OBJ_CARC: + case OBJ_CCUT: + case OBJ_CUSTOMSHAPE: + aPopupId = "draw"; + break; + + case OBJ_GRUP: + aPopupId = "group"; + break; + + case OBJ_GRAF: + aPopupId = "graphic"; + break; + + case OBJ_OLE2: + aPopupId = "oleobject"; + break; + case OBJ_MEDIA: + aPopupId = "media"; + break; + case OBJ_TABLE: + aPopupId = "table"; + break; } - else if( nInv == SdrInventor::E3d ) + } + else if( nInv == SdrInventor::E3d ) + { + if( nId == E3D_SCENE_ID ) { - if( nId == E3D_SCENE_ID ) - { - if( !mpDrawView->IsGroupEntered() ) - aPopupId = "3dscene"; - else - aPopupId = "3dscene2"; - } + if( !mpDrawView->IsGroupEntered() ) + aPopupId = "3dscene"; else - aPopupId = "3dobject"; - } - else if( nInv == SdrInventor::FmForm ) - { - aPopupId = "form"; + aPopupId = "3dscene2"; } + else + aPopupId = "3dobject"; + } + else if( nInv == SdrInventor::FmForm ) + { + aPopupId = "form"; } } } - - // multiple selection - else if (mpDrawView->AreObjectsMarked() && - mpDrawView->GetMarkedObjectList().GetMarkCount() > 1 ) - { - aPopupId = "multiselect"; - } - - // nothing selected - else - { - aPopupId = "page"; - } } - // show Popup-Menu - if (!aPopupId.isEmpty()) + + // multiple selection + else if (mpDrawView->AreObjectsMarked() && + mpDrawView->GetMarkedObjectList().GetMarkCount() > 1 ) { - GetActiveWindow()->ReleaseMouse(); + aPopupId = "multiselect"; + } - if(rCEvt.IsMouseEvent()) - GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId ); - else - { - //don't open contextmenu at mouse position if not opened via mouse + // nothing selected + else + { + aPopupId = "page"; + } + } + // show Popup-Menu + if (!aPopupId.isEmpty()) + { + GetActiveWindow()->ReleaseMouse(); - //middle of the window if nothing is marked - Point aMenuPos(GetActiveWindow()->GetSizePixel().Width()/2 - ,GetActiveWindow()->GetSizePixel().Height()/2); + if(rCEvt.IsMouseEvent()) + GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId ); + else + { + //don't open contextmenu at mouse position if not opened via mouse - //middle of the bounding rect if something is marked - if( mpDrawView->AreObjectsMarked() && mpDrawView->GetMarkedObjectList().GetMarkCount() >= 1 ) - { - ::tools::Rectangle aMarkRect; - mpDrawView->GetMarkedObjectList().TakeBoundRect(nullptr,aMarkRect); - aMenuPos = GetActiveWindow()->LogicToPixel( aMarkRect.Center() ); - - //move the point into the visible window area - if( aMenuPos.X() < 0 ) - aMenuPos.setX( 0 ); - if( aMenuPos.Y() < 0 ) - aMenuPos.setY( 0 ); - if( aMenuPos.X() > GetActiveWindow()->GetSizePixel().Width() ) - aMenuPos.setX( GetActiveWindow()->GetSizePixel().Width() ); - if( aMenuPos.Y() > GetActiveWindow()->GetSizePixel().Height() ) - aMenuPos.setY( GetActiveWindow()->GetSizePixel().Height() ); - } + //middle of the window if nothing is marked + Point aMenuPos(GetActiveWindow()->GetSizePixel().Width()/2 + ,GetActiveWindow()->GetSizePixel().Height()/2); - //open context menu at that point - GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId, GetActiveWindow(), &aMenuPos ); + //middle of the bounding rect if something is marked + if( mpDrawView->AreObjectsMarked() && mpDrawView->GetMarkedObjectList().GetMarkCount() >= 1 ) + { + ::tools::Rectangle aMarkRect; + mpDrawView->GetMarkedObjectList().TakeBoundRect(nullptr,aMarkRect); + aMenuPos = GetActiveWindow()->LogicToPixel( aMarkRect.Center() ); + + //move the point into the visible window area + if( aMenuPos.X() < 0 ) + aMenuPos.setX( 0 ); + if( aMenuPos.Y() < 0 ) + aMenuPos.setY( 0 ); + if( aMenuPos.X() > GetActiveWindow()->GetSizePixel().Width() ) + aMenuPos.setX( GetActiveWindow()->GetSizePixel().Width() ); + if( aMenuPos.Y() > GetActiveWindow()->GetSizePixel().Height() ) + aMenuPos.setY( GetActiveWindow()->GetSizePixel().Height() ); } - mbMousePosFreezed = false; + + //open context menu at that point + GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId, GetActiveWindow(), &aMenuPos ); } + mbMousePosFreezed = false; } - else - { - ViewShell::Command(rCEvt, pWin); - } + } + else + { + ViewShell::Command(rCEvt, pWin); } } @@ -842,24 +842,24 @@ void DrawViewShell::ShowMousePosInfo(const ::tools::Rectangle& rRect, // display with coordinates in StatusBar OSL_ASSERT (GetViewShell()!=nullptr); - if ( !GetViewShell()->GetUIActiveClient() ) - { - SfxItemSet aSet( - GetPool(), - svl::Items< - SID_CONTEXT, SID_CONTEXT, - SID_ATTR_POSITION, SID_ATTR_SIZE>{}); + if ( GetViewShell()->GetUIActiveClient() ) + return; - GetStatusBarState(aSet); + SfxItemSet aSet( + GetPool(), + svl::Items< + SID_CONTEXT, SID_CONTEXT, + SID_ATTR_POSITION, SID_ATTR_SIZE>{}); - aSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) ); + GetStatusBarState(aSet); - SfxBindings& rBindings = GetViewFrame()->GetBindings(); - rBindings.SetState(aSet); - rBindings.Invalidate(SID_CONTEXT); - rBindings.Invalidate(SID_ATTR_POSITION); - rBindings.Invalidate(SID_ATTR_SIZE); - } + aSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) ); + + SfxBindings& rBindings = GetViewFrame()->GetBindings(); + rBindings.SetState(aSet); + rBindings.Invalidate(SID_CONTEXT); + rBindings.Invalidate(SID_ATTR_POSITION); + rBindings.Invalidate(SID_ATTR_SIZE); } void DrawViewShell::LockInput() diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 2266c7981d06..66512b0a777d 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -594,20 +594,20 @@ int DrawViewShell::GetActiveTabLayerIndex() const void DrawViewShell::SetActiveTabLayerIndex (int nIndex) { LayerTabBar* pBar = GetLayerTabControl (); - if (pBar != nullptr) + if (pBar == nullptr) + return; + + // Ignore invalid indices silently. + if (nIndex>=0 && nIndex<pBar->GetPageCount()) { - // Ignore invalid indices silently. - if (nIndex>=0 && nIndex<pBar->GetPageCount()) - { - // Tell the draw view and the tab control of the new active layer. - mpDrawView->SetActiveLayer (pBar->GetLayerName (pBar->GetPageId (static_cast<sal_uInt16>(nIndex)))); - pBar->SetCurPageId (pBar->GetPageId (static_cast<sal_uInt16>(nIndex))); - rtl::Reference<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView ( - *this, - *GetView())); - css::uno::Reference< css::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer(); - GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer ); - } + // Tell the draw view and the tab control of the new active layer. + mpDrawView->SetActiveLayer (pBar->GetLayerName (pBar->GetPageId (static_cast<sal_uInt16>(nIndex)))); + pBar->SetCurPageId (pBar->GetPageId (static_cast<sal_uInt16>(nIndex))); + rtl::Reference<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView ( + *this, + *GetView())); + css::uno::Reference< css::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer(); + GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer ); } } diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 73c1e7253a67..456cc5ce176d 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1682,60 +1682,60 @@ void DrawViewShell::GetPageProperties( SfxItemSet &rSet ) { SdPage *pPage = getCurrentPage(); - if (pPage != nullptr && GetDoc() != nullptr) - { - SvxPageItem aPageItem(SID_ATTR_PAGE); - aPageItem.SetLandscape( pPage->GetOrientation() == Orientation::Landscape ); + if (pPage == nullptr || GetDoc() == nullptr) + return; - rSet.Put(SvxSizeItem( SID_ATTR_PAGE_SIZE, pPage->GetSize() )); - rSet.Put(aPageItem); + SvxPageItem aPageItem(SID_ATTR_PAGE); + aPageItem.SetLandscape( pPage->GetOrientation() == Orientation::Landscape ); - const SfxItemSet &rPageAttr = pPage->getSdrPageProperties().GetItemSet(); - drawing::FillStyle eXFS = rPageAttr.GetItem( XATTR_FILLSTYLE )->GetValue(); - XFillStyleItem aFillStyleItem( eXFS ); - aFillStyleItem.SetWhich( SID_ATTR_PAGE_FILLSTYLE ); - rSet.Put(aFillStyleItem); + rSet.Put(SvxSizeItem( SID_ATTR_PAGE_SIZE, pPage->GetSize() )); + rSet.Put(aPageItem); - switch (eXFS) - { - case drawing::FillStyle_SOLID: - { - Color aColor = rPageAttr.GetItem( XATTR_FILLCOLOR )->GetColorValue(); - XFillColorItem aFillColorItem( OUString(), aColor ); - aFillColorItem.SetWhich( SID_ATTR_PAGE_COLOR ); - rSet.Put( aFillColorItem ); - } - break; + const SfxItemSet &rPageAttr = pPage->getSdrPageProperties().GetItemSet(); + drawing::FillStyle eXFS = rPageAttr.GetItem( XATTR_FILLSTYLE )->GetValue(); + XFillStyleItem aFillStyleItem( eXFS ); + aFillStyleItem.SetWhich( SID_ATTR_PAGE_FILLSTYLE ); + rSet.Put(aFillStyleItem); - case drawing::FillStyle_GRADIENT: - { - const XFillGradientItem *pGradient = rPageAttr.GetItem( XATTR_FILLGRADIENT ); - XFillGradientItem aFillGradientItem( pGradient->GetName(), pGradient->GetGradientValue(), SID_ATTR_PAGE_GRADIENT ); - rSet.Put( aFillGradientItem ); - } - break; + switch (eXFS) + { + case drawing::FillStyle_SOLID: + { + Color aColor = rPageAttr.GetItem( XATTR_FILLCOLOR )->GetColorValue(); + XFillColorItem aFillColorItem( OUString(), aColor ); + aFillColorItem.SetWhich( SID_ATTR_PAGE_COLOR ); + rSet.Put( aFillColorItem ); + } + break; - case drawing::FillStyle_HATCH: - { - const XFillHatchItem *pFillHatchItem( rPageAttr.GetItem( XATTR_FILLHATCH ) ); - XFillHatchItem aFillHatchItem( pFillHatchItem->GetName(), pFillHatchItem->GetHatchValue()); - aFillHatchItem.SetWhich( SID_ATTR_PAGE_HATCH ); - rSet.Put( aFillHatchItem ); - } - break; + case drawing::FillStyle_GRADIENT: + { + const XFillGradientItem *pGradient = rPageAttr.GetItem( XATTR_FILLGRADIENT ); + XFillGradientItem aFillGradientItem( pGradient->GetName(), pGradient->GetGradientValue(), SID_ATTR_PAGE_GRADIENT ); + rSet.Put( aFillGradientItem ); + } + break; - case drawing::FillStyle_BITMAP: - { - const XFillBitmapItem *pFillBitmapItem = rPageAttr.GetItem( XATTR_FILLBITMAP ); - XFillBitmapItem aFillBitmapItem( pFillBitmapItem->GetName(), pFillBitmapItem->GetGraphicObject() ); - aFillBitmapItem.SetWhich( SID_ATTR_PAGE_BITMAP ); - rSet.Put( aFillBitmapItem ); - } - break; + case drawing::FillStyle_HATCH: + { + const XFillHatchItem *pFillHatchItem( rPageAttr.GetItem( XATTR_FILLHATCH ) ); + XFillHatchItem aFillHatchItem( pFillHatchItem->GetName(), pFillHatchItem->GetHatchValue()); + aFillHatchItem.SetWhich( SID_ATTR_PAGE_HATCH ); + rSet.Put( aFillHatchItem ); + } + break; - default: - break; + case drawing::FillStyle_BITMAP: + { + const XFillBitmapItem *pFillBitmapItem = rPageAttr.GetItem( XATTR_FILLBITMAP ); + XFillBitmapItem aFillBitmapItem( pFillBitmapItem->GetName(), pFillBitmapItem->GetGraphicObject() ); + aFillBitmapItem.SetWhich( SID_ATTR_PAGE_BITMAP ); + rSet.Put( aFillBitmapItem ); } + break; + + default: + break; } } diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index d19758c1b1d7..87aa3a3d650a 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -723,24 +723,24 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) void DrawViewShell::Notify (SfxBroadcaster&, const SfxHint& rHint) { - if (rHint.GetId()==SfxHintId::ModeChanged) + if (rHint.GetId()!=SfxHintId::ModeChanged) + return; + + // Change to selection when turning on read-only mode. + if(GetDocSh()->IsReadOnly() && dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) ) { - // Change to selection when turning on read-only mode. - if(GetDocSh()->IsReadOnly() && dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) ) - { - SfxRequest aReq(SID_OBJECT_SELECT, SfxCallMode::SLOT, GetDoc()->GetItemPool()); - FuPermanent(aReq); - } + SfxRequest aReq(SID_OBJECT_SELECT, SfxCallMode::SLOT, GetDoc()->GetItemPool()); + FuPermanent(aReq); + } - // Turn on design mode when document is not read-only. - if (GetDocSh()->IsReadOnly() != mbReadOnly ) - { - mbReadOnly = GetDocSh()->IsReadOnly(); + // Turn on design mode when document is not read-only. + if (GetDocSh()->IsReadOnly() != mbReadOnly ) + { + mbReadOnly = GetDocSh()->IsReadOnly(); - SfxBoolItem aItem( SID_FM_DESIGN_MODE, !mbReadOnly ); - GetViewFrame()->GetDispatcher()->ExecuteList(SID_FM_DESIGN_MODE, - SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aItem }); - } + SfxBoolItem aItem( SID_FM_DESIGN_MODE, !mbReadOnly ); + GetViewFrame()->GetDispatcher()->ExecuteList(SID_FM_DESIGN_MODE, + SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aItem }); } } diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx index b8fa08362400..6e8509e8c166 100644 --- a/sd/source/ui/view/drviewsb.cxx +++ b/sd/source/ui/view/drviewsb.cxx @@ -160,62 +160,62 @@ void DrawViewShell::ModifyLayer ( return; } - if( pLayer ) + if( !pLayer ) + return; + + const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount(); + sal_uInt16 nCurPage = 0; + sal_uInt16 nPos; + for( nPos = 0; nPos < nPageCount; nPos++ ) { - const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount(); - sal_uInt16 nCurPage = 0; - sal_uInt16 nPos; - for( nPos = 0; nPos < nPageCount; nPos++ ) + sal_uInt16 nId = GetLayerTabControl()->GetPageId( nPos ); + if (GetLayerTabControl()->GetLayerName(nId) == pLayer->GetName()) { - sal_uInt16 nId = GetLayerTabControl()->GetPageId( nPos ); - if (GetLayerTabControl()->GetLayerName(nId) == pLayer->GetName()) - { - nCurPage = nId; - break; - } + nCurPage = nId; + break; } + } - pLayer->SetName( rLayerName ); - pLayer->SetTitle( rLayerTitle ); - pLayer->SetDescription( rLayerDesc ); - mpDrawView->SetLayerVisible( rLayerName, bIsVisible ); - mpDrawView->SetLayerLocked( rLayerName, bIsLocked); - mpDrawView->SetLayerPrintable(rLayerName, bIsPrintable); + pLayer->SetName( rLayerName ); + pLayer->SetTitle( rLayerTitle ); + pLayer->SetDescription( rLayerDesc ); + mpDrawView->SetLayerVisible( rLayerName, bIsVisible ); + mpDrawView->SetLayerLocked( rLayerName, bIsLocked); + mpDrawView->SetLayerPrintable(rLayerName, bIsPrintable); - GetDoc()->SetChanged(); + GetDoc()->SetChanged(); - GetLayerTabControl()->SetPageText(nCurPage, rLayerName); + GetLayerTabControl()->SetPageText(nCurPage, rLayerName); - // Set page bits for modified tab name display + // Set page bits for modified tab name display - TabBarPageBits nBits = TabBarPageBits::NONE; + TabBarPageBits nBits = TabBarPageBits::NONE; - if (!bIsVisible) - { - nBits = TabBarPageBits::Blue; - } - if (bIsLocked) - { - nBits |= TabBarPageBits::Italic; - } - if (!bIsPrintable) - { - nBits |= TabBarPageBits::Underline; - } + if (!bIsVisible) + { + nBits = TabBarPageBits::Blue; + } + if (bIsLocked) + { + nBits |= TabBarPageBits::Italic; + } + if (!bIsPrintable) + { + nBits |= TabBarPageBits::Underline; + } - // Save the bits + // Save the bits - GetLayerTabControl()->SetPageBits(nCurPage, nBits); + GetLayerTabControl()->SetPageBits(nCurPage, nBits); - GetViewFrame()->GetDispatcher()->Execute( - SID_SWITCHLAYER, - SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); + GetViewFrame()->GetDispatcher()->Execute( + SID_SWITCHLAYER, + SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); - // Call Invalidate at the form shell. - FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); - if (pFormShell != nullptr) - pFormShell->Invalidate(); - } + // Call Invalidate at the form shell. + FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); + if (pFormShell != nullptr) + pFormShell->Invalidate(); } } // end of namespace sd diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx index 8d162688582a..e819d24d3c90 100644 --- a/sd/source/ui/view/drviewsc.cxx +++ b/sd/source/ui/view/drviewsc.cxx @@ -51,28 +51,29 @@ namespace sd { void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) { - if( ( dynamic_cast< SdrGrafObj *>( pObj ) != nullptr || dynamic_cast< SdrOle2Obj *>( pObj ) != nullptr ) && !mpDrawView->IsTextEdit() && - GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) ) - { - Graphic aGraphic; - ImageMap* pIMap = nullptr; - std::unique_ptr<TargetList> pTargetList; - SdIMapInfo* pIMapInfo = SdDrawDocument::GetIMapInfo( pObj ); + if( ( dynamic_cast< SdrGrafObj *>( pObj ) == nullptr && dynamic_cast< SdrOle2Obj *>( pObj ) == nullptr ) + || mpDrawView->IsTextEdit() + || !GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) ) + return; - // get graphic from shape - SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >( pObj ); - if( pGrafObj ) - aGraphic = pGrafObj->GetGraphic(); + Graphic aGraphic; + ImageMap* pIMap = nullptr; + std::unique_ptr<TargetList> pTargetList; + SdIMapInfo* pIMapInfo = SdDrawDocument::GetIMapInfo( pObj ); - if ( pIMapInfo ) - { - pIMap = const_cast<ImageMap*>(&pIMapInfo->GetImageMap()); - pTargetList.reset(new TargetList); - SfxViewFrame::GetTargetList( *pTargetList ); - } + // get graphic from shape + SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >( pObj ); + if( pGrafObj ) + aGraphic = pGrafObj->GetGraphic(); - SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic, pIMap, pTargetList.get(), pObj ); + if ( pIMapInfo ) + { + pIMap = const_cast<ImageMap*>(&pIMapInfo->GetImageMap()); + pTargetList.reset(new TargetList); + SfxViewFrame::GetTargetList( *pTargetList ); } + + SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic, pIMap, pTargetList.get(), pObj ); } IMPL_LINK( DrawViewShell, NameObjectHdl, AbstractSvxObjectNameDialog&, rDialog, bool ) diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index bd405c766229..1289f6097066 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -113,29 +113,29 @@ static void ImpAddPrintableCharactersToTextEdit(SfxRequest const & rReq, ::sd::V // evtl. feed characters to activated textedit const SfxItemSet* pSet = rReq.GetArgs(); - if(pSet) - { - OUString aInputString; + if(!pSet) + return; - if(SfxItemState::SET == pSet->GetItemState(SID_ATTR_CHAR)) - aInputString = static_cast<const SfxStringItem&>(pSet->Get(SID_ATTR_CHAR)).GetValue(); + OUString aInputString; - if(!aInputString.isEmpty()) - { - OutlinerView* pOLV = pView->GetTextEditOutlinerView(); + if(SfxItemState::SET == pSet->GetItemState(SID_ATTR_CHAR)) + aInputString = static_cast<const SfxStringItem&>(pSet->Get(SID_ATTR_CHAR)).GetValue(); - if(pOLV) - { - for(sal_Int32 a(0); a < aInputString.getLength(); a++) - { - sal_Char aChar = static_cast<sal_Char>(aInputString[a]); - vcl::KeyCode aKeyCode; - KeyEvent aKeyEvent(aChar, aKeyCode); + if(aInputString.isEmpty()) + return; - // add actual character - pOLV->PostKeyEvent(aKeyEvent); - } - } + OutlinerView* pOLV = pView->GetTextEditOutlinerView(); + + if(pOLV) + { + for(sal_Int32 a(0); a < aInputString.getLength(); a++) + { + sal_Char aChar = static_cast<sal_Char>(aInputString[a]); + vcl::KeyCode aKeyCode; + KeyEvent aKeyEvent(aChar, aKeyCode); + + // add actual character + pOLV->PostKeyEvent(aKeyEvent); } } } @@ -604,56 +604,56 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) } // with qualifier construct directly - if(HasCurrentFunction() && ((rReq.GetModifier() & KEY_MOD1) || bCreateDirectly)) + if(!(HasCurrentFunction() && ((rReq.GetModifier() & KEY_MOD1) || bCreateDirectly))) + return; + + // get SdOptions + SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType()); + sal_uInt32 nDefaultObjectSizeWidth(pOptions->GetDefaultObjectSizeWidth()); + sal_uInt32 nDefaultObjectSizeHeight(pOptions->GetDefaultObjectSizeHeight()); + + // calc position and size + ::tools::Rectangle aVisArea = GetActiveWindow()->PixelToLogic(::tools::Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel())); + if (comphelper::LibreOfficeKit::isActive()) { - // get SdOptions - SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType()); - sal_uInt32 nDefaultObjectSizeWidth(pOptions->GetDefaultObjectSizeWidth()); - sal_uInt32 nDefaultObjectSizeHeight(pOptions->GetDefaultObjectSizeHeight()); - - // calc position and size - ::tools::Rectangle aVisArea = GetActiveWindow()->PixelToLogic(::tools::Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel())); - if (comphelper::LibreOfficeKit::isActive()) - { - // aVisArea is nonsensical in the LOK case, use the slide size - aVisArea = ::tools::Rectangle(Point(), getCurrentPage()->GetSize()); - } + // aVisArea is nonsensical in the LOK case, use the slide size + aVisArea = ::tools::Rectangle(Point(), getCurrentPage()->GetSize()); + } - Point aPagePos = aVisArea.Center(); - aPagePos.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) ); - aPagePos.AdjustY( -sal_Int32(nDefaultObjectSizeHeight / 2) ); - ::tools::Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight)); - SdrPageView* pPageView = mpDrawView->GetSdrPageView(); + Point aPagePos = aVisArea.Center(); + aPagePos.AdjustX( -sal_Int32(nDefaultObjectSizeWidth / 2) ); + aPagePos.AdjustY( -sal_Int32(nDefaultObjectSizeHeight / 2) ); + ::tools::Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight)); + SdrPageView* pPageView = mpDrawView->GetSdrPageView(); - if(pPageView) - { - // create the default object - SdrObjectUniquePtr pObj = GetCurrentFunction()->CreateDefaultObject(nSId, aNewObjectRectangle); + if(!pPageView) + return; - if(pObj) - { - auto pObjTmp = pObj.get(); - // insert into page - GetView()->InsertObjectAtView(pObj.release(), *pPageView); + // create the default object + SdrObjectUniquePtr pObj = GetCurrentFunction()->CreateDefaultObject(nSId, aNewObjectRectangle); - // Now that pFuActual has done what it was created for we - // can switch on the edit mode for callout objects. - switch (nSId) - { - case SID_DRAW_CAPTION: - case SID_DRAW_CAPTION_VERTICAL: - { - // Make FuText the current function. - SfxUInt16Item aItem (SID_TEXTEDIT, 1); - GetViewFrame()->GetDispatcher()-> - ExecuteList(SID_TEXTEDIT, SfxCallMode::SYNCHRON | - SfxCallMode::RECORD, { &aItem }); - // Put text object into edit mode. - GetView()->SdrBeginTextEdit(static_cast<SdrTextObj*>(pObjTmp), pPageView); - break; - } - } - } + if(!pObj) + return; + + auto pObjTmp = pObj.get(); + // insert into page + GetView()->InsertObjectAtView(pObj.release(), *pPageView); + + // Now that pFuActual has done what it was created for we + // can switch on the edit mode for callout objects. + switch (nSId) + { + case SID_DRAW_CAPTION: + case SID_DRAW_CAPTION_VERTICAL: + { + // Make FuText the current function. + SfxUInt16Item aItem (SID_TEXTEDIT, 1); + GetViewFrame()->GetDispatcher()-> + ExecuteList(SID_TEXTEDIT, SfxCallMode::SYNCHRON | + SfxCallMode::RECORD, { &aItem }); + // Put text object into edit mode. + GetView()->SdrBeginTextEdit(static_cast<SdrTextObj*>(pObjTmp), pPageView); + break; } } } @@ -706,19 +706,19 @@ void DrawViewShell::FuDeleteSelectedObjects() bConsumed = true; } - if (!bConsumed) - { - vcl::KeyCode aKCode(KEY_DELETE); - KeyEvent aKEvt( 0, aKCode); + if (bConsumed) + return; - bConsumed = mpDrawView->getSmartTags().KeyInput( aKEvt ); + vcl::KeyCode aKCode(KEY_DELETE); + KeyEvent aKEvt( 0, aKCode); - if (!bConsumed && HasCurrentFunction()) - bConsumed = GetCurrentFunction()->KeyInput(aKEvt); + bConsumed = mpDrawView->getSmartTags().KeyInput( aKEvt ); - if (!bConsumed) - mpDrawView->DeleteMarked(); - } + if (!bConsumed && HasCurrentFunction()) + bConsumed = GetCurrentFunction()->KeyInput(aKEvt); + + if (!bConsumed) + mpDrawView->DeleteMarked(); } void DrawViewShell::FuSupport(SfxRequest& rReq) @@ -1434,20 +1434,20 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) void DrawViewShell::FuSupportRotate(SfxRequest const &rReq) { - if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE ) - { - ::sd::View* pView = GetView(); + if( rReq.GetSlot() != SID_TRANSLITERATE_ROTATE_CASE ) + return; - if (!pView) - return; + ::sd::View* pView = GetView(); + + if (!pView) + return; - OutlinerView* pOLV = pView->GetTextEditOutlinerView(); + OutlinerView* pOLV = pView->GetTextEditOutlinerView(); - if (!pOLV) - return; + if (!pOLV) + return; - pOLV->TransliterateText( m_aRotateCase.getNextMode() ); - } + pOLV->TransliterateText( m_aRotateCase.getNextMode() ); } void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText, @@ -1554,7 +1554,10 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText, } } - if (bNewObj) try + if (!bNewObj) + return; + + try { SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject( @@ -1622,40 +1625,40 @@ namespace slideshowhelp void ShowSlideShow(SfxRequest const & rReq, SdDrawDocument &rDoc) { Reference< XPresentation2 > xPresentation( rDoc.getPresentation() ); - if( xPresentation.is() ) + if( !xPresentation.is() ) + return; + + sfx2::SfxNotebookBar::LockNotebookBar(); + if (SID_REHEARSE_TIMINGS == rReq.GetSlot()) + xPresentation->rehearseTimings(); + else if (rDoc.getPresentationSettings().mbCustomShow) { - sfx2::SfxNotebookBar::LockNotebookBar(); - if (SID_REHEARSE_TIMINGS == rReq.GetSlot()) - xPresentation->rehearseTimings(); - else if (rDoc.getPresentationSettings().mbCustomShow) - { - //fdo#69975 if a custom show has been set, then - //use it whether or not we've been asked to - //start from the current or first slide - xPresentation->start(); - } - else if (SID_PRESENTATION_CURRENT_SLIDE == rReq.GetSlot()) - { - //If there is no custom show set, start will automatically - //start at the current page - xPresentation->start(); - } - else - { - //Start at page 0, this would blow away any custom - //show settings if any were set - Sequence< PropertyValue > aArguments(1); - PropertyValue aPage; + //fdo#69975 if a custom show has been set, then + //use it whether or not we've been asked to + //start from the current or first slide + xPresentation->start(); + } + else if (SID_PRESENTATION_CURRENT_SLIDE == rReq.GetSlot()) + { + //If there is no custom show set, start will automatically + //start at the current page + xPresentation->start(); + } + else + { + //Start at page 0, this would blow away any custom + //show settings if any were set + Sequence< PropertyValue > aArguments(1); + PropertyValue aPage; - aPage.Name = "FirstPage"; - aPage.Value <<= OUString("0"); + aPage.Name = "FirstPage"; + aPage.Value <<= OUString("0"); - aArguments[0] = aPage; + aArguments[0] = aPage; - xPresentation->startWithArguments( aArguments ); - } - sfx2::SfxNotebookBar::UnlockNotebookBar(); + xPresentation->startWithArguments( aArguments ); } + sfx2::SfxNotebookBar::UnlockNotebookBar(); } } diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 48659c094ddf..0a8af78c3014 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -679,61 +679,61 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) rSet.Put( aAllSet, false ); // there were changes at area and/or line attributes - if( bAttr && pSet ) + if( !(bAttr && pSet) ) + return; + + // if the view owns selected objects, corresponding items have to be + // changed from SfxItemState::DEFAULT (_ON) to SfxItemState::DISABLED + if( mpDrawView->AreObjectsMarked() ) { - // if the view owns selected objects, corresponding items have to be - // changed from SfxItemState::DEFAULT (_ON) to SfxItemState::DISABLED - if( mpDrawView->AreObjectsMarked() ) + SfxWhichIter aNewIter( *pSet ); + nWhich = aNewIter.FirstWhich(); + while( nWhich ) { - SfxWhichIter aNewIter( *pSet ); - nWhich = aNewIter.FirstWhich(); - while( nWhich ) + if (nWhich >= XATTR_LINE_FIRST && nWhich <= XATTR_LINE_LAST + && SfxItemState::DEFAULT == pSet->GetItemState(nWhich) ) { - if (nWhich >= XATTR_LINE_FIRST && nWhich <= XATTR_LINE_LAST - && SfxItemState::DEFAULT == pSet->GetItemState(nWhich) ) - { - rSet.ClearItem( nWhich ); - rSet.DisableItem( nWhich ); - } - nWhich = aNewIter.NextWhich(); + rSet.ClearItem( nWhich ); + rSet.DisableItem( nWhich ); } + nWhich = aNewIter.NextWhich(); } + } - SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE ); - if ( eState == SfxItemState::DONTCARE ) - { - rSet.InvalidateItem(EE_PARA_LRSPACE); - rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); - } - eState = pSet->GetItemState( EE_PARA_SBL ); - if ( eState == SfxItemState::DONTCARE ) - { - rSet.InvalidateItem(EE_PARA_SBL); - rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE); - } - eState = pSet->GetItemState( EE_PARA_ULSPACE ); - if ( eState == SfxItemState::DONTCARE ) - { - rSet.InvalidateItem(EE_PARA_ULSPACE); - rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE); - } + SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE ); + if ( eState == SfxItemState::DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_LRSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); + } + eState = pSet->GetItemState( EE_PARA_SBL ); + if ( eState == SfxItemState::DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_SBL); + rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE); + } + eState = pSet->GetItemState( EE_PARA_ULSPACE ); + if ( eState == SfxItemState::DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_ULSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE); + } - SvxEscapement eEsc = static_cast<SvxEscapement>(pSet->Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); - if( eEsc == SvxEscapement::Superscript ) - { - rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, true ) ); - } - else if( eEsc == SvxEscapement::Subscript ) - { - rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, true ) ); - } + SvxEscapement eEsc = static_cast<SvxEscapement>(pSet->Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); + if( eEsc == SvxEscapement::Superscript ) + { + rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, true ) ); + } + else if( eEsc == SvxEscapement::Subscript ) + { + rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, true ) ); + } - eState = pSet->GetItemState( EE_CHAR_KERNING ); - if ( eState == SfxItemState::DONTCARE ) - { - rSet.InvalidateItem(EE_CHAR_KERNING); - rSet.InvalidateItem(SID_ATTR_CHAR_KERNING); - } + eState = pSet->GetItemState( EE_CHAR_KERNING ); + if ( eState == SfxItemState::DONTCARE ) + { + rSet.InvalidateItem(EE_CHAR_KERNING); + rSet.InvalidateItem(SID_ATTR_CHAR_KERNING); } } diff --git a/sd/source/ui/view/drviewsg.cxx b/sd/source/ui/view/drviewsg.cxx index b989b84105c7..aaf3d3d7fa09 100644 --- a/sd/source/ui/view/drviewsg.cxx +++ b/sd/source/ui/view/drviewsg.cxx @@ -47,28 +47,28 @@ void DrawViewShell::ExecIMap( SfxRequest const & rReq ) if(HasCurrentFunction(SID_PRESENTATION) ) return; - if ( rReq.GetSlot() == SID_IMAP_EXEC ) - { - SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0); + if ( rReq.GetSlot() != SID_IMAP_EXEC ) + return; - if ( pMark ) - { - SdrObject* pSdrObj = pMark->GetMarkedSdrObj(); - SvxIMapDlg* pDlg = ViewShell::Implementation::GetImageMapDialog(); + SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0); - if ( pDlg->GetEditingObject() == static_cast<void*>(pSdrObj) ) - { - const ImageMap& rImageMap = pDlg->GetImageMap(); - SdIMapInfo* pIMapInfo = SdDrawDocument::GetIMapInfo( pSdrObj ); + if ( !pMark ) + return; - if ( !pIMapInfo ) - pSdrObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SdIMapInfo( rImageMap )) ); - else - pIMapInfo->SetImageMap( rImageMap ); + SdrObject* pSdrObj = pMark->GetMarkedSdrObj(); + SvxIMapDlg* pDlg = ViewShell::Implementation::GetImageMapDialog(); - GetDoc()->SetChanged(); - } - } + if ( pDlg->GetEditingObject() == static_cast<void*>(pSdrObj) ) + { + const ImageMap& rImageMap = pDlg->GetImageMap(); + SdIMapInfo* pIMapInfo = SdDrawDocument::GetIMapInfo( pSdrObj ); + + if ( !pIMapInfo ) + pSdrObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SdIMapInfo( rImageMap )) ); + else + pIMapInfo->SetImageMap( rImageMap ); + + GetDoc()->SetChanged(); } } @@ -193,20 +193,20 @@ void DrawViewShell::ExecOptionsBar( SfxRequest& rReq ) break; } - if( !bDefault ) - { - pOptions->StoreConfig(); + if( bDefault ) + return; - // Saves the configuration IMMEDIATELY - // SfxGetpApp()->SaveConfiguration(); - WriteFrameViewData(); + pOptions->StoreConfig(); - mpFrameView->Update( pOptions ); - ReadFrameViewData( mpFrameView ); + // Saves the configuration IMMEDIATELY + // SfxGetpApp()->SaveConfiguration(); + WriteFrameViewData(); - Invalidate( nSlot ); - rReq.Done(); - } + mpFrameView->Update( pOptions ); + ReadFrameViewData( mpFrameView ); + + Invalidate( nSlot ); + rReq.Done(); } diff --git a/sd/source/ui/view/drviewsh.cxx b/sd/source/ui/view/drviewsh.cxx index 2a921d25bf6b..f2b48ca30cb0 100644 --- a/sd/source/ui/view/drviewsh.cxx +++ b/sd/source/ui/view/drviewsh.cxx @@ -95,118 +95,118 @@ void DrawViewShell::MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rW rWin.Pop(); Size aVisAreaSize(aVisArea.GetSize()); - if ( !aVisArea.IsInside(rRect) ) + if ( aVisArea.IsInside(rRect) ) + return; + + // object is not entirely in visible area + sal_Int32 nFreeSpaceX(aVisAreaSize.Width() - aLogicSize.Width()); + sal_Int32 nFreeSpaceY(aVisAreaSize.Height() - aLogicSize.Height()); + + // allow a mode for move-only visibility without zooming. + const sal_Int32 nPercentBorder(30); + const ::tools::Rectangle aInnerRectangle( + aVisArea.Left() + ((aVisAreaSize.Width() * nPercentBorder) / 200), + aVisArea.Top() + ((aVisAreaSize.Height() * nPercentBorder) / 200), + aVisArea.Right() - ((aVisAreaSize.Width() * nPercentBorder) / 200), + aVisArea.Bottom() - ((aVisAreaSize.Height() * nPercentBorder) / 200) + ); + Point aNewPos(aVisArea.TopLeft()); + + if(nFreeSpaceX < 0) { - // object is not entirely in visible area - sal_Int32 nFreeSpaceX(aVisAreaSize.Width() - aLogicSize.Width()); - sal_Int32 nFreeSpaceY(aVisAreaSize.Height() - aLogicSize.Height()); - - // allow a mode for move-only visibility without zooming. - const sal_Int32 nPercentBorder(30); - const ::tools::Rectangle aInnerRectangle( - aVisArea.Left() + ((aVisAreaSize.Width() * nPercentBorder) / 200), - aVisArea.Top() + ((aVisAreaSize.Height() * nPercentBorder) / 200), - aVisArea.Right() - ((aVisAreaSize.Width() * nPercentBorder) / 200), - aVisArea.Bottom() - ((aVisAreaSize.Height() * nPercentBorder) / 200) - ); - Point aNewPos(aVisArea.TopLeft()); - - if(nFreeSpaceX < 0) + if(aInnerRectangle.Left() > rRect.Right()) { - if(aInnerRectangle.Left() > rRect.Right()) - { - // object moves out to the left - aNewPos.AdjustX( -(aVisAreaSize.Width() / 2) ); - } + // object moves out to the left + aNewPos.AdjustX( -(aVisAreaSize.Width() / 2) ); + } - if(aInnerRectangle.Right() < rRect.Left()) - { - // object moves out to the right - aNewPos.AdjustX(aVisAreaSize.Width() / 2 ); - } + if(aInnerRectangle.Right() < rRect.Left()) + { + // object moves out to the right + aNewPos.AdjustX(aVisAreaSize.Width() / 2 ); + } + } + else + { + if(nFreeSpaceX > rRect.GetWidth()) + { + nFreeSpaceX = rRect.GetWidth(); + } + + if(nFreeSpaceX <= 0) + { + SAL_WARN("sd", "The given Rectangle contains values that lead to numerical overflows (!)"); } else { - if(nFreeSpaceX > rRect.GetWidth()) - { - nFreeSpaceX = rRect.GetWidth(); - } + const long distRight(rRect.Right() - aNewPos.X() - aVisAreaSize.Width()); - if(nFreeSpaceX <= 0) + if(distRight > 0) { - SAL_WARN("sd", "The given Rectangle contains values that lead to numerical overflows (!)"); + long mult = (distRight / nFreeSpaceX) + 1; + aNewPos.AdjustX(mult * nFreeSpaceX ); } - else - { - const long distRight(rRect.Right() - aNewPos.X() - aVisAreaSize.Width()); - - if(distRight > 0) - { - long mult = (distRight / nFreeSpaceX) + 1; - aNewPos.AdjustX(mult * nFreeSpaceX ); - } - const long distLeft(aNewPos.X() - rRect.Left()); + const long distLeft(aNewPos.X() - rRect.Left()); - if(distLeft > 0) - { - long mult = (distLeft / nFreeSpaceX) + 1; - aNewPos.AdjustX( -(mult * nFreeSpaceX) ); - } + if(distLeft > 0) + { + long mult = (distLeft / nFreeSpaceX) + 1; + aNewPos.AdjustX( -(mult * nFreeSpaceX) ); } } + } + + if(nFreeSpaceY < 0) + { + if(aInnerRectangle.Top() > rRect.Bottom()) + { + // object moves out to the top + aNewPos.AdjustY( -(aVisAreaSize.Height() / 2) ); + } - if(nFreeSpaceY < 0) + if(aInnerRectangle.Bottom() < rRect.Top()) { - if(aInnerRectangle.Top() > rRect.Bottom()) - { - // object moves out to the top - aNewPos.AdjustY( -(aVisAreaSize.Height() / 2) ); - } + // object moves out to the right + aNewPos.AdjustY(aVisAreaSize.Height() / 2 ); + } + } + else + { + if(nFreeSpaceY > rRect.GetHeight()) + { + nFreeSpaceY = rRect.GetHeight(); + } - if(aInnerRectangle.Bottom() < rRect.Top()) - { - // object moves out to the right - aNewPos.AdjustY(aVisAreaSize.Height() / 2 ); - } + if(nFreeSpaceY <= 0) + { + SAL_WARN("sd", "The given Rectangle contains values that lead to numerical overflows (!)"); } else { - if(nFreeSpaceY > rRect.GetHeight()) - { - nFreeSpaceY = rRect.GetHeight(); - } + const long distBottom(rRect.Bottom() - aNewPos.Y() - aVisAreaSize.Height()); - if(nFreeSpaceY <= 0) + if(distBottom > 0) { - SAL_WARN("sd", "The given Rectangle contains values that lead to numerical overflows (!)"); + long mult = (distBottom / nFreeSpaceY) + 1; + aNewPos.AdjustY(mult * nFreeSpaceY ); } - else - { - const long distBottom(rRect.Bottom() - aNewPos.Y() - aVisAreaSize.Height()); - - if(distBottom > 0) - { - long mult = (distBottom / nFreeSpaceY) + 1; - aNewPos.AdjustY(mult * nFreeSpaceY ); - } - const long distTop(aNewPos.Y() - rRect.Top()); + const long distTop(aNewPos.Y() - rRect.Top()); - if(distTop > 0) - { - long mult = (distTop / nFreeSpaceY) + 1; - aNewPos.AdjustY( -(mult * nFreeSpaceY) ); - } + if(distTop > 0) + { + long mult = (distTop / nFreeSpaceY) + 1; + aNewPos.AdjustY( -(mult * nFreeSpaceY) ); } } + } - // did position change? Does it need to be set? - if(aNewPos != aVisArea.TopLeft()) - { - aVisArea.SetPos(aNewPos); - SetZoomRect(aVisArea); - } + // did position change? Does it need to be set? + if(aNewPos != aVisArea.TopLeft()) + { + aVisArea.SetPos(aNewPos); + SetZoomRect(aVisArea); } } diff --git a/sd/source/ui/view/drviewsi.cxx b/sd/source/ui/view/drviewsi.cxx index ebd27be7672b..e3ca9c9177ed 100644 --- a/sd/source/ui/view/drviewsi.cxx +++ b/sd/source/ui/view/drviewsi.cxx @@ -111,68 +111,68 @@ void DrawViewShell::AssignFrom3DWindow() { sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId(); SfxChildWindow* pWin = GetViewFrame()->GetChildWindow( nId ); - if( pWin ) + if( !pWin ) + return; + + Svx3DWin* p3DWin = static_cast<Svx3DWin*>( pWin->GetWindow() ); + if( !(p3DWin && GetView()) ) + return; + + if(!GetView()->IsPresObjSelected()) { - Svx3DWin* p3DWin = static_cast<Svx3DWin*>( pWin->GetWindow() ); - if( p3DWin && GetView() ) - { - if(!GetView()->IsPresObjSelected()) - { - SfxItemSet aSet( GetDoc()->GetPool(), - svl::Items<SDRATTR_START, SDRATTR_END>{}); - p3DWin->GetAttr( aSet ); - - // own UNDO-compounding also around transformation in 3D - GetView()->BegUndo(SdResId(STR_UNDO_APPLY_3D_FAVOURITE)); - - if(GetView()->IsConvertTo3DObjPossible()) - { - // assign only text-attribute - SfxItemSet aTextSet( GetDoc()->GetPool(), - svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} ); - aTextSet.Put( aSet, false ); - GetView()->SetAttributes( aTextSet ); - - // transform text into 3D - sal_uInt16 nSId = SID_CONVERT_TO_3D; - SfxBoolItem aItem( nSId, true ); - GetViewFrame()->GetDispatcher()->ExecuteList( - nSId, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, - { &aItem }); - - // Determine if a FILL attribute is set. - // If not, hard set a fill attribute - drawing::FillStyle eFillStyle = aSet.Get(XATTR_FILLSTYLE).GetValue(); - if(eFillStyle == drawing::FillStyle_NONE) - aSet.Put(XFillStyleItem (drawing::FillStyle_SOLID)); - - // remove some 3DSCENE attributes since these were - // created by convert to 3D and may not be changed - // to the defaults again. - aSet.ClearItem(SDRATTR_3DSCENE_DISTANCE); - aSet.ClearItem(SDRATTR_3DSCENE_FOCAL_LENGTH); - aSet.ClearItem(SDRATTR_3DOBJ_DEPTH); - } - - // assign attribute - GetView()->Set3DAttributes( aSet ); - - // end UNDO - GetView()->EndUndo(); - } - else - { - vcl::Window* pWindow = GetActiveWindow(); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, - VclMessageType::Info, VclButtonsType::Ok, - SdResId(STR_ACTION_NOTPOSSIBLE))); - xInfoBox->run(); - } + SfxItemSet aSet( GetDoc()->GetPool(), + svl::Items<SDRATTR_START, SDRATTR_END>{}); + p3DWin->GetAttr( aSet ); - // get focus back - GetActiveWindow()->GrabFocus(); + // own UNDO-compounding also around transformation in 3D + GetView()->BegUndo(SdResId(STR_UNDO_APPLY_3D_FAVOURITE)); + + if(GetView()->IsConvertTo3DObjPossible()) + { + // assign only text-attribute + SfxItemSet aTextSet( GetDoc()->GetPool(), + svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} ); + aTextSet.Put( aSet, false ); + GetView()->SetAttributes( aTextSet ); + + // transform text into 3D + sal_uInt16 nSId = SID_CONVERT_TO_3D; + SfxBoolItem aItem( nSId, true ); + GetViewFrame()->GetDispatcher()->ExecuteList( + nSId, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, + { &aItem }); + + // Determine if a FILL attribute is set. + // If not, hard set a fill attribute + drawing::FillStyle eFillStyle = aSet.Get(XATTR_FILLSTYLE).GetValue(); + if(eFillStyle == drawing::FillStyle_NONE) + aSet.Put(XFillStyleItem (drawing::FillStyle_SOLID)); + + // remove some 3DSCENE attributes since these were + // created by convert to 3D and may not be changed + // to the defaults again. + aSet.ClearItem(SDRATTR_3DSCENE_DISTANCE); + aSet.ClearItem(SDRATTR_3DSCENE_FOCAL_LENGTH); + aSet.ClearItem(SDRATTR_3DOBJ_DEPTH); } + + // assign attribute + GetView()->Set3DAttributes( aSet ); + + // end UNDO + GetView()->EndUndo(); } + else + { + vcl::Window* pWindow = GetActiveWindow(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); + } + + // get focus back + GetActiveWindow()->GrabFocus(); } } diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index e6f2e0edaf86..287ea241ac45 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -278,47 +278,47 @@ void FrameView::Disconnect() */ void FrameView::Update(SdOptions const * pOptions) { - if (pOptions) - { - mbRuler = pOptions->IsRulerVisible(); - SetGridVisible( pOptions->IsGridVisible() ); - SetSnapAngle( pOptions->GetAngle() ); - SetGridSnap( pOptions->IsUseGridSnap() ); - SetBordSnap( pOptions->IsSnapBorder() ); - SetHlplSnap( pOptions->IsSnapHelplines() ); - SetOFrmSnap( pOptions->IsSnapFrame() ); - SetOPntSnap( pOptions->IsSnapPoints() ); - SetHlplVisible( pOptions->IsHelplines() ); - SetDragStripes( pOptions->IsDragStripes() ); - SetPlusHandlesAlwaysVisible( pOptions->IsHandlesBezier() ); - SetSnapMagneticPixel( pOptions->GetSnapArea() ); - SetMarkedHitMovesAlways( pOptions->IsMarkedHitMovesAlways() ); - SetMoveOnlyDragging( pOptions->IsMoveOnlyDragging() ); - SetSlantButShear( pOptions->IsMoveOnlyDragging() ); - SetNoDragXorPolys ( !pOptions->IsMoveOutline() ); - SetCrookNoContortion( pOptions->IsCrookNoContortion() ); - SetAngleSnapEnabled( pOptions->IsRotate() ); - SetBigOrtho( pOptions->IsBigOrtho() ); - SetOrtho( pOptions->IsOrtho() ); - SetEliminatePolyPointLimitAngle( pOptions->GetEliminatePolyPointLimitAngle() ); - GetModel()->SetPickThroughTransparentTextFrames( pOptions->IsPickThrough() ); - - SetSolidDragging( pOptions->IsSolidDragging() ); - - SetGridCoarse( Size( pOptions->GetFieldDrawX(), pOptions->GetFieldDrawY() ) ); - SetGridFine( Size( pOptions->GetFieldDivisionX(), pOptions->GetFieldDivisionY() ) ); - Fraction aFractX(pOptions->GetFieldDrawX(), pOptions->GetFieldDrawX() / ( pOptions->GetFieldDivisionX() ? pOptions->GetFieldDivisionX() : 1 )); - Fraction aFractY(pOptions->GetFieldDrawY(), pOptions->GetFieldDrawY() / ( pOptions->GetFieldDivisionY() ? pOptions->GetFieldDivisionY() : 1 )); - SetSnapGridWidth(aFractX, aFractY); - SetQuickEdit(pOptions->IsQuickEdit()); - - // #i26631# - SetMasterPagePaintCaching( pOptions->IsMasterPagePaintCaching() ); - - SetDragWithCopy(pOptions->IsDragWithCopy()); - SetDoubleClickTextEdit( pOptions->IsDoubleClickTextEdit() ); - SetClickChangeRotation( pOptions->IsClickChangeRotation() ); - } + if (!pOptions) + return; + + mbRuler = pOptions->IsRulerVisible(); + SetGridVisible( pOptions->IsGridVisible() ); + SetSnapAngle( pOptions->GetAngle() ); + SetGridSnap( pOptions->IsUseGridSnap() ); + SetBordSnap( pOptions->IsSnapBorder() ); + SetHlplSnap( pOptions->IsSnapHelplines() ); + SetOFrmSnap( pOptions->IsSnapFrame() ); + SetOPntSnap( pOptions->IsSnapPoints() ); + SetHlplVisible( pOptions->IsHelplines() ); + SetDragStripes( pOptions->IsDragStripes() ); + SetPlusHandlesAlwaysVisible( pOptions->IsHandlesBezier() ); + SetSnapMagneticPixel( pOptions->GetSnapArea() ); + SetMarkedHitMovesAlways( pOptions->IsMarkedHitMovesAlways() ); + SetMoveOnlyDragging( pOptions->IsMoveOnlyDragging() ); + SetSlantButShear( pOptions->IsMoveOnlyDragging() ); + SetNoDragXorPolys ( !pOptions->IsMoveOutline() ); + SetCrookNoContortion( pOptions->IsCrookNoContortion() ); + SetAngleSnapEnabled( pOptions->IsRotate() ); + SetBigOrtho( pOptions->IsBigOrtho() ); + SetOrtho( pOptions->IsOrtho() ); + SetEliminatePolyPointLimitAngle( pOptions->GetEliminatePolyPointLimitAngle() ); + GetModel()->SetPickThroughTransparentTextFrames( pOptions->IsPickThrough() ); + + SetSolidDragging( pOptions->IsSolidDragging() ); + + SetGridCoarse( Size( pOptions->GetFieldDrawX(), pOptions->GetFieldDrawY() ) ); + SetGridFine( Size( pOptions->GetFieldDivisionX(), pOptions->GetFieldDivisionY() ) ); + Fraction aFractX(pOptions->GetFieldDrawX(), pOptions->GetFieldDrawX() / ( pOptions->GetFieldDivisionX() ? pOptions->GetFieldDivisionX() : 1 )); + Fraction aFractY(pOptions->GetFieldDrawY(), pOptions->GetFieldDrawY() / ( pOptions->GetFieldDivisionY() ? pOptions->GetFieldDivisionY() : 1 )); + SetSnapGridWidth(aFractX, aFractY); + SetQuickEdit(pOptions->IsQuickEdit()); + + // #i26631# + SetMasterPagePaintCaching( pOptions->IsMasterPagePaintCaching() ); + + SetDragWithCopy(pOptions->IsDragWithCopy()); + SetDoubleClickTextEdit( pOptions->IsDoubleClickTextEdit() ); + SetClickChangeRotation( pOptions->IsClickChangeRotation() ); } /** @@ -532,364 +532,364 @@ static void createHelpLinesFromString( const OUString& rLines, SdrHelpLineList& void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& rSequence ) { const sal_Int32 nLength = rSequence.getLength(); - if (nLength) - { - SdDrawDocument* pDrawDocument = dynamic_cast<SdDrawDocument*>(GetModel()); - const bool bImpress = pDrawDocument && pDrawDocument->GetDocumentType() == DocumentType::Impress; + if (!nLength) + return; - bool bBool = false; - sal_Int32 nInt32 = 0; - sal_Int16 nInt16 = 0; - OUString aString; + SdDrawDocument* pDrawDocument = dynamic_cast<SdDrawDocument*>(GetModel()); + const bool bImpress = pDrawDocument && pDrawDocument->GetDocumentType() == DocumentType::Impress; - sal_Int32 aSnapGridWidthXNum = GetSnapGridWidthX().GetNumerator(); - sal_Int32 aSnapGridWidthXDom = GetSnapGridWidthX().GetDenominator(); + bool bBool = false; + sal_Int32 nInt32 = 0; + sal_Int16 nInt16 = 0; + OUString aString; - sal_Int32 aSnapGridWidthYNum = GetSnapGridWidthY().GetNumerator(); - sal_Int32 aSnapGridWidthYDom = GetSnapGridWidthY().GetDenominator(); + sal_Int32 aSnapGridWidthXNum = GetSnapGridWidthX().GetNumerator(); + sal_Int32 aSnapGridWidthXDom = GetSnapGridWidthX().GetDenominator(); - const css::beans::PropertyValue *pValue = rSequence.getConstArray(); - for (sal_Int32 i = 0 ; i < nLength; i++, pValue++ ) + sal_Int32 aSnapGridWidthYNum = GetSnapGridWidthY().GetNumerator(); + sal_Int32 aSnapGridWidthYDom = GetSnapGridWidthY().GetDenominator(); + + const css::beans::PropertyValue *pValue = rSequence.getConstArray(); + for (sal_Int32 i = 0 ; i < nLength; i++, pValue++ ) + { + if ( pValue->Name == sUNO_View_ViewId ) + { + } + else if ( pValue->Name == sUNO_View_SnapLinesDrawing ) { - if ( pValue->Name == sUNO_View_ViewId ) + if( pValue->Value >>= aString ) { + SdrHelpLineList aHelpLines; + createHelpLinesFromString( aString, aHelpLines ); + SetStandardHelpLines( aHelpLines ); } - else if ( pValue->Name == sUNO_View_SnapLinesDrawing ) + } + else if ( pValue->Name == sUNO_View_SnapLinesNotes ) + { + if( pValue->Value >>= aString ) { - if( pValue->Value >>= aString ) - { - SdrHelpLineList aHelpLines; - createHelpLinesFromString( aString, aHelpLines ); - SetStandardHelpLines( aHelpLines ); - } + SdrHelpLineList aHelpLines; + createHelpLinesFromString( aString, aHelpLines ); + SetNotesHelpLines( aHelpLines ); } - else if ( pValue->Name == sUNO_View_SnapLinesNotes ) + } + else if ( pValue->Name == sUNO_View_SnapLinesHandout ) + { + if( pValue->Value >>= aString ) { - if( pValue->Value >>= aString ) - { - SdrHelpLineList aHelpLines; - createHelpLinesFromString( aString, aHelpLines ); - SetNotesHelpLines( aHelpLines ); - } + SdrHelpLineList aHelpLines; + createHelpLinesFromString( aString, aHelpLines ); + SetHandoutHelpLines( aHelpLines ); } - else if ( pValue->Name == sUNO_View_SnapLinesHandout ) + } + else if ( pValue->Name == sUNO_View_RulerIsVisible ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= aString ) - { - SdrHelpLineList aHelpLines; - createHelpLinesFromString( aString, aHelpLines ); - SetHandoutHelpLines( aHelpLines ); - } + SetRuler( bBool ); } - else if ( pValue->Name == sUNO_View_RulerIsVisible ) - { - if( pValue->Value >>= bBool ) - { - SetRuler( bBool ); - } - } - else if ( pValue->Name == sUNO_View_PageKind ) + } + else if ( pValue->Name == sUNO_View_PageKind ) + { + if( pValue->Value >>= nInt16 ) { - if( pValue->Value >>= nInt16 ) - { - SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); - if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) - SetPageKind( static_cast<PageKind>(nInt16) ); + SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); + if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) + SetPageKind( static_cast<PageKind>(nInt16) ); - SetPageKindOnLoad( static_cast<PageKind>(nInt16) ); - } + SetPageKindOnLoad( static_cast<PageKind>(nInt16) ); } - else if ( pValue->Name == sUNO_View_SelectedPage ) + } + else if ( pValue->Name == sUNO_View_SelectedPage ) + { + if( pValue->Value >>= nInt16 ) { - if( pValue->Value >>= nInt16 ) - { - SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); - if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) - SetSelectedPage( static_cast<sal_uInt16>(nInt16) ); + SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); + if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) + SetSelectedPage( static_cast<sal_uInt16>(nInt16) ); - SetSelectedPageOnLoad( static_cast<sal_uInt16>(nInt16) ); - } + SetSelectedPageOnLoad( static_cast<sal_uInt16>(nInt16) ); } - else if ( pValue->Name == sUNO_View_IsLayerMode ) + } + else if ( pValue->Name == sUNO_View_IsLayerMode ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= bBool ) - { - SetLayerMode( bBool ); - } + SetLayerMode( bBool ); } - else if ( pValue->Name == sUNO_View_IsDoubleClickTextEdit ) + } + else if ( pValue->Name == sUNO_View_IsDoubleClickTextEdit ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= bBool ) - { - SetDoubleClickTextEdit( bBool ); - } + SetDoubleClickTextEdit( bBool ); } - else if ( pValue->Name == sUNO_View_IsClickChangeRotation ) + } + else if ( pValue->Name == sUNO_View_IsClickChangeRotation ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= bBool ) - { - SetClickChangeRotation( bBool ); - } + SetClickChangeRotation( bBool ); } - else if ( pValue->Name == sUNO_View_SlidesPerRow ) + } + else if ( pValue->Name == sUNO_View_SlidesPerRow ) + { + if( pValue->Value >>= nInt16 ) { - if( pValue->Value >>= nInt16 ) - { - SetSlidesPerRow( static_cast<sal_uInt16>(nInt16) ); - } + SetSlidesPerRow( static_cast<sal_uInt16>(nInt16) ); } - else if ( pValue->Name == sUNO_View_EditMode ) + } + else if ( pValue->Name == sUNO_View_EditMode ) + { + if( pValue->Value >>= nInt32 ) { - if( pValue->Value >>= nInt32 ) - { - SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); - if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) - SetViewShEditMode( static_cast<EditMode>(nInt32) ); - } + SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); + if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) + SetViewShEditMode( static_cast<EditMode>(nInt32) ); } - // This one is kept for compatibility. Old value read from sUNO_View_EditModeStandard - // is used. New value will be written into sUNO_View_EditMode. - // Values from sUNO_View_EditModeNotes and sUNO_View_EditModeHangout will be ignored. - else if ( pValue->Name == sUNO_View_EditModeStandard ) + } + // This one is kept for compatibility. Old value read from sUNO_View_EditModeStandard + // is used. New value will be written into sUNO_View_EditMode. + // Values from sUNO_View_EditModeNotes and sUNO_View_EditModeHangout will be ignored. + else if ( pValue->Name == sUNO_View_EditModeStandard ) + { + if( pValue->Value >>= nInt32 ) { - if( pValue->Value >>= nInt32 ) - { - SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); - if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) - SetViewShEditMode( static_cast<EditMode>(nInt32) ); - } + SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); + if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) + SetViewShEditMode( static_cast<EditMode>(nInt32) ); } - else if ( pValue->Name == sUNO_View_VisibleAreaTop ) + } + else if ( pValue->Name == sUNO_View_VisibleAreaTop ) + { + sal_Int32 nTop = 0; + if( pValue->Value >>= nTop ) { - sal_Int32 nTop = 0; - if( pValue->Value >>= nTop ) - { - ::tools::Rectangle aVisArea( GetVisArea() ); - aVisArea.AdjustBottom(nTop - aVisArea.Top() ); - aVisArea.SetTop( nTop ); - SetVisArea( aVisArea ); - } + ::tools::Rectangle aVisArea( GetVisArea() ); + aVisArea.AdjustBottom(nTop - aVisArea.Top() ); + aVisArea.SetTop( nTop ); + SetVisArea( aVisArea ); } - else if ( pValue->Name == sUNO_View_VisibleAreaLeft ) + } + else if ( pValue->Name == sUNO_View_VisibleAreaLeft ) + { + sal_Int32 nLeft = 0; + if( pValue->Value >>= nLeft ) { - sal_Int32 nLeft = 0; - if( pValue->Value >>= nLeft ) - { - ::tools::Rectangle aVisArea( GetVisArea() ); - aVisArea.AdjustRight(nLeft - aVisArea.Left() ); - aVisArea.SetLeft( nLeft ); - SetVisArea( aVisArea ); - } + ::tools::Rectangle aVisArea( GetVisArea() ); + aVisArea.AdjustRight(nLeft - aVisArea.Left() ); + aVisArea.SetLeft( nLeft ); + SetVisArea( aVisArea ); } - else if ( pValue->Name == sUNO_View_VisibleAreaWidth ) + } + else if ( pValue->Name == sUNO_View_VisibleAreaWidth ) + { + sal_Int32 nWidth = 0; + if( pValue->Value >>= nWidth ) { - sal_Int32 nWidth = 0; - if( pValue->Value >>= nWidth ) - { - ::tools::Rectangle aVisArea( GetVisArea() ); - aVisArea.SetRight( aVisArea.Left() + nWidth - 1 ); - SetVisArea( aVisArea ); - } + ::tools::Rectangle aVisArea( GetVisArea() ); + aVisArea.SetRight( aVisArea.Left() + nWidth - 1 ); + SetVisArea( aVisArea ); } - else if ( pValue->Name == sUNO_View_VisibleAreaHeight ) + } + else if ( pValue->Name == sUNO_View_VisibleAreaHeight ) + { + sal_Int32 nHeight = 0; + if( pValue->Value >>= nHeight ) { - sal_Int32 nHeight = 0; - if( pValue->Value >>= nHeight ) - { - ::tools::Rectangle aVisArea( GetVisArea() ); - aVisArea.SetBottom( nHeight + aVisArea.Top() - 1 ); - SetVisArea( aVisArea ); - } + ::tools::Rectangle aVisArea( GetVisArea() ); + aVisArea.SetBottom( nHeight + aVisArea.Top() - 1 ); + SetVisArea( aVisArea ); } + } - else if ( pValue->Name == sUNO_View_GridIsVisible ) + else if ( pValue->Name == sUNO_View_GridIsVisible ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= bBool ) - { - SetGridVisible( bBool ); - } + SetGridVisible( bBool ); } + } - else if ( pValue->Name == sUNO_View_IsSnapToGrid ) - { - if( pValue->Value >>= bBool ) - { - SetGridSnap( bBool ); - } - } - else if ( pValue->Name == sUNO_View_GridIsFront ) - { - if( pValue->Value >>= bBool ) - { - SetGridFront( bBool ); - } - } - else if ( pValue->Name == sUNO_View_IsSnapToPageMargins ) - { - if( pValue->Value >>= bBool ) - { - SetBordSnap( bBool ); - } - } - else if ( pValue->Name == sUNO_View_IsSnapToSnapLines ) - { - if( pValue->Value >>= bBool ) - { - SetHlplSnap( bBool ); - } - } - else if ( pValue->Name == sUNO_View_IsSnapToObjectFrame ) - { - if( pValue->Value >>= bBool ) - { - SetOFrmSnap( bBool ); - } - } - else if ( pValue->Name == sUNO_View_IsSnapToObjectPoints ) - { - if( pValue->Value >>= bBool ) - { - SetOPntSnap( bBool ); - } - } - else if ( pValue->Name == sUNO_View_IsPlusHandlesAlwaysVisible ) - { - if( pValue->Value >>= bBool ) - { - SetPlusHandlesAlwaysVisible( bBool ); - } - } - else if ( pValue->Name == sUNO_View_IsFrameDragSingles ) + else if ( pValue->Name == sUNO_View_IsSnapToGrid ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= bBool ) - { - SetFrameDragSingles( bBool ); - } + SetGridSnap( bBool ); } - else if ( pValue->Name == sUNO_View_EliminatePolyPointLimitAngle ) + } + else if ( pValue->Name == sUNO_View_GridIsFront ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= nInt32 ) - { - SetEliminatePolyPointLimitAngle( nInt32 ); - } + SetGridFront( bBool ); } - else if ( pValue->Name == sUNO_View_IsEliminatePolyPoints ) + } + else if ( pValue->Name == sUNO_View_IsSnapToPageMargins ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= bBool ) - { - SetEliminatePolyPoints( bBool ); - } + SetBordSnap( bBool ); } - else if ( pValue->Name == sUNO_View_ActiveLayer ) + } + else if ( pValue->Name == sUNO_View_IsSnapToSnapLines ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= aString ) - { - SetActiveLayer( aString ); - } + SetHlplSnap( bBool ); } - else if ( pValue->Name == sUNO_View_NoAttribs ) + } + else if ( pValue->Name == sUNO_View_IsSnapToObjectFrame ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= bBool ) - { - SetNoAttribs( bBool ); - } + SetOFrmSnap( bBool ); } - else if ( pValue->Name == sUNO_View_NoColors ) + } + else if ( pValue->Name == sUNO_View_IsSnapToObjectPoints ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= bBool ) - { - SetNoColors( bBool ); - } + SetOPntSnap( bBool ); } - else if ( pValue->Name == sUNO_View_GridCoarseWidth ) + } + else if ( pValue->Name == sUNO_View_IsPlusHandlesAlwaysVisible ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= nInt32 ) - { - const Size aCoarse( nInt32, GetGridCoarse().Height() ); - SetGridCoarse( aCoarse ); - } + SetPlusHandlesAlwaysVisible( bBool ); } - else if ( pValue->Name == sUNO_View_GridCoarseHeight ) + } + else if ( pValue->Name == sUNO_View_IsFrameDragSingles ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= nInt32 ) - { - const Size aCoarse( GetGridCoarse().Width(), nInt32 ); - SetGridCoarse( aCoarse ); - } + SetFrameDragSingles( bBool ); } - else if ( pValue->Name == sUNO_View_GridFineWidth ) + } + else if ( pValue->Name == sUNO_View_EliminatePolyPointLimitAngle ) + { + if( pValue->Value >>= nInt32 ) { - if( pValue->Value >>= nInt32 ) - { - const Size aCoarse( nInt32, GetGridFine().Height() ); - SetGridFine( aCoarse ); - } + SetEliminatePolyPointLimitAngle( nInt32 ); } - else if ( pValue->Name == sUNO_View_GridFineHeight ) + } + else if ( pValue->Name == sUNO_View_IsEliminatePolyPoints ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= nInt32 ) - { - const Size aCoarse( GetGridFine().Width(), nInt32 ); - SetGridFine( aCoarse ); - } + SetEliminatePolyPoints( bBool ); } - else if ( pValue->Name == sUNO_View_IsAngleSnapEnabled ) + } + else if ( pValue->Name == sUNO_View_ActiveLayer ) + { + if( pValue->Value >>= aString ) { - if( pValue->Value >>= bBool ) - { - SetAngleSnapEnabled( bBool ); - } + SetActiveLayer( aString ); } - else if ( pValue->Name == sUNO_View_SnapAngle ) + } + else if ( pValue->Name == sUNO_View_NoAttribs ) + { + if( pValue->Value >>= bBool ) { - if( pValue->Value >>= nInt32 ) - { - SetSnapAngle( nInt32 ); - } + SetNoAttribs( bBool ); } - else if ( pValue->Name == sUNO_View_GridSnapWidthXNumerator ) + } + else if ( pValue->Name == sUNO_View_NoColors ) + { + if( pValue->Value >>= bBool ) { - pValue->Value >>= aSnapGridWidthXNum; + SetNoColors( bBool ); } - else if ( pValue->Name == sUNO_View_GridSnapWidthXDenominator ) + } + else if ( pValue->Name == sUNO_View_GridCoarseWidth ) + { + if( pValue->Value >>= nInt32 ) { - pValue->Value >>= aSnapGridWidthXDom; + const Size aCoarse( nInt32, GetGridCoarse().Height() ); + SetGridCoarse( aCoarse ); } - else if ( pValue->Name == sUNO_View_GridSnapWidthYNumerator ) + } + else if ( pValue->Name == sUNO_View_GridCoarseHeight ) + { + if( pValue->Value >>= nInt32 ) { - pValue->Value >>= aSnapGridWidthYNum; + const Size aCoarse( GetGridCoarse().Width(), nInt32 ); + SetGridCoarse( aCoarse ); } - else if ( pValue->Name == sUNO_View_GridSnapWidthYDenominator ) + } + else if ( pValue->Name == sUNO_View_GridFineWidth ) + { + if( pValue->Value >>= nInt32 ) { - pValue->Value >>= aSnapGridWidthYDom; + const Size aCoarse( nInt32, GetGridFine().Height() ); + SetGridFine( aCoarse ); } - else if (!bImpress && pValue->Name == sUNO_View_VisibleLayers ) + } + else if ( pValue->Name == sUNO_View_GridFineHeight ) + { + if( pValue->Value >>= nInt32 ) { - SdrLayerIDSet aSdrLayerIDSets; - aSdrLayerIDSets.PutValue( pValue->Value ); - SetVisibleLayers( aSdrLayerIDSets ); + const Size aCoarse( GetGridFine().Width(), nInt32 ); + SetGridFine( aCoarse ); } - else if (!bImpress && pValue->Name == sUNO_View_PrintableLayers ) + } + else if ( pValue->Name == sUNO_View_IsAngleSnapEnabled ) + { + if( pValue->Value >>= bBool ) { - SdrLayerIDSet aSdrLayerIDSets; - aSdrLayerIDSets.PutValue( pValue->Value ); - SetPrintableLayers( aSdrLayerIDSets ); + SetAngleSnapEnabled( bBool ); } - else if (!bImpress && pValue->Name == sUNO_View_LockedLayers ) + } + else if ( pValue->Name == sUNO_View_SnapAngle ) + { + if( pValue->Value >>= nInt32 ) { - SdrLayerIDSet aSdrLayerIDSets; - aSdrLayerIDSets.PutValue( pValue->Value ); - SetLockedLayers( aSdrLayerIDSets ); + SetSnapAngle( nInt32 ); } } + else if ( pValue->Name == sUNO_View_GridSnapWidthXNumerator ) + { + pValue->Value >>= aSnapGridWidthXNum; + } + else if ( pValue->Name == sUNO_View_GridSnapWidthXDenominator ) + { + pValue->Value >>= aSnapGridWidthXDom; + } + else if ( pValue->Name == sUNO_View_GridSnapWidthYNumerator ) + { + pValue->Value >>= aSnapGridWidthYNum; + } + else if ( pValue->Name == sUNO_View_GridSnapWidthYDenominator ) + { + pValue->Value >>= aSnapGridWidthYDom; + } + else if (!bImpress && pValue->Name == sUNO_View_VisibleLayers ) + { + SdrLayerIDSet aSdrLayerIDSets; + aSdrLayerIDSets.PutValue( pValue->Value ); + SetVisibleLayers( aSdrLayerIDSets ); + } + else if (!bImpress && pValue->Name == sUNO_View_PrintableLayers ) + { + SdrLayerIDSet aSdrLayerIDSets; + aSdrLayerIDSets.PutValue( pValue->Value ); + SetPrintableLayers( aSdrLayerIDSets ); + } + else if (!bImpress && pValue->Name == sUNO_View_LockedLayers ) + { + SdrLayerIDSet aSdrLayerIDSets; + aSdrLayerIDSets.PutValue( pValue->Value ); + SetLockedLayers( aSdrLayerIDSets ); + } + } - SetViewShEditModeOnLoad(EditMode::Page); + SetViewShEditModeOnLoad(EditMode::Page); - const Fraction aSnapGridWidthX( aSnapGridWidthXNum, aSnapGridWidthXDom ); - const Fraction aSnapGridWidthY( aSnapGridWidthYNum, aSnapGridWidthYDom ); + const Fraction aSnapGridWidthX( aSnapGridWidthXNum, aSnapGridWidthXDom ); + const Fraction aSnapGridWidthY( aSnapGridWidthYNum, aSnapGridWidthYDom ); - SetSnapGridWidth( aSnapGridWidthX, aSnapGridWidthY ); - } + SetSnapGridWidth( aSnapGridWidthX, aSnapGridWidthY ); } void FrameView::SetPreviousViewShellType (ViewShell::ShellType eType) diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 1c72f1ff5009..244ba1afd975 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -255,31 +255,31 @@ void OutlineViewShell::ArrangeGUIElements () ViewShell::ArrangeGUIElements (); ::sd::Window* pWindow = mpContentWindow.get(); - if (pWindow != nullptr) - { - pWindow->SetMinZoomAutoCalc(false); + if (pWindow == nullptr) + return; - // change OutputArea of the OutlinerView - OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow); + pWindow->SetMinZoomAutoCalc(false); - ::tools::Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel()); + // change OutputArea of the OutlinerView + OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow); - aWin = pWindow->PixelToLogic(aWin); - pOutlinerView->SetOutputArea(aWin); + ::tools::Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel()); - ::tools::Rectangle aVis = pOutlinerView->GetVisArea(); + aWin = pWindow->PixelToLogic(aWin); + pOutlinerView->SetOutputArea(aWin); - ::tools::Rectangle aText = ::tools::Rectangle(Point(0,0), - Size(pOlView->GetPaperWidth(), - pOlView->GetOutliner().GetTextHeight())); - if (aWin.GetHeight() > aText.Bottom()) - aText.SetBottom( aWin.GetHeight() ); + ::tools::Rectangle aVis = pOutlinerView->GetVisArea(); - if (!aWin.IsEmpty()) // not when opening - { - InitWindows(Point(0,0), aText.GetSize(), aVis.TopLeft()); - UpdateScrollBars(); - } + ::tools::Rectangle aText = ::tools::Rectangle(Point(0,0), + Size(pOlView->GetPaperWidth(), + pOlView->GetOutliner().GetTextHeight())); + if (aWin.GetHeight() > aText.Bottom()) + aText.SetBottom( aWin.GetHeight() ); + + if (!aWin.IsEmpty()) // not when opening + { + InitWindows(Point(0,0), aText.GetSize(), aVis.TopLeft()); + UpdateScrollBars(); } } @@ -380,30 +380,30 @@ void OutlineViewShell::GetCtrlState(SfxItemSet &rSet) if ( SfxItemState::DEFAULT == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) ) rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, true ) ); - if ( SfxItemState::DEFAULT == rSet.GetItemState(SID_TRANSLITERATE_HALFWIDTH) || + if ( !(SfxItemState::DEFAULT == rSet.GetItemState(SID_TRANSLITERATE_HALFWIDTH) || SfxItemState::DEFAULT == rSet.GetItemState(SID_TRANSLITERATE_FULLWIDTH) || SfxItemState::DEFAULT == rSet.GetItemState(SID_TRANSLITERATE_HIRAGANA) || - SfxItemState::DEFAULT == rSet.GetItemState(SID_TRANSLITERATE_KATAGANA) ) + SfxItemState::DEFAULT == rSet.GetItemState(SID_TRANSLITERATE_KATAGANA)) ) + return; + + SvtCJKOptions aCJKOptions; + if( !aCJKOptions.IsChangeCaseMapEnabled() ) { - SvtCJKOptions aCJKOptions; - if( !aCJKOptions.IsChangeCaseMapEnabled() ) - { - GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, false ); - GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, false ); - GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, false ); - GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, false ); - rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH ); - rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH ); - rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA ); - rSet.DisableItem( SID_TRANSLITERATE_KATAGANA ); - } - else - { - GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, true ); - GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, true ); - GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, true ); - GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, true ); - } + GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, false ); + GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, false ); + GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, false ); + GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, false ); + rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH ); + rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH ); + rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA ); + rSet.DisableItem( SID_TRANSLITERATE_KATAGANA ); + } + else + { + GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, true ); + GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, true ); + GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, true ); + GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, true ); } } diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 743b00a104a4..c1636dc1405a 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -333,20 +333,20 @@ IMPL_LINK( OutlineView, ParagraphInsertedHdl, Outliner::ParagraphHdlParam, aPara { // 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() - if (maDragAndDropModelGuard == nullptr) - { - OutlineViewPageChangesGuard aGuard(this); + if (maDragAndDropModelGuard != nullptr) + return; - sal_Int32 nAbsPos = mrOutliner.GetAbsPos( aParam.pPara ); + OutlineViewPageChangesGuard aGuard(this); - UpdateParagraph( nAbsPos ); + sal_Int32 nAbsPos = mrOutliner.GetAbsPos( aParam.pPara ); - if( (nAbsPos == 0) || - ::Outliner::HasParaFlag(aParam.pPara, ParaFlag::ISPAGE) || - ::Outliner::HasParaFlag(mrOutliner.GetParagraph( nAbsPos-1 ), ParaFlag::ISPAGE) ) - { - InsertSlideForParagraph( aParam.pPara ); - } + UpdateParagraph( nAbsPos ); + + if( (nAbsPos == 0) || + ::Outliner::HasParaFlag(aParam.pPara, ParaFlag::ISPAGE) || + ::Outliner::HasParaFlag(mrOutliner.GetParagraph( nAbsPos-1 ), ParaFlag::ISPAGE) ) + { + InsertSlideForParagraph( aParam.pPara ); } } @@ -474,46 +474,46 @@ IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, aPa OutlineViewPageChangesGuard aGuard(this); Paragraph* pPara = aParam.pPara; - if( ::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) ) + if( !::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) ) + return; + + // how many titles are in front of the title paragraph in question? + sal_uLong nPos = 0; + while(pPara) { - // how many titles are in front of the title paragraph in question? - sal_uLong nPos = 0; - while(pPara) - { - pPara = GetPrevTitle(pPara); - if (pPara) nPos++; - } + pPara = GetPrevTitle(pPara); + if (pPara) nPos++; + } - // delete page and notes page - sal_uInt16 nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; - SdrPage* pPage = mrDoc.GetPage(nAbsPos); - if( isRecordingUndo() ) - AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); - mrDoc.RemovePage(nAbsPos); + // delete page and notes page + sal_uInt16 nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; + SdrPage* pPage = mrDoc.GetPage(nAbsPos); + if( isRecordingUndo() ) + AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); + mrDoc.RemovePage(nAbsPos); - nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; - pPage = mrDoc.GetPage(nAbsPos); - if( isRecordingUndo() ) - AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); - mrDoc.RemovePage(nAbsPos); + nAbsPos = static_cast<sal_uInt16>(nPos) * 2 + 1; + pPage = mrDoc.GetPage(nAbsPos); + if( isRecordingUndo() ) + AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); + mrDoc.RemovePage(nAbsPos); - // progress display if necessary - if (mnPagesToProcess) - { - mnPagesProcessed++; + // progress display if necessary + if (mnPagesToProcess) + { + mnPagesProcessed++; - if(mpProgress) - mpProgress->SetState(mnPagesProcessed); + if(mpProgress) + mpProgress->SetState(mnPagesProcessed); - if (mnPagesProcessed == mnPagesToProcess) - { - mpProgress.reset(); - mnPagesToProcess = 0; - mnPagesProcessed = 0; - } + if (mnPagesProcessed == mnPagesToProcess) + { + mpProgress.reset(); + mnPagesToProcess = 0; + mnPagesProcessed = 0; } - aParam.pOutliner->UpdateFields(); } + aParam.pOutliner->UpdateFields(); } /** @@ -670,56 +670,56 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam nPos++; } - if( nPos >= 0 ) - { - SdPage* pPage = mrDoc.GetSdPage( static_cast<sal_uInt16>(nPos), PageKind::Standard ); - - if( pPage ) - { - SfxStyleSheet* pStyleSheet = nullptr; - sal_Int32 nPara = pOutliner->GetAbsPos( pPara ); - sal_Int16 nDepth = pOutliner->GetDepth( nPara ); - bool bSubTitle = pPage->GetPresObj(PRESOBJ_TEXT) != nullptr; + if( nPos < 0 ) + return; - if( ::Outliner::HasParaFlag(pPara, ParaFlag::ISPAGE) ) - { - pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ); - } - else if( bSubTitle ) - { - pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT ); - } - else - { - pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ); + SdPage* pPage = mrDoc.GetSdPage( static_cast<sal_uInt16>(nPos), PageKind::Standard ); - if( nDepth > 0 ) - { - OUString aNewStyleSheetName = pStyleSheet->GetName(); - if (!aNewStyleSheetName.isEmpty()) - aNewStyleSheetName = aNewStyleSheetName.copy(0, aNewStyleSheetName.getLength() - 1); - aNewStyleSheetName += OUString::number( nDepth+1 ); - SfxStyleSheetBasePool* pStylePool = mrDoc.GetStyleSheetPool(); - pStyleSheet = static_cast<SfxStyleSheet*>( pStylePool->Find( aNewStyleSheetName, pStyleSheet->GetFamily() ) ); - } - } + if( !pPage ) + return; - // before we set the style sheet we need to preserve the bullet item - // since all items will be deleted while setting a new style sheet - SfxItemSet aOldAttrs( pOutliner->GetParaAttribs( nPara ) ); + SfxStyleSheet* pStyleSheet = nullptr; + sal_Int32 nPara = pOutliner->GetAbsPos( pPara ); + sal_Int16 nDepth = pOutliner->GetDepth( nPara ); + bool bSubTitle = pPage->GetPresObj(PRESOBJ_TEXT) != nullptr; - pOutliner->SetStyleSheet( nPara, pStyleSheet ); + if( ::Outliner::HasParaFlag(pPara, ParaFlag::ISPAGE) ) + { + pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ); + } + else if( bSubTitle ) + { + pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT ); + } + else + { + pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ); - // restore the old bullet item but not if the style changed - if ( pOutliner->GetPrevDepth() != -1 && nDepth != -1 && - aOldAttrs.GetItemState( EE_PARA_NUMBULLET ) == SfxItemState::SET ) - { - SfxItemSet aAttrs( pOutliner->GetParaAttribs( nPara ) ); - aAttrs.Put( *aOldAttrs.GetItem( EE_PARA_NUMBULLET ) ); - pOutliner->SetParaAttribs( nPara, aAttrs ); - } + if( nDepth > 0 ) + { + OUString aNewStyleSheetName = pStyleSheet->GetName(); + if (!aNewStyleSheetName.isEmpty()) + aNewStyleSheetName = aNewStyleSheetName.copy(0, aNewStyleSheetName.getLength() - 1); + aNewStyleSheetName += OUString::number( nDepth+1 ); + SfxStyleSheetBasePool* pStylePool = mrDoc.GetStyleSheetPool(); + pStyleSheet = static_cast<SfxStyleSheet*>( pStylePool->Find( aNewStyleSheetName, pStyleSheet->GetFamily() ) ); } } + + // before we set the style sheet we need to preserve the bullet item + // since all items will be deleted while setting a new style sheet + SfxItemSet aOldAttrs( pOutliner->GetParaAttribs( nPara ) ); + + pOutliner->SetStyleSheet( nPara, pStyleSheet ); + + // restore the old bullet item but not if the style changed + if ( pOutliner->GetPrevDepth() != -1 && nDepth != -1 && + aOldAttrs.GetItemState( EE_PARA_NUMBULLET ) == SfxItemState::SET ) + { + SfxItemSet aAttrs( pOutliner->GetParaAttribs( nPara ) ); + aAttrs.Put( *aOldAttrs.GetItem( EE_PARA_NUMBULLET ) ); + pOutliner->SetParaAttribs( nPara, aAttrs ); + } } /** @@ -1340,27 +1340,27 @@ void OutlineView::onUpdateStyleSettings( bool bForceUpdate /* = false */ ) { svtools::ColorConfig aColorConfig; const Color aDocColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor ); - if( bForceUpdate || (maDocColor != aDocColor) ) + if( !(bForceUpdate || (maDocColor != aDocColor)) ) + return; + + sal_uInt16 nView; + for( nView = 0; nView < MAX_OUTLINERVIEWS; nView++ ) { - sal_uInt16 nView; - for( nView = 0; nView < MAX_OUTLINERVIEWS; nView++ ) + if (mpOutlinerViews[nView] != nullptr) { - if (mpOutlinerViews[nView] != nullptr) - { - mpOutlinerViews[nView]->SetBackgroundColor( aDocColor ); + mpOutlinerViews[nView]->SetBackgroundColor( aDocColor ); - vcl::Window* pWindow = mpOutlinerViews[nView]->GetWindow(); + vcl::Window* pWindow = mpOutlinerViews[nView]->GetWindow(); - if( pWindow ) - pWindow->SetBackground( Wallpaper( aDocColor ) ); + if( pWindow ) + pWindow->SetBackground( Wallpaper( aDocColor ) ); - } } + } - mrOutliner.SetBackgroundColor( aDocColor ); + mrOutliner.SetBackgroundColor( aDocColor ); - maDocColor = aDocColor; - } + maDocColor = aDocColor; } IMPL_LINK_NOARG(OutlineView, AppEventListenerHdl, VclSimpleEvent&, void) @@ -1470,69 +1470,69 @@ void OutlineView::UpdateDocument() void OutlineView::TryToMergeUndoActions() { SfxUndoManager& rOutlineUndo = mrOutliner.GetUndoManager(); - if( rOutlineUndo.GetUndoActionCount() > 1 ) + if( rOutlineUndo.GetUndoActionCount() <= 1 ) + return; + + SfxListUndoAction* pListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction() ); + SfxListUndoAction* pPrevListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction(1) ); + if( !(pListAction && pPrevListAction) ) + return; + + // find the top EditUndo action in the top undo action list + size_t nAction = pListAction->maUndoActions.size(); + EditUndo* pEditUndo = nullptr; + while( !pEditUndo && nAction ) { - SfxListUndoAction* pListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction() ); - SfxListUndoAction* pPrevListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction(1) ); - if( pListAction && pPrevListAction ) - { - // find the top EditUndo action in the top undo action list - size_t nAction = pListAction->maUndoActions.size(); - EditUndo* pEditUndo = nullptr; - while( !pEditUndo && nAction ) - { - pEditUndo = dynamic_cast< EditUndo* >(pListAction->GetUndoAction(--nAction)); - } + pEditUndo = dynamic_cast< EditUndo* >(pListAction->GetUndoAction(--nAction)); + } - sal_uInt16 nEditPos = nAction; // we need this later to remove the merged undo actions + sal_uInt16 nEditPos = nAction; // we need this later to remove the merged undo actions - // make sure it is the only EditUndo action in the top undo list - while( pEditUndo && nAction ) - { - if( dynamic_cast< EditUndo* >(pListAction->GetUndoAction(--nAction)) ) - pEditUndo = nullptr; - } + // make sure it is the only EditUndo action in the top undo list + while( pEditUndo && nAction ) + { + if( dynamic_cast< EditUndo* >(pListAction->GetUndoAction(--nAction)) ) + pEditUndo = nullptr; + } - // do we have one and only one EditUndo action in the top undo list? - if( pEditUndo ) - { - // yes, see if we can merge it with the prev undo list + // do we have one and only one EditUndo action in the top undo list? + if( !pEditUndo ) + return; - nAction = pPrevListAction->maUndoActions.size(); - EditUndo* pPrevEditUndo = nullptr; - while( !pPrevEditUndo && nAction ) - pPrevEditUndo = dynamic_cast< EditUndo* >(pPrevListAction->GetUndoAction(--nAction)); + // yes, see if we can merge it with the prev undo list - if( pPrevEditUndo && pPrevEditUndo->Merge( pEditUndo ) ) - { - // ok we merged the only EditUndo of the top undo list with - // the top EditUndo of the previous undo list + nAction = pPrevListAction->maUndoActions.size(); + EditUndo* pPrevEditUndo = nullptr; + while( !pPrevEditUndo && nAction ) + pPrevEditUndo = dynamic_cast< EditUndo* >(pPrevListAction->GetUndoAction(--nAction)); - // first remove the merged undo action - assert( pListAction->GetUndoAction(nEditPos) == pEditUndo && - "sd::OutlineView::TryToMergeUndoActions(), wrong edit pos!" ); - pListAction->Remove(nEditPos); + if( !(pPrevEditUndo && pPrevEditUndo->Merge( pEditUndo )) ) + return; - if ( !pListAction->maUndoActions.empty() ) - { - // now we have to move all remaining doc undo actions from the top undo - // list to the previous undo list and remove the top undo list - - size_t nCount = pListAction->maUndoActions.size(); - size_t nDestAction = pPrevListAction->maUndoActions.size(); - while( nCount-- ) - { - std::unique_ptr<SfxUndoAction> pTemp = pListAction->Remove(0); - pPrevListAction->Insert( std::move(pTemp), nDestAction++ ); - } - pPrevListAction->nCurUndoAction = pPrevListAction->maUndoActions.size(); - } + // ok we merged the only EditUndo of the top undo list with + // the top EditUndo of the previous undo list - rOutlineUndo.RemoveLastUndoAction(); - } - } + // first remove the merged undo action + assert( pListAction->GetUndoAction(nEditPos) == pEditUndo && + "sd::OutlineView::TryToMergeUndoActions(), wrong edit pos!" ); + pListAction->Remove(nEditPos); + + if ( !pListAction->maUndoActions.empty() ) + { + // now we have to move all remaining doc undo actions from the top undo + // list to the previous undo list and remove the top undo list + + size_t nCount = pListAction->maUndoActions.size(); + size_t nDestAction = pPrevListAction->maUndoActions.size(); + while( nCount-- ) + { + std::unique_ptr<SfxUndoAction> pTemp = pListAction->Remove(0); + pPrevListAction->Insert( std::move(pTemp), nDestAction++ ); } + pPrevListAction->nCurUndoAction = pPrevListAction->maUndoActions.size(); } + + rOutlineUndo.RemoveLastUndoAction(); } IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo, void) @@ -1547,80 +1547,80 @@ IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo, void) Size aOffset( 100, 100 ); // paint slide number - if( pPara && ::Outliner::HasParaFlag(pPara,ParaFlag::ISPAGE) ) + if( !(pPara && ::Outliner::HasParaFlag(pPara,ParaFlag::ISPAGE)) ) + return; + + 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 = static_cast<long>(mrOutliner.GetLineHeight( pInfo->mnPara )); - long nFontHeight = 0; - if ( !rEditEngine.IsFlatMode() ) - { - nFontHeight = nBulletHeight / 5; - } - else - { - nFontHeight = (nBulletHeight * 10) / 25; - } + long nBulletHeight = static_cast<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 = (static_cast<float>(aOutSize.Height()) * float(4)) / float(7); - if (aImageSize.Width() != 0) + const float fImageHeight = (static_cast<float>(aOutSize.Height()) * float(4)) / float(7); + if (aImageSize.Width() != 0) + { + const float fImageRatio = static_cast<float>(aImageSize.Height()) / static_cast<float>(aImageSize.Width()); + aImageSize.setWidth( static_cast<long>( fImageRatio * fImageHeight ) ); + } + aImageSize.setHeight( static_cast<long>(fImageHeight) ); + + Point aImagePos( pInfo->mrStartPos ); + aImagePos.AdjustX(aOutSize.Width() - aImageSize.Width() - aOffset.Width() ) ; + aImagePos.AdjustY((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.SetFontSize( 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.setWidth( pInfo->mpOutDev->GetTextWidth( aPageText ) ); + aTextSz.setHeight( pInfo->mpOutDev->GetTextHeight() ); + if ( !bVertical ) + { + aTextPos.AdjustY((aOutSize.Height() - aTextSz.Height()) / 2 ); + if ( !bRightToLeftPara ) { - const float fImageRatio = static_cast<float>(aImageSize.Height()) / static_cast<float>(aImageSize.Width()); - aImageSize.setWidth( static_cast<long>( fImageRatio * fImageHeight ) ); - } - aImageSize.setHeight( static_cast<long>(fImageHeight) ); - - Point aImagePos( pInfo->mrStartPos ); - aImagePos.AdjustX(aOutSize.Width() - aImageSize.Width() - aOffset.Width() ) ; - aImagePos.AdjustY((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.SetFontSize( 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.setWidth( pInfo->mpOutDev->GetTextWidth( aPageText ) ); - aTextSz.setHeight( pInfo->mpOutDev->GetTextHeight() ); - if ( !bVertical ) - { - aTextPos.AdjustY((aOutSize.Height() - aTextSz.Height()) / 2 ); - if ( !bRightToLeftPara ) - { - aTextPos.AdjustX( -(aTextSz.Width()) ); - } - else - { - aTextPos.AdjustX(aTextSz.Width() ); - } + aTextPos.AdjustX( -(aTextSz.Width()) ); } else { - aTextPos.AdjustY( -(aTextSz.Width()) ); - aTextPos.AdjustX(nBulletHeight / 2 ); + aTextPos.AdjustX(aTextSz.Width() ); } - pInfo->mpOutDev->DrawText( aTextPos, aPageText ); } + else + { + aTextPos.AdjustY( -(aTextSz.Width()) ); + aTextPos.AdjustX(nBulletHeight / 2 ); + } + pInfo->mpOutDev->DrawText( aTextPos, aPageText ); } void OutlineView::UpdateParagraph( sal_Int32 nPara ) diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 6c80320db1b1..088311eb4634 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -458,35 +458,35 @@ drawinglayer::primitive2d::Primitive2DContainer ViewRedirector::createRedirected void View::CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0*/) { // execute ?? - if (mnLockRedrawSmph == 0) - { - SdrPageView* pPgView = GetSdrPageView(); + if (mnLockRedrawSmph != 0) + return; + + SdrPageView* pPgView = GetSdrPageView(); - if (pPgView) + if (pPgView) + { + SdPage* pPage = static_cast<SdPage*>( pPgView->GetPage() ); + if( pPage ) { - SdPage* pPage = static_cast<SdPage*>( pPgView->GetPage() ); - if( pPage ) - { - SdrOutliner& rOutl = mrDoc.GetDrawOutliner(); - bool bScreenDisplay(true); - - // #i75566# printing; suppress AutoColor BackgroundColor generation - // for visibility reasons by giving GetPageBackgroundColor() - // the needed hint - // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see printing) - if (pOutDev && ((OUTDEV_PRINTER == pOutDev->GetOutDevType()) - || (OUTDEV_PDF == pOutDev->GetOutDevType()))) - bScreenDisplay = false; - - // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and - // hint value if screen display. Only then the AutoColor mechanisms shall be applied - rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pPgView, bScreenDisplay) ); - } + SdrOutliner& rOutl = mrDoc.GetDrawOutliner(); + bool bScreenDisplay(true); + + // #i75566# printing; suppress AutoColor BackgroundColor generation + // for visibility reasons by giving GetPageBackgroundColor() + // the needed hint + // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see printing) + if (pOutDev && ((OUTDEV_PRINTER == pOutDev->GetOutDevType()) + || (OUTDEV_PDF == pOutDev->GetOutDevType()))) + bScreenDisplay = false; + + // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and + // hint value if screen display. Only then the AutoColor mechanisms shall be applied + rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pPgView, bScreenDisplay) ); } - - ViewRedirector aViewRedirector; - FmFormView::CompleteRedraw(pOutDev, rReg, pRedirector ? pRedirector : &aViewRedirector); } + + ViewRedirector aViewRedirector; + FmFormView::CompleteRedraw(pOutDev, rReg, pRedirector ? pRedirector : &aViewRedirector); } void View::MarkListHasChanged() @@ -911,37 +911,37 @@ void View::SetMarkedOriginalSize() */ void View::DoConnect(SdrOle2Obj* pObj) { - if (mpViewSh) + if (!mpViewSh) + return; + + uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() ); + if( !xObj.is() ) + return; + + ::sd::Window* pWindow = mpViewSh->GetActiveWindow(); + SfxInPlaceClient* pSdClient = mpViewSh-> GetViewShellBase().FindIPClient( xObj, pWindow ); + if ( pSdClient ) + return; + + pSdClient = new Client(pObj, mpViewSh, pWindow); + ::tools::Rectangle aRect = pObj->GetLogicRect(); { - uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() ); - if( xObj.is() ) - { - ::sd::Window* pWindow = mpViewSh->GetActiveWindow(); - SfxInPlaceClient* pSdClient = mpViewSh-> GetViewShellBase().FindIPClient( xObj, pWindow ); - if ( !pSdClient ) - { - pSdClient = new Client(pObj, mpViewSh, pWindow); - ::tools::Rectangle aRect = pObj->GetLogicRect(); - { - // TODO/LEAN: working with visual area can switch object to running state - Size aDrawSize = aRect.GetSize(); - - MapMode aMapMode( mrDoc.GetScaleUnit() ); - Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode ); - - Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() ); - Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() ); - aScaleWidth.ReduceInaccurate(10); // compatible to SdrOle2Obj - aScaleHeight.ReduceInaccurate(10); - pSdClient->SetSizeScale(aScaleWidth, aScaleHeight); - - // visible area is only changed in-place! - // the object area must be set after the scaling, since it triggers resize - aRect.SetSize(aObjAreaSize); - pSdClient->SetObjArea(aRect); - } - } - } + // TODO/LEAN: working with visual area can switch object to running state + Size aDrawSize = aRect.GetSize(); + + MapMode aMapMode( mrDoc.GetScaleUnit() ); + Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode ); + + Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() ); + Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() ); + aScaleWidth.ReduceInaccurate(10); // compatible to SdrOle2Obj + aScaleHeight.ReduceInaccurate(10); + pSdClient->SetSizeScale(aScaleWidth, aScaleHeight); + + // visible area is only changed in-place! + // the object area must be set after the scaling, since it triggers resize + aRect.SetSize(aObjAreaSize); + pSdClient->SetObjArea(aRect); } } @@ -1014,44 +1014,44 @@ bool View::IsVectorizeAllowed() const void View::onAccessibilityOptionsChanged() { - if( mpViewSh ) - { - ::sd::Window* pWindow = mpViewSh->GetActiveWindow(); - if( pWindow ) - { - const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings(); + if( !mpViewSh ) + return; - sal_uInt16 nOutputSlot, nPreviewSlot; + ::sd::Window* pWindow = mpViewSh->GetActiveWindow(); + if( !pWindow ) + return; - SvtAccessibilityOptions& aAccOptions = getAccessibilityOptions(); + const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings(); - if( mpViewSh->GetViewFrame() && mpViewSh->GetViewFrame()->GetDispatcher() ) - { - if( rStyleSettings.GetHighContrastMode() ) - { - nOutputSlot = SID_OUTPUT_QUALITY_CONTRAST; - } - else - { - nOutputSlot = SID_OUTPUT_QUALITY_COLOR; - } + sal_uInt16 nOutputSlot, nPreviewSlot; - if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() ) - { - nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST; - } - else - { - nPreviewSlot = SID_PREVIEW_QUALITY_COLOR; - } + SvtAccessibilityOptions& aAccOptions = getAccessibilityOptions(); - mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nOutputSlot, SfxCallMode::ASYNCHRON ); - mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nPreviewSlot, SfxCallMode::ASYNCHRON ); - } + if( mpViewSh->GetViewFrame() && mpViewSh->GetViewFrame()->GetDispatcher() ) + { + if( rStyleSettings.GetHighContrastMode() ) + { + nOutputSlot = SID_OUTPUT_QUALITY_CONTRAST; + } + else + { + nOutputSlot = SID_OUTPUT_QUALITY_COLOR; + } - mpViewSh->Invalidate(); + if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() ) + { + nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST; + } + else + { + nPreviewSlot = SID_PREVIEW_QUALITY_COLOR; } + + mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nOutputSlot, SfxCallMode::ASYNCHRON ); + mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nPreviewSlot, SfxCallMode::ASYNCHRON ); } + + mpViewSh->Invalidate(); } IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, aParam, void ) diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 8b7975bfabf6..fafe96ebb842 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -338,33 +338,33 @@ void View::DoPaste (::sd::Window* pWindow) void View::StartDrag( const Point& rStartPos, vcl::Window* pWindow ) { - if( AreObjectsMarked() && IsAction() && mpViewSh && pWindow && !mpDragSrcMarkList ) - { - BrkAction(); + if( !AreObjectsMarked() || !IsAction() || !mpViewSh || !pWindow || mpDragSrcMarkList ) + return; - if( IsTextEdit() ) - SdrEndTextEdit(); + BrkAction(); - DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpDocSh ? mpDocSh->GetViewShell() : nullptr ); + if( IsTextEdit() ) + SdrEndTextEdit(); - if( pDrawViewShell ) - { - const rtl::Reference<FuPoor>& xFunction( pDrawViewShell->GetCurrentFunction() ); + DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpDocSh ? mpDocSh->GetViewShell() : nullptr ); - if( xFunction.is() && nullptr != dynamic_cast< const FuDraw *>( xFunction.get() ) ) - static_cast<FuDraw*>(xFunction.get())->ForcePointer(); - } + if( pDrawViewShell ) + { + const rtl::Reference<FuPoor>& xFunction( pDrawViewShell->GetCurrentFunction() ); - mpDragSrcMarkList.reset( new SdrMarkList(GetMarkedObjectList()) ); - mnDragSrcPgNum = GetSdrPageView()->GetPage()->GetPageNum(); + if( xFunction.is() && nullptr != dynamic_cast< const FuDraw *>( xFunction.get() ) ) + static_cast<FuDraw*>(xFunction.get())->ForcePointer(); + } - if( IsUndoEnabled() ) - { - OUString aStr(SdResId(STR_UNDO_DRAGDROP)); - BegUndo(aStr + " " + mpDragSrcMarkList->GetMarkDescription()); - } - CreateDragDataObject( this, *pWindow, rStartPos ); + mpDragSrcMarkList.reset( new SdrMarkList(GetMarkedObjectList()) ); + mnDragSrcPgNum = GetSdrPageView()->GetPage()->GetPageNum(); + + if( IsUndoEnabled() ) + { + OUString aStr(SdResId(STR_UNDO_DRAGDROP)); + BegUndo(aStr + " " + mpDragSrcMarkList->GetMarkDescription()); } + CreateDragDataObject( this, *pWindow, rStartPos ); } void View::DragFinished( sal_Int8 nDropAction ) diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 3c96e5abd9a8..e392b69fa23f 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -117,32 +117,32 @@ static SdrObject* ImpGetClone(std::vector<ImpRememberOrigAndClone>& aConnectorCo // restrict movement to WorkArea static void ImpCheckInsertPos(Point& rPos, const Size& rSize, const ::tools::Rectangle& rWorkArea) { - if(!rWorkArea.IsEmpty()) - { - ::tools::Rectangle aMarkRect(Point(rPos.X() - (rSize.Width() / 2), rPos.Y() - (rSize.Height() / 2)), rSize); + if(rWorkArea.IsEmpty()) + return; - if(!aMarkRect.IsInside(rWorkArea)) - { - if(aMarkRect.Left() < rWorkArea.Left()) - { - rPos.AdjustX(rWorkArea.Left() - aMarkRect.Left() ); - } + ::tools::Rectangle aMarkRect(Point(rPos.X() - (rSize.Width() / 2), rPos.Y() - (rSize.Height() / 2)), rSize); - if(aMarkRect.Right() > rWorkArea.Right()) - { - rPos.AdjustX( -(aMarkRect.Right() - rWorkArea.Right()) ); - } + if(aMarkRect.IsInside(rWorkArea)) + return; - if(aMarkRect.Top() < rWorkArea.Top()) - { - rPos.AdjustY(rWorkArea.Top() - aMarkRect.Top() ); - } + if(aMarkRect.Left() < rWorkArea.Left()) + { + rPos.AdjustX(rWorkArea.Left() - aMarkRect.Left() ); + } - if(aMarkRect.Bottom() > rWorkArea.Bottom()) - { - rPos.AdjustY( -(aMarkRect.Bottom() - rWorkArea.Bottom()) ); - } - } + if(aMarkRect.Right() > rWorkArea.Right()) + { + rPos.AdjustX( -(aMarkRect.Right() - rWorkArea.Right()) ); + } + + if(aMarkRect.Top() < rWorkArea.Top()) + { + rPos.AdjustY(rWorkArea.Top() - aMarkRect.Top() ); + } + + if(aMarkRect.Bottom() > rWorkArea.Bottom()) + { + rPos.AdjustY( -(aMarkRect.Bottom() - rWorkArea.Bottom()) ); } } diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 227291d4de41..2dcc85ded9fe 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -139,34 +139,34 @@ ViewShell* Window::GetViewShell() void Window::CalcMinZoom() { // Are we entitled to change the minimal zoom factor? - if ( mbMinZoomAutoCalc ) - { - // Get current zoom factor. - long nZoom = GetZoom(); + if ( !mbMinZoomAutoCalc ) + return; - // Get the rectangle of the output area in logical coordinates - // and calculate the scaling factors that would lead to the view - // area (also called application area) to completely fill the - // window. - Size aWinSize = PixelToLogic(GetOutputSizePixel()); - sal_uLong nX = static_cast<sal_uLong>(static_cast<double>(aWinSize.Width()) - * double(ZOOM_MULTIPLICATOR) / static_cast<double>(maViewSize.Width())); - sal_uLong nY = static_cast<sal_uLong>(static_cast<double>(aWinSize.Height()) - * double(ZOOM_MULTIPLICATOR) / static_cast<double>(maViewSize.Height())); + // Get current zoom factor. + long nZoom = GetZoom(); - // Decide whether to take the larger or the smaller factor. - sal_uLong nFact = std::min(nX, nY); + // Get the rectangle of the output area in logical coordinates + // and calculate the scaling factors that would lead to the view + // area (also called application area) to completely fill the + // window. + Size aWinSize = PixelToLogic(GetOutputSizePixel()); + sal_uLong nX = static_cast<sal_uLong>(static_cast<double>(aWinSize.Width()) + * double(ZOOM_MULTIPLICATOR) / static_cast<double>(maViewSize.Width())); + sal_uLong nY = static_cast<sal_uLong>(static_cast<double>(aWinSize.Height()) + * double(ZOOM_MULTIPLICATOR) / static_cast<double>(maViewSize.Height())); - // The factor is transformed according to the current zoom factor. - nFact = nFact * nZoom / ZOOM_MULTIPLICATOR; - mnMinZoom = std::max(sal_uInt16(MIN_ZOOM), static_cast<sal_uInt16>(nFact)); + // Decide whether to take the larger or the smaller factor. + sal_uLong nFact = std::min(nX, nY); - // If the current zoom factor is smaller than the calculated minimal - // zoom factor then set the new minimal factor as the current zoom - // factor. - if ( nZoom < static_cast<long>(mnMinZoom) ) - SetZoomFactor(mnMinZoom); - } + // The factor is transformed according to the current zoom factor. + nFact = nFact * nZoom / ZOOM_MULTIPLICATOR; + mnMinZoom = std::max(sal_uInt16(MIN_ZOOM), static_cast<sal_uInt16>(nFact)); + + // If the current zoom factor is smaller than the calculated minimal + // zoom factor then set the new minimal factor as the current zoom + // factor. + if ( nZoom < static_cast<long>(mnMinZoom) ) + SetZoomFactor(mnMinZoom); } void Window::SetMinZoom (long int nMin) @@ -747,123 +747,123 @@ void Window::DataChanged( const DataChangedEvent& rDCEvt ) Omit FONTS and FONTSUBSTITUTION if no text output is available or if the document does not allow text. */ - if ( (rDCEvt.GetType() == DataChangedEventType::PRINTER) || + if ( !((rDCEvt.GetType() == DataChangedEventType::PRINTER) || (rDCEvt.GetType() == DataChangedEventType::DISPLAY) || (rDCEvt.GetType() == DataChangedEventType::FONTS) || (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) || ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && - (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) + (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))) ) + return; + + if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && + (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && - (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) + /* Rearrange or initiate Resize for scroll bars since the size of + the scroll bars my have changed. Within this, inside the resize- + handler, the size of the scroll bars will be asked from the + Settings. */ + Resize(); + + /* Re-set data, which are from system control or from Settings. May + have to re-set more data since the resolution may also has + changed. */ + if( mpViewShell ) { - /* Rearrange or initiate Resize for scroll bars since the size of - the scroll bars my have changed. Within this, inside the resize- - handler, the size of the scroll bars will be asked from the - Settings. */ - Resize(); - - /* Re-set data, which are from system control or from Settings. May - have to re-set more data since the resolution may also has - changed. */ - if( mpViewShell ) + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + SvtAccessibilityOptions aAccOptions; + DrawModeFlags nOutputMode; + sal_uInt16 nPreviewSlot; + + if( rStyleSettings.GetHighContrastMode() ) + nOutputMode = sd::OUTPUT_DRAWMODE_CONTRAST; + else + nOutputMode = sd::OUTPUT_DRAWMODE_COLOR; + + if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() ) + nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST; + else + nPreviewSlot = SID_PREVIEW_QUALITY_COLOR; + + if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SvtAccessibilityOptions aAccOptions; - DrawModeFlags nOutputMode; - sal_uInt16 nPreviewSlot; - - if( rStyleSettings.GetHighContrastMode() ) - nOutputMode = sd::OUTPUT_DRAWMODE_CONTRAST; - else - nOutputMode = sd::OUTPUT_DRAWMODE_COLOR; - - if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() ) - nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST; - else - nPreviewSlot = SID_PREVIEW_QUALITY_COLOR; - - if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) - { - SetDrawMode( nOutputMode ); - mpViewShell->GetFrameView()->SetDrawMode( nOutputMode ); - Invalidate(); - } - - // Overwrite window color for OutlineView - if( dynamic_cast< OutlineViewShell *>( mpViewShell ) != nullptr ) - { - svtools::ColorConfig aColorConfig; - const Color aDocColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor ); - SetBackground( Wallpaper( aDocColor ) ); - } - - SfxRequest aReq( nPreviewSlot, SfxCallMode::SLOT, mpViewShell->GetDocSh()->GetDoc()->GetItemPool() ); - mpViewShell->ExecReq( aReq ); - mpViewShell->Invalidate(); - mpViewShell->ArrangeGUIElements(); - - // re-create handles to show new outfit - if(dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr) - { - mpViewShell->GetView()->AdjustMarkHdl(); - } + SetDrawMode( nOutputMode ); + mpViewShell->GetFrameView()->SetDrawMode( nOutputMode ); + Invalidate(); } - } - if ( (rDCEvt.GetType() == DataChangedEventType::DISPLAY) || - ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && - (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) - { - /* Virtual devices, which also depends on the resolution or the - system control, should be updated. Otherwise, we should update - the virtual devices at least at DataChangedEventType::DISPLAY since some - systems allow to change the resolution and color depth during - runtime. Or the virtual devices have to be updated when the color - palette has changed since a different color matching can be used - when outputting. */ - } + // Overwrite window color for OutlineView + if( dynamic_cast< OutlineViewShell *>( mpViewShell ) != nullptr ) + { + svtools::ColorConfig aColorConfig; + const Color aDocColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor ); + SetBackground( Wallpaper( aDocColor ) ); + } - if ( rDCEvt.GetType() == DataChangedEventType::FONTS ) - { - /* If the document provides font choose boxes, we have to update - them. I don't know how this looks like (also not really me, I - only translated the comment ;). We may can handle it global. We - have to discuss it with PB, but he is ill at the moment. - Before we handle it here, discuss it with PB and me. */ - } + SfxRequest aReq( nPreviewSlot, SfxCallMode::SLOT, mpViewShell->GetDocSh()->GetDoc()->GetItemPool() ); + mpViewShell->ExecReq( aReq ); + mpViewShell->Invalidate(); + mpViewShell->ArrangeGUIElements(); - if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) || - (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ) - { - /* Do reformatting since the fonts of the document may no longer - exist, or exist now, or are replaced with others. */ - if( mpViewShell ) + // re-create handles to show new outfit + if(dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr) { - DrawDocShell* pDocSh = mpViewShell->GetDocSh(); - if( pDocSh ) - pDocSh->SetPrinter( pDocSh->GetPrinter( true ) ); + mpViewShell->GetView()->AdjustMarkHdl(); } } + } + + if ( (rDCEvt.GetType() == DataChangedEventType::DISPLAY) || + ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && + (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) + { + /* Virtual devices, which also depends on the resolution or the + system control, should be updated. Otherwise, we should update + the virtual devices at least at DataChangedEventType::DISPLAY since some + systems allow to change the resolution and color depth during + runtime. Or the virtual devices have to be updated when the color + palette has changed since a different color matching can be used + when outputting. */ + } + + if ( rDCEvt.GetType() == DataChangedEventType::FONTS ) + { + /* If the document provides font choose boxes, we have to update + them. I don't know how this looks like (also not really me, I + only translated the comment ;). We may can handle it global. We + have to discuss it with PB, but he is ill at the moment. + Before we handle it here, discuss it with PB and me. */ + } - if ( rDCEvt.GetType() == DataChangedEventType::PRINTER ) + if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) || + (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ) + { + /* Do reformatting since the fonts of the document may no longer + exist, or exist now, or are replaced with others. */ + if( mpViewShell ) { - /* I don't know how the handling should look like. Maybe we delete a - printer and look what we have to do. Maybe I have to add - something to the VCL, in case the used printer is deleted. - Otherwise I may recalculate the formatting here if the current - printer is destroyed. */ - if( mpViewShell ) - { - DrawDocShell* pDocSh = mpViewShell->GetDocSh(); - if( pDocSh ) - pDocSh->SetPrinter( pDocSh->GetPrinter( true ) ); - } + DrawDocShell* pDocSh = mpViewShell->GetDocSh(); + if( pDocSh ) + pDocSh->SetPrinter( pDocSh->GetPrinter( true ) ); } + } - // Update everything - Invalidate(); + if ( rDCEvt.GetType() == DataChangedEventType::PRINTER ) + { + /* I don't know how the handling should look like. Maybe we delete a + printer and look what we have to do. Maybe I have to add + something to the VCL, in case the used printer is deleted. + Otherwise I may recalculate the formatting here if the current + printer is destroyed. */ + if( mpViewShell ) + { + DrawDocShell* pDocSh = mpViewShell->GetDocSh(); + if( pDocSh ) + pDocSh->SetPrinter( pDocSh->GetPrinter( true ) ); + } } + + // Update everything + Invalidate(); } sal_Int8 Window::AcceptDrop( const AcceptDropEvent& rEvt ) diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index 0a23a60119cc..6cc9e6bf48d9 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -210,29 +210,29 @@ void ImageButtonHdl::onHelpRequest(const HelpEvent& /*rHEvt*/) void ImageButtonHdl::onMouseEnter(const MouseEvent& rMEvt) { - if( pHdlList && pHdlList->GetView()) - { - int nHighlightId = 0; - OutputDevice* pDev = pHdlList->GetView()->GetFirstOutputDevice(); - if( pDev == nullptr ) - pDev = Application::GetDefaultDevice(); + if( !(pHdlList && pHdlList->GetView())) + return; - Point aMDPos( rMEvt.GetPosPixel() ); - aMDPos -= pDev->LogicToPixel( GetPos() ); + int nHighlightId = 0; + OutputDevice* pDev = pHdlList->GetView()->GetFirstOutputDevice(); + if( pDev == nullptr ) + pDev = Application::GetDefaultDevice(); - nHighlightId += aMDPos.X() > maImageSize.Width() ? 1 : 0; - nHighlightId += aMDPos.Y() > maImageSize.Height() ? 2 : 0; + Point aMDPos( rMEvt.GetPosPixel() ); + aMDPos -= pDev->LogicToPixel( GetPos() ); - if( mnHighlightId != nHighlightId ) - { - HideTip(); + nHighlightId += aMDPos.X() > maImageSize.Width() ? 1 : 0; + nHighlightId += aMDPos.Y() > maImageSize.Height() ? 2 : 0; - mnHighlightId = nHighlightId; + if( mnHighlightId != nHighlightId ) + { + HideTip(); - ShowTip(); + mnHighlightId = nHighlightId; - Touch(); - } + ShowTip(); + + Touch(); } } @@ -256,35 +256,35 @@ void ImageButtonHdl::CreateB2dIAObject() maImageSize.setWidth( maImageSize.Width() >> 1 ); maImageSize.setHeight( maImageSize.Height() >> 1 ); - if(pHdlList) + if(!pHdlList) + return; + + SdrMarkView* pView = pHdlList->GetView(); + + if(!(pView && !pView->areMarkHandlesHidden())) + return; + + SdrPageView* pPageView = pView->GetSdrPageView(); + + if(!pPageView) + return; + + for(sal_uInt32 b = 0; b < pPageView->PageWindowCount(); b++) { - SdrMarkView* pView = pHdlList->GetView(); + const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b); - if(pView && !pView->areMarkHandlesHidden()) + SdrPaintWindow& rPaintWindow = rPageWindow.GetPaintWindow(); + const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager(); + if(rPaintWindow.OutputToWindow() && xManager.is() ) { - SdrPageView* pPageView = pView->GetSdrPageView(); - - if(pPageView) - { - for(sal_uInt32 b = 0; b < pPageView->PageWindowCount(); b++) - { - const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b); - - SdrPaintWindow& rPaintWindow = rPageWindow.GetPaintWindow(); - const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager(); - if(rPaintWindow.OutputToWindow() && xManager.is() ) - { - std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject( - new sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 )); - - // OVERLAYMANAGER - insertNewlyCreatedOverlayObjectForSdrHdl( - std::move(pOverlayObject), - rPageWindow.GetObjectContact(), - *xManager); - } - } - } + std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject( + new sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 )); + + // OVERLAYMANAGER + insertNewlyCreatedOverlayObjectForSdrHdl( + std::move(pOverlayObject), + rPageWindow.GetObjectContact(), + *xManager); } } } @@ -390,44 +390,44 @@ BitmapEx ChangePlaceholderTag::createOverlayImage( int nHighlight ) void ChangePlaceholderTag::addCustomHandles( SdrHdlList& rHandlerList ) { - if( mxPlaceholderObj.is() ) - { - SdrObject* pPlaceholder = mxPlaceholderObj.get(); - SmartTagReference xThis( this ); - const ::tools::Rectangle& rSnapRect = pPlaceholder->GetSnapRect(); - const Point aPoint; + if( !mxPlaceholderObj.is() ) + return; - OutputDevice* pDev = mrView.GetFirstOutputDevice(); - if( pDev == nullptr ) - pDev = Application::GetDefaultDevice(); + SdrObject* pPlaceholder = mxPlaceholderObj.get(); + SmartTagReference xThis( this ); + const ::tools::Rectangle& rSnapRect = pPlaceholder->GetSnapRect(); + const Point aPoint; - Size aShapeSizePix = pDev->LogicToPixel(rSnapRect.GetSize()); - long nShapeSizePix = std::min(aShapeSizePix.Width(),aShapeSizePix.Height()); - if( 50 > nShapeSizePix ) - return; + OutputDevice* pDev = mrView.GetFirstOutputDevice(); + if( pDev == nullptr ) + pDev = Application::GetDefaultDevice(); - bool bLarge = nShapeSizePix > 250; + Size aShapeSizePix = pDev->LogicToPixel(rSnapRect.GetSize()); + long nShapeSizePix = std::min(aShapeSizePix.Width(),aShapeSizePix.Height()); + if( 50 > nShapeSizePix ) + return; - Size aButtonSize( pDev->PixelToLogic( getButtonImage(0, bLarge )->GetSizePixel()) ); + bool bLarge = nShapeSizePix > 250; - const int nColumns = 2; - const int nRows = 2; + Size aButtonSize( pDev->PixelToLogic( getButtonImage(0, bLarge )->GetSizePixel()) ); - long all_width = nColumns * aButtonSize.Width(); - long all_height = nRows * aButtonSize.Height(); + const int nColumns = 2; + const int nRows = 2; - Point aPos( rSnapRect.Center() ); - aPos.AdjustX( -(all_width >> 1) ); - aPos.AdjustY( -(all_height >> 1) ); + long all_width = nColumns * aButtonSize.Width(); + long all_height = nRows * aButtonSize.Height(); - std::unique_ptr<ImageButtonHdl> pHdl(new ImageButtonHdl( xThis, aPoint )); - pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM ); - pHdl->SetPageView( mrView.GetSdrPageView() ); + Point aPos( rSnapRect.Center() ); + aPos.AdjustX( -(all_width >> 1) ); + aPos.AdjustY( -(all_height >> 1) ); - pHdl->SetPos( aPos ); + std::unique_ptr<ImageButtonHdl> pHdl(new ImageButtonHdl( xThis, aPoint )); + pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM ); + pHdl->SetPageView( mrView.GetSdrPageView() ); - rHandlerList.AddHdl( std::move(pHdl) ); - } + pHdl->SetPos( aPos ); + + rHandlerList.AddHdl( std::move(pHdl) ); } ViewOverlayManager::ViewOverlayManager( ViewShellBase& rViewShellBase ) diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index bed0ee921646..7c44ab0e99d3 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -146,43 +146,42 @@ void ViewShell::VirtHScrollHdl(ScrollBar* pHScroll) { long nDelta = pHScroll->GetDelta(); - if (nDelta != 0) - { - double fX = static_cast<double>(pHScroll->GetThumbPos()) / pHScroll->GetRange().Len(); + if (nDelta == 0) + return; - // scroll all windows of the column - ::sd::View* pView = GetView(); - OutlinerView* pOLV = nullptr; + double fX = static_cast<double>(pHScroll->GetThumbPos()) / pHScroll->GetRange().Len(); - if (pView) - pOLV = pView->GetTextEditOutlinerView(); + // scroll all windows of the column + ::sd::View* pView = GetView(); + OutlinerView* pOLV = nullptr; - if (pOLV) - pOLV->HideCursor(); + if (pView) + pOLV = pView->GetTextEditOutlinerView(); - mpContentWindow->SetVisibleXY(fX, -1); + if (pOLV) + pOLV->HideCursor(); - ::tools::Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT); - Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) ); - aVisArea.SetPos(aVisAreaPos); - GetDocSh()->SetVisArea(aVisArea); + mpContentWindow->SetVisibleXY(fX, -1); - Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel(); - ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), aVisSizePixel) ); - VisAreaChanged(aVisAreaWin); + ::tools::Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT); + Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) ); + aVisArea.SetPos(aVisAreaPos); + GetDocSh()->SetVisArea(aVisArea); - if (pView) - { - pView->VisAreaChanged(GetActiveWindow()); - } + Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel(); + ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), aVisSizePixel) ); + VisAreaChanged(aVisAreaWin); - if (pOLV) - pOLV->ShowCursor(); + if (pView) + { + pView->VisAreaChanged(GetActiveWindow()); + } - if (mbHasRulers) - UpdateHRuler(); + if (pOLV) + pOLV->ShowCursor(); - } + if (mbHasRulers) + UpdateHRuler(); } /** diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx index 73edd5dc7bc8..e3b2284c702a 100644 --- a/sd/source/ui/view/viewshe3.cxx +++ b/sd/source/ui/view/viewshe3.cxx @@ -151,33 +151,33 @@ void ViewShell::GetMenuState( SfxItemSet &rSet ) } } - if(SfxItemState::DEFAULT == rSet.GetItemState(SID_REDO)) + if(SfxItemState::DEFAULT != rSet.GetItemState(SID_REDO)) + return; + + SfxUndoManager* pUndoManager = ImpGetUndoManager(); + if(!pUndoManager) + return; + + if(pUndoManager->GetRedoActionCount() != 0) { - SfxUndoManager* pUndoManager = ImpGetUndoManager(); - if(pUndoManager) + // If another view created the first undo action, prevent redoing it from this view. + const SfxUndoAction* pAction = pUndoManager->GetRedoAction(); + if (pAction->GetViewShellId() != GetViewShellBase().GetViewShellId()) { - if(pUndoManager->GetRedoActionCount() != 0) - { - // If another view created the first undo action, prevent redoing it from this view. - const SfxUndoAction* pAction = pUndoManager->GetRedoAction(); - if (pAction->GetViewShellId() != GetViewShellBase().GetViewShellId()) - { - rSet.Put(SfxUInt32Item(SID_REDO, static_cast<sal_uInt32>(SID_REPAIRPACKAGE))); - } - else - { - // Set the necessary string like in - // sfx2/source/view/viewfrm.cxx ver 1.23 ln 1081 ff. - OUString aTmp(SvtResId(STR_REDO)); - aTmp += pUndoManager->GetRedoActionComment(); - rSet.Put(SfxStringItem(SID_REDO, aTmp)); - } - } - else - { - rSet.DisableItem(SID_REDO); - } + rSet.Put(SfxUInt32Item(SID_REDO, static_cast<sal_uInt32>(SID_REPAIRPACKAGE))); } + else + { + // Set the necessary string like in + // sfx2/source/view/viewfrm.cxx ver 1.23 ln 1081 ff. + OUString aTmp(SvtResId(STR_REDO)); + aTmp += pUndoManager->GetRedoActionComment(); + rSet.Put(SfxStringItem(SID_REDO, aTmp)); + } + } + else + { + rSet.DisableItem(SID_REDO); } } diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 66ae776d158f..c0fb2aa674a6 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -485,22 +485,22 @@ void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin) if( GetView() ) bConsumed = GetView()->getSmartTags().MouseButtonDown( rMEvt ); - if( !bConsumed ) + if( bConsumed ) + return; + + rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() ); + if( !xSelectionController.is() || !xSelectionController->onMouseButtonDown( rMEvt, pWin ) ) { - rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() ); - if( !xSelectionController.is() || !xSelectionController->onMouseButtonDown( rMEvt, pWin ) ) - { - if(HasCurrentFunction()) - GetCurrentFunction()->MouseButtonDown(rMEvt); - } - else + if(HasCurrentFunction()) + GetCurrentFunction()->MouseButtonDown(rMEvt); + } + else + { + if (HasCurrentFunction()) { - if (HasCurrentFunction()) - { - FuText* pTextFunction = dynamic_cast<FuText*>(GetCurrentFunction().get()); - if (pTextFunction != nullptr) - pTextFunction->InvalidateBindings(); - } + FuText* pTextFunction = dynamic_cast<FuText*>(GetCurrentFunction().get()); + if (pTextFunction != nullptr) + pTextFunction->InvalidateBindings(); } } } @@ -671,23 +671,23 @@ void ViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) { bool bDone = HandleScrollCommand (rCEvt, pWin); - if( !bDone ) + if( bDone ) + return; + + if( rCEvt.GetCommand() == CommandEventId::InputLanguageChange ) { - if( rCEvt.GetCommand() == CommandEventId::InputLanguageChange ) - { - //#i42732# update state of fontname if input language changes - GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONT ); - GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); - } - else - { - bool bConsumed = false; - if( GetView() ) - bConsumed = GetView()->getSmartTags().Command(rCEvt); + //#i42732# update state of fontname if input language changes + GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONT ); + GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + } + else + { + bool bConsumed = false; + if( GetView() ) + bConsumed = GetView()->getSmartTags().Command(rCEvt); - if( !bConsumed && HasCurrentFunction()) - GetCurrentFunction()->Command(rCEvt); - } + if( !bConsumed && HasCurrentFunction()) + GetCurrentFunction()->Command(rCEvt); } } @@ -810,29 +810,29 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi void ViewShell::SetupRulers() { - if(mbHasRulers && (mpContentWindow.get() != nullptr) && !SlideShow::IsRunning(GetViewShellBase())) - { - long nHRulerOfs = 0; + if(!(mbHasRulers && (mpContentWindow.get() != nullptr) && !SlideShow::IsRunning(GetViewShellBase()))) + return; + + long nHRulerOfs = 0; - if ( mpVerticalRuler.get() == nullptr ) + if ( mpVerticalRuler.get() == nullptr ) + { + mpVerticalRuler.reset(CreateVRuler(GetActiveWindow())); + if ( mpVerticalRuler.get() != nullptr ) { - mpVerticalRuler.reset(CreateVRuler(GetActiveWindow())); - if ( mpVerticalRuler.get() != nullptr ) - { - nHRulerOfs = mpVerticalRuler->GetSizePixel().Width(); - mpVerticalRuler->SetActive(); - mpVerticalRuler->Show(); - } + nHRulerOfs = mpVerticalRuler->GetSizePixel().Width(); + mpVerticalRuler->SetActive(); + mpVerticalRuler->Show(); } - if ( mpHorizontalRuler.get() == nullptr ) + } + if ( mpHorizontalRuler.get() == nullptr ) + { + mpHorizontalRuler.reset(CreateHRuler(GetActiveWindow())); + if ( mpHorizontalRuler.get() != nullptr ) { - mpHorizontalRuler.reset(CreateHRuler(GetActiveWindow())); - if ( mpHorizontalRuler.get() != nullptr ) - { - mpHorizontalRuler->SetWinPos(nHRulerOfs); - mpHorizontalRuler->SetActive(); - mpHorizontalRuler->Show(); - } + mpHorizontalRuler->SetWinPos(nHRulerOfs); + mpHorizontalRuler->SetActive(); + mpHorizontalRuler->Show(); } } } @@ -1154,52 +1154,52 @@ SfxUndoManager* ViewShell::ImpGetUndoManager() const void ViewShell::ImpGetUndoStrings(SfxItemSet &rSet) const { SfxUndoManager* pUndoManager = ImpGetUndoManager(); - if(pUndoManager) - { - sal_uInt16 nCount(pUndoManager->GetUndoActionCount()); - if(nCount) - { - // prepare list - std::vector<OUString> aStringList; - aStringList.reserve(nCount); - for (sal_uInt16 a = 0; a < nCount; ++a) - { - // generate one String in list per undo step - aStringList.push_back( pUndoManager->GetUndoActionComment(a) ); - } + if(!pUndoManager) + return; - // set item - rSet.Put(SfxStringListItem(SID_GETUNDOSTRINGS, &aStringList)); - } - else + sal_uInt16 nCount(pUndoManager->GetUndoActionCount()); + if(nCount) + { + // prepare list + std::vector<OUString> aStringList; + aStringList.reserve(nCount); + for (sal_uInt16 a = 0; a < nCount; ++a) { - rSet.DisableItem(SID_GETUNDOSTRINGS); + // generate one String in list per undo step + aStringList.push_back( pUndoManager->GetUndoActionComment(a) ); } + + // set item + rSet.Put(SfxStringListItem(SID_GETUNDOSTRINGS, &aStringList)); + } + else + { + rSet.DisableItem(SID_GETUNDOSTRINGS); } } void ViewShell::ImpGetRedoStrings(SfxItemSet &rSet) const { SfxUndoManager* pUndoManager = ImpGetUndoManager(); - if(pUndoManager) + if(!pUndoManager) + return; + + sal_uInt16 nCount(pUndoManager->GetRedoActionCount()); + if(nCount) { - sal_uInt16 nCount(pUndoManager->GetRedoActionCount()); - if(nCount) - { - // prepare list - ::std::vector< OUString > aStringList; - aStringList.reserve(nCount); - for(sal_uInt16 a = 0; a < nCount; a++) - // generate one String in list per undo step - aStringList.push_back( pUndoManager->GetRedoActionComment(a) ); - - // set item - rSet.Put(SfxStringListItem(SID_GETREDOSTRINGS, &aStringList)); - } - else - { - rSet.DisableItem(SID_GETREDOSTRINGS); - } + // prepare list + ::std::vector< OUString > aStringList; + aStringList.reserve(nCount); + for(sal_uInt16 a = 0; a < nCount; a++) + // generate one String in list per undo step + aStringList.push_back( pUndoManager->GetRedoActionComment(a) ); + + // set item + rSet.Put(SfxStringListItem(SID_GETREDOSTRINGS, &aStringList)); + } + else + { + rSet.DisableItem(SID_GETREDOSTRINGS); } } |