From bca12756a58b79d27fd4c607e6d922bd5ba7da50 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Thu, 27 Aug 2009 11:59:20 +0000 Subject: CWS-TOOLING: integrate CWS sw32a11y01 2009-08-27 10:11:46 +0200 hde r275457 : new testcase i103265 2009-08-27 08:24:31 +0200 hde r275454 : new testcase i103265 2009-08-27 08:23:05 +0200 hde r275453 : new document for testcase i103265 2009-08-26 13:43:33 +0200 hde r275421 : added new autotest 2009-08-26 13:36:28 +0200 hde r275420 : added new autotest 2009-08-18 15:41:18 +0200 od r275113 : #i104300# method - improve help tip for hyperlinks to cross-reference bookmarks. 2009-08-10 15:18:41 +0200 od r274816 : #i73249# method - no update of fly frame manager on dialog "Title and Description" 2009-08-10 14:24:15 +0200 od r274813 : #i92125# correction of end of file - missing newline end 2009-08-10 14:10:14 +0200 od r274811 : #i92125# correction of end of file - newline missing 2009-08-10 14:00:30 +0200 od r274808 : #i92125# - correct end of file - new line missing 2009-08-10 09:12:30 +0200 od r274794 : CWS-TOOLING: rebase CWS sw32a11y01 to trunk@274622 (milestone: DEV300:m54) 2009-08-07 15:52:59 +0200 od r274775 : #i73249# minor adjustment due to compiler warning 2009-08-07 15:40:38 +0200 od r274774 : #i92125# method - do not delete cross-reference bookmark, if deletion occurs inside a certain node 2009-08-06 12:53:05 +0200 od r274717 : #i92125# method - keep cross-reference bookmarks, if deletion occurs inside a certain node. 2009-08-06 09:53:29 +0200 od r274705 : #i103265# method - For outline and template entries create link to bookmark. The bookmark of type CROSSREF_HEADING_BOOKMARK is created, if needed 2009-07-22 13:57:04 +0200 od r274236 : #i73249# adjustment for export of svg:title and svg:description 2009-07-22 13:51:58 +0200 od r274234 : #i73249# adjust and enhance import/export of svg:title and svg:description for Writer's text frames, graphics and embedded objects 2009-07-21 10:26:27 +0200 od r274168 : #i73249# implement support for attributes Title and Description for text frames, graphics and embedded objects in Writer - core, UNO-API, undo/redo and UI 2009-07-21 10:05:15 +0200 od r274164 : #i73249# new optional properties Title and Description as basis frame properties in text documents 2009-07-13 12:19:54 +0200 od r273928 : #i73249# Implementation of Undo/Redo of drawing object's name, title and description --- svx/inc/svdstr.hrc | 8 +- svx/inc/svx/svdundo.hxx | 36 ++++++++ svx/source/svdraw/svdobj.cxx | 74 ++++++++++++++++- svx/source/svdraw/svdstr.src | 14 ++++ svx/source/svdraw/svdundo.cxx | 98 ++++++++++++++++++++++ xmloff/inc/xmloff/txtparae.hxx | 14 +++- xmloff/source/text/XMLTextFrameContext.cxx | 128 ++++++++++++++++++++++------- xmloff/source/text/XMLTextFrameContext.hxx | 3 + xmloff/source/text/txtparae.cxx | 44 ++++++++-- 9 files changed, 375 insertions(+), 44 deletions(-) diff --git a/svx/inc/svdstr.hrc b/svx/inc/svdstr.hrc index cb1b85079f37..280a9dba6122 100644 --- a/svx/inc/svdstr.hrc +++ b/svx/inc/svdstr.hrc @@ -324,7 +324,13 @@ #define STR_UndoNewLayer (STR_UndoBegin +13) #define STR_UndoDelLayer (STR_UndoBegin +14) #define STR_UndoMovLayer (STR_UndoBegin +15) -#define STR_UndoEnd (STR_UndoMovLayer) + +// --> OD 2009-07-09 #i73249# +#define STR_UndoObjName (STR_UndoBegin +16) +#define STR_UndoObjTitle (STR_UndoBegin +17) +#define STR_UndoObjDescription (STR_UndoBegin +18) +// <-- +#define STR_UndoEnd (STR_UndoObjDescription) #define STR_LayerBegin (STR_UndoEnd+1) diff --git a/svx/inc/svx/svdundo.hxx b/svx/inc/svx/svdundo.hxx index f9de0733608d..717b1a070c6f 100644 --- a/svx/inc/svx/svdundo.hxx +++ b/svx/inc/svx/svdundo.hxx @@ -484,6 +484,35 @@ public: virtual bool CanSdrRepeat(SdrView& rView) const; }; +// --> OD 2009-07-09 #i73249# +class SdrUndoObjStrAttr : public SdrUndoObj +{ +public: + enum ObjStrAttrType + { + OBJ_NAME, + OBJ_TITLE, + OBJ_DESCRIPTION + }; + +protected: + const ObjStrAttrType meObjStrAttr; + const String msOldStr; + const String msNewStr; + +public: + SdrUndoObjStrAttr( SdrObject& rNewObj, + const ObjStrAttrType eObjStrAttr, + const String& sOldStr, + const String& sNewStr); + + virtual void Undo(); + virtual void Redo(); + + virtual String GetComment() const; +}; +// <-- + //////////////////////////////////////////////////////////////////////////////////////////////////// // // @@ @@@@ @@ @@ @@@@@ @@@@@ @@ -827,6 +856,13 @@ public: virtual SdrUndoAction* CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer ); virtual SdrUndoAction* CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText ); + // --> OD 2009-07-09 #i73249# + virtual SdrUndoAction* CreateUndoObjectStrAttr( SdrObject& rObject, + SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType, + String sOldStr, + String sNewStr ); + // <-- + // layer virtual SdrUndoAction* CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel); virtual SdrUndoAction* CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index e272a51a4a7a..7ba4aec3e565 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -129,6 +129,10 @@ #include "svx/shapepropertynotifier.hxx" #include +// --> OD 2009-07-10 #i73249# +#include +// <-- + using namespace ::com::sun::star; // #104018# replace macros above with type-detecting methods @@ -759,7 +763,29 @@ void SdrObject::SetName(const String& rStr) if(pPlusData && pPlusData->aObjName != rStr) { + // --> OD 2009-07-09 #i73249# + // Undo/Redo for setting object's name + bool bUndo( false ); + if ( GetModel() && GetModel()->IsUndoEnabled() ) + { + bUndo = true; + SdrUndoAction* pUndoAction = + GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr( + *this, + SdrUndoObjStrAttr::OBJ_NAME, + GetName(), + rStr ); + GetModel()->BegUndo( pUndoAction->GetComment() ); + GetModel()->AddUndo( pUndoAction ); + } + // <-- pPlusData->aObjName = rStr; + // --> OD 2009-07-09 #i73249# + if ( bUndo ) + { + GetModel()->EndUndo(); + } + // <-- SetChanged(); BroadcastObjectChange(); } @@ -784,7 +810,29 @@ void SdrObject::SetTitle(const String& rStr) if(pPlusData && pPlusData->aObjTitle != rStr) { + // --> OD 2009-07-13 #i73249# + // Undo/Redo for setting object's title + bool bUndo( false ); + if ( GetModel() && GetModel()->IsUndoEnabled() ) + { + bUndo = true; + SdrUndoAction* pUndoAction = + GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr( + *this, + SdrUndoObjStrAttr::OBJ_TITLE, + GetTitle(), + rStr ); + GetModel()->BegUndo( pUndoAction->GetComment() ); + GetModel()->AddUndo( pUndoAction ); + } + // <-- pPlusData->aObjTitle = rStr; + // --> OD 2009-07-13 #i73249# + if ( bUndo ) + { + GetModel()->EndUndo(); + } + // <-- SetChanged(); BroadcastObjectChange(); } @@ -809,7 +857,29 @@ void SdrObject::SetDescription(const String& rStr) if(pPlusData && pPlusData->aObjDescription != rStr) { + // --> OD 2009-07-13 #i73249# + // Undo/Redo for setting object's description + bool bUndo( false ); + if ( GetModel() && GetModel()->IsUndoEnabled() ) + { + bUndo = true; + SdrUndoAction* pUndoAction = + GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr( + *this, + SdrUndoObjStrAttr::OBJ_DESCRIPTION, + GetDescription(), + rStr ); + GetModel()->BegUndo( pUndoAction->GetComment() ); + GetModel()->AddUndo( pUndoAction ); + } + // <-- pPlusData->aObjDescription = rStr; + // --> OD 2009-07-13 #i73249# + if ( bUndo ) + { + GetModel()->EndUndo(); + } + // <-- SetChanged(); BroadcastObjectChange(); } @@ -2863,8 +2933,8 @@ void SdrObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& _rxUn { maWeakUnoShape = _rxUnoShape; mpSvxShape = SvxShape::getImplementation( _rxUnoShape ); - OSL_ENSURE( mpSvxShape || !_rxUnoShape.is(), - "SdrObject::setUnoShape: not sure it's a good idea to have an XShape which is not implemented by SvxShape ..." ); +// OSL_ENSURE( mpSvxShape || !_rxUnoShape.is(), +// "SdrObject::setUnoShape: not sure it's a good idea to have an XShape which is not implemented by SvxShape ..." ); } /** only for internal use! */ diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index 32c457cf3d02..144db41d515f 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -1127,6 +1127,20 @@ String STR_UndoMovLayer { Text [ en-US ] = "Change order of layers" ; }; +// --> OD 2009-07-09 #i73249# +String STR_UndoObjName +{ + Text [ en-US ] = "Change object name of %1 to" ; +}; +String STR_UndoObjTitle +{ + Text [ en-US ] = "Change object title of %1" ; +}; +String STR_UndoObjDescription +{ + Text [ en-US ] = "Change object description of %1" ; +}; +// <-- String STR_StandardLayerName { Text [ en-US ] = "Standard" ; diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index b49d087d0251..08cee1eb17d3 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -1219,6 +1219,95 @@ bool SdrUndoObjSetText::CanSdrRepeat(SdrView& rView) const return bOk; } +// --> OD 2009-07-09 #i73249# +SdrUndoObjStrAttr::SdrUndoObjStrAttr( SdrObject& rNewObj, + const ObjStrAttrType eObjStrAttr, + const String& sOldStr, + const String& sNewStr) + : SdrUndoObj( rNewObj ), + meObjStrAttr( eObjStrAttr ), + msOldStr( sOldStr ), + msNewStr( sNewStr ) +{ +} + +void SdrUndoObjStrAttr::Undo() +{ + ImpShowPageOfThisObject(); + + switch ( meObjStrAttr ) + { + case OBJ_NAME: + { + pObj->SetName( msOldStr ); + } + break; + case OBJ_TITLE: + { + pObj->SetTitle( msOldStr ); + } + break; + case OBJ_DESCRIPTION: + { + pObj->SetDescription( msOldStr ); + } + break; + } +} + +void SdrUndoObjStrAttr::Redo() +{ + switch ( meObjStrAttr ) + { + case OBJ_NAME: + { + pObj->SetName( msNewStr ); + } + break; + case OBJ_TITLE: + { + pObj->SetTitle( msNewStr ); + } + break; + case OBJ_DESCRIPTION: + { + pObj->SetDescription( msNewStr ); + } + break; + } + + ImpShowPageOfThisObject(); +} + +String SdrUndoObjStrAttr::GetComment() const +{ + String aStr; + switch ( meObjStrAttr ) + { + case OBJ_NAME: + { + ImpTakeDescriptionStr( STR_UndoObjName, aStr ); + aStr += sal_Unicode(' '); + aStr += sal_Unicode('\''); + aStr += msNewStr; + aStr += sal_Unicode('\''); + } + break; + case OBJ_TITLE: + { + ImpTakeDescriptionStr( STR_UndoObjTitle, aStr ); + } + break; + case OBJ_DESCRIPTION: + { + ImpTakeDescriptionStr( STR_UndoObjDescription, aStr ); + } + break; + } + + return aStr; +} + //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -1726,6 +1815,15 @@ SdrUndoAction* SdrUndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_ return new SdrUndoObjSetText( rNewObj, nText ); } +SdrUndoAction* SdrUndoFactory::CreateUndoObjectStrAttr( SdrObject& rObject, + SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType, + String sOldStr, + String sNewStr ) +{ + return new SdrUndoObjStrAttr( rObject, eObjStrAttrType, sOldStr, sNewStr ); +} + + // layer SdrUndoAction* SdrUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel) { diff --git a/xmloff/inc/xmloff/txtparae.hxx b/xmloff/inc/xmloff/txtparae.hxx index 1ea068911236..a7c7df50ee64 100644 --- a/xmloff/inc/xmloff/txtparae.hxx +++ b/xmloff/inc/xmloff/txtparae.hxx @@ -123,7 +123,11 @@ class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport protected: const ::rtl::OUString sActualSize; - const ::rtl::OUString sAlternativeText; + // --> OD 2009-07-22 #i73249# +// const ::rtl::OUString sAlternativeText; + const ::rtl::OUString sTitle; + const ::rtl::OUString sDescription; + // <-- const ::rtl::OUString sAnchorCharStyleName; const ::rtl::OUString sAnchorPageNo; const ::rtl::OUString sAnchorType; @@ -605,8 +609,12 @@ public: virtual void exportTextAutoStyles(); void exportEvents( const ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > & rPropSet ); - void exportAlternativeText( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & rPropSet, - const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo ); + // --> OD 2009-07-22 #i73249# +// void exportAlternativeText( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & rPropSet, +// const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo ); + void exportTitleAndDescription( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & rPropSet, + const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo ); + // <-- // This method exports the given XText void exportText( diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index c53885e73187..eee8f862f802 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -124,44 +124,45 @@ inline XMLTextFrameContextHyperlink_Impl::XMLTextFrameContextHyperlink_Impl( { } -class XMLTextFrameDescContext_Impl : public SvXMLImportContext +// --> OD 2009-07-22 #i73249# +class XMLTextFrameTitleOrDescContext_Impl : public SvXMLImportContext { - OUString& rDesc; + OUString& mrTitleOrDesc; public: TYPEINFO(); - XMLTextFrameDescContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx, - const ::rtl::OUString& rLName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XAttributeList > & xAttrList, - OUString& rD ); - virtual ~XMLTextFrameDescContext_Impl(); + XMLTextFrameTitleOrDescContext_Impl( SvXMLImport& rImport, + sal_uInt16 nPrfx, + const ::rtl::OUString& rLName, + OUString& rTitleOrDesc ); + virtual ~XMLTextFrameTitleOrDescContext_Impl(); virtual void Characters( const OUString& rText ); }; -TYPEINIT1( XMLTextFrameDescContext_Impl, SvXMLImportContext ); +TYPEINIT1( XMLTextFrameTitleOrDescContext_Impl, SvXMLImportContext ); -XMLTextFrameDescContext_Impl::XMLTextFrameDescContext_Impl( +XMLTextFrameTitleOrDescContext_Impl::XMLTextFrameTitleOrDescContext_Impl( SvXMLImport& rImport, - sal_uInt16 nPrfx, const OUString& rLName, - const Reference< XAttributeList > &, - OUString& rD ) : - SvXMLImportContext( rImport, nPrfx, rLName ), - rDesc( rD ) + sal_uInt16 nPrfx, + const OUString& rLName, + OUString& rTitleOrDesc ) + : SvXMLImportContext( rImport, nPrfx, rLName ) + , mrTitleOrDesc( rTitleOrDesc ) { } -XMLTextFrameDescContext_Impl::~XMLTextFrameDescContext_Impl() +XMLTextFrameTitleOrDescContext_Impl::~XMLTextFrameTitleOrDescContext_Impl() { } -void XMLTextFrameDescContext_Impl::Characters( const OUString& rText ) +void XMLTextFrameTitleOrDescContext_Impl::Characters( const OUString& rText ) { - rDesc += rText; + mrTitleOrDesc += rText; } +// <-- // ------------------------------------------------------------------------ @@ -385,7 +386,11 @@ class XMLTextFrameContext_Impl : public SvXMLImportContext const ::rtl::OUString sAnchorPageNo; const ::rtl::OUString sGraphicURL; const ::rtl::OUString sGraphicFilter; - const ::rtl::OUString sAlternativeText; + // --> OD 2009-07-22 #i73249# +// const ::rtl::OUString sAlternativeText; + const ::rtl::OUString sTitle; + const ::rtl::OUString sDescription; + // <-- const ::rtl::OUString sFrameStyleName; const ::rtl::OUString sGraphicRotation; const ::rtl::OUString sTextBoxServiceName; @@ -461,6 +466,9 @@ public: const ::rtl::OUString& rName, const ::rtl::OUString& rTargetFrameName, sal_Bool bMap ); + // --> OD 2009-07-22 #i73249# + void SetTitle( const ::rtl::OUString& rTitle ); + // <-- void SetDesc( const ::rtl::OUString& rDesc ); ::com::sun::star::text::TextContentAnchorType GetAnchorType() const { return eAnchorType; } @@ -829,7 +837,11 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( , sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo")) , sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")) , sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter")) -, sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")) +// --> OD 2009-07-22 #i73249# +//, sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")) +, sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")) +, sDescription(RTL_CONSTASCII_USTRINGPARAM("Description")) +// <-- , sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName")) , sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation")) , sTextBoxServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")) @@ -1262,18 +1274,31 @@ void XMLTextFrameContext_Impl::SetHyperlink( const OUString& rHRef, } } +// --> OD 2009-07-22 #i73249# +void XMLTextFrameContext_Impl::SetTitle( const OUString& rTitle ) +{ + if ( xPropSet.is() ) + { + Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); + if( xPropSetInfo->hasPropertyByName( sTitle ) ) + { + xPropSet->setPropertyValue( sTitle, makeAny( rTitle ) ); + } + } +} + void XMLTextFrameContext_Impl::SetDesc( const OUString& rDesc ) { if ( xPropSet.is() ) { - Reference< XPropertySetInfo > xPropSetInfo = - xPropSet->getPropertySetInfo(); - if( xPropSetInfo->hasPropertyByName( sAlternativeText ) ) + Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); + if( xPropSetInfo->hasPropertyByName( sDescription ) ) { - xPropSet->setPropertyValue( sAlternativeText, makeAny( rDesc ) ); + xPropSet->setPropertyValue( sDescription, makeAny( rDesc ) ); } } } +// <-- //----------------------------------------------------------------------------------------------------- @@ -1312,6 +1337,10 @@ XMLTextFrameContext::XMLTextFrameContext( : SvXMLImportContext( rImport, nPrfx, rLName ) , m_xAttrList( new SvXMLAttributeList( xAttrList ) ) , m_pHyperlink( 0 ) +// --> OD 2009-07-22 #i73249# +, m_sTitle() +, m_sDesc() +// <-- , m_eDefaultAnchorType( eATyp ) // --> OD 2006-03-10 #i51726# , m_HasAutomaticStyleWithoutParentStyle( sal_False ) @@ -1374,9 +1403,20 @@ void XMLTextFrameContext::EndElement() { pImpl->CreateIfNotThere(); - // alternative text + // --> OD 2009-07-22 #i73249# +// // alternative text +// if( m_sDesc.getLength() ) +// pImpl->SetDesc( m_sDesc ); + // svg:title + if( m_sTitle.getLength() ) + { + pImpl->SetTitle( m_sTitle ); + } if( m_sDesc.getLength() ) + { pImpl->SetDesc( m_sDesc ); + } + // <-- if( m_pHyperlink ) { @@ -1494,10 +1534,40 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext( // the child is a writer frame if( XML_NAMESPACE_SVG == p_nPrefix ) { - bool bOld = SvXMLImport::OOo_2x >= GetImport().getGeneratorVersion(); - if( IsXMLToken( rLocalName, bOld ? XML_DESC : XML_TITLE ) ) - pContext = new XMLTextFrameDescContext_Impl( GetImport(), p_nPrefix, rLocalName, - xAttrList, m_sDesc ); + // --> OD 2009-07-22 #i73249# +// bool bOld = SvXMLImport::OOo_2x >= GetImport().getGeneratorVersion(); +// if( IsXMLToken( rLocalName, bOld ? XML_DESC : XML_TITLE ) ) +// pContext = new XMLTextFrameDescContext_Impl( GetImport(), p_nPrefix, rLocalName, +// xAttrList, m_sDesc ); + const bool bOld = SvXMLImport::OOo_2x >= GetImport().getGeneratorVersion(); + if ( bOld ) + { + if ( IsXMLToken( rLocalName, XML_DESC ) ) + { + pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(), + p_nPrefix, + rLocalName, + m_sTitle ); + } + } + else + { + if( IsXMLToken( rLocalName, XML_TITLE ) ) + { + pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(), + p_nPrefix, + rLocalName, + m_sTitle ); + } + else if ( IsXMLToken( rLocalName, XML_DESC ) ) + { + pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(), + p_nPrefix, + rLocalName, + m_sDesc ); + } + } + // <-- } else if( XML_NAMESPACE_DRAW == p_nPrefix ) { diff --git a/xmloff/source/text/XMLTextFrameContext.hxx b/xmloff/source/text/XMLTextFrameContext.hxx index 9b620a993590..51e41d45367c 100644 --- a/xmloff/source/text/XMLTextFrameContext.hxx +++ b/xmloff/source/text/XMLTextFrameContext.hxx @@ -53,6 +53,9 @@ class XMLTextFrameContext : public SvXMLImportContext SvXMLAttributeList *m_pAttrList; XMLTextFrameContextHyperlink_Impl *m_pHyperlink; + // --> OD 2009-07-22 #i73249# + ::rtl::OUString m_sTitle; + // <-- ::rtl::OUString m_sDesc; ::com::sun::star::text::TextContentAnchorType m_eDefaultAnchorType; diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index a96fe0ffd1a2..6a3b66ec58ee 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1128,7 +1128,11 @@ XMLTextParagraphExport::XMLTextParagraphExport( // <-- sActualSize(RTL_CONSTASCII_USTRINGPARAM("ActualSize")), - sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")), + // --> OD 2009-07-22 #i73249# +// sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")), + sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")), + sDescription(RTL_CONSTASCII_USTRINGPARAM("Description")), + // <-- sAnchorCharStyleName(RTL_CONSTASCII_USTRINGPARAM("AnchorCharStyleName")), sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo")), sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType")), @@ -2782,6 +2786,10 @@ void XMLTextParagraphExport::_exportTextFrame( // image map GetExport().GetImageMapExport().Export( rPropSet ); + // --> OD 2009-07-22 #i73249# + // svg:title and svg:desc + exportTitleAndDescription( rPropSet, rPropSetInfo ); + // <-- } void XMLTextParagraphExport::exportContour( @@ -2973,8 +2981,10 @@ void XMLTextParagraphExport::_exportTextGraphic( // image map GetExport().GetImageMapExport().Export( rPropSet ); - // svg:desc - exportAlternativeText( rPropSet, rPropSetInfo ); + // --> OD 2009-07-22 #i73249# + // svg:title and svg:desc + exportTitleAndDescription( rPropSet, rPropSetInfo ); + // <-- // draw:contour exportContour( rPropSet, rPropSetInfo ); @@ -3003,23 +3013,39 @@ void XMLTextParagraphExport::exportEvents( const Reference < XPropertySet > & rP if (rPropSet->getPropertySetInfo()->hasPropertyByName(sImageMap)) GetExport().GetImageMapExport().Export( rPropSet ); } -void XMLTextParagraphExport::exportAlternativeText( + +// --> OD 2009-07-22 #i73249# +void XMLTextParagraphExport::exportTitleAndDescription( const Reference < XPropertySet > & rPropSet, const Reference < XPropertySetInfo > & rPropSetInfo ) { // svg:title - if( rPropSetInfo->hasPropertyByName( sAlternativeText ) ) + if( rPropSetInfo->hasPropertyByName( sTitle ) ) { - OUString sAltText; - rPropSet->getPropertyValue( sAlternativeText ) >>= sAltText; - if( sAltText.getLength() ) + OUString sObjTitle; + rPropSet->getPropertyValue( sTitle ) >>= sObjTitle; + if( sObjTitle.getLength() ) { SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_SVG, XML_TITLE, sal_True, sal_False ); - GetExport().Characters( sAltText ); + GetExport().Characters( sObjTitle ); + } + } + + // svg:description + if( rPropSetInfo->hasPropertyByName( sDescription ) ) + { + OUString sObjDesc; + rPropSet->getPropertyValue( sDescription ) >>= sObjDesc; + if( sObjDesc.getLength() ) + { + SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_SVG, + XML_DESC, sal_True, sal_False ); + GetExport().Characters( sObjDesc ); } } } +// <-- void XMLTextParagraphExport::setTextEmbeddedGraphicURL( const Reference < XPropertySet >&, -- cgit v1.2.3