Drop uses of css::uno::Sequence::getConstArray in canvas .. connectivity
where it was obsoleted by commits2484de6728(Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) andfb3c04bd19(Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: I9467028fd1a7eeafad7f0dd776a91a9a40770b48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166816 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -142,13 +142,10 @@ CanvasFactory::CanvasFactory( Reference<XComponentContext> const & xContext ) :
|
||||
Reference<container::XHierarchicalNameAccess> xHierarchicalNameAccess(
|
||||
xNameAccess, UNO_QUERY_THROW);
|
||||
|
||||
Sequence<OUString> serviceNames = xNameAccess->getElementNames();
|
||||
const OUString* pCurr = serviceNames.getConstArray();
|
||||
const OUString* const pEnd = pCurr + serviceNames.getLength();
|
||||
while( pCurr != pEnd )
|
||||
for (auto& serviceName : xNameAccess->getElementNames())
|
||||
{
|
||||
Reference<container::XNameAccess> xEntryNameAccess(
|
||||
xHierarchicalNameAccess->getByHierarchicalName(*pCurr),
|
||||
xHierarchicalNameAccess->getByHierarchicalName(serviceName),
|
||||
UNO_QUERY );
|
||||
|
||||
if( xEntryNameAccess.is() )
|
||||
@@ -156,20 +153,17 @@ CanvasFactory::CanvasFactory( Reference<XComponentContext> const & xContext ) :
|
||||
Sequence<OUString> implementationList;
|
||||
if( xEntryNameAccess->getByName("PreferredImplementations") >>= implementationList )
|
||||
{
|
||||
m_aAvailableImplementations.emplace_back(*pCurr,implementationList );
|
||||
m_aAvailableImplementations.emplace_back(serviceName, implementationList);
|
||||
}
|
||||
if( xEntryNameAccess->getByName("AcceleratedImplementations") >>= implementationList )
|
||||
{
|
||||
m_aAcceleratedImplementations.emplace_back(*pCurr,implementationList );
|
||||
m_aAcceleratedImplementations.emplace_back(serviceName, implementationList);
|
||||
}
|
||||
if( xEntryNameAccess->getByName("AntialiasingImplementations") >>= implementationList )
|
||||
{
|
||||
m_aAAImplementations.emplace_back(*pCurr,implementationList );
|
||||
m_aAAImplementations.emplace_back(serviceName, implementationList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
++pCurr;
|
||||
}
|
||||
}
|
||||
catch (const RuntimeException &)
|
||||
|
||||
+126
-203
@@ -209,104 +209,89 @@ namespace canvas::tools
|
||||
}
|
||||
virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) override
|
||||
{
|
||||
const double* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::RGBColor > aRes(nLen/4);
|
||||
rendering::RGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]);
|
||||
pIn += 4;
|
||||
*pOut++ = rendering::RGBColor(deviceColor[i], deviceColor[i+1], deviceColor[i+2]);
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) override
|
||||
{
|
||||
SAL_WARN_IF(!deviceColor.hasElements(), "canvas", "empty deviceColor argument");
|
||||
const double* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
|
||||
rendering::ARGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::ARGBColor(pIn[3],pIn[0],pIn[1],pIn[2]);
|
||||
pIn += 4;
|
||||
*pOut++ = rendering::ARGBColor(deviceColor[i+3], deviceColor[i], deviceColor[i+1], deviceColor[i+2]);
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) override
|
||||
{
|
||||
const double* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
|
||||
rendering::ARGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::ARGBColor(pIn[3],pIn[3]*pIn[0],pIn[3]*pIn[1],pIn[3]*pIn[2]);
|
||||
pIn += 4;
|
||||
*pOut++ = rendering::ARGBColor(deviceColor[i+3],
|
||||
deviceColor[i+3] * deviceColor[i],
|
||||
deviceColor[i+3] * deviceColor[i+1],
|
||||
deviceColor[i+3] * deviceColor[i+2]);
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::RGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< double > aRes(nLen*4);
|
||||
uno::Sequence<double> aRes(rgbColor.getLength() * 4);
|
||||
double* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = pIn->Red;
|
||||
*pColors++ = pIn->Green;
|
||||
*pColors++ = pIn->Blue;
|
||||
*pColors++ = color.Red;
|
||||
*pColors++ = color.Green;
|
||||
*pColors++ = color.Blue;
|
||||
*pColors++ = 1.0;
|
||||
++pIn;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< double > aRes(nLen*4);
|
||||
uno::Sequence<double> aRes(rgbColor.getLength() * 4);
|
||||
double* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = pIn->Red;
|
||||
*pColors++ = pIn->Green;
|
||||
*pColors++ = pIn->Blue;
|
||||
*pColors++ = pIn->Alpha;
|
||||
++pIn;
|
||||
*pColors++ = color.Red;
|
||||
*pColors++ = color.Green;
|
||||
*pColors++ = color.Blue;
|
||||
*pColors++ = color.Alpha;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< double > aRes(nLen*4);
|
||||
uno::Sequence<double> aRes(rgbColor.getLength() * 4);
|
||||
double* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = pIn->Red/pIn->Alpha;
|
||||
*pColors++ = pIn->Green/pIn->Alpha;
|
||||
*pColors++ = pIn->Blue/pIn->Alpha;
|
||||
*pColors++ = pIn->Alpha;
|
||||
++pIn;
|
||||
*pColors++ = color.Red / color.Alpha;
|
||||
*pColors++ = color.Green / color.Alpha;
|
||||
*pColors++ = color.Blue / color.Alpha;
|
||||
*pColors++ = color.Alpha;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
@@ -329,21 +314,14 @@ namespace canvas::tools
|
||||
{
|
||||
if( dynamic_cast<StandardColorSpace*>(targetColorSpace.get()) )
|
||||
{
|
||||
const sal_Int8* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence<double> aRes(nLen);
|
||||
double* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
{
|
||||
*pOut++ = vcl::unotools::toDoubleColor(*pIn++);
|
||||
*pOut++ = vcl::unotools::toDoubleColor(*pIn++);
|
||||
*pOut++ = vcl::unotools::toDoubleColor(*pIn++);
|
||||
*pOut++ = vcl::unotools::toDoubleColor(*pIn++);
|
||||
}
|
||||
std::transform(deviceColor.begin(), deviceColor.end(), aRes.getArray(),
|
||||
[](auto c) { return vcl::unotools::toDoubleColor(c); });
|
||||
return aRes;
|
||||
}
|
||||
else
|
||||
@@ -374,120 +352,102 @@ namespace canvas::tools
|
||||
}
|
||||
virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override
|
||||
{
|
||||
const sal_Int8* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::RGBColor > aRes(nLen/4);
|
||||
rendering::RGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::RGBColor(
|
||||
vcl::unotools::toDoubleColor(pIn[0]),
|
||||
vcl::unotools::toDoubleColor(pIn[1]),
|
||||
vcl::unotools::toDoubleColor(pIn[2]));
|
||||
pIn += 4;
|
||||
vcl::unotools::toDoubleColor(deviceColor[i]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+1]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+2]));
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override
|
||||
{
|
||||
const sal_Int8* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
|
||||
rendering::ARGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::ARGBColor(
|
||||
vcl::unotools::toDoubleColor(pIn[3]),
|
||||
vcl::unotools::toDoubleColor(pIn[0]),
|
||||
vcl::unotools::toDoubleColor(pIn[1]),
|
||||
vcl::unotools::toDoubleColor(pIn[2]));
|
||||
pIn += 4;
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+3]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+1]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+2]));
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override
|
||||
{
|
||||
const sal_Int8* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
|
||||
rendering::ARGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
const sal_Int8 nAlpha( pIn[3] );
|
||||
const sal_Int8 nAlpha(deviceColor[i+3]);
|
||||
*pOut++ = rendering::ARGBColor(
|
||||
vcl::unotools::toDoubleColor(nAlpha),
|
||||
vcl::unotools::toDoubleColor(nAlpha*pIn[0]),
|
||||
vcl::unotools::toDoubleColor(nAlpha*pIn[1]),
|
||||
vcl::unotools::toDoubleColor(nAlpha*pIn[2]));
|
||||
pIn += 4;
|
||||
vcl::unotools::toDoubleColor(nAlpha * deviceColor[i]),
|
||||
vcl::unotools::toDoubleColor(nAlpha * deviceColor[i+1]),
|
||||
vcl::unotools::toDoubleColor(nAlpha * deviceColor[i+2]));
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::RGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< sal_Int8 > aRes(nLen*4);
|
||||
uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4);
|
||||
sal_Int8* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Red);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Green);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Blue);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Red);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Green);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Blue);
|
||||
*pColors++ = 0;
|
||||
++pIn;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< sal_Int8 > aRes(nLen*4);
|
||||
uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4);
|
||||
sal_Int8* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Red);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Green);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Blue);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
|
||||
++pIn;
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Red);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Green);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Blue);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Alpha);
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< sal_Int8 > aRes(nLen*4);
|
||||
uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4);
|
||||
sal_Int8* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
|
||||
++pIn;
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Red / color.Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Green / color.Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Blue / color.Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Alpha);
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
@@ -544,103 +504,85 @@ namespace canvas::tools
|
||||
}
|
||||
virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) override
|
||||
{
|
||||
const double* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::RGBColor > aRes(nLen/4);
|
||||
rendering::RGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]);
|
||||
pIn += 4;
|
||||
*pOut++ = rendering::RGBColor(deviceColor[i], deviceColor[i+1], deviceColor[i+2]);
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) override
|
||||
{
|
||||
const double* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
|
||||
rendering::ARGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]);
|
||||
pIn += 4;
|
||||
*pOut++ = rendering::ARGBColor(1.0, deviceColor[i], deviceColor[i+1], deviceColor[i+2]);
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) override
|
||||
{
|
||||
const double* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
|
||||
rendering::ARGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]);
|
||||
pIn += 4;
|
||||
*pOut++ = rendering::ARGBColor(1.0, deviceColor[i], deviceColor[i+1], deviceColor[i+2]);
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::RGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< double > aRes(nLen*4);
|
||||
uno::Sequence<double> aRes(rgbColor.getLength() * 4);
|
||||
double* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = pIn->Red;
|
||||
*pColors++ = pIn->Green;
|
||||
*pColors++ = pIn->Blue;
|
||||
*pColors++ = color.Red;
|
||||
*pColors++ = color.Green;
|
||||
*pColors++ = color.Blue;
|
||||
*pColors++ = 1.0; // the value does not matter
|
||||
++pIn;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< double > aRes(nLen*4);
|
||||
uno::Sequence<double> aRes(rgbColor.getLength() * 4);
|
||||
double* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = pIn->Red;
|
||||
*pColors++ = pIn->Green;
|
||||
*pColors++ = pIn->Blue;
|
||||
*pColors++ = color.Red;
|
||||
*pColors++ = color.Green;
|
||||
*pColors++ = color.Blue;
|
||||
*pColors++ = 1.0; // the value does not matter
|
||||
++pIn;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< double > aRes(nLen*4);
|
||||
uno::Sequence<double> aRes(rgbColor.getLength() * 4);
|
||||
double* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = pIn->Red/pIn->Alpha;
|
||||
*pColors++ = pIn->Green/pIn->Alpha;
|
||||
*pColors++ = pIn->Blue/pIn->Alpha;
|
||||
*pColors++ = color.Red / color.Alpha;
|
||||
*pColors++ = color.Green / color.Alpha;
|
||||
*pColors++ = color.Blue / color.Alpha;
|
||||
*pColors++ = 1.0; // the value does not matter
|
||||
++pIn;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
@@ -663,20 +605,19 @@ namespace canvas::tools
|
||||
{
|
||||
if( dynamic_cast<StandardNoAlphaColorSpace*>(targetColorSpace.get()) )
|
||||
{
|
||||
const sal_Int8* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence<double> aRes(nLen);
|
||||
double* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = vcl::unotools::toDoubleColor(*pIn++);
|
||||
*pOut++ = vcl::unotools::toDoubleColor(*pIn++);
|
||||
*pOut++ = vcl::unotools::toDoubleColor(*pIn++);
|
||||
*pOut++ = 1.0; pIn++;
|
||||
*pOut++ = vcl::unotools::toDoubleColor(deviceColor[i]);
|
||||
*pOut++ = vcl::unotools::toDoubleColor(deviceColor[i+1]);
|
||||
*pOut++ = vcl::unotools::toDoubleColor(deviceColor[i+2]);
|
||||
*pOut++ = 1.0;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
@@ -708,119 +649,101 @@ namespace canvas::tools
|
||||
}
|
||||
virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override
|
||||
{
|
||||
const sal_Int8* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::RGBColor > aRes(nLen/4);
|
||||
rendering::RGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::RGBColor(
|
||||
vcl::unotools::toDoubleColor(pIn[0]),
|
||||
vcl::unotools::toDoubleColor(pIn[1]),
|
||||
vcl::unotools::toDoubleColor(pIn[2]));
|
||||
pIn += 4;
|
||||
vcl::unotools::toDoubleColor(deviceColor[i]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+1]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+2]));
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override
|
||||
{
|
||||
const sal_Int8* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
|
||||
rendering::ARGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::ARGBColor(
|
||||
1.0,
|
||||
vcl::unotools::toDoubleColor(pIn[0]),
|
||||
vcl::unotools::toDoubleColor(pIn[1]),
|
||||
vcl::unotools::toDoubleColor(pIn[2]));
|
||||
pIn += 4;
|
||||
vcl::unotools::toDoubleColor(deviceColor[i]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+1]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+2]));
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override
|
||||
{
|
||||
const sal_Int8* pIn( deviceColor.getConstArray() );
|
||||
const std::size_t nLen( deviceColor.getLength() );
|
||||
const sal_Int32 nLen(deviceColor.getLength());
|
||||
ENSURE_ARG_OR_THROW2(nLen%4==0,
|
||||
"number of channels no multiple of 4",
|
||||
static_cast<rendering::XColorSpace*>(this), 0);
|
||||
|
||||
uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
|
||||
rendering::ARGBColor* pOut( aRes.getArray() );
|
||||
for( std::size_t i=0; i<nLen; i+=4 )
|
||||
for (sal_Int32 i = 0; i < nLen; i += 4)
|
||||
{
|
||||
*pOut++ = rendering::ARGBColor(
|
||||
1.0,
|
||||
vcl::unotools::toDoubleColor(pIn[0]),
|
||||
vcl::unotools::toDoubleColor(pIn[1]),
|
||||
vcl::unotools::toDoubleColor(pIn[2]));
|
||||
pIn += 4;
|
||||
vcl::unotools::toDoubleColor(deviceColor[i]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+1]),
|
||||
vcl::unotools::toDoubleColor(deviceColor[i+2]));
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::RGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< sal_Int8 > aRes(nLen*4);
|
||||
uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4);
|
||||
sal_Int8* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Red);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Green);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Blue);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Red);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Green);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Blue);
|
||||
*pColors++ = 1.0;
|
||||
++pIn;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< sal_Int8 > aRes(nLen*4);
|
||||
uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4);
|
||||
sal_Int8* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Red);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Green);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Blue);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Red);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Green);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Blue);
|
||||
*pColors++ = -1;
|
||||
++pIn;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
|
||||
{
|
||||
const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
|
||||
const std::size_t nLen( rgbColor.getLength() );
|
||||
|
||||
uno::Sequence< sal_Int8 > aRes(nLen*4);
|
||||
uno::Sequence<sal_Int8> aRes(rgbColor.getLength() * 4);
|
||||
sal_Int8* pColors=aRes.getArray();
|
||||
for( std::size_t i=0; i<nLen; ++i )
|
||||
for (auto& color : rgbColor)
|
||||
{
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Red / color.Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Green / color.Alpha);
|
||||
*pColors++ = vcl::unotools::toByteColor(color.Blue / color.Alpha);
|
||||
*pColors++ = -1;
|
||||
++pIn;
|
||||
}
|
||||
return aRes;
|
||||
}
|
||||
|
||||
@@ -520,18 +520,16 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
TypeAttributes::BeforeFieldInit |
|
||||
TypeAttributes::AnsiClass) );
|
||||
|
||||
Sequence< Reference<
|
||||
const Sequence< Reference<
|
||||
reflection::XConstantTypeDescription > > seq_constants(
|
||||
xType->getConstants() );
|
||||
Reference< reflection::XConstantTypeDescription > const * constants =
|
||||
seq_constants.getConstArray();
|
||||
sal_Int32 constants_length = seq_constants.getLength();
|
||||
for ( sal_Int32 constants_pos = 0;
|
||||
constants_pos < constants_length; ++constants_pos )
|
||||
{
|
||||
Reference<
|
||||
reflection::XConstantTypeDescription > const & xConstant =
|
||||
constants[ constants_pos ];
|
||||
seq_constants[ constants_pos ];
|
||||
::System::Object ^ constant =
|
||||
to_cli_constant( xConstant->getConstantValue() );
|
||||
::System::String ^ uno_name =
|
||||
@@ -575,12 +573,10 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
(FieldAttributes) (FieldAttributes::Private |
|
||||
FieldAttributes::SpecialName |
|
||||
FieldAttributes::RTSpecialName) );
|
||||
Sequence< OUString > seq_enum_names( xType->getEnumNames() );
|
||||
Sequence< sal_Int32 > seq_enum_values( xType->getEnumValues() );
|
||||
const Sequence< OUString > seq_enum_names( xType->getEnumNames() );
|
||||
const Sequence< sal_Int32 > seq_enum_values( xType->getEnumValues() );
|
||||
sal_Int32 enum_length = seq_enum_names.getLength();
|
||||
OSL_ASSERT( enum_length == seq_enum_values.getLength() );
|
||||
OUString const * enum_names = seq_enum_names.getConstArray();
|
||||
sal_Int32 const * enum_values = seq_enum_values.getConstArray();
|
||||
for ( sal_Int32 enum_pos = 0; enum_pos < enum_length; ++enum_pos )
|
||||
{
|
||||
// enum_builder->DefineLiteral(
|
||||
@@ -588,13 +584,13 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
// __box ((::System::Int32) enum_values[ enum_pos ]) );
|
||||
Emit::FieldBuilder ^ field_builder =
|
||||
enum_builder->DefineField(
|
||||
ustring_to_String( enum_names[ enum_pos ] ),
|
||||
ustring_to_String( seq_enum_names[ enum_pos ] ),
|
||||
enum_builder,
|
||||
(FieldAttributes) (FieldAttributes::Public |
|
||||
FieldAttributes::Static |
|
||||
FieldAttributes::Literal) );
|
||||
field_builder->SetConstant(
|
||||
((::System::Int32) enum_values[ enum_pos ]) );
|
||||
((::System::Int32) seq_enum_values[ enum_pos ]) );
|
||||
}
|
||||
|
||||
if (g_bVerbose)
|
||||
@@ -844,18 +840,16 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
}
|
||||
}
|
||||
|
||||
Sequence<
|
||||
const Sequence<
|
||||
Reference< reflection::XInterfaceMemberTypeDescription > > seq_members(
|
||||
xType->getMembers() );
|
||||
Reference< reflection::XInterfaceMemberTypeDescription > const * members =
|
||||
seq_members.getConstArray();
|
||||
sal_Int32 members_length = seq_members.getLength();
|
||||
for ( sal_Int32 members_pos = 0;
|
||||
members_pos < members_length; ++members_pos )
|
||||
{
|
||||
Reference<
|
||||
reflection::XInterfaceMemberTypeDescription > const & xMember =
|
||||
members[ members_pos ];
|
||||
seq_members[ members_pos ];
|
||||
Sequence< Reference< reflection::XTypeDescription > > seq_exceptions;
|
||||
|
||||
MethodAttributes c_method_attr = (MethodAttributes)
|
||||
@@ -870,21 +864,19 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
Reference< reflection::XInterfaceMethodTypeDescription > xMethod(
|
||||
xMember, UNO_QUERY_THROW );
|
||||
|
||||
Sequence<
|
||||
const Sequence<
|
||||
Reference< reflection::XMethodParameter > > seq_parameters(
|
||||
xMethod->getParameters() );
|
||||
sal_Int32 params_length = seq_parameters.getLength();
|
||||
array< ::System::Type^>^ param_types =
|
||||
gcnew array< ::System::Type^>( params_length );
|
||||
Reference< reflection::XMethodParameter > const * parameters =
|
||||
seq_parameters.getConstArray();
|
||||
// first determine all types
|
||||
//Make the first param type as return type
|
||||
sal_Int32 params_pos = 0;
|
||||
for ( ; params_pos < params_length; ++params_pos )
|
||||
{
|
||||
Reference< reflection::XMethodParameter > const & xParam =
|
||||
parameters[ params_pos ];
|
||||
seq_parameters[ params_pos ];
|
||||
::System::Type ^ param_type = get_type( xParam->getType() );
|
||||
::System::String ^ param_type_name = param_type->FullName;
|
||||
if (xParam->isOut())
|
||||
@@ -913,7 +905,7 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
for ( ; params_pos < params_length; ++params_pos )
|
||||
{
|
||||
Reference< reflection::XMethodParameter > const & xParam =
|
||||
parameters[ params_pos ];
|
||||
seq_parameters[ params_pos ];
|
||||
long param_flags = 0;
|
||||
if (xParam->isIn())
|
||||
param_flags |= (long)ParameterAttributes::In;
|
||||
@@ -932,19 +924,17 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
|
||||
if (xReturnStruct.is())
|
||||
{
|
||||
Sequence<Reference<reflection::XTypeDescription> > seq_type_args =
|
||||
const Sequence<Reference<reflection::XTypeDescription> > seq_type_args =
|
||||
xReturnStruct->getTypeArguments();
|
||||
if (seq_type_args.getLength() != 0)
|
||||
{
|
||||
//get th ctor of the attribute
|
||||
array< ::System::Type^>^ arCtor = {::System::Type::GetType("System.Type[]")};
|
||||
//Get the arguments for the attribute's ctor
|
||||
Reference<reflection::XTypeDescription> const * arXTypeArgs =
|
||||
seq_type_args.getConstArray();
|
||||
int numTypes = seq_type_args.getLength();
|
||||
array< ::System::Type^>^ arCtsTypes = gcnew array< ::System::Type^>(numTypes);
|
||||
for (int i = 0; i < numTypes; i++)
|
||||
arCtsTypes[i] = get_type(arXTypeArgs[i]);
|
||||
arCtsTypes[i] = get_type(seq_type_args[i]);
|
||||
array< ::System::Object^>^ arArgs = {arCtsTypes};
|
||||
|
||||
Emit::CustomAttributeBuilder ^ attrBuilder =
|
||||
@@ -1080,7 +1070,7 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
{
|
||||
array< ::System::Object^>^ aArg = gcnew array< ::System::Object^>(numTypes);
|
||||
for (int i = 0; i < numTypes; i++)
|
||||
aArg[i] = ustring_to_String(seq_type_parameters.getConstArray()[i]);
|
||||
aArg[i] = ustring_to_String(seq_type_parameters[i]);
|
||||
array< ::System::Object^>^ args = {aArg};
|
||||
|
||||
array< ::System::Type^>^ arTypesCtor =
|
||||
@@ -1105,22 +1095,18 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
}
|
||||
|
||||
// members
|
||||
Sequence< Reference< reflection::XTypeDescription > > seq_members(
|
||||
const Sequence< Reference< reflection::XTypeDescription > > seq_members(
|
||||
entry->m_xType->getMemberTypes() );
|
||||
Sequence< OUString > seq_member_names( entry->m_xType->getMemberNames() );
|
||||
const Sequence< OUString > seq_member_names( entry->m_xType->getMemberNames() );
|
||||
sal_Int32 members_length = seq_members.getLength();
|
||||
OSL_ASSERT( seq_member_names.getLength() == members_length );
|
||||
//check if we have a XTypeDescription for every member. If not then the user may
|
||||
//have forgotten to specify additional rdbs with the --extra option.
|
||||
Reference< reflection::XTypeDescription > const * pseq_members =
|
||||
seq_members.getConstArray();
|
||||
OUString const * pseq_member_names =
|
||||
seq_member_names.getConstArray();
|
||||
for (int i = 0; i < members_length; i++)
|
||||
{
|
||||
const OUString sType(entry->m_xType->getName());
|
||||
const OUString sMemberName(pseq_member_names[i]);
|
||||
if ( ! pseq_members[i].is())
|
||||
const OUString sMemberName(seq_member_names[i]);
|
||||
if ( ! seq_members[i].is())
|
||||
throw RuntimeException("Missing type description . Check if you need to "
|
||||
"specify additional RDBs with the --extra option. Type missing for: " + sType +
|
||||
"::" + sMemberName,0);
|
||||
@@ -1231,11 +1217,11 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
for ( member_pos = 0; member_pos < members_length; ++member_pos )
|
||||
{
|
||||
::System::String ^ field_name =
|
||||
ustring_to_String( pseq_member_names[ member_pos ] );
|
||||
ustring_to_String( seq_member_names[ member_pos ] );
|
||||
::System::Type ^ field_type;
|
||||
//Special handling of struct parameter types
|
||||
bool bParameterizedType = false;
|
||||
if (pseq_members[ member_pos ]->getTypeClass() == TypeClass_UNKNOWN)
|
||||
if (seq_members[ member_pos ]->getTypeClass() == TypeClass_UNKNOWN)
|
||||
{
|
||||
bParameterizedType = true;
|
||||
if (type_param_pos < seq_type_parameters.getLength())
|
||||
@@ -1251,7 +1237,7 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
}
|
||||
else
|
||||
{
|
||||
field_type = get_type( pseq_members[ member_pos ] );
|
||||
field_type = get_type( seq_members[ member_pos ] );
|
||||
|
||||
if (field_type->IsArray
|
||||
&& m_incomplete_structs[cts_name]
|
||||
@@ -1262,7 +1248,7 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
while ((value = value->GetElementType())->IsArray);
|
||||
//If the value type is a struct then make sure it is fully created.
|
||||
get_complete_struct(value->FullName);
|
||||
field_type = get_type(pseq_members[member_pos]);
|
||||
field_type = get_type(seq_members[member_pos]);
|
||||
}
|
||||
}
|
||||
members[ member_pos ] =
|
||||
@@ -1275,7 +1261,7 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
//get the name
|
||||
OSL_ASSERT(seq_type_parameters.getLength() > curParamIndex);
|
||||
::System::String^ sTypeName = ustring_to_String(
|
||||
seq_type_parameters.getConstArray()[curParamIndex++]);
|
||||
seq_type_parameters[curParamIndex++]);
|
||||
array< ::System::Object^>^ args = {sTypeName};
|
||||
//set ParameterizedTypeAttribute
|
||||
array< ::System::Type^>^ arCtorTypes = {::System::String::typeid};
|
||||
@@ -1511,18 +1497,17 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
const Reference<reflection::XServiceConstructorDescription> & ctorDes =
|
||||
seqCtors[j];
|
||||
//obtain the parameter types
|
||||
Sequence<Reference<reflection::XParameter> > seqParams =
|
||||
const Sequence<Reference<reflection::XParameter> > seqParams =
|
||||
ctorDes->getParameters();
|
||||
Reference<reflection::XParameter> const * arXParams = seqParams.getConstArray();
|
||||
sal_Int32 cParams = seqParams.getLength();
|
||||
array< ::System::Type^>^ arTypeParameters = gcnew array< ::System::Type^> (cParams + 1);
|
||||
arTypeParameters[0] = get_type("unoidl.com.sun.star.uno.XComponentContext", true);
|
||||
for (int iparam = 0; iparam != cParams; iparam++)
|
||||
{
|
||||
if (arXParams[iparam]->isRestParameter())
|
||||
if (seqParams[iparam]->isRestParameter())
|
||||
arTypeParameters[iparam + 1] = array< ::uno::Any>::typeid;
|
||||
else
|
||||
arTypeParameters[iparam + 1] = get_type(arXParams[iparam]->getType());
|
||||
arTypeParameters[iparam + 1] = get_type(seqParams[iparam]->getType());
|
||||
}
|
||||
//The array arTypeParameters can contain:
|
||||
//System.Type and uno.PolymorphicType.
|
||||
@@ -1572,7 +1557,7 @@ Assembly ^ TypeEmitter::type_resolve(
|
||||
gcnew array<Emit::ParameterBuilder^> (cParams);
|
||||
for (int iparam = 0; iparam != cParams; iparam++)
|
||||
{
|
||||
Reference<reflection::XParameter> const & aParam = arXParams[iparam];
|
||||
Reference<reflection::XParameter> const & aParam = seqParams[iparam];
|
||||
::System::String ^ sParamName = ustring_to_String(aParam->getName());
|
||||
|
||||
arParameterBuilder[iparam] = method_builder->DefineParameter(
|
||||
@@ -1909,9 +1894,6 @@ Emit::CustomAttributeBuilder^ TypeEmitter::get_exception_attribute(
|
||||
{
|
||||
Emit::CustomAttributeBuilder ^ attr_builder = nullptr;
|
||||
|
||||
Reference< reflection::XCompoundTypeDescription > const * exceptions =
|
||||
seq_exceptionsTd.getConstArray();
|
||||
|
||||
array< ::System::Type^>^ arTypesCtor = {::System::Type::GetType("System.Type[]")};
|
||||
ConstructorInfo ^ ctor_ExceptionAttribute =
|
||||
::uno::ExceptionAttribute::typeid->GetConstructor(arTypesCtor);
|
||||
@@ -1924,7 +1906,7 @@ Emit::CustomAttributeBuilder^ TypeEmitter::get_exception_attribute(
|
||||
for ( sal_Int32 exc_pos = 0; exc_pos < exc_length; ++exc_pos )
|
||||
{
|
||||
Reference< reflection::XCompoundTypeDescription > const & xExc =
|
||||
exceptions[ exc_pos ];
|
||||
seq_exceptionsTd[ exc_pos ];
|
||||
exception_types[ exc_pos ] = get_type( xExc );
|
||||
}
|
||||
array< ::System::Object^>^ args = {exception_types};
|
||||
|
||||
@@ -33,13 +33,8 @@ namespace
|
||||
void lcl_convert(const uno::Sequence< OUString >& _aSource,uno::Any& _rDest)
|
||||
{
|
||||
uno::Sequence<uno::Any> aRet(_aSource.getLength());
|
||||
uno::Any* pAny = aRet.getArray();
|
||||
const OUString* pIter = _aSource.getConstArray();
|
||||
const OUString* pEnd = pIter + _aSource.getLength();
|
||||
for (;pIter != pEnd ; ++pIter,++pAny)
|
||||
{
|
||||
*pAny <<= *pIter;
|
||||
}
|
||||
std::transform(_aSource.begin(), _aSource.end(), aRet.getArray(),
|
||||
[](auto& str) { return uno::Any(str); });
|
||||
_rDest <<= aRet;
|
||||
}
|
||||
void lcl_fillValues(const ::utl::OConfigurationNode& _aURLPatternNode,const OUString& _sNode,::comphelper::NamedValueCollection& _rValues)
|
||||
@@ -49,17 +44,14 @@ namespace
|
||||
return;
|
||||
|
||||
uno::Sequence< OUString > aStringSeq;
|
||||
const uno::Sequence< OUString > aProperties = aPropertiesNode.getNodeNames();
|
||||
const OUString* pPropertiesIter = aProperties.getConstArray();
|
||||
const OUString* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
|
||||
for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
|
||||
for (auto& prop : aPropertiesNode.getNodeNames())
|
||||
{
|
||||
uno::Any aValue = aPropertiesNode.getNodeValue(*pPropertiesIter + "/Value");
|
||||
uno::Any aValue = aPropertiesNode.getNodeValue(prop + "/Value");
|
||||
if ( aValue >>= aStringSeq )
|
||||
{
|
||||
lcl_convert(aStringSeq,aValue);
|
||||
}
|
||||
_rValues.put(*pPropertiesIter,aValue);
|
||||
_rValues.put(prop, aValue);
|
||||
} // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter,++pNamedIter)
|
||||
}
|
||||
void lcl_readURLPatternNode(const ::utl::OConfigurationTreeRoot& _aInstalled,const OUString& _sEntry,TInstalledDriver& _rInstalledDriver)
|
||||
@@ -106,15 +98,12 @@ const TInstalledDrivers& DriversConfigImpl::getInstalledDrivers(const uno::Refer
|
||||
|
||||
if ( m_aInstalled.isValid() )
|
||||
{
|
||||
const uno::Sequence< OUString > aURLPatterns = m_aInstalled.getNodeNames();
|
||||
const OUString* pPatternIter = aURLPatterns.getConstArray();
|
||||
const OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength();
|
||||
for (;pPatternIter != pPatternEnd ; ++pPatternIter)
|
||||
for (auto& pattern : m_aInstalled.getNodeNames())
|
||||
{
|
||||
TInstalledDriver aInstalledDriver;
|
||||
lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver);
|
||||
lcl_readURLPatternNode(m_aInstalled, pattern, aInstalledDriver);
|
||||
if ( !aInstalledDriver.sDriverFactory.isEmpty() )
|
||||
m_aDrivers.emplace(*pPatternIter,aInstalledDriver);
|
||||
m_aDrivers.emplace(pattern, aInstalledDriver);
|
||||
}
|
||||
} // if ( m_aInstalled.isValid() )
|
||||
}
|
||||
|
||||
@@ -741,29 +741,25 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
|
||||
return;
|
||||
|
||||
ORows aRowsToSet;
|
||||
const Sequence<Any>* pRowsIter = aRows.getConstArray();
|
||||
const Sequence<Any>* pRowsEnd = pRowsIter + aRows.getLength();
|
||||
for (; pRowsIter != pRowsEnd;++pRowsIter)
|
||||
for (auto& row : aRows)
|
||||
{
|
||||
ORow aRowToSet;
|
||||
const Any* pRowIter = pRowsIter->getConstArray();
|
||||
const Any* pRowEnd = pRowIter + pRowsIter->getLength();
|
||||
for (; pRowIter != pRowEnd;++pRowIter)
|
||||
for (auto& field : row)
|
||||
{
|
||||
ORowSetValueDecoratorRef aValue;
|
||||
switch( pRowIter->getValueTypeClass() )
|
||||
switch (field.getValueTypeClass())
|
||||
{
|
||||
case TypeClass_BOOLEAN:
|
||||
{
|
||||
bool bValue = false;
|
||||
*pRowIter >>= bValue;
|
||||
field >>= bValue;
|
||||
aValue = new ORowSetValueDecorator(ORowSetValue(bValue));
|
||||
}
|
||||
break;
|
||||
case TypeClass_BYTE:
|
||||
{
|
||||
sal_Int8 nValue(0);
|
||||
*pRowIter >>= nValue;
|
||||
field >>= nValue;
|
||||
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
|
||||
}
|
||||
break;
|
||||
@@ -771,7 +767,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
|
||||
case TypeClass_UNSIGNED_SHORT:
|
||||
{
|
||||
sal_Int16 nValue(0);
|
||||
*pRowIter >>= nValue;
|
||||
field >>= nValue;
|
||||
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
|
||||
}
|
||||
break;
|
||||
@@ -779,7 +775,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
|
||||
case TypeClass_UNSIGNED_LONG:
|
||||
{
|
||||
sal_Int32 nValue(0);
|
||||
*pRowIter >>= nValue;
|
||||
field >>= nValue;
|
||||
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
|
||||
}
|
||||
break;
|
||||
@@ -787,28 +783,28 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA
|
||||
case TypeClass_UNSIGNED_HYPER:
|
||||
{
|
||||
sal_Int64 nValue(0);
|
||||
*pRowIter >>= nValue;
|
||||
field >>= nValue;
|
||||
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
|
||||
}
|
||||
break;
|
||||
case TypeClass_FLOAT:
|
||||
{
|
||||
float nValue(0.0);
|
||||
*pRowIter >>= nValue;
|
||||
field >>= nValue;
|
||||
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
|
||||
}
|
||||
break;
|
||||
case TypeClass_DOUBLE:
|
||||
{
|
||||
double nValue(0.0);
|
||||
*pRowIter >>= nValue;
|
||||
field >>= nValue;
|
||||
aValue = new ORowSetValueDecorator(ORowSetValue(nValue));
|
||||
}
|
||||
break;
|
||||
case TypeClass_STRING:
|
||||
{
|
||||
OUString sValue;
|
||||
*pRowIter >>= sValue;
|
||||
field >>= sValue;
|
||||
aValue = new ORowSetValueDecorator(ORowSetValue(sValue));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -965,11 +965,8 @@ OUString ORowSetValue::getString( ) const
|
||||
case DataType::LONGVARBINARY:
|
||||
{
|
||||
OUStringBuffer sVal("0x");
|
||||
Sequence<sal_Int8> aSeq(getSequence());
|
||||
const sal_Int8* pBegin = aSeq.getConstArray();
|
||||
const sal_Int8* pEnd = pBegin + aSeq.getLength();
|
||||
for(;pBegin != pEnd;++pBegin)
|
||||
sVal.append(static_cast<sal_Int32>(*pBegin),16);
|
||||
for (sal_Int32 byte : getSequence())
|
||||
sVal.append(byte, 16);
|
||||
aRet = sVal.makeStringAndClear();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -122,12 +122,10 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( )
|
||||
std::vector<std::shared_ptr<ExpressionNode>> aConditions;
|
||||
if ( aTypeInfoSettings.getLength() > 1 && ((aTypeInfoSettings.getLength() % 2) == 0) )
|
||||
{
|
||||
const Any* pIter = aTypeInfoSettings.getConstArray();
|
||||
const Any* pEnd = pIter + aTypeInfoSettings.getLength();
|
||||
try
|
||||
{
|
||||
for(;pIter != pEnd;++pIter)
|
||||
aConditions.push_back(FunctionParser::parseFunction(::comphelper::getString(*pIter)));
|
||||
for (auto& any : aTypeInfoSettings)
|
||||
aConditions.push_back(FunctionParser::parseFunction(::comphelper::getString(any)));
|
||||
}
|
||||
catch(ParseError&)
|
||||
{
|
||||
|
||||
@@ -1732,15 +1732,14 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
|
||||
|
||||
// now transfer the values from the continuation object to the parameter columns
|
||||
Sequence< PropertyValue > aFinalValues = pParams->getValues();
|
||||
const PropertyValue* pFinalValues = aFinalValues.getConstArray();
|
||||
for (sal_Int32 i=0; i<aFinalValues.getLength(); ++i, ++pFinalValues)
|
||||
for (sal_Int32 i = 0; i < aFinalValues.getLength(); ++i)
|
||||
{
|
||||
Reference< XPropertySet > xParamColumn(xWrappedParameters->getByIndex(i),UNO_QUERY);
|
||||
if (xParamColumn.is())
|
||||
{
|
||||
OUString sName;
|
||||
xParamColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
|
||||
OSL_ENSURE(sName == pFinalValues->Name, "::dbaui::askForParameters: inconsistent parameter names!");
|
||||
OSL_ENSURE(sName == aFinalValues[i].Name, "::dbaui::askForParameters: inconsistent parameter names!");
|
||||
|
||||
// determine the field type and ...
|
||||
sal_Int32 nParamType = 0;
|
||||
@@ -1750,12 +1749,12 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
|
||||
if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE), xParamColumn))
|
||||
xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale;
|
||||
// (the index of the parameters is one-based)
|
||||
TParameterPositions::const_iterator aFind = aParameterNames.find(pFinalValues->Name);
|
||||
TParameterPositions::const_iterator aFind = aParameterNames.find(aFinalValues[i].Name);
|
||||
for(const auto& rItem : aFind->second)
|
||||
{
|
||||
if ( _aParametersSet.empty() || !_aParametersSet[rItem-1] )
|
||||
{
|
||||
_xParameters->setObjectWithInfo(rItem, pFinalValues->Value, nParamType, nScale);
|
||||
_xParameters->setObjectWithInfo(rItem, aFinalValues[i].Value, nParamType, nScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,22 +843,15 @@ bool isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent, Referenc
|
||||
|
||||
if ( xModel.is() )
|
||||
{
|
||||
Sequence< PropertyValue > aArgs = xModel->getArgs();
|
||||
const PropertyValue* pIter = aArgs.getConstArray();
|
||||
const PropertyValue* pEnd = pIter + aArgs.getLength();
|
||||
for(;pIter != pEnd;++pIter)
|
||||
for (auto& arg : xModel->getArgs())
|
||||
{
|
||||
if ( pIter->Name == "ComponentData" )
|
||||
if (arg.Name == "ComponentData")
|
||||
{
|
||||
Sequence<PropertyValue> aDocumentContext;
|
||||
pIter->Value >>= aDocumentContext;
|
||||
const PropertyValue* pContextIter = aDocumentContext.getConstArray();
|
||||
const PropertyValue* pContextEnd = pContextIter + aDocumentContext.getLength();
|
||||
for(;pContextIter != pContextEnd;++pContextIter)
|
||||
arg.Value >>= aDocumentContext;
|
||||
for (auto& item : aDocumentContext)
|
||||
{
|
||||
if ( pContextIter->Name == "ActiveConnection"
|
||||
&& ( pContextIter->Value >>= _rxActualConnection )
|
||||
)
|
||||
if (item.Name == "ActiveConnection" && (item.Value >>= _rxActualConnection))
|
||||
{
|
||||
bIsEmbedded = true;
|
||||
break;
|
||||
|
||||
@@ -669,8 +669,7 @@ namespace dbtools
|
||||
{
|
||||
// transfer the values from the continuation object to the parameter columns
|
||||
const Sequence< PropertyValue >& aFinalValues = pParams->getValues();
|
||||
const PropertyValue* pFinalValues = aFinalValues.getConstArray();
|
||||
for ( sal_Int32 i = 0; i < aFinalValues.getLength(); ++i, ++pFinalValues )
|
||||
for (sal_Int32 i = 0; i < aFinalValues.getLength(); ++i)
|
||||
{
|
||||
Reference< XPropertySet > xParamColumn(aRequest.Parameters->getByIndex( i ),UNO_QUERY);
|
||||
if ( xParamColumn.is() )
|
||||
@@ -678,9 +677,9 @@ namespace dbtools
|
||||
#ifdef DBG_UTIL
|
||||
OUString sName;
|
||||
xParamColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME) ) >>= sName;
|
||||
OSL_ENSURE( sName == pFinalValues->Name, "ParameterManager::completeParameters: inconsistent parameter names!" );
|
||||
OSL_ENSURE( sName == aFinalValues[i].Name, "ParameterManager::completeParameters: inconsistent parameter names!" );
|
||||
#endif
|
||||
xParamColumn->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE), pFinalValues->Value );
|
||||
xParamColumn->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE), aFinalValues[i].Value );
|
||||
// the property sets are wrapper classes, translating the Value property into a call to
|
||||
// the appropriate XParameters interface
|
||||
}
|
||||
|
||||
@@ -178,15 +178,12 @@ bool OPoolCollection::isDriverPoolingEnabled(std::u16string_view _sDriverImplNam
|
||||
|
||||
if(xDirectAccess.is())
|
||||
{
|
||||
Sequence< OUString > aDriverKeys = xDirectAccess->getElementNames();
|
||||
const OUString* pDriverKeys = aDriverKeys.getConstArray();
|
||||
const OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
|
||||
for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
|
||||
for (auto& driverKey : xDirectAccess->getElementNames())
|
||||
{
|
||||
// the name of the driver in this round
|
||||
if(_sDriverImplName == *pDriverKeys)
|
||||
if (_sDriverImplName == driverKey)
|
||||
{
|
||||
_rxDriverNode = openNode(*pDriverKeys,xDirectAccess);
|
||||
_rxDriverNode = openNode(driverKey, xDirectAccess);
|
||||
if(_rxDriverNode.is())
|
||||
getNodeValue(ENABLE,_rxDriverNode) >>= bEnabled;
|
||||
break;
|
||||
|
||||
@@ -96,16 +96,14 @@ void OConnection::construct(std::u16string_view url,const Sequence< PropertyValu
|
||||
o3tl::starts_with(aDSN, u"access:", &aDSN);
|
||||
|
||||
sal_Int32 nTimeout = 20;
|
||||
const PropertyValue *pIter = info.getConstArray();
|
||||
const PropertyValue *pEnd = pIter + info.getLength();
|
||||
for(;pIter != pEnd;++pIter)
|
||||
for (const auto& propval : info)
|
||||
{
|
||||
if(pIter->Name == "Timeout")
|
||||
pIter->Value >>= nTimeout;
|
||||
else if(pIter->Name == "user")
|
||||
pIter->Value >>= aUID;
|
||||
else if(pIter->Name == "password")
|
||||
pIter->Value >>= aPWD;
|
||||
if (propval.Name == "Timeout")
|
||||
propval.Value >>= nTimeout;
|
||||
else if (propval.Name == "user")
|
||||
propval.Value >>= aUID;
|
||||
else if (propval.Name == "password")
|
||||
propval.Value >>= aPWD;
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
@@ -927,11 +927,9 @@ Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& ro
|
||||
rgsabound[0].cElements = rows.getLength();
|
||||
SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
|
||||
|
||||
const Any* pBegin = rows.getConstArray();
|
||||
const Any* pEnd = pBegin + rows.getLength();
|
||||
for(sal_Int32 i=0;pBegin != pEnd ;++pBegin,++i)
|
||||
for (sal_Int32 i = 0; i < rows.getLength(); ++i)
|
||||
{
|
||||
*pBegin >>= nPos;
|
||||
rows[i] >>= nPos;
|
||||
SafeArrayPutElement(psa,&i,&m_aBookmarks[nPos]);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,12 +117,10 @@ OLEVariant::OLEVariant(const css::uno::Sequence< sal_Int8 >& x)
|
||||
vt = VT_ARRAY|VT_UI1;
|
||||
|
||||
parray = SafeArrayCreateVector(VT_UI1, 0, x.getLength());
|
||||
const sal_Int8* pBegin = x.getConstArray();
|
||||
const sal_Int8* pEnd = pBegin + x.getLength();
|
||||
|
||||
for(sal_Int32 i=0;pBegin != pEnd;++i,++pBegin)
|
||||
for (sal_Int32 i = 0; i < x.getLength(); ++i)
|
||||
{
|
||||
sal_Int32 nData = *pBegin;
|
||||
sal_Int32 nData = x[i];
|
||||
HRESULT rs = SafeArrayPutElement(parray,&i,&nData);
|
||||
OSL_ENSURE(S_OK == rs,"Error while copy byte data");
|
||||
}
|
||||
|
||||
@@ -1821,13 +1821,11 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
|
||||
|
||||
++nPos;
|
||||
OUStringBuffer aTypes;
|
||||
const OUString* pIter = types.getConstArray();
|
||||
const OUString* pEnd = pIter + types.getLength();
|
||||
for( ; pIter != pEnd ; ++pIter)
|
||||
for (auto& type : types)
|
||||
{
|
||||
if ( aTypes.getLength() )
|
||||
aTypes.append(",");
|
||||
aTypes.append(*pIter);
|
||||
aTypes.append(type);
|
||||
}
|
||||
|
||||
OUString sTypeNames = aTypes.makeStringAndClear();
|
||||
|
||||
@@ -80,18 +80,15 @@ void OCalcConnection::construct(const OUString& url,const Sequence< PropertyValu
|
||||
m_aFileName = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
|
||||
|
||||
m_sPassword.clear();
|
||||
const char pPwd[] = "password";
|
||||
|
||||
const PropertyValue *pIter = info.getConstArray();
|
||||
const PropertyValue *pEnd = pIter + info.getLength();
|
||||
for(;pIter != pEnd;++pIter)
|
||||
for (auto& propval : info)
|
||||
{
|
||||
if(pIter->Name == pPwd)
|
||||
if (propval.Name == "password")
|
||||
{
|
||||
pIter->Value >>= m_sPassword;
|
||||
propval.Value >>= m_sPassword;
|
||||
break;
|
||||
}
|
||||
} // for(;pIter != pEnd;++pIter)
|
||||
}
|
||||
ODocHolder aDocHolder(this); // just to test that the doc can be loaded
|
||||
acquireDoc();
|
||||
}
|
||||
|
||||
@@ -134,27 +134,23 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables(
|
||||
// check if ORowSetValue type is given
|
||||
// when no types are given then we have to return all tables e.g. TABLE
|
||||
|
||||
OUString aTable("TABLE");
|
||||
static constexpr OUString aTable(u"TABLE"_ustr);
|
||||
|
||||
bool bTableFound = true;
|
||||
sal_Int32 nLength = types.getLength();
|
||||
if(nLength)
|
||||
if (types.hasElements())
|
||||
{
|
||||
bTableFound = false;
|
||||
bool bTableFound = false;
|
||||
|
||||
const OUString* pIter = types.getConstArray();
|
||||
const OUString* pEnd = pIter + nLength;
|
||||
for(;pIter != pEnd;++pIter)
|
||||
for (auto& type : types)
|
||||
{
|
||||
if(*pIter == aTable)
|
||||
if (type == aTable)
|
||||
{
|
||||
bTableFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bTableFound)
|
||||
return pResult;
|
||||
}
|
||||
if(!bTableFound)
|
||||
return pResult;
|
||||
|
||||
// get the sheet names from the document
|
||||
|
||||
|
||||
@@ -69,14 +69,11 @@ static void lcl_UpdateArea( const Reference<XCellRange>& xUsedRange, sal_Int32&
|
||||
CellFlags::STRING | CellFlags::VALUE | CellFlags::DATETIME | CellFlags::FORMULA | CellFlags::ANNOTATION;
|
||||
|
||||
const Reference<XSheetCellRanges> xUsedRanges = xUsedQuery->queryContentCells( nContentFlags );
|
||||
const Sequence<CellRangeAddress> aAddresses = xUsedRanges->getRangeAddresses();
|
||||
|
||||
const sal_Int32 nCount = aAddresses.getLength();
|
||||
const CellRangeAddress* pData = aAddresses.getConstArray();
|
||||
for ( sal_Int32 i=0; i<nCount; i++ )
|
||||
for (auto& address : xUsedRanges->getRangeAddresses())
|
||||
{
|
||||
rEndCol = std::max(pData[i].EndColumn, rEndCol);
|
||||
rEndRow = std::max(pData[i].EndRow, rEndRow);
|
||||
rEndCol = std::max(address.EndColumn, rEndCol);
|
||||
rEndRow = std::max(address.EndRow, rEndRow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -166,35 +166,28 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns(
|
||||
try
|
||||
{
|
||||
aRow[10] = new ORowSetValueDecorator(sal_Int32(10));
|
||||
Sequence< OUString> aTabNames(xNames->getElementNames());
|
||||
const OUString* pTabBegin = aTabNames.getConstArray();
|
||||
const OUString* pTabEnd = pTabBegin + aTabNames.getLength();
|
||||
for(;pTabBegin != pTabEnd;++pTabBegin)
|
||||
for (auto& tabName : xNames->getElementNames())
|
||||
{
|
||||
if(match(tableNamePattern,*pTabBegin,'\0'))
|
||||
if (match(tableNamePattern, tabName, '\0'))
|
||||
{
|
||||
Reference< XColumnsSupplier> xTable(
|
||||
xNames->getByName(*pTabBegin), css::uno::UNO_QUERY);
|
||||
Reference<XColumnsSupplier> xTable(xNames->getByName(tabName), css::uno::UNO_QUERY);
|
||||
OSL_ENSURE(xTable.is(),"Table not found! Normally an exception had to be thrown here!");
|
||||
aRow[3] = new ORowSetValueDecorator(*pTabBegin);
|
||||
aRow[3] = new ORowSetValueDecorator(tabName);
|
||||
|
||||
Reference< XNameAccess> xColumns = xTable->getColumns();
|
||||
if(!xColumns.is())
|
||||
throw SQLException();
|
||||
|
||||
Sequence< OUString> aColNames(xColumns->getElementNames());
|
||||
|
||||
const OUString* pBegin = aColNames.getConstArray();
|
||||
const OUString* pEnd = pBegin + aColNames.getLength();
|
||||
Reference< XPropertySet> xColumn;
|
||||
for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i)
|
||||
sal_Int32 i = 0;
|
||||
for (auto& colName : xColumns->getElementNames())
|
||||
{
|
||||
if(match(columnNamePattern,*pBegin,'\0'))
|
||||
++i;
|
||||
if (match(columnNamePattern, colName, '\0'))
|
||||
{
|
||||
aRow[4] = new ORowSetValueDecorator(*pBegin);
|
||||
aRow[4] = new ORowSetValueDecorator(colName);
|
||||
|
||||
xColumn.set(
|
||||
xColumns->getByName(*pBegin), css::uno::UNO_QUERY);
|
||||
xColumn.set(xColumns->getByName(colName), css::uno::UNO_QUERY);
|
||||
OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!");
|
||||
aRow[5] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))));
|
||||
aRow[6] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))));
|
||||
@@ -274,20 +267,16 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
|
||||
if(!xIndexes.is())
|
||||
throw SQLException();
|
||||
|
||||
Sequence< OUString> aIdxNames(xIndexes->getElementNames());
|
||||
|
||||
const OUString* pBegin = aIdxNames.getConstArray();
|
||||
const OUString* pEnd = pBegin + aIdxNames.getLength();
|
||||
Reference< XPropertySet> xIndex;
|
||||
for(;pBegin != pEnd;++pBegin)
|
||||
for (auto& idxName : xIndexes->getElementNames())
|
||||
{
|
||||
xIndex.set(xIndexes->getByName(*pBegin), css::uno::UNO_QUERY);
|
||||
xIndex.set(xIndexes->getByName(idxName), css::uno::UNO_QUERY);
|
||||
OSL_ENSURE(xIndex.is(),"Indexes contains a column who isn't a fastpropertyset!");
|
||||
|
||||
if(unique && !getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))))
|
||||
continue;
|
||||
aRow[4] = new ORowSetValueDecorator(ORowSetValue(getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))));
|
||||
aRow[6] = new ORowSetValueDecorator(*pBegin);
|
||||
aRow[6] = new ORowSetValueDecorator(idxName);
|
||||
|
||||
auto pIndex = dynamic_cast<ODbaseIndex*>(xIndex.get());
|
||||
if(pIndex)
|
||||
@@ -298,14 +287,12 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
|
||||
|
||||
Reference<XColumnsSupplier> xColumnsSup(xIndex,UNO_QUERY);
|
||||
Reference< XNameAccess> xColumns = xColumnsSup->getColumns();
|
||||
Sequence< OUString> aColNames(xColumns->getElementNames());
|
||||
|
||||
const OUString* pColBegin = aColNames.getConstArray();
|
||||
const OUString* pColEnd = pColBegin + aColNames.getLength();
|
||||
for(sal_Int32 j=1;pColBegin != pColEnd;++pColBegin,++j)
|
||||
sal_Int32 j = 0;
|
||||
for (auto& colName : xColumns->getElementNames())
|
||||
{
|
||||
aRow[8] = new ORowSetValueDecorator(j);
|
||||
aRow[9] = new ORowSetValueDecorator(*pColBegin);
|
||||
aRow[8] = new ORowSetValueDecorator(++j);
|
||||
aRow[9] = new ORowSetValueDecorator(colName);
|
||||
aRows.push_back(aRow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,14 +739,12 @@ Sequence< Type > SAL_CALL ODbaseTable::getTypes( )
|
||||
std::vector<Type> aOwnTypes;
|
||||
aOwnTypes.reserve(aTypes.getLength());
|
||||
|
||||
const Type* pBegin = aTypes.getConstArray();
|
||||
const Type* pEnd = pBegin + aTypes.getLength();
|
||||
for(;pBegin != pEnd;++pBegin)
|
||||
for (auto& type : aTypes)
|
||||
{
|
||||
if(*pBegin != cppu::UnoType<XKeysSupplier>::get() &&
|
||||
*pBegin != cppu::UnoType<XDataDescriptorFactory>::get())
|
||||
if(type != cppu::UnoType<XKeysSupplier>::get() &&
|
||||
type != cppu::UnoType<XDataDescriptorFactory>::get())
|
||||
{
|
||||
aOwnTypes.push_back(*pBegin);
|
||||
aOwnTypes.push_back(type);
|
||||
}
|
||||
}
|
||||
aOwnTypes.push_back(cppu::UnoType<css::lang::XUnoTunnel>::get());
|
||||
|
||||
@@ -1533,18 +1533,14 @@ void OSQLParseTreeIterator::appendColumns(const OUString& _rTableAlias, const OS
|
||||
if ( !xColumns.is() )
|
||||
return;
|
||||
|
||||
Sequence< OUString > aColNames = xColumns->getElementNames();
|
||||
const OUString* pBegin = aColNames.getConstArray();
|
||||
const OUString* pEnd = pBegin + aColNames.getLength();
|
||||
|
||||
::comphelper::UStringMixLess aCompare(isCaseSensitive());
|
||||
std::vector<OUString> aSelectColumnNames = getSelectColumnNames();
|
||||
|
||||
for(;pBegin != pEnd;++pBegin)
|
||||
for (auto& colName : xColumns->getElementNames())
|
||||
{
|
||||
OUString aName(getUniqueColumnName(aSelectColumnNames, *pBegin));
|
||||
OUString aName(getUniqueColumnName(aSelectColumnNames, colName));
|
||||
Reference< XPropertySet > xColumn;
|
||||
if(xColumns->hasByName(*pBegin) && (xColumns->getByName(*pBegin) >>= xColumn) && xColumn.is())
|
||||
if(xColumns->hasByName(colName) && (xColumns->getByName(colName) >>= xColumn) && xColumn.is())
|
||||
{
|
||||
rtl::Reference<OParseColumn> pColumn = new OParseColumn(aName
|
||||
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
|
||||
@@ -1562,13 +1558,13 @@ void OSQLParseTreeIterator::appendColumns(const OUString& _rTableAlias, const OS
|
||||
, getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME))));
|
||||
|
||||
pColumn->setTableName(_rTableAlias);
|
||||
pColumn->setRealName(*pBegin);
|
||||
pColumn->setRealName(colName);
|
||||
m_aSelectColumns->push_back(pColumn);
|
||||
// update aSelectColumnNames with newly insert aName
|
||||
aSelectColumnNames.insert(std::upper_bound(aSelectColumnNames.begin(), aSelectColumnNames.end(), aName, aCompare), aName);
|
||||
}
|
||||
else
|
||||
impl_appendError( IParseContext::ErrorCode::InvalidColumn, pBegin, &_rTableAlias );
|
||||
impl_appendError(IParseContext::ErrorCode::InvalidColumn, &colName, &_rTableAlias);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user