diff options
author | Oliver Specht <os@openoffice.org> | 2006-11-20 11:19:04 +0000 |
---|---|---|
committer | Oliver Specht <os@openoffice.org> | 2006-11-20 11:19:04 +0000 |
commit | 2b5bf2f1c57d6585ec898c4c44a74c5b47f09ab9 (patch) | |
tree | 55f38991eaffb7e34c573bf2caae4bd80d051f51 /writerfilter/source/dmapper/GraphicImport.cxx | |
parent | new version for SRC680 (diff) | |
download | core-2b5bf2f1c57d6585ec898c4c44a74c5b47f09ab9.tar.gz core-2b5bf2f1c57d6585ec898c4c44a74c5b47f09ab9.zip |
graphic import improved
Diffstat (limited to 'writerfilter/source/dmapper/GraphicImport.cxx')
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 384 |
1 files changed, 342 insertions, 42 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 167b599a5e2e..53b3b3c60f37 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -4,9 +4,9 @@ * * $RCSfile: GraphicImport.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: hbrinkm $ $Date: 2006-11-08 09:50:27 $ + * last change: $Author: os $ $Date: 2006-11-20 12:19:03 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -32,6 +32,7 @@ * MA 02111-1307 USA * ************************************************************************/ + #ifndef INCLUDED_GRAPHICIMPORT_HXX #include <GraphicImport.hxx> #endif @@ -41,6 +42,9 @@ #ifndef INCLUDED_RESOURCESIDS #include <doctok/resourceids.hxx> #endif +#ifndef INCLUDED_DMAPPER_CONVERSIONHELPER_HXX +#include <ConversionHelper.hxx> +#endif #ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_ #include <com/sun/star/uno/XComponentContext.hpp> #endif @@ -50,8 +54,11 @@ #ifndef _CPPUHELPER_IMPLBASE1_HXX_ #include <cppuhelper/implbase1.hxx> #endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_ +#include <com/sun/star/awt/Size.hpp> +#endif +#ifndef _COM_SUN_STAR_DRAWING_COLORMODE_HPP_ +#include <com/sun/star/drawing/ColorMode.hpp> #endif #ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHICPROVIDER_HPP_ #include <com/sun/star/graphic/XGraphicProvider.hpp> @@ -59,12 +66,31 @@ #ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHIC_HPP_ #include <com/sun/star/graphic/XGraphicr.hpp> #endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_TEXT_GRAPHICCROP_HPP_ +#include <com/sun/star/text/GraphicCrop.hpp> +#endif #ifndef _COM_SUN_STAR_TEXT_XTEXTCONTENT_HPP_ #include <com/sun/star/text/XTextContent.hpp> #endif #ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP_ #include <com/sun/star/text/TextContentAnchorType.hpp> #endif +#ifndef _COM_SUN_STAR_TEXT_HORIORIENTATION_HDL_ +#include <com/sun/star/text/HoriOrientation.hpp> +#endif +#ifndef _COM_SUN_STAR_TEXT_RELORIENTATION_HDL_ +#include <com/sun/star/text/RelOrientation.hpp> +#endif +#ifndef _COM_SUN_STAR_TEXT_VERTORIENTATION_HDL_ +#include <com/sun/star/text/VertOrientation.hpp> +#endif +#ifndef _COM_SUN_STAR_TEXT_WRAPTEXTMODE_HPP_ +#include <com/sun/star/text/WrapTextMode.hpp> +#endif + #include <iostream> @@ -173,15 +199,31 @@ struct GraphicBorderLine }; struct GraphicImport_Impl { + bool bIsShapeImport; + sal_Int32 nHoriScaling; sal_Int32 nVertScaling; sal_Int32 nXSize; sal_Int32 nYSize; + sal_Int32 nLeftPosition; + sal_Int32 nTopPosition; + sal_Int32 nRightPosition; + sal_Int32 nBottomPosition; sal_Int32 nLeftCrop; sal_Int32 nTopCrop; sal_Int32 nRightCrop; sal_Int32 nBottomCrop; + sal_Int32 nWrap; + bool bContour; + bool bIgnoreWRK; + + sal_Int32 nContrast; + sal_Int32 nBrightness; + double fGamma; + + drawing::ColorMode eColorMode; + GraphicBorderLine aBorders[4]; sal_Int32 nCurrentBorderLine; @@ -192,11 +234,19 @@ struct GraphicImport_Impl bool bHoriFlip; bool bVertFlip; - GraphicImport_Impl() : - nHoriScaling(0) + bool bInShapeOptionMode; + sal_Int32 nShapeOptionType; + + GraphicImport_Impl(bool bIsShape) : + bIsShapeImport( bIsShape ) + ,nHoriScaling(0) ,nVertScaling(0) ,nXSize(0) ,nYSize(0) + ,nLeftPosition(0) + ,nTopPosition(0) + ,nRightPosition(0) + ,nBottomPosition(0) ,nLeftCrop(0) ,nTopCrop (0) ,nRightCrop (0) @@ -207,14 +257,24 @@ struct GraphicImport_Impl ,nBitsPerPixel(0) ,bHoriFlip(false) ,bVertFlip(false) + ,bInShapeOptionMode(false) + ,nShapeOptionType(0) + ,nWrap(0) + ,bContour(false) + ,bIgnoreWRK(true) + ,nContrast(0) + ,nBrightness(100) + ,eColorMode( drawing::ColorMode_STANDARD ) + ,fGamma( -1.0 ) {} }; /*-- 01.11.2006 09:42:42--------------------------------------------------- -----------------------------------------------------------------------*/ GraphicImport::GraphicImport(uno::Reference < uno::XComponentContext > xComponentContext, - uno::Reference< lang::XMultiServiceFactory > xTextFactory ) -: m_pImpl( new GraphicImport_Impl) + uno::Reference< lang::XMultiServiceFactory > xTextFactory, + bool bIsShape ) +: m_pImpl( new GraphicImport_Impl( bIsShape )) ,m_xComponentContext( xComponentContext ) ,m_xTextFactory( xTextFactory) { @@ -245,6 +305,8 @@ void GraphicImport::attribute(doctok::Id Name, doctok::Value & val) case NS_rtf::LN_BRCLEFT: //left border case NS_rtf::LN_BRCBOTTOM: //bottom border case NS_rtf::LN_BRCRIGHT: //right border + case NS_rtf::LN_shape: //shape + case NS_rtf::LN_blip: //the binary graphic data in a shape { switch(Name) { @@ -260,6 +322,9 @@ void GraphicImport::attribute(doctok::Id Name, doctok::Value & val) case NS_rtf::LN_BRCRIGHT: //right border m_pImpl->nCurrentBorderLine = BORDER_RIGHT; break; + case NS_rtf::LN_shpopt: + m_pImpl->bInShapeOptionMode = true; + break; default:; } doctok::Reference<Properties>::Pointer_t pProperties = val.getProperties(); @@ -267,6 +332,13 @@ void GraphicImport::attribute(doctok::Id Name, doctok::Value & val) { pProperties->resolve(*this); } + switch(Name) + { + case NS_rtf::LN_shpopt: + m_pImpl->bInShapeOptionMode = false; + break; + default:; + } } break; case NS_rtf::LN_BM_RCWINMF: //windows bitmap structure - if it's a bitmap @@ -276,10 +348,10 @@ void GraphicImport::attribute(doctok::Id Name, doctok::Value & val) break; case NS_rtf::LN_MX: m_pImpl->nHoriScaling = nIntValue; break;// hori scaling in 0.001% case NS_rtf::LN_MY: m_pImpl->nVertScaling = nIntValue; break;// vert scaling in 0.001% - case NS_rtf::LN_DXACROPLEFT: m_pImpl->nLeftCrop = nIntValue; break;// left crop in twips - case NS_rtf::LN_DYACROPTOP: m_pImpl->nTopCrop = nIntValue; break;// top crop in twips - case NS_rtf::LN_DXACROPRIGHT: m_pImpl->nRightCrop = nIntValue; break;// right crop in twips - case NS_rtf::LN_DYACROPBOTTOM: m_pImpl->nBottomCrop = nIntValue; break;// bottom crop in twips + case NS_rtf::LN_DXACROPLEFT: m_pImpl->nLeftCrop = ConversionHelper::convertToMM100(nIntValue); break;// left crop in twips + case NS_rtf::LN_DYACROPTOP: m_pImpl->nTopCrop = ConversionHelper::convertToMM100(nIntValue); break;// top crop in twips + case NS_rtf::LN_DXACROPRIGHT: m_pImpl->nRightCrop = ConversionHelper::convertToMM100(nIntValue); break;// right crop in twips + case NS_rtf::LN_DYACROPBOTTOM: m_pImpl->nBottomCrop = ConversionHelper::convertToMM100(nIntValue); break;// bottom crop in twips case NS_rtf::LN_BRCL: break;//border type - legacy - case NS_rtf::LN_FFRAMEEMPTY: break;// picture consists of a single frame case NS_rtf::LN_FBITMAP: break;//1 if it's a bitmap ??? @@ -329,10 +401,102 @@ void GraphicImport::attribute(doctok::Id Name, doctok::Value & val) case NS_rtf::LN_shptypename: break;// shape type name - case NS_rtf::LN_shppid: break; + case NS_rtf::LN_shppid: m_pImpl->nShapeOptionType = nIntValue; break; //type of shape option case NS_rtf::LN_shpfBid: break; case NS_rtf::LN_shpfComplex:break; - case NS_rtf::LN_shpop: break; + case NS_rtf::LN_shpop: + { + sal_Int32 nTwipValue = ConversionHelper::convertToMM100(nIntValue); + switch( m_pImpl->nShapeOptionType ) + { + case 256 : m_pImpl->nTopCrop = nTwipValue; break;// rtf:shpcropFromTop + case 257 : m_pImpl->nBottomCrop= nTwipValue; break;// rtf:shpcropFromBottom + case 258 : m_pImpl->nLeftCrop = nTwipValue; break;// rtf:shpcropFromLeft + case 259 : m_pImpl->nRightCrop = nTwipValue;break;// rtf:shpcropFromRight + case 260: break; // rtf:shppib + case 261: break; // rtf:shppibName + case 262: // rtf:shppibFlags + /* + * // MSOBLIPFLAGS – flags for pictures + typedef enum + { + msoblipflagDefault = 0, + msoblipflagComment = 0, // Blip name is a comment + msoblipflagFile, // Blip name is a file name + msoblipflagURL, // Blip name is a full URL + msoblipflagType = 3, // Mask to extract type + // Or the following flags with any of the above. + msoblipflagDontSave = 4, // A "dont" is the depression in the metal + // body work of an automobile caused when a + // cyclist violently thrusts his or her nose + // at it, thus a DontSave is another name for + // a cycle lane. + msoblipflagDoNotSave = 4, // For those who prefer English + msoblipflagLinkToFile = 8, + }; + * + * */ + break; + case 264: // rtf:shppictureContrast docu: "1<<16" + /* + 0x10000 is msoffice 50% + < 0x10000 is in units of 1/50th of 0x10000 per 1% + > 0x10000 is in units where + a msoffice x% is stored as 50/(100-x) * 0x10000 + + plus, a (ui) microsoft % ranges from 0 to 100, OOO + from -100 to 100, so also normalize into that range + */ + if ( nIntValue > 0x10000 ) + { + double fX = nIntValue; + fX /= 0x10000; + fX /= 51; // 50 + 1 to round + fX = 1/fX; + m_pImpl->nContrast = static_cast<sal_Int32>(fX); + m_pImpl->nContrast -= 100; + m_pImpl->nContrast = -m_pImpl->nContrast; + m_pImpl->nContrast = (m_pImpl->nContrast-50)*2; + } + else if ( nIntValue == 0x10000 ) + m_pImpl->nContrast = 0; + else + { + m_pImpl->nContrast = nIntValue * 101; //100 + 1 to round + m_pImpl->nContrast /= 0x10000; + m_pImpl->nContrast -= 100; + } + break; + case 265: // rtf:shppictureBrightness + m_pImpl->nBrightness = ( (sal_Int32) nIntValue / 327 ); + break; + case 266: // rtf:shppictureGamma + m_pImpl->fGamma = double(nIntValue/655); + break; + case 267: break; // rtf:shppictureId + case 268: break; // rtf:shppictureDblCrMod + case 269: break; // rtf:shppictureFillCrMod + case 270: break; // rtf:shppictureLineCrMod + + case 319: // rtf:shppictureActive + switch( nIntValue & 0x06 ) + { + case 0 : m_pImpl->eColorMode = drawing::ColorMode_STANDARD; break; + case 4 : m_pImpl->eColorMode = drawing::ColorMode_GREYS; break; + case 6 : m_pImpl->eColorMode = drawing::ColorMode_MONO; break; + default:; + } + break; + case 385: break; // rtf:shpfillColor + case 386: break; // rtf:shpfillOpacity + case 447: break; // rtf:shpfNoFillHitTest + case 511: break; // rtf:shpfNoLineDrawDash + case 899: break; // rtf:shppWrapPolygonVertices + case 959: break; // rtf:shpfPrint + default:; + } + } + break; case NS_rtf::LN_shpname: break; case NS_rtf::LN_shpvalue: break; @@ -392,26 +556,75 @@ void GraphicImport::attribute(doctok::Id Name, doctok::Value & val) // case NS_rtf::LN_LINEWIDTH = 10373; // case NS_rtf::LN_LINETYPE = 10374; -// case NS_rtf::LN_SPID = 10407; -// case NS_rtf::LN_XALEFT = 10408; -// case NS_rtf::LN_YATOP = 10409; -// case NS_rtf::LN_XARIGHT = 10410; -// case NS_rtf::LN_YABOTTOM = 10411; -// case NS_rtf::LN_FHDR = 10412; -// case NS_rtf::LN_BX = 10413; -// case NS_rtf::LN_BY = 10414; -// case NS_rtf::LN_WR = 10415; -// case NS_rtf::LN_WRK = 10416; -// case NS_rtf::LN_FRCASIMPLE = 10417; -// case NS_rtf::LN_FBELOWTEXT = 10418; -// case NS_rtf::LN_FANCHORLOCK = 10419; -// case NS_rtf::LN_CTXBX = 10420; -// case NS_rtf::LN_CH = 10421; -// case NS_rtf::LN_UNUSED0_5 = 10422; -// case NS_rtf::LN_FLT = 10423; -// case NS_rtf::LN_shpLeft = 10424; -// case NS_rtf::LN_shpTop = 10425; + case NS_rtf::LN_SPID: + case NS_rtf::LN_XALEFT: m_pImpl->nLeftPosition = ConversionHelper::convertToMM100(nIntValue); break; //left position + case NS_rtf::LN_YATOP: m_pImpl->nTopPosition = ConversionHelper::convertToMM100(nIntValue); break; //top position + case NS_rtf::LN_XARIGHT: m_pImpl->nRightPosition = ConversionHelper::convertToMM100(nIntValue); break; //right position + case NS_rtf::LN_YABOTTOM: m_pImpl->nBottomPosition = ConversionHelper::convertToMM100(nIntValue); break;//bottom position + case NS_rtf::LN_FHDR: + case NS_rtf::LN_BX: + case NS_rtf::LN_BY: break; + case NS_rtf::LN_WR: //wrapping + switch( nIntValue ) + { + case 0: //0 like 2, but doesn't require absolute object + m_pImpl->bIgnoreWRK = false; + case 2: //2 wrap around absolute object + m_pImpl->nWrap = text::WrapTextMode_PARALLEL; + break; + case 1: //1 no text next to shape + m_pImpl->nWrap = text::WrapTextMode_NONE; + break; + case 3: //3 wrap as if no object present + m_pImpl->nWrap = text::WrapTextMode_THROUGHT; + break; + case 4: //4 wrap tightly around object + m_pImpl->bIgnoreWRK = false; + case 5: //5 wrap tightly, but allow holes + m_pImpl->nWrap = text::WrapTextMode_PARALLEL; + m_pImpl->bContour = true; + break; + default:; + } + break; + case NS_rtf::LN_WRK: + if( !m_pImpl->bIgnoreWRK ) + switch( nIntValue ) + { + case 0: //0 like 2, but doesn't require absolute object + case 2: //2 wrap around absolute object + m_pImpl->nWrap = text::WrapTextMode_PARALLEL; + break; + case 1: //1 no text next to shape + m_pImpl->nWrap = text::WrapTextMode_NONE; + break; + case 3: //3 wrap as if no object present + m_pImpl->nWrap = text::WrapTextMode_THROUGHT; + break; + case 4: //4 wrap tightly around object + case 5: //5 wrap tightly, but allow holes + m_pImpl->nWrap = text::WrapTextMode_PARALLEL; + m_pImpl->bContour = true; + break; + default:; + } + break; + case NS_rtf::LN_FRCASIMPLE: + case NS_rtf::LN_FBELOWTEXT: + case NS_rtf::LN_FANCHORLOCK: + case NS_rtf::LN_CTXBX: + { + sal_Int32 nValue1 = val.getInt(); + nValue1++; + } + break; +/* case NS_rtf::LN_CH = 10421; + case NS_rtf::LN_UNUSED0_5 = 10422; + case NS_rtf::LN_FLT = 10423; + case NS_rtf::LN_shpLeft = 10424; + case NS_rtf::LN_shpTop = 10425; + break;*/ default: val.getInt(); } @@ -428,7 +641,6 @@ void GraphicImport::sprm(doctok::Sprm & sprm_) case 0xf004: //dff record case 0xf00a: //part of 0xf004 - shape properties case 0xf00b: //part of 0xf004 - case 0xf010: //part of 0xf004 - case 0xf007: { doctok::Reference<Properties>::Pointer_t pProperties = sprm_.getProps(); @@ -445,6 +657,11 @@ void GraphicImport::sprm(doctok::Sprm & sprm_) pPictureData->resolve(*this); } break; + case 0xf010: + case 0xf011: + case 0xf122: + //ignore - doesn't contain useful members + break; default: doctok::Value::Pointer_t pValue = sprm_.getValue(); if( pValue.get() ) @@ -457,6 +674,16 @@ void GraphicImport::sprm(doctok::Sprm & sprm_) void GraphicImport::entry(int /*pos*/, doctok::Reference<Properties>::Pointer_t /*ref*/) { } +/*-- 16.11.2006 16:14:32--------------------------------------------------- + crop is stored as "fixed float" as 16.16 fraction value + related to width/or height + -----------------------------------------------------------------------*/ +void lcl_CalcCrop( sal_Int32& nCrop, sal_Int32 nRef ) +{ + nCrop = ((nCrop >> 16 ) * nRef ) + + (((nCrop & 0xffff) * nRef ) >> 16); +} + /*-- 01.11.2006 09:45:02--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -471,8 +698,10 @@ void GraphicImport::data(const sal_uInt8* buf, size_t len, doctok::Reference<Pro uno::UNO_QUERY_THROW ); uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len ); + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); + ::com::sun::star::beans::PropertyValues aMediaProperties( 1 ); - aMediaProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")); + aMediaProperties[0].Name = rPropNameSupplier.GetName(PROP_INPUT_STREAM); aMediaProperties[0].Value <<= xIStream; uno::Reference< graphic::XGraphic > xGraphic = xGraphicProvider->queryGraphic( aMediaProperties ); // @@ -480,16 +709,87 @@ void GraphicImport::data(const sal_uInt8* buf, size_t len, doctok::Reference<Pro { clog << "Graphic loaded" << endl; - uno::Reference< beans::XPropertySet > xGraphicProperties( + uno::Reference< beans::XPropertySet > xGraphicObjectProperties( m_xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextGraphicObject"))), uno::UNO_QUERY_THROW); - xGraphicProperties->setPropertyValue( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Graphic")), uno::makeAny( xGraphic )); - xGraphicProperties->setPropertyValue( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorType")), uno::makeAny( text::TextContentAnchorType_AS_CHARACTER )); - m_xGraphicObject = uno::Reference< text::XTextContent >( xGraphicProperties, uno::UNO_QUERY_THROW ); - } + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_GRAPHIC), uno::makeAny( xGraphic )); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_ANCHOR_TYPE), + uno::makeAny( m_pImpl->bIsShapeImport ? + text::TextContentAnchorType_AT_CHARACTER : + text::TextContentAnchorType_AS_CHARACTER )); + m_xGraphicObject = uno::Reference< text::XTextContent >( xGraphicObjectProperties, uno::UNO_QUERY_THROW ); + if( m_pImpl->bIsShapeImport ) + { + sal_Int32 nWidth = m_pImpl->nRightPosition - m_pImpl->nLeftPosition; + sal_Int32 nHeight = m_pImpl->nBottomPosition - m_pImpl->nTopPosition; + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_SIZE), + uno::makeAny( awt::Size( nWidth, nHeight ))); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT ), + uno::makeAny(text::HoriOrientation::NONE)); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT_POSITTION), + uno::makeAny(m_pImpl->nLeftPosition)); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT_RELATION ), + uno::makeAny(text::RelOrientation::PRINT_AREA)); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT ), + uno::makeAny(text::VertOrientation::NONE)); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_POSITTION), + uno::makeAny(m_pImpl->nTopPosition)); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_RELATION ), + uno::makeAny(text::RelOrientation::PRINT_AREA)); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_SURROUND ), + uno::makeAny(m_pImpl->nWrap)); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_SURROUND_CONTOUR ), + uno::makeAny(m_pImpl->bContour)); + + if( m_pImpl->eColorMode == drawing::ColorMode_STANDARD && + m_pImpl->nContrast == -70 && + m_pImpl->nBrightness == 70 ) + { + // strange definition of WATERMARK! + m_pImpl->nContrast = 0; + m_pImpl->nBrightness = 0; + m_pImpl->eColorMode = drawing::ColorMode_WATERMARK; + } + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_ADJUST_CONTRAST ), + uno::makeAny((sal_Int16)m_pImpl->nContrast)); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_ADJUST_LUMINANCE ), + uno::makeAny((sal_Int16)m_pImpl->nBrightness)); + if(m_pImpl->eColorMode != drawing::ColorMode_STANDARD) + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_GRAPHIC_COLOR_MODE ), + uno::makeAny(m_pImpl->eColorMode)); + if(m_pImpl->fGamma > 0. ) + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_GAMMA ), + uno::makeAny(m_pImpl->fGamma )); + if(m_pImpl->bHoriFlip) + { + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_MIRRORED_ON_EVEN_PAGES ), + uno::makeAny( m_pImpl->bHoriFlip )); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_MIRRORED_ON_ODD_PAGES ), + uno::makeAny( m_pImpl->bHoriFlip )); + } + if( m_pImpl->bVertFlip ) + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_MIRRORED ), + uno::makeAny( m_pImpl->bVertFlip )); + + //there seems to be no way to detect the original size via _real_ API + uno::Reference< beans::XPropertySet > xGraphicProperties( xGraphic, uno::UNO_QUERY_THROW ); + awt::Size aGraphicSize, aGraphicSizePixel; + xGraphicProperties->getPropertyValue(rPropNameSupplier.GetName( PROP_SIZE100th_M_M )) >>= aGraphicSize; + xGraphicProperties->getPropertyValue(rPropNameSupplier.GetName( PROP_SIZE_PIXEL )) >>= aGraphicSizePixel; + if( aGraphicSize.Width && aGraphicSize.Height ) + { + //todo: i71651 graphic size is not provided by the GraphicDescriptor + lcl_CalcCrop( m_pImpl->nTopCrop, aGraphicSize.Height ); + lcl_CalcCrop( m_pImpl->nBottomCrop, aGraphicSize.Height ); + lcl_CalcCrop( m_pImpl->nLeftCrop, aGraphicSize.Width ); + lcl_CalcCrop( m_pImpl->nRightCrop, aGraphicSize.Width ); + + xGraphicProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_GRAPHIC_CROP ), + uno::makeAny(text::GraphicCrop(m_pImpl->nTopCrop, m_pImpl->nBottomCrop, m_pImpl->nLeftCrop, m_pImpl->nRightCrop))); + } + } + } } catch( const uno::Exception& ) { |