Kaydet (Commit) 90b63345 authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann

125086: correct UNO-API implementation for <com::sun::star::text::XTextField> in…

125086: correct UNO-API implementation for <com::sun::star::text::XTextField> in Writer to reflect changes made for the in-place editing of Input Fields
üst 0ce4a90e
......@@ -27,6 +27,8 @@
#include <tools/string.hxx>
#include <pam.hxx>
#include <boost/shared_ptr.hpp>
class SwTxtNode;
// ATT_FLD ***********************************
......@@ -68,6 +70,13 @@ public:
// enable notification that field content has changed and needs reformatting
virtual void NotifyContentChange( SwFmtFld& rFmtFld );
// deletes the given field via removing the corresponding text selection from the document's content
static void DeleteTxtFld( const SwTxtFld& rTxtFld );
// return text selection for the given field
static void GetPamForTxtFld( const SwTxtFld& rTxtFld,
boost::shared_ptr< SwPaM >& rPamForTxtFld );
};
class SwTxtInputFld : public SwTxtFld
......
......@@ -456,6 +456,43 @@ void SwTxtFld::NotifyContentChange(SwFmtFld& rFmtFld)
}
/*static*/
void SwTxtFld::GetPamForTxtFld(
const SwTxtFld& rTxtFld,
boost::shared_ptr< SwPaM >& rPamForTxtFld )
{
if ( rTxtFld.GetpTxtNode() == NULL )
{
ASSERT( false, "<SwTxtFld::GetPamForField> - missing <SwTxtNode>" );
return;
}
const SwTxtNode& rTxtNode = rTxtFld.GetTxtNode();
rPamForTxtFld.reset( new SwPaM( rTxtNode,
( (rTxtFld.End() != NULL) ? *(rTxtFld.End()) : ( *(rTxtFld.GetStart()) + 1 ) ),
rTxtNode,
*(rTxtFld.GetStart()) ) );
}
/*static*/
void SwTxtFld::DeleteTxtFld( const SwTxtFld& rTxtFld )
{
if ( rTxtFld.GetpTxtNode() != NULL )
{
boost::shared_ptr< SwPaM > pPamForTxtFld;
GetPamForTxtFld( rTxtFld, pPamForTxtFld );
if ( pPamForTxtFld.get() != NULL )
{
rTxtFld.GetTxtNode().GetDoc()->DeleteAndJoin( *pPamForTxtFld );
}
}
}
// input field in-place editing
SwTxtInputFld::SwTxtInputFld(
SwFmtFld & rAttr,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment