diff options
Diffstat (limited to 'sw/source/uibase/shells/drwtxtex.cxx')
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 269 |
1 files changed, 140 insertions, 129 deletions
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index da358b617d17..9600c1a83e1c 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -79,57 +79,19 @@ #include <wview.hxx> #include <swabstdlg.hxx> -#include <memory> using namespace ::com::sun::star; -namespace -{ - void lcl_convertStringArguments(sal_uInt16 nSlot, const std::unique_ptr<SfxItemSet>& pArgs) - { - Color aColor; - OUString sColor; - const SfxPoolItem* pItem = nullptr; - - if (SfxItemState::SET != pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem)) - return; - - sColor = static_cast<const SfxStringItem*>(pItem)->GetValue(); - - if (sColor == "transparent") - aColor = COL_TRANSPARENT; - else - aColor = Color(ColorTransparency, sColor.toInt32(16)); - - switch (nSlot) - { - case SID_ATTR_CHAR_COLOR: - { - SvxColorItem aColorItem(aColor, EE_CHAR_COLOR); - pArgs->Put(aColorItem); - break; - } - - case SID_ATTR_CHAR_BACK_COLOR: - { - SvxBackgroundColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR); - pArgs->Put(pBackgroundItem); - break; - } - } - } -} - void SwDrawTextShell::Execute( SfxRequest &rReq ) { SwWrtShell &rSh = GetShell(); - OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + OutlinerView* pOLV = m_pSdrView->GetTextEditOutlinerView(); SfxItemSet aEditAttr(pOLV->GetAttribs()); SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges()); const sal_uInt16 nSlot = rReq.GetSlot(); - const sal_uInt16 nWhich = GetPool().GetWhich(nSlot); + const sal_uInt16 nWhich = GetPool().GetWhichIDFromSlotID(nSlot); std::unique_ptr<SfxItemSet> pNewAttrs(rReq.GetArgs() ? rReq.GetArgs()->Clone() : nullptr); bool bRestoreSelection = false; @@ -153,7 +115,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_THES: { OUString aReplaceText; - const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_THES); + const SfxStringItem* pItem2 = rReq.GetArg(FN_PARAM_THES_WORD_REPLACE); if (pItem2) aReplaceText = pItem2->GetValue(); if (!aReplaceText.isEmpty()) @@ -191,7 +153,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) { if ( pNewAttrs ) { - const SvxTextLineItem& rTextLineItem = static_cast< const SvxTextLineItem& >( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich(nSlot) ) ); + const SvxTextLineItem& rTextLineItem = static_cast< const SvxTextLineItem& >( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhichIDFromSlotID(nSlot) ) ); aNewAttr.Put( SvxUnderlineItem( rTextLineItem.GetLineStyle(), EE_CHAR_UNDERLINE ) ); } else @@ -257,18 +219,20 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } break; case SID_ATTR_PARA_LINESPACE: + if (pNewAttrs) { SvxLineSpacingItem aLineSpace = static_cast<const SvxLineSpacingItem&>(pNewAttrs->Get( - GetPool().GetWhich(nSlot))); + GetPool().GetWhichIDFromSlotID(nSlot))); aLineSpace.SetWhich( EE_PARA_SBL ); aNewAttr.Put( aLineSpace ); rReq.Done(); } break; case SID_ATTR_PARA_ULSPACE: + if (pNewAttrs) { SvxULSpaceItem aULSpace = static_cast<const SvxULSpaceItem&>(pNewAttrs->Get( - GetPool().GetWhich(nSlot))); + GetPool().GetWhichIDFromSlotID(nSlot))); aULSpace.SetWhich( EE_PARA_ULSPACE ); aNewAttr.Put( aULSpace ); rReq.Done(); @@ -305,6 +269,13 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) aNewAttr.Put(aItem); } break; + case SID_ATTR_PARA_LINESPACE_115: + { + SvxLineSpacingItem aItem(LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL); + aItem.SetPropLineSpace(115); + aNewAttr.Put(aItem); + } + break; case SID_ATTR_PARA_LINESPACE_15: { SvxLineSpacingItem aItem(LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL); @@ -346,6 +317,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) break; case SID_CHAR_DLG_EFFECT: + case SID_CHAR_DLG_POSITION: case SID_CHAR_DLG: case SID_CHAR_DLG_FOR_PARAGRAPH: { @@ -366,7 +338,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SwView* pView = &GetView(); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); - SfxItemSet aDlgAttr(GetPool(), svl::Items<XATTR_FILLSTYLE, XATTR_FILLCOLOR, EE_ITEMS_START, EE_ITEMS_END>{}); + SfxItemSetFixed<XATTR_FILLSTYLE, XATTR_FILLCOLOR, EE_ITEMS_START, EE_ITEMS_END> aDlgAttr(GetPool()); // util::Language does not exists in the EditEngine! That is why not in set. @@ -374,28 +346,39 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(pView->GetFrameWeld(), *pView, aDlgAttr, SwCharDlgMode::Draw)); + VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(pView->GetFrameWeld(), *pView, aDlgAttr, SwCharDlgMode::Draw)); if (nSlot == SID_CHAR_DLG_EFFECT) { pDlg->SetCurPageId("fonteffects"); } + else if (nSlot == SID_CHAR_DLG_POSITION) + { + pDlg->SetCurPageId("position"); + } else if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH) { pDlg->SetCurPageId("font"); } else if (pItem) { - pDlg->SetCurPageId(OUStringToOString(pItem->GetValue(), RTL_TEXTENCODING_UTF8)); + pDlg->SetCurPageId(pItem->GetValue()); } - sal_uInt16 nRet = pDlg->Execute(); - if(RET_OK == nRet ) - { - rReq.Done( *( pDlg->GetOutputItemSet() ) ); - aNewAttr.Put(*pDlg->GetOutputItemSet()); - } - if(RET_OK != nRet) - return ; + auto xRequest = std::make_shared<SfxRequest>(rReq); + rReq.Ignore(); // the 'old' request is not relevant any more + pDlg->StartExecuteAsync( + [this, pDlg, xRequest=std::move(xRequest), nEEWhich, aNewAttr2=aNewAttr, pOLV, bRestoreSelection, aOldSelection] (sal_Int32 nResult) mutable ->void + { + if (nResult == RET_OK) + { + xRequest->Done( *( pDlg->GetOutputItemSet() ) ); + aNewAttr2.Put(*pDlg->GetOutputItemSet()); + ExecutePost(*xRequest, nEEWhich, aNewAttr2, pOLV, bRestoreSelection, aOldSelection); + } + pDlg->disposeOnce(); + } + ); + return; } else aNewAttr.Put(*pArgs); @@ -431,11 +414,9 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SwView* pView = &GetView(); FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); - SfxItemSet aDlgAttr( - GetPool(), - svl::Items< + SfxItemSetFixed< EE_ITEMS_START, EE_ITEMS_END, - SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_WIDOWS>{}); + SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_WIDOWS> aDlgAttr( GetPool() ); aDlgAttr.Put(aEditAttr); @@ -464,7 +445,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) { //!! JP 16.03.2001: why?? pSdrView = rSh.GetDrawView(); //!! JP 16.03.2001: why?? pOutliner = pSdrView->GetTextEditOutliner(); - SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner(); + SdrOutliner * pOutliner = m_pSdrView->GetTextEditOutliner(); EEControlBits nCtrl = pOutliner->GetControlWord(); bool bSet = static_cast<const SfxBoolItem&>(rReq.GetArgs()->Get( @@ -475,7 +456,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) nCtrl &= ~EEControlBits::ONLINESPELLING; pOutliner->SetControlWord(nCtrl); - rView.ExecuteSlot(rReq); + m_rView.ExecuteSlot(rReq); } break; case SID_HYPERLINK_SETLINK: @@ -508,7 +489,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) { // Ensure the field is selected first pOLV->SelectFieldAtCursor(); - GetView().GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG); + GetView().GetViewFrame().GetDispatcher()->Execute(SID_HYPERLINK_DIALOG); } break; @@ -520,22 +501,22 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_OPEN_HYPERLINK: { - const SvxFieldData* pField = pOLV->GetFieldAtCursor(); + const SvxFieldItem* pFieldItem + = pOLV->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true); + const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr; if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField)) { - SfxStringItem aUrl(SID_FILE_NAME, pURLField->GetURL()); - SfxStringItem aTarget(SID_TARGETNAME, pURLField->GetTargetFrame()); - SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, false); - SfxBoolItem aBrowsing(SID_BROWSE, true); - GetView().GetViewFrame()->GetDispatcher()->ExecuteList( - SID_OPENDOC, SfxCallMode::SYNCHRON, { &aUrl, &aTarget, &aNewView, &aBrowsing }); + ::LoadURL(GetShell(), pURLField->GetURL(), LoadUrlFlags::NONE, + pURLField->GetTargetFrame()); } } break; case SID_COPY_HYPERLINK_LOCATION: { - const SvxFieldData* pField = pOLV->GetFieldAtCursor(); + const SvxFieldItem* pFieldItem + = pOLV->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true); + const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr; if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField)) { uno::Reference<datatransfer::clipboard::XClipboard> xClipboard @@ -549,15 +530,14 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_TEXTDIRECTION_TOP_TO_BOTTOM: // Shell switch! { - SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); - SdrPageView* pTmpPV = pSdrView->GetSdrPageView(); - SdrView* pTmpView = pSdrView; + SdrObject* pTmpObj = m_pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + SdrPageView* pTmpPV = m_pSdrView->GetSdrPageView(); + SdrView* pTmpView = m_pSdrView; - pSdrView->SdrEndTextEdit(true); + m_pSdrView->SdrEndTextEdit(true); - SfxItemSet aAttr( *aNewAttr.GetPool(), - svl::Items<SDRATTR_TEXTDIRECTION, - SDRATTR_TEXTDIRECTION>{} ); + SfxItemSetFixed<SDRATTR_TEXTDIRECTION, + SDRATTR_TEXTDIRECTION> aAttr( *aNewAttr.GetPool() ); aAttr.Put( SvxWritingModeItem( nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ? @@ -573,11 +553,11 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_ATTR_PARA_LEFT_TO_RIGHT: case SID_ATTR_PARA_RIGHT_TO_LEFT: { - SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); - SdrPageView* pTmpPV = pSdrView->GetSdrPageView(); - SdrView* pTmpView = pSdrView; + SdrObject* pTmpObj = m_pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + SdrPageView* pTmpPV = m_pSdrView->GetSdrPageView(); + SdrView* pTmpView = m_pSdrView; - pSdrView->SdrEndTextEdit(true); + m_pSdrView->SdrEndTextEdit(true); bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT; const SfxPoolItem* pPoolItem; @@ -586,15 +566,13 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) if( !static_cast<const SfxBoolItem*>(pPoolItem)->GetValue() ) bLeftToRight = !bLeftToRight; } - SfxItemSet aAttr( - *aNewAttr.GetPool(), - svl::Items< + SfxItemSetFixed< EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR, - EE_PARA_JUST, EE_PARA_JUST>{}); + EE_PARA_JUST, EE_PARA_JUST> aAttr( *aNewAttr.GetPool() ); SvxAdjust nAdjust = SvxAdjust::Left; - if( SfxItemState::SET == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) ) - nAdjust = static_cast<const SvxAdjustItem*>(pPoolItem)->GetAdjust(); + if( const SvxAdjustItem* pAdjustItem = aEditAttr.GetItemIfSet(EE_PARA_JUST) ) + nAdjust = pAdjustItem->GetAdjust(); if( bLeftToRight ) { @@ -617,8 +595,9 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case FN_GROW_FONT_SIZE: case FN_SHRINK_FONT_SIZE: { + const SfxObjectShell* pObjSh = SfxObjectShell::Current(); const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* > - ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); + (pObjSh ? pObjSh->GetItem(SID_ATTR_CHAR_FONTLIST) : nullptr); const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr; pOLV->GetEditView().ChangeFontSize( nSlot == FN_GROW_FONT_SIZE, pFontList ); } @@ -628,16 +607,35 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) assert(false && "wrong dispatcher"); return; } + + ExecutePost(rReq, nEEWhich, aNewAttr, pOLV, bRestoreSelection, aOldSelection); +} + +void SwDrawTextShell::ExecutePost( SfxRequest& rReq, sal_uInt16 nEEWhich, SfxItemSet& rNewAttr, + OutlinerView* pOLV, bool bRestoreSelection, const ESelection& rOldSelection ) +{ + SwWrtShell &rSh = GetShell(); + const SfxItemSet *pNewAttrs = rReq.GetArgs(); + const sal_uInt16 nSlot = rReq.GetSlot(); + const sal_uInt16 nWhich = GetPool().GetWhichIDFromSlotID(nSlot); + if (nEEWhich && pNewAttrs) { - lcl_convertStringArguments(nSlot, pNewAttrs); - - aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); + rNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); } + else if (nEEWhich == EE_CHAR_COLOR) + { + GetView().GetViewFrame().GetDispatcher()->Execute(SID_CHAR_DLG_EFFECT); + } + else if (nEEWhich == EE_CHAR_KERNING) + { + GetView().GetViewFrame().GetDispatcher()->Execute(SID_CHAR_DLG_POSITION); + } + - SetAttrToMarked(aNewAttr); + SetAttrToMarked(rNewAttr); - GetView().GetViewFrame()->GetBindings().InvalidateAll(false); + GetView().GetViewFrame().GetBindings().InvalidateAll(false); if (IsTextEdit() && pOLV->GetOutliner()->IsModified()) rSh.SetModified(); @@ -645,7 +643,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) if (bRestoreSelection) { // restore selection - pOLV->GetEditView().SetSelection( aOldSelection ); + pOLV->GetEditView().SetSelection( rOldSelection ); } } @@ -654,12 +652,14 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) if (!IsTextEdit()) // Otherwise sometimes crash! return; - OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + OutlinerView* pOLV = m_pSdrView->GetTextEditOutlinerView(); SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); SfxItemSet aEditAttr(pOLV->GetAttribs()); - const SfxPoolItem *pAdjust = nullptr, *pLSpace = nullptr, *pEscItem = nullptr; + const SvxAdjustItem *pAdjust = nullptr; + const SvxLineSpacingItem *pLSpace = nullptr; + const SfxPoolItem *pEscItem = nullptr; SvxAdjust eAdjust; int nLSpace; SvxEscapement nEsc; @@ -711,7 +711,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) ASK_ADJUST: { if (!pAdjust) - aEditAttr.GetItemState(EE_PARA_JUST, false, &pAdjust); + pAdjust = aEditAttr.GetItemIfSet(EE_PARA_JUST, false); if (!pAdjust || IsInvalidItem(pAdjust)) { @@ -719,7 +719,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) nSlotId = 0; } else - bFlag = eAdjust == static_cast<const SvxAdjustItem*>(pAdjust)->GetAdjust(); + bFlag = eAdjust == pAdjust->GetAdjust(); } break; @@ -789,6 +789,9 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) case SID_ATTR_PARA_LINESPACE_10: nLSpace = 100; goto ASK_LINESPACE; + case SID_ATTR_PARA_LINESPACE_115: + nLSpace = 115; + goto ASK_LINESPACE; case SID_ATTR_PARA_LINESPACE_15: nLSpace = 150; goto ASK_LINESPACE; @@ -798,7 +801,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) ASK_LINESPACE: { if (!pLSpace) - aEditAttr.GetItemState(EE_PARA_SBL, false, &pLSpace); + pLSpace = aEditAttr.GetItemIfSet(EE_PARA_SBL, false); if (!pLSpace || IsInvalidItem(pLSpace)) { @@ -806,10 +809,14 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) nSlotId = 0; } else if (nLSpace - == static_cast<const SvxLineSpacingItem*>(pLSpace)->GetPropLineSpace()) + == pLSpace->GetPropLineSpace()) bFlag = true; else + { + // tdf#114631 - disable non selected line spacing + rSet.Put(SfxBoolItem(nWhich, false)); nSlotId = 0; + } } break; @@ -834,10 +841,11 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) case SID_THESAURUS: { // disable "Thesaurus" if the language is not supported - const SfxPoolItem& rItem = GetShell().GetDoc()->GetDefault(GetWhichOfScript( + TypedWhichId<SvxLanguageItem> nLangWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, - SvtLanguageOptions::GetI18NScriptTypeOfLanguage(GetAppLanguage()))); - LanguageType nLang = static_cast<const SvxLanguageItem&>(rItem).GetLanguage(); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage(GetAppLanguage())); + const SvxLanguageItem& rItem = GetShell().GetDoc()->GetDefault(nLangWhich); + LanguageType nLang = rItem.GetLanguage(); uno::Reference<linguistic2::XThesaurus> xThes(::GetThesaurus()); if (!xThes.is() || nLang == LANGUAGE_NONE @@ -849,26 +857,26 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) case SID_HANGUL_HANJA_CONVERSION: case SID_CHINESE_CONVERSION: { - if (!SvtCJKOptions().IsAnyEnabled()) + if (!SvtCJKOptions::IsAnyEnabled()) { - GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, false); + GetView().GetViewFrame().GetBindings().SetVisibleState(nWhich, false); rSet.DisableItem(nWhich); } else - GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, true); + GetView().GetViewFrame().GetBindings().SetVisibleState(nWhich, true); } break; case SID_TEXTDIRECTION_LEFT_TO_RIGHT: case SID_TEXTDIRECTION_TOP_TO_BOTTOM: - if (!SvtLanguageOptions().IsVerticalTextEnabled()) + if (!SvtCJKOptions::IsVerticalTextEnabled()) { rSet.DisableItem(nSlotId); nSlotId = 0; } else { - SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner(); + SdrOutliner* pOutliner = m_pSdrView->GetTextEditOutliner(); if (pOutliner) bFlag = pOutliner->IsVertical() == (SID_TEXTDIRECTION_TOP_TO_BOTTOM == nSlotId); @@ -890,14 +898,14 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) case SID_ATTR_PARA_LEFT_TO_RIGHT: case SID_ATTR_PARA_RIGHT_TO_LEFT: { - if (!SvtLanguageOptions().IsCTLFontEnabled()) + if (!SvtCTLOptions::IsCTLFontEnabled()) { rSet.DisableItem(nWhich); nSlotId = 0; } else { - SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner(); + SdrOutliner* pOutliner = m_pSdrView->GetTextEditOutliner(); if (pOutliner && pOutliner->IsVertical()) { rSet.DisableItem(nWhich); @@ -926,22 +934,20 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) case SID_TRANSLITERATE_HIRAGANA: case SID_TRANSLITERATE_KATAKANA: { - SvtCJKOptions aCJKOptions; - if (!aCJKOptions.IsChangeCaseMapEnabled()) + if (!SvtCJKOptions::IsChangeCaseMapEnabled()) { rSet.DisableItem(nWhich); - GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, false); + GetView().GetViewFrame().GetBindings().SetVisibleState(nWhich, false); } else - GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, true); + GetView().GetViewFrame().GetBindings().SetVisibleState(nWhich, true); } break; case SID_INSERT_RLM: case SID_INSERT_LRM: { - SvtCTLOptions aCTLOptions; - bool bEnabled = aCTLOptions.IsCTLFontEnabled(); - GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, bEnabled); + bool bEnabled = SvtCTLOptions::IsCTLFontEnabled(); + GetView().GetViewFrame().GetBindings().SetVisibleState(nWhich, bEnabled); if (!bEnabled) rSet.DisableItem(nWhich); } @@ -951,8 +957,9 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) case SID_OPEN_HYPERLINK: case SID_COPY_HYPERLINK_LOCATION: { - if (!URLFieldHelper::IsCursorAtURLField(pOLV)) + if (!URLFieldHelper::IsCursorAtURLField(pOLV, /*AlsoCheckBeforeCursor=*/true)) rSet.DisableItem(nWhich); + nSlotId = 0; } break; default: @@ -960,7 +967,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) break; } - if (nSlotId && bFlag) + if (nSlotId) rSet.Put(SfxBoolItem(nWhich, bFlag)); nWhich = aIter.NextWhich(); @@ -972,7 +979,7 @@ void SwDrawTextShell::GetDrawTextCtrlState(SfxItemSet& rSet) if (!IsTextEdit()) // Otherwise crash! return; - OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + OutlinerView* pOLV = m_pSdrView->GetTextEditOutlinerView(); SfxItemSet aEditAttr(pOLV->GetAttribs()); SfxWhichIter aIter(rSet); @@ -1012,9 +1019,9 @@ void SwDrawTextShell::GetDrawTextCtrlState(SfxItemSet& rSet) case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break; case SID_AUTOSPELL_CHECK: { - const SfxPoolItem* pState = rView.GetSlotState(nWhich); - if (pState) - rSet.Put(SfxBoolItem(nWhich, static_cast<const SfxBoolItem*>(pState)->GetValue())); + const SfxPoolItemHolder aResult(m_rView.GetSlotState(nWhich)); + if (aResult) + rSet.Put(SfxBoolItem(nWhich, static_cast<const SfxBoolItem*>(aResult.getItem())->GetValue())); else rSet.DisableItem( nWhich ); break; @@ -1061,7 +1068,7 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest const &rReq) if (!IsTextEdit()) // Otherwise crash! return; - OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + OutlinerView* pOLV = m_pSdrView->GetTextEditOutlinerView(); ESelection aSel(pOLV->GetSelection()); const bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos); @@ -1094,6 +1101,7 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest const &rReq) pDlg->Insert(SotClipboardFormatId::STRING, OUString()); pDlg->Insert(SotClipboardFormatId::RTF, OUString()); pDlg->Insert(SotClipboardFormatId::RICHTEXT, OUString()); + pDlg->Insert(SotClipboardFormatId::HTML_SIMPLE, OUString()); TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromSystemClipboard(&GetView().GetEditWin())); SotClipboardFormatId nFormat = pDlg->GetFormat(aDataHelper.GetTransferable()); @@ -1103,7 +1111,7 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest const &rReq) if (nFormat == SotClipboardFormatId::STRING) pOLV->Paste(); else - pOLV->PasteSpecial(); + pOLV->PasteSpecial(nFormat); } break; @@ -1124,7 +1132,7 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest const &rReq) if (nFormat == SotClipboardFormatId::STRING) pOLV->Paste(); else - pOLV->PasteSpecial(); + pOLV->PasteSpecial(nFormat); } break; @@ -1141,7 +1149,7 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet) if (!IsTextEdit()) // Otherwise crash! return; - OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + OutlinerView* pOLV = m_pSdrView->GetTextEditOutlinerView(); ESelection aSel(pOLV->GetSelection()); const bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos); @@ -1149,7 +1157,8 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet) TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &GetView().GetEditWin() ) ); const bool bPaste = aDataHelper.HasFormat( SotClipboardFormatId::STRING ) || aDataHelper.HasFormat( SotClipboardFormatId::RTF ) || - aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ); + aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) || + aDataHelper.HasFormat( SotClipboardFormatId::HTML_SIMPLE); SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); @@ -1182,6 +1191,8 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet) aFormats.AddClipbrdFormat( SotClipboardFormatId::RTF ); if ( aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ) aFormats.AddClipbrdFormat( SotClipboardFormatId::RICHTEXT ); + if (aDataHelper.HasFormat(SotClipboardFormatId::HTML_SIMPLE)) + aFormats.AddClipbrdFormat(SotClipboardFormatId::HTML_SIMPLE); rSet.Put( aFormats ); } @@ -1201,7 +1212,7 @@ void SwDrawTextShell::StateInsert(SfxItemSet &rSet) if (!IsTextEdit()) // Otherwise crash! return; - OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + OutlinerView* pOLV = m_pSdrView->GetTextEditOutlinerView(); SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); |