diff options
-rw-r--r-- | accessibility/source/extended/textwindowaccessibility.cxx | 1 | ||||
-rw-r--r-- | include/vcl/txtattr.hxx | 19 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 27 | ||||
-rw-r--r-- | vcl/source/edit/textview.cxx | 30 | ||||
-rw-r--r-- | vcl/source/edit/txtattr.cxx | 29 |
5 files changed, 3 insertions, 103 deletions
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index d74ee64fcc5d..dcf95d8211f6 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1056,7 +1056,6 @@ void Document::retrieveRunAttributesImpl( ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() ); ::TextPaM aPaM( nNumber, Index ); // XXX numeric overflow - // FIXME TEXTATTR_HYPERLINK ignored: ::TextAttribFontColor const * pColor = static_cast< ::TextAttribFontColor const * >( m_rEngine.FindAttrib( aPaM, TEXTATTR_FONTCOLOR ) ); diff --git a/include/vcl/txtattr.hxx b/include/vcl/txtattr.hxx index 97fd9034160d..e446ee203563 100644 --- a/include/vcl/txtattr.hxx +++ b/include/vcl/txtattr.hxx @@ -30,7 +30,6 @@ namespace vcl { class Font; } #define TEXTATTR_FONTCOLOR 1 -#define TEXTATTR_HYPERLINK 2 #define TEXTATTR_FONTWEIGHT 3 #define TEXTATTR_USER_START 1000 //start id for user defined text attributes @@ -95,24 +94,6 @@ public: FontWeight getFontWeight() const { return meWeight; } }; - -class TextAttribHyperLink : public TextAttrib -{ -private: - OUString maURL; - OUString maDescription; - Color maColor; - -public: - TextAttribHyperLink( const TextAttribHyperLink& rAttr ); - virtual ~TextAttribHyperLink() override; - - const OUString& GetURL() const { return maURL; } - virtual void SetFont( vcl::Font& rFont ) const override; - virtual TextAttrib* Clone() const override; - virtual bool operator==( const TextAttrib& rAttr ) const override; -}; - class VCL_DLLPUBLIC TextAttribProtect : public TextAttrib { public: diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 188a3769f34e..769e2927d2ed 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -2495,31 +2495,8 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML } else { - sal_Int32 nTmpStart = nStartPos; - sal_Int32 nTmpEnd; - do - { - const TextCharAttrib* pAttr = pNode->GetCharAttribs().FindNextAttrib( TEXTATTR_HYPERLINK, nTmpStart, nEndPos ); - nTmpEnd = pAttr ? pAttr->GetStart() : nEndPos; - - // Text before Attribute - aText.append( pNode->GetText().copy( nTmpStart, nTmpEnd-nTmpStart ) ); - - if ( pAttr ) - { - nTmpEnd = std::min( pAttr->GetEnd(), nEndPos ); - - // e.g. <A HREF="http://www.mopo.de/">Morgenpost</A> - aText.append( "<A HREF=\"" ); - aText.append( static_cast<const TextAttribHyperLink&>( pAttr->GetAttr() ).GetURL() ); - aText.append( "\">" ); - nTmpStart = pAttr->GetStart(); - aText.append( pNode->GetText().copy( nTmpStart, nTmpEnd-nTmpStart ) ); - aText.append( "</A>" ); - - nTmpStart = pAttr->GetEnd(); - } - } while ( nTmpEnd < nEndPos ); + // Text before Attribute + aText.append( pNode->GetText().copy( nStartPos, nEndPos-nStartPos ) ); } aText.append( "</P>" ); diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index 366aa5bfaf6a..ae9fac5aba7f 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -1038,9 +1038,6 @@ void TextView::Copy( css::uno::Reference< css::datatransfer::clipboard::XClipboa { TETextDataObject* pDataObj = new TETextDataObject( GetSelected() ); - if ( mpImpl->mpTextEngine->HasAttrib( TEXTATTR_HYPERLINK ) ) // then also as HTML - mpImpl->mpTextEngine->Write( pDataObj->GetHTMLStream(), &mpImpl->maSelection, true ); - SolarMutexReleaser aReleaser; try @@ -1752,11 +1749,10 @@ bool TextView::IsSelectionAtPoint( const Point& rPosPixel ) { Point aDocPos = GetDocPos( rPosPixel ); TextPaM aPaM = mpImpl->mpTextEngine->GetPaM( aDocPos ); - // For Hyperlinks D&D also start w/o a selection. // BeginDrag is only called, however, if IsSelectionAtPoint() // Problem: IsSelectionAtPoint is not called by Command() // if before MBDown returned false. - return IsInSelection( aPaM ) || mpImpl->mpTextEngine->FindAttrib( aPaM, TEXTATTR_HYPERLINK ); + return IsInSelection( aPaM ); } bool TextView::IsInSelection( const TextPaM& rPaM ) @@ -1882,30 +1878,6 @@ void TextView::dragGestureRecognized( const css::datatransfer::dnd::DragGestureE TETextDataObject* pDataObj = new TETextDataObject( GetSelected() ); - if ( mpImpl->mpTextEngine->HasAttrib( TEXTATTR_HYPERLINK ) ) // then also as HTML - mpImpl->mpTextEngine->Write( pDataObj->GetHTMLStream(), &mpImpl->maSelection, true ); - - /* - // D&D of a Hyperlink - // TODO: Better would be to store MBDownPaM in MBDown, - // but this would be incompatible => change later - TextPaM aPaM( mpImpl->mpTextEngine->GetPaM( GetDocPos( GetWindow()->GetPointerPosPixel() ) ) ); - const TextCharAttrib* pAttr = mpImpl->mpTextEngine->FindCharAttrib( aPaM, TEXTATTR_HYPERLINK ); - if ( pAttr ) - { - aSel = aPaM; - aSel.GetStart().GetIndex() = pAttr->GetStart(); - aSel.GetEnd().GetIndex() = pAttr->GetEnd(); - - const TextAttribHyperLink& rLink = (const TextAttribHyperLink&)pAttr->GetAttr(); - String aText( rLink.GetDescription() ); - if ( !aText.Len() ) - aText = mpImpl->mpTextEngine->GetText( aSel ); - INetBookmark aBookmark( rLink.GetURL(), aText ); - aBookmark.CopyDragServer(); - } - */ - mpImpl->mpCursor->Hide(); sal_Int8 nActions = css::datatransfer::dnd::DNDConstants::ACTION_COPY; diff --git a/vcl/source/edit/txtattr.cxx b/vcl/source/edit/txtattr.cxx index 23e0c02cd281..4065995314ec 100644 --- a/vcl/source/edit/txtattr.cxx +++ b/vcl/source/edit/txtattr.cxx @@ -89,35 +89,6 @@ bool TextAttribFontWeight::operator==( const TextAttrib& rAttr ) const ( meWeight == static_cast<const TextAttribFontWeight&>(rAttr).meWeight ) ); } -TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink& rAttr ) - : TextAttrib( rAttr ), maURL( rAttr.maURL ), maDescription( rAttr.maDescription ) -{ - maColor = rAttr.maColor; -} - -TextAttribHyperLink::~TextAttribHyperLink() -{ -} - -void TextAttribHyperLink::SetFont( vcl::Font& rFont ) const -{ - rFont.SetColor( maColor ); - rFont.SetUnderline( LINESTYLE_SINGLE ); -} - -TextAttrib* TextAttribHyperLink::Clone() const -{ - return new TextAttribHyperLink( *this ); -} - -bool TextAttribHyperLink::operator==( const TextAttrib& rAttr ) const -{ - return ( ( TextAttrib::operator==(rAttr ) ) && - ( maURL == static_cast<const TextAttribHyperLink&>(rAttr).maURL ) && - ( maDescription == static_cast<const TextAttribHyperLink&>(rAttr).maDescription ) && - ( maColor == static_cast<const TextAttribHyperLink&>(rAttr).maColor ) ); -} - TextAttribProtect::TextAttribProtect() : TextAttrib( TEXTATTR_PROTECTED ) { |