Kaydet (Commit) a8dd49b9 authored tarafından Olivier Hallot's avatar Olivier Hallot Kaydeden (comit) Caolán McNamara

Convert dimension lines tab page to widget UI

Change-Id: I1d5176609e2acd0d70991a541196e2b9857576f8
Reviewed-on: https://gerrit.libreoffice.org/5879Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 8c204276
......@@ -71,7 +71,6 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
cui/source/tabpages/grfpage.src \
cui/source/tabpages/labdlg.src \
cui/source/tabpages/macroass.src \
cui/source/tabpages/measure.src \
cui/source/tabpages/page.src \
cui/source/tabpages/paragrph.src \
cui/source/tabpages/strings.src \
......
......@@ -31,6 +31,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/colorpage \
cui/uiconfig/ui/comment \
cui/uiconfig/ui/cuiimapdlg \
cui/uiconfig/ui/dimensionlines \
cui/uiconfig/ui/editdictionarydialog \
cui/uiconfig/ui/formatnumberdialog \
cui/uiconfig/ui/gradientpage \
......
......@@ -224,7 +224,7 @@
#define HID_SVXPAGE_GRFCROP "CUI_HID_SVXPAGE_GRFCROP"
#define HID_CAPTION "CUI_HID_CAPTION"
#define HID_CAPTION_CTL_TYPE "CUI_HID_CAPTION_CTL_TYPE"
#define HID_PAGE_MEASURE "CUI_HID_PAGE_MEASURE"
#define HID_MEASURE_CTL_POSITION "CUI_HID_MEASURE_CTL_POSITION"
#define HID_VALUESET_NUM "CUI_HID_VALUESET_NUM"
#define HID_MEASURE_CTL_PREVIEW "CUI_HID_MEASURE_CTL_PREVIEW"
......
......@@ -32,40 +32,30 @@ class SvxMeasurePage : public SvxTabPage
{
private:
FixedLine aFlLine;
FixedText aFtLineDist;
MetricField aMtrFldLineDist;
FixedText aFtHelplineOverhang;
MetricField aMtrFldHelplineOverhang;
FixedText aFtHelplineDist;
MetricField aMtrFldHelplineDist;
FixedText aFtHelpline1Len;
MetricField aMtrFldHelpline1Len;
FixedText aFtHelpline2Len;
MetricField aMtrFldHelpline2Len;
TriStateBox aTsbBelowRefEdge;
FixedText aFtDecimalPlaces;
MetricField aMtrFldDecimalPlaces;
FixedLine aFlLabel;
FixedText aFtPosition;
SvxRectCtl aCtlPosition;
TriStateBox aTsbAutoPosV;
TriStateBox aTsbAutoPosH;
TriStateBox aTsbShowUnit;
ListBox aLbUnit;
TriStateBox aTsbParallel;
SvxXMeasurePreview aCtlPreview;
FixedLine aFlVert;
MetricField* m_pMtrFldLineDist;
MetricField* m_pMtrFldHelplineOverhang;
MetricField* m_pMtrFldHelplineDist;
MetricField* m_pMtrFldHelpline1Len;
MetricField* m_pMtrFldHelpline2Len;
TriStateBox* m_pTsbBelowRefEdge;
MetricField* m_pMtrFldDecimalPlaces;
SvxRectCtl* m_pCtlPosition;
TriStateBox* m_pTsbAutoPosV;
TriStateBox* m_pTsbAutoPosH;
TriStateBox* m_pTsbShowUnit;
ListBox* m_pLbUnit;
TriStateBox* m_pTsbParallel;
FixedText* m_pFtAutomatic;
SvxXMeasurePreview* m_pCtlPreview;
const SfxItemSet& rOutAttrs;
SfxItemSet aAttrSet;
const SdrView* pView;
SfxMapUnit eUnit;
sal_Bool bPositionModified;
sal_Bool bPositionModified;
void FillUnitLB();
......@@ -88,6 +78,7 @@ public:
void Construct();
void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
virtual void PageCreated (SfxAllItemSet aSet);
};
/* Derived from SfxNoLayoutSingleTabDialog, in order to be able to be
......
This diff is collapsed.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#define FL_LINE 1
#define FL_LABEL 2
#define FL_VERT 3
#define FT_LINE_DIST 1
#define FT_HELPLINE_OVERHANG 2
#define FT_HELPLINE_DIST 3
#define FT_HELPLINE1_LEN 4
#define FT_HELPLINE2_LEN 5
#define FT_POSITION 6
#define FT_DECIMALPLACES 7
#define MTR_LINE_DIST 1
#define MTR_FLD_HELPLINE_OVERHANG 2
#define MTR_FLD_HELPLINE_DIST 3
#define MTR_FLD_HELPLINE1_LEN 4
#define MTR_FLD_HELPLINE2_LEN 5
#define MTR_FLD_DECIMALPLACES 6
#define TSB_BELOW_REF_EDGE 1
#define TSB_SHOW_UNIT 2
#define TSB_AUTOPOSV 3
#define TSB_AUTOPOSH 4
#define TSB_PARALLEL 5
#define CTL_POSITION 1
#define CTL_PREVIEW 2
#define LB_UNIT 1
#define STR_MEASURE_AUTOMATIC 1
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <cuires.hrc>
#include "measure.hrc"
#include "helpid.hrc"
#include <svx/dialogs.hrc>
#define DELTA 20
// RID_SVXPAGE_MEASURE ---------------------------------------------------
TabPage RID_SVXPAGE_MEASURE
{
HelpId = HID_PAGE_MEASURE ;
Hide = TRUE ;
Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
Text [ en-US ] = "Dimensioning" ;
FixedLine FL_LINE
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 120 , 8 ) ;
Text [ en-US ] = "Line";
};
FixedText FT_LINE_DIST
{
Pos = MAP_APPFONT ( 12 , 16 ) ;
Size = MAP_APPFONT ( 65 , 8 ) ;
Text [ en-US ] = "Line ~distance" ;
};
MetricField MTR_LINE_DIST
{
HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_LINE_DIST";
Border = TRUE ;
Pos = MAP_APPFONT ( 78 , 14 ) ;
Size = MAP_APPFONT ( 42 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Unit = FUNIT_MM ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
};
FixedText FT_HELPLINE_OVERHANG
{
Pos = MAP_APPFONT ( 12 , 32 ) ;
Size = MAP_APPFONT ( 65 , 8 ) ;
Text [ en-US ] = "Guide ~overhang" ;
};
MetricField MTR_FLD_HELPLINE_OVERHANG
{
HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_HELPLINE_OVERHANG";
Border = TRUE ;
Pos = MAP_APPFONT ( 78 , 30 ) ;
Size = MAP_APPFONT ( 42 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Unit = FUNIT_MM ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
};
FixedText FT_HELPLINE_DIST
{
Pos = MAP_APPFONT ( 12 , 48 ) ;
Size = MAP_APPFONT ( 65 , 8 ) ;
Text [ en-US ] = "~Guide distance" ;
};
MetricField MTR_FLD_HELPLINE_DIST
{
HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_HELPLINE_DIST";
Border = TRUE ;
Pos = MAP_APPFONT ( 78 , 46 ) ;
Size = MAP_APPFONT ( 42 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Unit = FUNIT_MM ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
};
FixedText FT_HELPLINE1_LEN
{
Pos = MAP_APPFONT ( 12 , 64 ) ;
Size = MAP_APPFONT ( 65 , 8 ) ;
Text [ en-US ] = "~Left guide" ;
};
MetricField MTR_FLD_HELPLINE1_LEN
{
HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_HELPLINE1_LEN";
Border = TRUE ;
Pos = MAP_APPFONT ( 78 , 62 ) ;
Size = MAP_APPFONT ( 42 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Unit = FUNIT_MM ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
};
FixedText FT_HELPLINE2_LEN
{
Pos = MAP_APPFONT ( 12 , 80 ) ;
Size = MAP_APPFONT ( 65 , 8 ) ;
Text [ en-US ] = "~Right guide" ;
};
MetricField MTR_FLD_HELPLINE2_LEN
{
HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_HELPLINE2_LEN";
Border = TRUE ;
Pos = MAP_APPFONT ( 78 , 78 ) ;
Size = MAP_APPFONT ( 42 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Unit = FUNIT_MM ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
};
TriStateBox TSB_BELOW_REF_EDGE
{
HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_BELOW_REF_EDGE";
Pos = MAP_APPFONT ( 12 , 96 ) ;
Size = MAP_APPFONT ( 108 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Measure ~below object";
};
FixedText FT_DECIMALPLACES
{
Pos = MAP_APPFONT ( 12 , 112 ) ;
Size = MAP_APPFONT ( 65 , 8 ) ;
Text [ en-US ] = "Decimal places" ;
};
MetricField MTR_FLD_DECIMALPLACES
{
HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_DECIMALPLACES";
Border = TRUE ;
Pos = MAP_APPFONT ( 78 , 110 ) ;
Size = MAP_APPFONT ( 42 , 12 ) ;
TabStop = TRUE ;
Right = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 99 ;
StrictFormat = TRUE ;
Last = 99 ;
SpinSize = 1 ;
};
FixedLine FL_VERT
{
Pos = MAP_APPFONT ( 127 , 14 ) ;
Size = MAP_APPFONT ( 4 , 108 ) ;
Vert = TRUE ;
};
FixedLine FL_LABEL
{
Pos = MAP_APPFONT ( 132 , 3 ) ;
Size = MAP_APPFONT ( 122 , 8 ) ;
Text [ en-US ] = "Legend";
};
FixedText FT_POSITION
{
Pos = MAP_APPFONT ( 138 , 14 ) ;
Size = MAP_APPFONT ( 110 , 8 ) ;
Text [ en-US ] = "~Text position" ;
};
Control CTL_POSITION
{
HelpId = HID_MEASURE_CTL_POSITION ;
Border = TRUE ;
Pos = MAP_APPFONT ( 154 , 25 ) ;
Size = MAP_APPFONT ( 60 , 24 ) ;
TabStop = TRUE ;
};
TriStateBox TSB_AUTOPOSV
{
HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_AUTOPOSV";
Pos = MAP_APPFONT ( 154 , 54 ) ;
Size = MAP_APPFONT ( 101 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~AutoVertical" ;
};
TriStateBox TSB_AUTOPOSH
{
HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_AUTOPOSH";
Pos = MAP_APPFONT ( 154 , 68 ) ;
Size = MAP_APPFONT ( 101 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "A~utoHorizontal" ;
};
TriStateBox TSB_PARALLEL
{
HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_PARALLEL";
Pos = MAP_APPFONT ( 138 , 82 ) ;
Size = MAP_APPFONT ( 110 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Parallel to line";
};
TriStateBox TSB_SHOW_UNIT
{
HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_SHOW_UNIT";
Pos = MAP_APPFONT ( 138 , 96 ) ;
Size = MAP_APPFONT ( 64+40 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Show ~meas. units" ;
};
ListBox LB_UNIT
{
HelpID = "cui:ListBox:RID_SVXPAGE_MEASURE:LB_UNIT";
Border = TRUE ;
Pos = MAP_APPFONT ( 154 , 110 ) ;
Size = MAP_APPFONT ( 60 , 80+35 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
DDExtraWidth = TRUE ;
};
Control CTL_PREVIEW
{
HelpId = HID_MEASURE_CTL_PREVIEW ;
Border = TRUE ;
Pos = MAP_APPFONT ( 6 , 132 ) ;
Size = MAP_APPFONT ( 248 , 47 ) ;
};
String STR_MEASURE_AUTOMATIC
{
Text [ en-US ] = "Automatic" ;
};
};
// ********************************************************************** EOF
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
......@@ -2,6 +2,21 @@
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkAdjustment" id="adjustmentPERCENT">
<property name="upper">100</property>
<property name="step_increment">5</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustmentWIDTH">
<property name="upper">5</property>
<property name="step_increment">0.10000000000000001</property>
<property name="page_increment">1</property>
</object>
<object class="GtkAdjustment" id="adjustmentWIDTH_SYMBOL">
<property name="upper">19.989999999999998</property>
<property name="step_increment">0.050000000000000003</property>
<property name="page_increment">1</property>
</object>
<object class="GtkBox" id="LineTabPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -700,11 +715,11 @@
</packing>
</child>
<child>
<object class="svxlo-SvxXLinePreview" id="CTL_PREVIEW">
<object class="svxlo-SvxXLinePreview" id="CTL_PREVIEW:border">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="CTL_PREVIEW-atkobject">
<object class="AtkObject" id="CTL_PREVIEW:border-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Example</property>
</object>
</child>
......@@ -716,21 +731,6 @@
</packing>
</child>
</object>
<object class="GtkAdjustment" id="adjustmentPERCENT">
<property name="upper">100</property>
<property name="step_increment">5</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustmentWIDTH">
<property name="upper">5</property>
<property name="step_increment">0.10000000000000001</property>
<property name="page_increment">1</property>
</object>
<object class="GtkAdjustment" id="adjustmentWIDTH_SYMBOL">
<property name="upper">19.989999999999998</property>
<property name="step_increment">0.050000000000000003</property>
<property name="page_increment">1</property>
</object>
<object class="GtkListStore" id="liststoreCAP_STYLE">
<columns>
<!-- column-name gchararray1 -->
......
......@@ -248,6 +248,9 @@
<glade-widget-class title="SvxXLinePreview" name="svxlo-SvxXLinePreview"
generic-name="Line Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="SvxXMeasurePreview" name="svxlo-SvxXMeasurePreview"
generic-name="Dimension Line Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Shadow Preview" name="svxlo-SvxXShadowPreview"
generic-name="Shadow Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
......
......@@ -37,16 +37,16 @@ class SVX_DLLPUBLIC SvxXMeasurePreview : public Control
friend class SvxMeasurePage;
private:
const SfxItemSet& rAttrs;
SdrMeasureObj* pMeasureObj;
SdrModel* pModel;
public:
SvxXMeasurePreview( Window* pParent, const ResId& rResId,
const SfxItemSet& rInAttrs );
~SvxXMeasurePreview();
SvxXMeasurePreview(Window* pParent, const ResId& rResId, const SfxItemSet& rInAttrs);
SvxXMeasurePreview(Window* pParent, WinBits nStyle);
~SvxXMeasurePreview();
virtual void Paint( const Rectangle& rRect );
virtual void Paint(const Rectangle& rRect);
virtual void Resize();
virtual void MouseButtonDown( const MouseEvent& rMEvt );
void SetAttributes( const SfxItemSet& rInAttrs );
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment