diff options
author | Rosemary Sebastian <rosemaryseb8@gmail.com> | 2016-01-29 19:15:08 +0530 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-02-02 09:10:43 +0000 |
commit | 04eba5f599b8ac2accfc1d6abc74a91c38616691 (patch) | |
tree | 395e782ae9db48cd14c304011e294b75d8fc0dd8 /oox/source/drawingml | |
parent | 90dfa7cbcaf32aab6005b94b393c7c409ff1af8f (diff) |
Export and import of file name field
Change-Id: Ic2c8ce0ff2a54079ef81f6ce2770497a9d22c7b6
Reviewed-on: https://gerrit.libreoffice.org/21902
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r-- | oox/source/drawingml/textfield.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx index 7c5fba03b1c2..7a338981c42e 100644 --- a/oox/source/drawingml/textfield.cxx +++ b/oox/source/drawingml/textfield.cxx @@ -140,6 +140,30 @@ void lclCreateTextFields( std::list< Reference< XTextField > > & aFields, xIface = xFactory->createInstance( "com.sun.star.text.TextField.PageNumber" ); aFields.push_back( Reference< XTextField > ( xIface, UNO_QUERY ) ); } + else if ( sType.startsWith("file") ) + { + OString s = OUStringToOString( sType, RTL_TEXTENCODING_UTF8); + OString p( s.pData->buffer + 4 ); + int idx = p.toInt32(); + xIface = xFactory->createInstance( "com.sun.star.text.TextField.FileName" ); + aFields.push_back( Reference< XTextField > ( xIface, UNO_QUERY ) ); + Reference< XPropertySet > xProps( xIface, UNO_QUERY_THROW ); + + switch( idx ) + { + case 1: // Path + xProps->setPropertyValue("FileFormat", makeAny<sal_Int16>(1)); + break; + case 2: // File name without extension + xProps->setPropertyValue("FileFormat", makeAny<sal_Int16>(2)); + break; + case 3: // File name with extension + xProps->setPropertyValue("FileFormat", makeAny<sal_Int16>(3)); + break; + default: // Path/File name + xProps->setPropertyValue("FileFormat", makeAny<sal_Int16>(0)); + } + } } } // namespace |