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

Convert connector tab page to widget UI

Also:
* Rename dimensionline.ui to dimensionlinetabpage for naming consistency
* Fix connector and measure dialogs for connectors and dimension lines

Change-Id: I921890b33a5f9807a6e12341ef7f374312abfc8b
Reviewed-on: https://gerrit.libreoffice.org/5920Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 60569652
......@@ -65,7 +65,6 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
cui/source/tabpages/autocdlg.src \
cui/source/tabpages/bbdlg.src \
cui/source/tabpages/border.src \
cui/source/tabpages/connect.src \
cui/source/tabpages/dstribut.src \
cui/source/tabpages/frmdirlbox.src \
cui/source/tabpages/grfpage.src \
......
......@@ -30,8 +30,9 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/charnamepage \
cui/uiconfig/ui/colorpage \
cui/uiconfig/ui/comment \
cui/uiconfig/ui/connectortabpage \
cui/uiconfig/ui/cuiimapdlg \
cui/uiconfig/ui/dimensionlines \
cui/uiconfig/ui/dimensionlinestabpage \
cui/uiconfig/ui/editdictionarydialog \
cui/uiconfig/ui/formatnumberdialog \
cui/uiconfig/ui/gradientpage \
......
......@@ -1630,14 +1630,17 @@ SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( Window* pParent,
sal_uInt32 nResId
)
{
// TODO will fix this ugly hack when all cases are in SfxSingleTabDialog
SfxNoLayoutSingleTabDialog* pDlg=NULL;
SfxSingleTabDialog* pDlg1=NULL;
switch ( nResId )
{
case RID_SVXPAGE_MEASURE :
pDlg = new SvxMeasureDialog( pParent, rAttr, pView );
pDlg1 = new SvxMeasureDialog( pParent, rAttr, pView );
break;
case RID_SVXPAGE_CONNECTION :
pDlg = new SvxConnectionDialog( pParent, rAttr, pView );
pDlg1 = new SvxConnectionDialog( pParent, rAttr, pView );
break;
case RID_SFXPAGE_DBREGISTER :
pDlg = new DatabaseRegistrationDialog( pParent, rAttr );
......@@ -1648,6 +1651,10 @@ SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( Window* pParent,
if ( pDlg )
return new CuiAbstractSfxDialog_Impl( pDlg );
if ( pDlg1 )
return new CuiAbstractSfxDialog_Impl( pDlg1 );
return 0;
}
......
......@@ -33,28 +33,21 @@ class SdrView;
class SvxConnectionPage : public SfxTabPage
{
private:
FixedText aFtType;
ListBox aLbType;
FixedLine aFlDelta;
FixedText aFtLine1;
MetricField aMtrFldLine1;
FixedText aFtLine2;
MetricField aMtrFldLine2;
FixedText aFtLine3;
MetricField aMtrFldLine3;
FixedLine aFlDistance;
FixedText aFtHorz1;
MetricField aMtrFldHorz1;
FixedText aFtVert1;
MetricField aMtrFldVert1;
FixedText aFtHorz2;
MetricField aMtrFldHorz2;
FixedText aFtVert2;
MetricField aMtrFldVert2;
SvxXConnectionPreview aCtlPreview;
ListBox* m_pLbType;
FixedText* m_pFtLine1;
MetricField* m_pMtrFldLine1;
FixedText* m_pFtLine2;
MetricField* m_pMtrFldLine2;
FixedText* m_pFtLine3;
MetricField* m_pMtrFldLine3;
MetricField* m_pMtrFldHorz1;
MetricField* m_pMtrFldVert1;
MetricField* m_pMtrFldHorz2;
MetricField* m_pMtrFldVert2;
SvxXConnectionPreview* m_pCtlPreview;
const SfxItemSet& rOutAttrs;
SfxItemSet aAttrSet;
......@@ -63,7 +56,7 @@ private:
void FillTypeLB();
DECL_LINK( ChangeAttrHdl_Impl, void * );
DECL_LINK( ChangeAttrHdl_Impl, void * );
public:
......@@ -83,7 +76,7 @@ public:
/* Derived from SfxNoLayoutSingleTabDialog, in order to be informed about
virtual methods by the control. */
class SvxConnectionDialog : public SfxNoLayoutSingleTabDialog
class SvxConnectionDialog : public SfxSingleTabDialog
{
public:
SvxConnectionDialog( Window* pParent, const SfxItemSet& rAttr,
......
......@@ -94,7 +94,8 @@
#define RID_SVXSTR_ASK_DEL_COLOR (RID_SVX_START + 217)
#define RID_SVXSTR_ASK_CHANGE_COLOR (RID_SVX_START + 218)
#define RID_SVXSTR_TABLE (RID_SVX_START + 220)
#define RID_SVXSTR_CONNECTOR (RID_SVX_START + 221)
#define RID_SVXSTR_DIMENSION_LINE (RID_SVX_START + 222)
#define RID_SVXSTR_CHARNAME_TRANSPARENT (RID_SVX_START + 237)
......
......@@ -217,7 +217,7 @@
#define HID_TPCOLOR_CMYK_2 "CUI_HID_TPCOLOR_CMYK_2"
#define HID_TPCOLOR_CMYK_3 "CUI_HID_TPCOLOR_CMYK_3"
#define HID_OFAPAGE_AUTOCOMPLETE_OPTIONS "CUI_HID_OFAPAGE_AUTOCOMPLETE_OPTIONS"
#define HID_PAGE_CONNECTION "CUI_HID_PAGE_CONNECTION"
#define HID_PAGE_CONNECTION_CTL_PREVIEW "CUI_HID_PAGE_CONNECTION_CTL_PREVIEW"
#define HID_PAGE_DISTRIBUTE "CUI_HID_PAGE_DISTRIBUTE"
#define HID_SVXPAGE_GRFCROP "CUI_HID_SVXPAGE_GRFCROP"
......
......@@ -83,7 +83,7 @@ public:
/* Derived from SfxNoLayoutSingleTabDialog, in order to be able to be
informed about virtual methods by the control. */
class SvxMeasureDialog : public SfxNoLayoutSingleTabDialog
class SvxMeasureDialog : public SfxSingleTabDialog
{
public:
SvxMeasureDialog( Window* pParent, const SfxItemSet& rAttr,
......
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_DISTANCE 1
#define FL_DELTA 2
#define FT_LINE_1 1
#define FT_LINE_2 2
#define FT_LINE_3 3
#define MTR_FLD_LINE_1 1
#define MTR_FLD_LINE_2 2
#define MTR_FLD_LINE_3 3
#define FT_HORZ_1 4
#define FT_HORZ_2 5
#define MTR_FLD_HORZ_1 4
#define MTR_FLD_HORZ_2 5
#define MTR_FLD_VERT_1 6
#define MTR_FLD_VERT_2 7
#define FT_VERT_2 7
#define FT_VERT_1 6
#define FT_TYPE 8
#define LB_TYPE 1
#define CTL_PREVIEW 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 <svtools/controldims.hrc>
#include "connect.hrc"
#include <cuires.hrc>
#include "helpid.hrc"
#include <svx/dialogs.hrc>
// RID_SVXPAGE_CONNECTION ------------------------------------------------
TabPage RID_SVXPAGE_CONNECTION
{
HelpId = HID_PAGE_CONNECTION ;
SVLook = TRUE ;
Hide = TRUE ;
Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
Text [ en-US ] = "Connector" ;
FixedText FT_TYPE
{
Pos = MAP_APPFONT ( 6 , 8 ) ;
Size = MAP_APPFONT ( 25 , 8 ) ;
Text [ en-US ] = "~Type" ;
};
ListBox LB_TYPE
{
HelpID = "cui:ListBox:RID_SVXPAGE_CONNECTION:LB_TYPE";
Border = TRUE ;
Pos = MAP_APPFONT ( 37 , 6 ) ;
Size = MAP_APPFONT ( 83 , 54 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
FixedLine FL_DELTA
{
Pos = MAP_APPFONT ( 6 , 24 ) ;
Size = MAP_APPFONT ( 120 , RSC_CD_FIXEDLINE_HEIGHT ) ;
Text [ en-US ] = "Line skew" ;
};
FixedText FT_LINE_1
{
Pos = MAP_APPFONT ( 12 , 37 ) ;
Size = MAP_APPFONT ( 66 , 8 ) ;
Text [ en-US ] = "Line ~1" ;
};
MetricField MTR_FLD_LINE_1
{
HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_LINE_1";
Border = TRUE ;
Pos = MAP_APPFONT ( 79 , 35 ) ;
Size = MAP_APPFONT ( 41 , 12 ) ;
TabStop = TRUE ;
Spin = TRUE ;
Repeat = TRUE ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
Unit = FUNIT_CM ;
};
FixedText FT_LINE_2
{
Pos = MAP_APPFONT ( 12 , 53 ) ;
Size = MAP_APPFONT ( 66 , 8 ) ;
Text [ en-US ] = "Line ~2" ;
};
MetricField MTR_FLD_LINE_2
{
HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_LINE_2";
Border = TRUE ;
Pos = MAP_APPFONT ( 79 , 51 ) ;
Size = MAP_APPFONT ( 41 , 12 ) ;
TabStop = TRUE ;
Spin = TRUE ;
Repeat = TRUE ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
Unit = FUNIT_CM ;
};
FixedText FT_LINE_3
{
Pos = MAP_APPFONT ( 12 , 69 ) ;
Size = MAP_APPFONT ( 66 , 8 ) ;
Text [ en-US ] = "Line ~3" ;
};
MetricField MTR_FLD_LINE_3
{
HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_LINE_3";
Border = TRUE ;
Pos = MAP_APPFONT ( 79 , 67 ) ;
Size = MAP_APPFONT ( 41 , 12 ) ;
TabStop = TRUE ;
Spin = TRUE ;
Repeat = TRUE ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
Unit = FUNIT_CM ;
};
FixedLine FL_DISTANCE
{
Pos = MAP_APPFONT ( 6 , 85 ) ;
Size = MAP_APPFONT ( 120 , RSC_CD_FIXEDLINE_HEIGHT ) ;
Text [ en-US ] = "Line spacing" ;
};
FixedText FT_HORZ_1
{
Pos = MAP_APPFONT ( 12 , 98 ) ;
Size = MAP_APPFONT ( 66 , 8 ) ;
Text [ en-US ] = "~Begin horizontal" ;
};
MetricField MTR_FLD_HORZ_1
{
HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_HORZ_1";
Border = TRUE ;
Pos = MAP_APPFONT ( 79 , 96 ) ;
Size = MAP_APPFONT ( 41 , 12 ) ;
TabStop = TRUE ;
Spin = TRUE ;
Repeat = TRUE ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
Unit = FUNIT_CM ;
};
FixedText FT_HORZ_2
{
Pos = MAP_APPFONT ( 12 , 130 ) ;
Size = MAP_APPFONT ( 66 , 8 ) ;
Text [ en-US ] = "End ~horizontal" ;
};
MetricField MTR_FLD_HORZ_2
{
HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_HORZ_2";
Border = TRUE ;
Pos = MAP_APPFONT ( 79 , 128 ) ;
Size = MAP_APPFONT ( 41 , 12 ) ;
TabStop = TRUE ;
Spin = TRUE ;
Repeat = TRUE ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
Unit = FUNIT_CM ;
};
FixedText FT_VERT_1
{
Pos = MAP_APPFONT ( 12 , 114 ) ;
Size = MAP_APPFONT ( 66 , 8 ) ;
Text [ en-US ] = "Begin ~vertical" ;
};
MetricField MTR_FLD_VERT_1
{
HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_VERT_1";
Border = TRUE ;
Pos = MAP_APPFONT ( 79 , 112 ) ;
Size = MAP_APPFONT ( 41 , 12 ) ;
TabStop = TRUE ;
Spin = TRUE ;
Repeat = TRUE ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
Unit = FUNIT_CM ;
};
FixedText FT_VERT_2
{
Pos = MAP_APPFONT ( 12 , 146 ) ;
Size = MAP_APPFONT ( 66 , 8 ) ;
Text [ en-US ] = "~End vertical" ;
};
MetricField MTR_FLD_VERT_2
{
HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_VERT_2";
Border = TRUE ;
Pos = MAP_APPFONT ( 79 , 144 ) ;
Size = MAP_APPFONT ( 41 , 12 ) ;
TabStop = TRUE ;
Spin = TRUE ;
Repeat = TRUE ;
DecimalDigits = 2 ;
Minimum = -10000 ;
First = -10000 ;
Maximum = 10000 ;
Last = 10000 ;
SpinSize = 10 ;
Unit = FUNIT_CM ;
};
Control CTL_PREVIEW
{
HelpId = HID_PAGE_CONNECTION_CTL_PREVIEW ;
Border = TRUE ;
Pos = MAP_APPFONT ( 6 + 120 + RSC_SP_FLGR_SPACE_Y + RSC_SP_FLGR_INNERBORDER_LEFT , 35 ) ;
Size = MAP_APPFONT ( 118 , 121 ) ;
QuickHelpText [ en-US ] = "Preview";
};
};
// ******************************************************************* EOF
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -61,16 +61,16 @@ static sal_uInt16 pRanges[] =
\************************************************************************/
SvxMeasureDialog::SvxMeasureDialog( Window* pParent, const SfxItemSet& rInAttrs,
const SdrView* pSdrView ) :
SfxNoLayoutSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_MEASURE )
const SdrView* pSdrView )
: SfxSingleTabDialog(pParent, rInAttrs)
{
SvxMeasurePage* _pPage = new SvxMeasurePage( this, rInAttrs );
SvxMeasurePage* _pPage = new SvxMeasurePage( get_content_area(), rInAttrs );
_pPage->SetView( pSdrView );
_pPage->Construct();
SetTabPage( _pPage );
SetText( _pPage->GetText() );
setTabPage(_pPage );
SetText(CUI_RESSTR(RID_SVXSTR_DIMENSION_LINE));
}
/*************************************************************************
......@@ -91,12 +91,9 @@ SvxMeasureDialog::~SvxMeasureDialog()
SvxMeasurePage::SvxMeasurePage( Window* pWindow, const SfxItemSet& rInAttrs ) :
SvxTabPage ( pWindow
,"DimensionLines"
,"cui/ui/dimensionlines.ui"
,"DimensionLinesTabPage"
,"cui/ui/dimensionlinestabpage.ui"
,rInAttrs ),
// aCtlPreview ( this, CUI_RES( CTL_PREVIEW ), rInAttrs ),
rOutAttrs ( rInAttrs ),
aAttrSet ( *rInAttrs.GetPool() ),
pView( 0 ),
......
......@@ -199,5 +199,13 @@ String RID_SVXSTR_DEL_SPACES_BETWEEN_LINES
{
Text [ en-US ] = "Delete spaces and tabs at end and start of line";
};
String RID_SVXSTR_CONNECTOR
{
Text [en-US ] = "Connector";
};
String RID_SVXSTR_DIMENSION_LINE
{
Text [en-US ] = "Dimension line";
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
......@@ -13,7 +13,7 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkBox" id="DimensionLines">
<object class="GtkBox" id="DimensionLinesTabPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
......
......@@ -251,6 +251,9 @@
<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="SvxXConnectionPreview" name="svxlo-SvxXConnectionPreview"
generic-name="Connector 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,22 +37,23 @@ class SVX_DLLPUBLIC SvxXConnectionPreview : public Control
friend class SvxConnectionPage;
private:
const SfxItemSet& rAttrs;
SdrEdgeObj* pEdgeObj;
SdrObjList* pObjList;
const SdrView* pView;
SVX_DLLPRIVATE void SetStyles();
SVX_DLLPRIVATE void AdaptSize();
public:
SvxXConnectionPreview( Window* pParent, const ResId& rResId,
const SfxItemSet& rInAttrs );
~SvxXConnectionPreview();
SvxXConnectionPreview( Window* pParent, WinBits nStyle);
virtual ~SvxXConnectionPreview();
virtual void Paint( const Rectangle& rRect );
virtual void Resize();
virtual Size GetOptimalSize() const;
virtual void MouseButtonDown( const MouseEvent& rMEvt );
void SetAttributes( const SfxItemSet& rInAttrs );
sal_uInt16 GetLineDeltaAnz();
sal_uInt16 GetLineDeltaAnz();
void Construct();
void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
......
......@@ -32,86 +32,53 @@
#include <svx/sxelditm.hxx>
#include <svx/sxmkitm.hxx>
SvxXConnectionPreview::SvxXConnectionPreview( Window* pParent, const ResId& rResId,
const SfxItemSet& rInAttrs ) :
Control ( pParent, rResId ),
rAttrs ( rInAttrs ),
pEdgeObj( NULL ),
pObjList( NULL ),
pView ( NULL )
#include <vcl/builder.hxx>
SvxXConnectionPreview::SvxXConnectionPreview( Window* pParent, WinBits nStyle)
: Control(pParent, nStyle)
, pEdgeObj(NULL)
, pObjList(NULL)
, pView(NULL)
{
SetMapMode( MAP_100TH_MM );
SetStyles();
}
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxXConnectionPreview(Window *pParent, VclBuilder::stringmap &rMap)
{
WinBits nWinStyle = 0;
OString sBorder = VclBuilder::extractCustomProperty(rMap);
if (!sBorder.isEmpty())
nWinStyle |= WB_BORDER;
return new SvxXConnectionPreview(pParent, nWinStyle);
}
SvxXConnectionPreview::~SvxXConnectionPreview()
{
delete pObjList;
}
void SvxXConnectionPreview::Construct()
void SvxXConnectionPreview::Resize()
{
DBG_ASSERT( pView, "No valid view is passed on! ");
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
sal_uIntPtr nMarkCount = rMarkList.GetMarkCount();
if( nMarkCount >= 1 )
{
bool bFound = false;
const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
for( sal_uInt16 i = 0; i < nMarkCount && !bFound; i++ )
{
pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
sal_uInt32 nInv = pObj->GetObjInventor();
sal_uInt16 nId = pObj->GetObjIdentifier();
if( nInv == SdrInventor && nId == OBJ_EDGE )
{
bFound = true;
SdrEdgeObj* pTmpEdgeObj = (SdrEdgeObj*) pObj;
pEdgeObj = (SdrEdgeObj*) pTmpEdgeObj->Clone();
SdrObjConnection& rConn1 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_True );
SdrObjConnection& rConn2 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_False );
rConn1 = pTmpEdgeObj->GetConnection( sal_True );
rConn2 = pTmpEdgeObj->GetConnection( sal_False );
Control::Resize();
SdrObject* pTmpObj1 = pTmpEdgeObj->GetConnectedNode( sal_True );
SdrObject* pTmpObj2 = pTmpEdgeObj->GetConnectedNode( sal_False );
// potential memory leak here (!). Create SdrObjList only when there is
// not yet one.
if(!pObjList)
{
pObjList = new SdrObjList( pView->GetModel(), NULL );
}
AdaptSize();
if( pTmpObj1 )
{
SdrObject* pObj1 = pTmpObj1->Clone();
pObjList->InsertObject( pObj1 );
pEdgeObj->ConnectToNode( sal_True, pObj1 );
}
if( pTmpObj2 )
{
SdrObject* pObj2 = pTmpObj2->Clone();
pObjList->InsertObject( pObj2 );
pEdgeObj->ConnectToNode( sal_False, pObj2 );
}
pObjList->InsertObject( pEdgeObj );
}
}
}
Invalidate();
}
if( !pEdgeObj )
pEdgeObj = new SdrEdgeObj();
Size SvxXConnectionPreview::GetOptimalSize() const
{
return LogicToPixel(Size(118 , 121), MapMode(MAP_APPFONT));
}
void SvxXConnectionPreview::AdaptSize()
{
// Adapt size
if( pObjList )
{
SetMapMode( MAP_100TH_MM );
OutputDevice* pOD = pView->GetFirstOutputDevice(); // GetWin( 0 );
Rectangle aRect = pObjList->GetAllObjBoundRect();
......@@ -161,13 +128,75 @@ void SvxXConnectionPreview::Construct()
aDisplayMap.SetOrigin( aNewPos );
SetMapMode( aDisplayMap );
Point aPos;
MouseEvent aMEvt( aPos, 1, 0, MOUSE_RIGHT );
MouseButtonDown( aMEvt );
}
}
void SvxXConnectionPreview::Construct()
{
DBG_ASSERT( pView, "No valid view is passed on! ");
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
sal_uIntPtr nMarkCount = rMarkList.GetMarkCount();
if( nMarkCount >= 1 )
{
bool bFound = false;
const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
for( sal_uInt16 i = 0; i < nMarkCount && !bFound; i++ )
{
pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
sal_uInt32 nInv = pObj->GetObjInventor();
sal_uInt16 nId = pObj->GetObjIdentifier();
if( nInv == SdrInventor && nId == OBJ_EDGE )
{
bFound = true;
SdrEdgeObj* pTmpEdgeObj = (SdrEdgeObj*) pObj;
pEdgeObj = (SdrEdgeObj*) pTmpEdgeObj->Clone();
SdrObjConnection& rConn1 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_True );
SdrObjConnection& rConn2 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_False );
rConn1 = pTmpEdgeObj->GetConnection( sal_True );
rConn2 = pTmpEdgeObj->GetConnection( sal_False );
SdrObject* pTmpObj1 = pTmpEdgeObj->GetConnectedNode( sal_True );
SdrObject* pTmpObj2 = pTmpEdgeObj->GetConnectedNode( sal_False );
// potential memory leak here (!). Create SdrObjList only when there is
// not yet one.
if(!pObjList)
{
pObjList = new SdrObjList( pView->GetModel(), NULL );
}
if( pTmpObj1 )
{
SdrObject* pObj1 = pTmpObj1->Clone();
pObjList->InsertObject( pObj1 );
pEdgeObj->ConnectToNode( sal_True, pObj1 );
}
if( pTmpObj2 )
{
SdrObject* pObj2 = pTmpObj2->Clone();
pObjList->InsertObject( pObj2 );
pEdgeObj->ConnectToNode( sal_False, pObj2 );
}
pObjList->InsertObject( pEdgeObj );
}
}
}
if( !pEdgeObj )
pEdgeObj = new SdrEdgeObj();
AdaptSize();
}
void SvxXConnectionPreview::Paint( const Rectangle& )
{
if( pObjList )
......
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