summaryrefslogtreecommitdiff
path: root/chart2/source/view/axes
diff options
context:
space:
mode:
authorThomas Benisch <tbe@openoffice.org>2010-10-27 16:02:26 +0200
committerThomas Benisch <tbe@openoffice.org>2010-10-27 16:02:26 +0200
commita82a5b6191de8e8dad9f55f0f7da57732a0bef14 (patch)
tree83868c736ad7174a1aed68b86ed800d1ead70c89 /chart2/source/view/axes
parent569acb98dd402b230ef905101e6021c9dcfb17bc (diff)
chartextensibility: #i115276# improve layout of hierarchical axis labels in chart
Diffstat (limited to 'chart2/source/view/axes')
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 14d728151992..991c87e3a2ef 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -48,6 +48,8 @@
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <editeng/unoprnms.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/unoshtxt.hxx>
#include <algorithm>
#include <memory>
@@ -319,6 +321,47 @@ void lcl_shiftLables( TickIter& rIter, const B2DVector& rStaggerDistance )
}
}
+bool lcl_hasWordBreak( const Reference< drawing::XShape >& rxShape )
+{
+ if ( rxShape.is() )
+ {
+ SvxShape* pShape = SvxShape::getImplementation( rxShape );
+ SvxShapeText* pShapeText = dynamic_cast< SvxShapeText* >( pShape );
+ if ( pShapeText )
+ {
+ SvxTextEditSource* pTextEditSource = dynamic_cast< SvxTextEditSource* >( pShapeText->GetEditSource() );
+ if ( pTextEditSource )
+ {
+ pTextEditSource->UpdateOutliner();
+ SvxTextForwarder* pTextForwarder = pTextEditSource->GetTextForwarder();
+ if ( pTextForwarder )
+ {
+ USHORT nParaCount = pTextForwarder->GetParagraphCount();
+ for ( USHORT nPara = 0; nPara < nParaCount; ++nPara )
+ {
+ USHORT nLineCount = pTextForwarder->GetLineCount( nPara );
+ for ( USHORT nLine = 0; nLine < nLineCount; ++nLine )
+ {
+ USHORT nLineStart = 0;
+ USHORT nLineEnd = 0;
+ pTextForwarder->GetLineBoundaries( nLineStart, nLineEnd, nPara, nLine );
+ USHORT nWordStart = 0;
+ USHORT nWordEnd = 0;
+ if ( pTextForwarder->GetWordIndices( nPara, nLineStart, nWordStart, nWordEnd ) &&
+ ( nWordStart != nLineStart ) )
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
class MaxLabelEquidistantTickIter : public EquidistantTickIter
{
//iterate over first two and last two labels and the longest label