summaryrefslogtreecommitdiff
path: root/sw/source/core/access/accpara.cxx
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <od@openoffice.org>2010-03-09 15:59:00 +0100
committerOliver-Rainer Wittmann <od@openoffice.org>2010-03-09 15:59:00 +0100
commit4385bcd318b0b2147c5723f3b821ad6652c38eb1 (patch)
tree67a803dd15d6b609bddfc5c48e50537655890e1c /sw/source/core/access/accpara.cxx
parent5879e44bafec55e5a9b76cb38c992645948ec607 (diff)
sw33a11y01 #i92233# - provide mm to pixel ratio as default paragraph attribute at Writer's implementation of <XAccessibleTextAttributes> for paragraphs
Diffstat (limited to 'sw/source/core/access/accpara.cxx')
-rw-r--r--sw/source/core/access/accpara.cxx43
1 files changed, 42 insertions, 1 deletions
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 059be745db01..368e076470ab 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -82,6 +82,9 @@
#include <parachangetrackinginfo.hxx>
#include <com/sun/star/text/TextMarkupType.hpp>
// <--
+// --> OD 2010-03-08 #i92233#
+#include <comphelper/stlunosequence.hxx>
+// <--
#include <algorithm>
@@ -1467,7 +1470,30 @@ uno::Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
tAccParaPropValMap aDefAttrSeq;
_getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq );
- uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
+ // --> OD 2010-03-08 #i92233#
+ static rtl::OUString sMMToPixelRatio( rtl::OUString::createFromAscii( "MMToPixelRatio" ) );
+ bool bProvideMMToPixelRatio( false );
+ {
+ if ( aRequestedAttributes.getLength() == 0 )
+ {
+ bProvideMMToPixelRatio = true;
+ }
+ else
+ {
+ const rtl::OUString* aRequestedAttrIter =
+ ::std::find( ::comphelper::stl_begin( aRequestedAttributes ),
+ ::comphelper::stl_end( aRequestedAttributes ),
+ sMMToPixelRatio );
+ if ( aRequestedAttrIter != ::comphelper::stl_end( aRequestedAttributes ) )
+ {
+ bProvideMMToPixelRatio = true;
+ }
+ }
+ }
+ // <--
+
+ uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() +
+ ( bProvideMMToPixelRatio ? 1 : 0 ) );
PropertyValue* pValues = aValues.getArray();
sal_Int32 i = 0;
for ( tAccParaPropValMap::const_iterator aIter = aDefAttrSeq.begin();
@@ -1478,6 +1504,21 @@ uno::Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
++i;
}
+ // --> OD 2010-03-08 #i92233#
+ if ( bProvideMMToPixelRatio )
+ {
+ PropertyValue rPropVal;
+ rPropVal.Name = sMMToPixelRatio;
+ const Size a100thMMSize( 1000, 1000 );
+ const Size aPixelSize = GetMap()->LogicToPixel( a100thMMSize );
+ const float fRatio = ((float)a100thMMSize.Width()/100)/aPixelSize.Width();
+ rPropVal.Value = uno::makeAny( fRatio );
+ rPropVal.Handle = -1;
+ rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
+ pValues[ aValues.getLength() - 1 ] = rPropVal;
+ }
+ // <--
+
return aValues;
}