Introduce msfilter::util::findQuotedText()
This was in writerfilter, but we'll need it soon in sw as well, so move it down to msfilter. Change-Id: I8efe02b6bbe8f391d9e14857ed58dbae184d5632
This commit is contained in:
@@ -427,6 +427,25 @@ const ApiPaperSize& PaperSizeConv::getApiSizeForMSPaperSizeIndex( sal_Int32 nMSO
|
|||||||
return spPaperSizeTable[ nMSOPaperIndex ];
|
return spPaperSizeTable[ nMSOPaperIndex ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OUString findQuotedText( const OUString& rCommand,
|
||||||
|
const sal_Char* cStartQuote, const sal_Unicode uEndQuote )
|
||||||
|
{
|
||||||
|
OUString sRet;
|
||||||
|
OUString sStartQuote( OUString::createFromAscii(cStartQuote) );
|
||||||
|
sal_Int32 nStartIndex = rCommand.indexOf( sStartQuote );
|
||||||
|
if( nStartIndex >= 0 )
|
||||||
|
{
|
||||||
|
sal_Int32 nStartLength = sStartQuote.getLength();
|
||||||
|
sal_Int32 nEndIndex = rCommand.indexOf( uEndQuote, nStartIndex + nStartLength);
|
||||||
|
if( nEndIndex > nStartIndex )
|
||||||
|
{
|
||||||
|
sRet = rCommand.copy( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sRet;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -88,6 +88,13 @@ public:
|
|||||||
static sal_Int32 getMSPaperSizeIndex( const com::sun::star::awt::Size& rSize );
|
static sal_Int32 getMSPaperSizeIndex( const com::sun::star::awt::Size& rSize );
|
||||||
static const ApiPaperSize& getApiSizeForMSPaperSizeIndex( sal_Int32 nMSOPaperIndex );
|
static const ApiPaperSize& getApiSizeForMSPaperSizeIndex( sal_Int32 nMSOPaperIndex );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the quoted text in a field instruction text.
|
||||||
|
*
|
||||||
|
* Example: SEQ "Figure" \someoption -> "Figure"
|
||||||
|
*/
|
||||||
|
MSFILTER_DLLPUBLIC OUString findQuotedText( const OUString& rCommand, const sal_Char* cStartQuote, const sal_Unicode uEndQuote );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,6 +71,7 @@
|
|||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
#include <vcl/outdev.hxx>
|
#include <vcl/outdev.hxx>
|
||||||
#include <officecfg/Office/Common.hxx>
|
#include <officecfg/Office/Common.hxx>
|
||||||
|
#include <filter/msfilter/util.hxx>
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
using namespace ::rtl;
|
using namespace ::rtl;
|
||||||
@@ -1822,33 +1823,12 @@ void DomainMapper_Impl::PopShapeContext()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OUString lcl_FindQuotedText( const OUString& rCommand,
|
|
||||||
const sal_Char* cStartQuote, const sal_Unicode uEndQuote )
|
|
||||||
{
|
|
||||||
OUString sRet;
|
|
||||||
OUString sStartQuote( OUString::createFromAscii(cStartQuote) );
|
|
||||||
sal_Int32 nStartIndex = rCommand.indexOf( sStartQuote );
|
|
||||||
if( nStartIndex >= 0 )
|
|
||||||
{
|
|
||||||
sal_Int32 nStartLength = sStartQuote.getLength();
|
|
||||||
sal_Int32 nEndIndex = rCommand.indexOf( uEndQuote, nStartIndex + nStartLength);
|
|
||||||
if( nEndIndex > nStartIndex )
|
|
||||||
{
|
|
||||||
sRet = rCommand.copy( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sRet;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sal_Int16 lcl_ParseNumberingType( const OUString& rCommand )
|
sal_Int16 lcl_ParseNumberingType( const OUString& rCommand )
|
||||||
{
|
{
|
||||||
sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR;
|
sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR;
|
||||||
|
|
||||||
// The command looks like: " PAGE \* Arabic "
|
// The command looks like: " PAGE \* Arabic "
|
||||||
OUString sNumber = lcl_FindQuotedText(rCommand, "\\* ", ' ');
|
OUString sNumber = msfilter::util::findQuotedText(rCommand, "\\* ", ' ');
|
||||||
|
|
||||||
if( !sNumber.isEmpty() )
|
if( !sNumber.isEmpty() )
|
||||||
{
|
{
|
||||||
@@ -1943,7 +1923,7 @@ style::NumberingType::
|
|||||||
OUString lcl_ParseFormat( const OUString& rCommand )
|
OUString lcl_ParseFormat( const OUString& rCommand )
|
||||||
{
|
{
|
||||||
// The command looks like: " DATE \@ "dd MMMM yyyy"
|
// The command looks like: " DATE \@ "dd MMMM yyyy"
|
||||||
return lcl_FindQuotedText(rCommand, "\\@ \"", '\"');
|
return msfilter::util::findQuotedText(rCommand, "\\@ \"", '\"');
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
extract a parameter (with or without quotes) between the command and the following backslash
|
extract a parameter (with or without quotes) between the command and the following backslash
|
||||||
@@ -3238,7 +3218,7 @@ void DomainMapper_Impl::CloseFieldCommand()
|
|||||||
// command looks like: " SEQ Table \* ARABIC "
|
// command looks like: " SEQ Table \* ARABIC "
|
||||||
OUString sCmd(pContext->GetCommand());
|
OUString sCmd(pContext->GetCommand());
|
||||||
// find the sequence name, e.g. "SEQ"
|
// find the sequence name, e.g. "SEQ"
|
||||||
OUString sSeqName = lcl_FindQuotedText(sCmd, "SEQ ", '\\');
|
OUString sSeqName = msfilter::util::findQuotedText(sCmd, "SEQ ", '\\');
|
||||||
sSeqName = sSeqName.trim();
|
sSeqName = sSeqName.trim();
|
||||||
|
|
||||||
// create a sequence field master using the sequence name
|
// create a sequence field master using the sequence name
|
||||||
|
Reference in New Issue
Block a user