summaryrefslogtreecommitdiff
path: root/writerfilter/source
diff options
context:
space:
mode:
authorVitaliy Anderson <vanderson@smartru.com>2017-03-21 18:31:37 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-03-31 12:03:55 +0000
commitdf30caea7979235b5d1a6a038133dbac2ef7ecac (patch)
tree72d4cb3d52dd715b355d9064668830cf3af224ef /writerfilter/source
parent657702108f3e06e7e90411838cd37f9e6a8b1471 (diff)
tdf#106849: don't reduce quality of picture in bullet list.
An image saved in cache when NS_ooxml::LN_CT_NumPicBullet_pict property is processed should not to be resized. It reduce quality the image. Just set the property "GraphicSize" of current level of the NumRule instead of resize the image when processing NS_ooxml::LN_CT_Lvl_lvlPicBulletId property. Change-Id: I8ac80643decb7794de7a295cc7c2895a5bd24e2d Reviewed-on: https://gerrit.libreoffice.org/35592 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx35
-rw-r--r--writerfilter/source/dmapper/NumberingManager.hxx4
-rw-r--r--writerfilter/source/dmapper/PropertyIds.cxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.hxx1
4 files changed, 28 insertions, 13 deletions
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 87c30c5bd336..325cef9fd982 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -279,7 +279,10 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetLevelProperties( )
if (!m_sGraphicURL.isEmpty())
aNumberingProperties.push_back(lcl_makePropVal(PROP_GRAPHIC_URL, m_sGraphicURL));
if (m_sGraphicBitmap.is())
+ {
aNumberingProperties.push_back(lcl_makePropVal(PROP_GRAPHIC_BITMAP, m_sGraphicBitmap));
+ aNumberingProperties.push_back(lcl_makePropVal(PROP_GRAPHIC_SIZE, m_aGraphicSize));
+ }
}
aNumberingProperties.push_back(lcl_makePropVal(PROP_LISTTAB_STOP_POSITION, m_nTabstop));
@@ -867,19 +870,6 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
{
uno::Reference<drawing::XShape> xShape = m_rDMapper.PopPendingShape();
- // Respect only the aspect ratio of the picture, not its size.
- awt::Size aPrefSize = xShape->getSize();
- // See SwDefBulletConfig::InitFont(), default height is 14.
- const int nFontHeight = 14;
- // Point -> mm100.
- const int nHeight = nFontHeight * 35;
- if (aPrefSize.Height * aPrefSize.Width != 0)
- {
- int nWidth = (nHeight * aPrefSize.Width) / aPrefSize.Height;
- awt::Size aSize(nWidth, nHeight);
- xShape->setSize(aSize);
- }
-
m_pCurrentNumPicBullet->SetShape(xShape);
}
break;
@@ -911,6 +901,25 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
m_pCurrentDefinition->GetCurrentLevel()->SetGraphicBitmap( gr );
} catch(const beans::UnknownPropertyException&)
{}
+
+ // Respect only the aspect ratio of the picture, not its size.
+ awt::Size aPrefSize = xShape->getSize();
+ // See SwDefBulletConfig::InitFont(), default height is 14.
+ const int nFontHeight = 14;
+ // Point -> mm100.
+ const int nHeight = nFontHeight * 35;
+ if ( aPrefSize.Height * aPrefSize.Width != 0 )
+ {
+ int nWidth = (nHeight * aPrefSize.Width) / aPrefSize.Height;
+
+ awt::Size aSize( convertMm100ToTwip(nWidth), convertMm100ToTwip(nHeight) );
+ m_pCurrentDefinition->GetCurrentLevel()->SetGraphicSize( aSize );
+ }
+ else
+ {
+ awt::Size aSize( convertMm100ToTwip(aPrefSize.Width), convertMm100ToTwip(aPrefSize.Height) );
+ m_pCurrentDefinition->GetCurrentLevel()->SetGraphicSize( aSize );
+ }
}
}
break;
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx
index 1aec2a1e05b8..cd09b3d10f9d 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -51,6 +51,7 @@ class ListLevel : public PropertyMap
sal_Int16 m_nXChFollow; //LN_IXCHFOLLOW
OUString m_sBulletChar;
OUString m_sGraphicURL;
+ css::awt::Size m_aGraphicSize;
css::uno::Reference<css::graphic::XGraphic> m_sGraphicBitmap;
sal_Int32 m_nTabstop;
std::shared_ptr< StyleSheetEntry > m_pParaStyle;
@@ -77,12 +78,15 @@ public:
void SetValue( Id nId, sal_Int32 nValue );
void SetBulletChar( const OUString& sValue ) { m_sBulletChar = sValue; };
void SetGraphicURL( const OUString& sValue ) { m_sGraphicURL = sValue; };
+ void SetGraphicSize( const css::awt::Size& aValue ) { m_aGraphicSize = aValue; };
+
void SetGraphicBitmap(css::uno::Reference<css::graphic::XGraphic> const& sValue)
{ m_sGraphicBitmap = sValue; }
void SetParaStyle( const std::shared_ptr< StyleSheetEntry >& pStyle );
// Getters
const OUString& GetBulletChar( ) { return m_sBulletChar; };
+ const css::awt::Size& GetGraphicSize( ) { return m_aGraphicSize; };
const std::shared_ptr< StyleSheetEntry >& GetParaStyle( ) { return m_pParaStyle; };
bool isOutlineNumbering() const { return m_outline; }
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index a807c47c58b2..9182ac48b3f9 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -292,6 +292,7 @@ OUString getPropertyName( PropertyIds eId )
case PROP_IS_WIDTH_RELATIVE: sName = "IsWidthRelative"; break;
case PROP_GRAPHIC_URL: sName = "GraphicURL"; break;
case PROP_GRAPHIC_BITMAP: sName = "GraphicBitmap"; break;
+ case PROP_GRAPHIC_SIZE: sName = "GraphicSize"; break;
case PROP_CHAR_SHADING_VALUE: sName = "CharShadingValue"; break;
case PROP_CHAR_SHADING_MARKER: sName = "CharShadingMarker"; break;
case PROP_LABEL_CATEGORY: sName = "LabelCategory"; break;
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index 1a97ca5c28bb..4bf8bf84c6ce 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -289,6 +289,7 @@ enum PropertyIds
,PROP_IS_WIDTH_RELATIVE
,PROP_GRAPHIC_URL
,PROP_GRAPHIC_BITMAP
+ ,PROP_GRAPHIC_SIZE
,PROP_CHAR_SHADING_VALUE
,PROP_CHAR_SHADING_MARKER
,PROP_MIRROR_INDENTS