summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorOlivier Hallot <olivier.hallot@edx.srv.br>2013-09-08 23:42:24 -0300
committerCaolán McNamara <caolanm@redhat.com>2013-09-09 10:36:32 +0000
commita8dd49b9fc59371ff8edb31082bbd4f1b6179b1c (patch)
tree1179f5a4ca575a4b988eb353fd8d8930a8534e78 /svx
parent8c204276a438c718bd2eed6c59189dcfb24032be (diff)
Convert dimension lines tab page to widget UI
Change-Id: I1d5176609e2acd0d70991a541196e2b9857576f8 Reviewed-on: https://gerrit.libreoffice.org/5879 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/measctrl.cxx57
1 files changed, 48 insertions, 9 deletions
diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx
index 740ddc8b938a..646decbf06d5 100644
--- a/svx/source/dialog/measctrl.cxx
+++ b/svx/source/dialog/measctrl.cxx
@@ -19,20 +19,14 @@
#include <svx/svdomeas.hxx>
#include <svx/svdmodel.hxx>
+#include <vcl/builder.hxx>
#include "svx/measctrl.hxx"
#include <svx/dialmgr.hxx>
#include "svx/dlgutil.hxx"
-SvxXMeasurePreview::SvxXMeasurePreview
-(
- Window* pParent,
- const ResId& rResId,
- const SfxItemSet& rInAttrs
-) :
-
- Control ( pParent, rResId ),
- rAttrs ( rInAttrs )
+SvxXMeasurePreview::SvxXMeasurePreview( Window* pParent,const ResId& rResId,const SfxItemSet& rInAttrs)
+: Control ( pParent, rResId )
{
SetMapMode( MAP_100TH_MM );
@@ -60,6 +54,51 @@ SvxXMeasurePreview::SvxXMeasurePreview
Invalidate();
}
+SvxXMeasurePreview::SvxXMeasurePreview( Window* pParent, WinBits nStyle)
+ : Control(pParent, nStyle)
+{
+ SetMapMode( MAP_100TH_MM );
+
+ // Scale: 1:2
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetScaleX( Fraction( 1, 2 ) );
+ aMapMode.SetScaleY( Fraction( 1, 2 ) );
+ SetMapMode( aMapMode );
+
+ Size aSize = GetOutputSize();
+ Point aPt1 = Point( aSize.Width() / 5, (long) ( aSize.Height() / 2 ) );
+ Point aPt2 = Point( aSize.Width() * 4 / 5, (long) ( aSize.Height() / 2 ) );
+
+ pMeasureObj = new SdrMeasureObj( aPt1, aPt2 );
+ pModel = new SdrModel();
+ pMeasureObj->SetModel( pModel );
+
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+
+ Invalidate();
+}
+
+void SvxXMeasurePreview::Resize()
+{
+ Control::Resize();
+
+ Size aSize = GetOutputSize();
+ Point aPt1 = Point( aSize.Width() / 5, (long) ( aSize.Height() / 2 ) );
+ pMeasureObj->SetPoint(aPt1, 0);
+ Point aPt2 = Point( aSize.Width() * 4 / 5, (long) ( aSize.Height() / 2 ) );
+ pMeasureObj->SetPoint(aPt2, 1);
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxXMeasurePreview(Window *pParent, VclBuilder::stringmap &rMap)
+{
+ WinBits nWinStyle = 0;
+ OString sBorder = VclBuilder::extractCustomProperty(rMap);
+ if (!sBorder.isEmpty())
+ nWinStyle |= WB_BORDER;
+ return new SvxXMeasurePreview(pParent, nWinStyle);
+}
+
+
SvxXMeasurePreview::~SvxXMeasurePreview()
{
// No one is deleting the MeasureObj? This is not only an error but also