summaryrefslogtreecommitdiff
path: root/sw/source/ui/table
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/table')
-rw-r--r--sw/source/ui/table/chartins.cxx285
-rw-r--r--sw/source/ui/table/chartins.hrc47
-rw-r--r--sw/source/ui/table/chartins.src130
-rw-r--r--sw/source/ui/table/colwd.cxx123
-rw-r--r--sw/source/ui/table/colwd.hrc36
-rw-r--r--sw/source/ui/table/colwd.src146
-rw-r--r--sw/source/ui/table/convert.cxx279
-rw-r--r--sw/source/ui/table/convert.hrc47
-rw-r--r--sw/source/ui/table/convert.src197
-rw-r--r--sw/source/ui/table/instable.cxx253
-rw-r--r--sw/source/ui/table/instable.hrc49
-rw-r--r--sw/source/ui/table/instable.src199
-rw-r--r--sw/source/ui/table/mergetbl.cxx66
-rw-r--r--sw/source/ui/table/mergetbl.hrc32
-rw-r--r--sw/source/ui/table/mergetbl.src118
-rw-r--r--sw/source/ui/table/rowht.cxx120
-rw-r--r--sw/source/ui/table/rowht.hrc34
-rw-r--r--sw/source/ui/table/rowht.src123
-rw-r--r--sw/source/ui/table/splittbl.cxx79
-rw-r--r--sw/source/ui/table/splittbl.hrc34
-rw-r--r--sw/source/ui/table/splittbl.src129
-rw-r--r--sw/source/ui/table/swtablerep.cxx241
-rw-r--r--sw/source/ui/table/table.src59
-rw-r--r--sw/source/ui/table/tabledlg.cxx1981
-rw-r--r--sw/source/ui/table/tabledlg.hrc110
-rw-r--r--sw/source/ui/table/tabledlg.src789
-rw-r--r--sw/source/ui/table/tablemgr.cxx382
-rw-r--r--sw/source/ui/table/tablepg.hxx239
-rw-r--r--sw/source/ui/table/tautofmt.cxx1057
-rw-r--r--sw/source/ui/table/tautofmt.hrc78
-rw-r--r--sw/source/ui/table/tautofmt.src307
31 files changed, 7769 insertions, 0 deletions
diff --git a/sw/source/ui/table/chartins.cxx b/sw/source/ui/table/chartins.cxx
new file mode 100644
index 000000000000..ce370ced3304
--- /dev/null
+++ b/sw/source/ui/table/chartins.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/viewfrm.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <IDocumentUndoRedo.hxx>
+
+#include <sfx2/app.hxx>
+#include <swtypes.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <view.hxx>
+#include <chartins.hxx>
+#include <tablemgr.hxx>
+#include <frmfmt.hxx>
+#include <swtable.hxx>
+#include <tblsel.hxx>
+#include <unochart.hxx>
+#include <autoedit.hxx>
+#include <doc.hxx>
+
+#include <edtwin.hxx>
+
+#include <cmdid.h>
+#include <chartins.hrc>
+#include <anchoredobject.hxx>
+
+#include <sot/clsids.hxx>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <cppuhelper/component_context.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+
+
+Point SwGetChartDialogPos( const Window *pParentWin, const Size& rDialogSize, const Rectangle& rLogicChart )
+{
+ // !! positioning code according to spepc; similar to Calc fuins2.cxx
+
+ Point aRet;
+
+ DBG_ASSERT( pParentWin, "Window not found" );
+ if (pParentWin)
+ {
+ Rectangle aObjPixel = pParentWin->LogicToPixel( rLogicChart, pParentWin->GetMapMode() );
+ Rectangle aObjAbs( pParentWin->OutputToAbsoluteScreenPixel( aObjPixel.TopLeft() ),
+ pParentWin->OutputToAbsoluteScreenPixel( aObjPixel.BottomRight() ) );
+
+ Rectangle aDesktop = pParentWin->GetDesktopRectPixel();
+ Size aSpace = pParentWin->LogicToPixel( Size( 8, 12 ), MAP_APPFONT );
+
+ sal_Bool bLayoutRTL = ::GetActiveView()->GetWrtShell().IsTableRightToLeft();
+ bool bCenterHor = false;
+
+ if ( aDesktop.Bottom() - aObjAbs.Bottom() >= rDialogSize.Height() + aSpace.Height() )
+ {
+ // first preference: below the chart
+ aRet.Y() = aObjAbs.Bottom() + aSpace.Height();
+ bCenterHor = true;
+ }
+ else if ( aObjAbs.Top() - aDesktop.Top() >= rDialogSize.Height() + aSpace.Height() )
+ {
+ // second preference: above the chart
+ aRet.Y() = aObjAbs.Top() - rDialogSize.Height() - aSpace.Height();
+ bCenterHor = true;
+ }
+ else
+ {
+ bool bFitLeft = ( aObjAbs.Left() - aDesktop.Left() >= rDialogSize.Width() + aSpace.Width() );
+ bool bFitRight = ( aDesktop.Right() - aObjAbs.Right() >= rDialogSize.Width() + aSpace.Width() );
+
+ if ( bFitLeft || bFitRight )
+ {
+ // if both fit, prefer right in RTL mode, left otherwise
+ bool bPutRight = bFitRight && ( bLayoutRTL || !bFitLeft );
+ if ( bPutRight )
+ aRet.X() = aObjAbs.Right() + aSpace.Width();
+ else
+ aRet.X() = aObjAbs.Left() - rDialogSize.Width() - aSpace.Width();
+
+ // center vertically
+ aRet.Y() = aObjAbs.Top() + ( aObjAbs.GetHeight() - rDialogSize.Height() ) / 2;
+ }
+ else
+ {
+ // doesn't fit on any edge - put at the bottom of the screen
+ aRet.Y() = aDesktop.Bottom() - rDialogSize.Height();
+ bCenterHor = true;
+ }
+ }
+ if ( bCenterHor )
+ aRet.X() = aObjAbs.Left() + ( aObjAbs.GetWidth() - rDialogSize.Width() ) / 2;
+
+ // limit to screen (centering might lead to invalid positions)
+ if ( aRet.X() + rDialogSize.Width() - 1 > aDesktop.Right() )
+ aRet.X() = aDesktop.Right() - rDialogSize.Width() + 1;
+ if ( aRet.X() < aDesktop.Left() )
+ aRet.X() = aDesktop.Left();
+ if ( aRet.Y() + rDialogSize.Height() - 1 > aDesktop.Bottom() )
+ aRet.Y() = aDesktop.Bottom() - rDialogSize.Height() + 1;
+ if ( aRet.Y() < aDesktop.Top() )
+ aRet.Y() = aDesktop.Top();
+ }
+
+ return aRet;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+void SwInsertChart(Window* pParent, SfxBindings* pBindings )
+{
+ (void) pParent;
+ (void) pBindings;
+ SwView *pView = ::GetActiveView();
+
+ // get range string of marked data
+ SwWrtShell &rWrtShell = pView->GetWrtShell();
+ uno::Reference< chart2::data::XDataProvider > xDataProvider;
+ uno::Reference< frame::XModel > xChartModel;
+ OUString aRangeString;
+
+ if( rWrtShell.IsCrsrInTbl())
+ {
+ if (!rWrtShell.IsTableMode())
+ {
+ // select whole table
+ rWrtShell.GetView().GetViewFrame()->GetDispatcher()->
+ Execute(FN_TABLE_SELECT_ALL, SFX_CALLMODE_SYNCHRON);
+ }
+ if( ! rWrtShell.IsTblComplexForChart())
+ {
+ SwFrmFmt* pTblFmt = rWrtShell.GetTableFmt();
+ String aCurrentTblName = pTblFmt->GetName();
+// String aText( String::CreateFromAscii("<.>") ); // was used for UI
+// aText.Insert( rWrtShell.GetBoxNms(), 2);
+// aText.Insert( aCurrentTblName, 1 );
+ aRangeString = aCurrentTblName;
+ aRangeString += OUString::valueOf( sal_Unicode('.') );
+ aRangeString += rWrtShell.GetBoxNms();
+
+ // get table data provider
+ xDataProvider.set( pView->GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider( true ) );
+ }
+ }
+
+ SwFlyFrmFmt *pFlyFrmFmt = 0;
+ xChartModel.set( SwTableFUNC( &rWrtShell, sal_False ).InsertChart( xDataProvider, (sal_True == xDataProvider.is()), aRangeString, &pFlyFrmFmt ));
+
+ //open wizard
+ //@todo get context from writer if that has one
+ uno::Reference< uno::XComponentContext > xContext(
+ ::cppu::defaultBootstrap_InitialComponentContext() );
+ if( xContext.is() && xChartModel.is() && xDataProvider.is())
+ {
+ uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
+ if(xMCF.is())
+ {
+ uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
+ xMCF->createInstanceWithContext(
+ C2U("com.sun.star.comp.chart2.WizardDialog")
+ , xContext), uno::UNO_QUERY);
+ uno::Reference< lang::XInitialization > xInit( xDialog, uno::UNO_QUERY );
+ if( xInit.is() )
+ {
+ uno::Reference< awt::XWindow > xDialogParentWindow(0);
+ // initialize dialog
+ uno::Sequence<uno::Any> aSeq(2);
+ uno::Any* pArray = aSeq.getArray();
+ beans::PropertyValue aParam1;
+ aParam1.Name = C2U("ParentWindow");
+ aParam1.Value <<= uno::makeAny(xDialogParentWindow);
+ beans::PropertyValue aParam2;
+ aParam2.Name = C2U("ChartModel");
+ aParam2.Value <<= uno::makeAny(xChartModel);
+ pArray[0] <<= uno::makeAny(aParam1);
+ pArray[1] <<= uno::makeAny(aParam2);
+ xInit->initialize( aSeq );
+
+ // try to set the dialog's position so it doesn't hide the chart
+ uno::Reference < beans::XPropertySet > xDialogProps( xDialog, uno::UNO_QUERY );
+ if ( xDialogProps.is() )
+ {
+ try
+ {
+ //get dialog size:
+ awt::Size aDialogAWTSize;
+ if( xDialogProps->getPropertyValue( ::rtl::OUString::createFromAscii("Size") )
+ >>= aDialogAWTSize )
+ {
+ Size aDialogSize( aDialogAWTSize.Width, aDialogAWTSize.Height );
+ if ( aDialogSize.Width() > 0 && aDialogSize.Height() > 0 )
+ {
+ //calculate and set new position
+ SwRect aSwRect;
+ if (pFlyFrmFmt)
+ aSwRect = pFlyFrmFmt->GetAnchoredObj()->GetObjRectWithSpaces();
+ Rectangle aRect( aSwRect.SVRect() );
+ Point aDialogPos = SwGetChartDialogPos( &rWrtShell.GetView().GetEditWin(), aDialogSize, aRect );
+ xDialogProps->setPropertyValue( ::rtl::OUString::createFromAscii("Position"),
+ uno::makeAny( awt::Point(aDialogPos.getX(),aDialogPos.getY()) ) );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "Chart wizard couldn't be positioned automatically\n" );
+ }
+ }
+
+ sal_Int16 nDialogRet = xDialog->execute();
+ if( nDialogRet == ui::dialogs::ExecutableDialogResults::CANCEL )
+ {
+ rWrtShell.Undo();
+ rWrtShell.GetIDocumentUndoRedo().ClearRedo();
+ }
+ else
+ {
+ DBG_ASSERT( nDialogRet == ui::dialogs::ExecutableDialogResults::OK,
+ "dialog execution failed" );
+ }
+ }
+ uno::Reference< lang::XComponent > xComponent( xDialog, uno::UNO_QUERY );
+ if( xComponent.is())
+ xComponent->dispose();
+ }
+ }
+}
+
+
+void __EXPORT AutoEdit::KeyInput( const KeyEvent& rEvt )
+{
+ sal_uInt16 nCode = rEvt.GetKeyCode().GetCode();
+ if( nCode != KEY_SPACE )
+ Edit::KeyInput( rEvt );
+}
+
+
+
+
diff --git a/sw/source/ui/table/chartins.hrc b/sw/source/ui/table/chartins.hrc
new file mode 100644
index 000000000000..91bbb0f424c6
--- /dev/null
+++ b/sw/source/ui/table/chartins.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHARTINS_HRC
+#define _CHARTINS_HRC
+
+#include "rcid.hrc"
+#include "table.hrc"
+
+#define ED_RANGE 1
+#define FT_RANGE 2
+#define BT_NEXT 3
+#define BT_FINISH 4
+#define BT_HELP 5
+#define BT_CANCEL 6
+#define CB_FIRST_ROW 7
+#define CB_FIRST_COL 8
+#define BT_PREV 9
+#define FL_HLINE 10
+#define FT_TEXT 11
+#define FL_1 12
+
+#endif
diff --git a/sw/source/ui/table/chartins.src b/sw/source/ui/table/chartins.src
new file mode 100644
index 000000000000..b4cd8fdbeff0
--- /dev/null
+++ b/sw/source/ui/table/chartins.src
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+#include "chartins.hrc"
+#include "helpid.h"
+ModelessDialog DLG_INSERT_CHART
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 297 , 169 ) ;
+ Moveable = TRUE ;
+ HelpID = HID_INSERT_CHART ;
+ Hide = TRUE ;
+ Text [ en-US ] = "AutoFormat Chart (1-4)" ;
+ FixedLine FL_1
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 285 , 8 ) ;
+ Text [ en-US ] = "Selection" ;
+ };
+ FixedText FT_RANGE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "A~rea" ;
+ };
+ Edit ED_RANGE
+ {
+ HelpID = "sw:Edit:DLG_INSERT_CHART:ED_RANGE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 14 ) ;
+ Size = MAP_APPFONT ( 229 , 12 ) ;
+ };
+ CheckBox CB_FIRST_ROW
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_CHART:CB_FIRST_ROW";
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~First row as caption" ;
+ Check = TRUE ;
+ };
+ CheckBox CB_FIRST_COL
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_CHART:CB_FIRST_COL";
+ Pos = MAP_APPFONT ( 12 , 46 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "First ~column as caption" ;
+ Check = TRUE ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 6 , 72 ) ;
+ Size = MAP_APPFONT ( 285 , 62 ) ;
+ Text [ en-US ] = "If the selected cells do not contain the desired data, select the data range now.\n\nInclude the cells containing column and row labels if you want them to be included in your chart." ;
+ WordBreak = TRUE ;
+ };
+ FixedLine FL_HLINE
+ {
+ Pos = MAP_APPFONT ( 0 , 140 ) ;
+ Size = MAP_APPFONT ( 297 , 8 ) ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BT_PREV
+ {
+ HelpID = "sw:PushButton:DLG_INSERT_CHART:BT_PREV";
+ Pos = MAP_APPFONT ( 130 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ // ### ACHTUNG: Neuer Text in Resource? << ~Zurück : << Zurück
+ /* ### ACHTUNG: Neuer Text in Resource? << ~Zurück : << ~Zur³ck */
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "<< ~Back" ;
+ };
+ PushButton BT_NEXT
+ {
+ HelpID = "sw:PushButton:DLG_INSERT_CHART:BT_NEXT";
+ Pos = MAP_APPFONT ( 185 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Next >>" ;
+ };
+ PushButton BT_FINISH
+ {
+ HelpID = "sw:PushButton:DLG_INSERT_CHART:BT_FINISH";
+ Pos = MAP_APPFONT ( 240 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Cre~ate" ;
+ };
+};
+
+
diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx
new file mode 100644
index 000000000000..70811c670496
--- /dev/null
+++ b/sw/source/ui/table/colwd.cxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <sfx2/dispatch.hxx>
+#include <svx/dlgutil.hxx>
+#include <colwd.hxx>
+#include <tablemgr.hxx>
+#include <wrtsh.hxx>
+#ifndef _WDOCSH_HXX
+#include <wdocsh.hxx>
+#endif
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _MODCFG_HXX
+#include <modcfg.hxx>
+#endif
+#include <usrpref.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _COLWD_HRC
+#include <colwd.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+
+
+IMPL_LINK_INLINE_START( SwTableWidthDlg, LoseFocusHdl, Edit *, EMPTYARG )
+{
+ sal_uInt16 nId = (sal_uInt16)aColEdit.GetValue()-1;
+ const SwTwips lWidth = rFnc.GetColWidth(nId);
+ aWidthEdit.SetValue(aWidthEdit.Normalize(lWidth), FUNIT_TWIP);
+ aWidthEdit.SetMax(aWidthEdit.Normalize(rFnc.GetMaxColWidth(nId)), FUNIT_TWIP);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwTableWidthDlg, LoseFocusHdl, Edit *, EMPTYARG )
+
+
+
+SwTableWidthDlg::SwTableWidthDlg(Window *pParent, SwTableFUNC &rTableFnc ) :
+
+ SvxStandardDialog( pParent, SW_RES(DLG_COL_WIDTH) ),
+
+ aColFT(this, SW_RES(FT_COL)),
+ aColEdit(this, SW_RES(ED_COL)),
+ aWidthFT(this, SW_RES(FT_WIDTH)),
+ aWidthEdit(this, SW_RES(ED_WIDTH)),
+ aWidthFL(this, SW_RES(FL_WIDTH)),
+ aOKBtn(this, SW_RES(BT_OK)),
+ aCancelBtn(this, SW_RES(BT_CANCEL)),
+ aHelpBtn(this, SW_RES(BT_HELP)),
+ rFnc(rTableFnc)
+{
+ FreeResource();
+
+ sal_Bool bIsWeb = rTableFnc.GetShell()
+ ? static_cast< sal_Bool >(0 != PTR_CAST( SwWebDocShell,
+ rTableFnc.GetShell()->GetView().GetDocShell()) )
+ : sal_False;
+ FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( bIsWeb )->GetMetric();
+ ::SetFieldUnit(aWidthEdit, eFieldUnit );
+
+ aColEdit.SetValue( rFnc.GetCurColNum() +1 );
+ aWidthEdit.SetMin(aWidthEdit.Normalize(MINLAY), FUNIT_TWIP);
+ if(!aWidthEdit.GetMin())
+ aWidthEdit.SetMin(1);
+
+ if(rFnc.GetColCount() == 0)
+ aWidthEdit.SetMin(aWidthEdit.Normalize(rFnc.GetColWidth(0)), FUNIT_TWIP);
+ aColEdit.SetMax(rFnc.GetColCount() +1 );
+ aColEdit.SetModifyHdl(LINK(this,SwTableWidthDlg, LoseFocusHdl));
+ LoseFocusHdl();
+}
+
+
+
+void SwTableWidthDlg::Apply()
+{
+ rFnc.InitTabCols();
+ rFnc.SetColWidth(
+ static_cast< sal_uInt16 >(aColEdit.GetValue() - 1),
+ static_cast< sal_uInt16 >(aWidthEdit.Denormalize(aWidthEdit.GetValue(FUNIT_TWIP))));
+}
+
+
+
+
diff --git a/sw/source/ui/table/colwd.hrc b/sw/source/ui/table/colwd.hrc
new file mode 100644
index 000000000000..4ac7358a65a9
--- /dev/null
+++ b/sw/source/ui/table/colwd.hrc
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FT_COL 1
+#define ED_COL 2
+#define FT_WIDTH 3
+#define ED_WIDTH 4
+#define FL_WIDTH 5
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
+
diff --git a/sw/source/ui/table/colwd.src b/sw/source/ui/table/colwd.src
new file mode 100644
index 000000000000..fb1505c1cabe
--- /dev/null
+++ b/sw/source/ui/table/colwd.src
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "colwd.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ // #define DLG_COL_WIDTH 256
+ModalDialog DLG_COL_WIDTH
+{
+ HelpID = CMD_FN_TABLE_SET_COL_WIDTH ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 159 , 60 ) ;
+ Text [ en-US ] = "Column Width" ;
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 104 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 104 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 104 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Width" ;
+ Left = TRUE ;
+ };
+ MetricField ED_WIDTH
+ {
+ HelpID = "sw:MetricField:DLG_COL_WIDTH:ED_WIDTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 51 , 30 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 50 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ SpinSize = 10 ;
+ Value = 10 ;
+ Unit = FUNIT_CM ;
+ First = 100 ;
+ Last = 9999 ;
+ };
+ FixedLine FL_WIDTH
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 91 , 8 ) ;
+ Text [ en-US ] = "Width" ;
+ };
+ FixedText FT_COL
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Column" ;
+ Left = TRUE ;
+ };
+ NumericField ED_COL
+ {
+ HelpID = "sw:NumericField:DLG_COL_WIDTH:ED_COL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 51 , 14 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Repeat = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
new file mode 100644
index 000000000000..da3ad666fd64
--- /dev/null
+++ b/sw/source/ui/table/convert.cxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <modcfg.hxx>
+#include <svx/htmlmode.hxx>
+#include <viewopt.hxx>
+#include "swmodule.hxx"
+#include "cmdid.h"
+#include "convert.hxx"
+#include "tablemgr.hxx"
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "tblafmt.hxx"
+
+#include "table.hrc"
+#include "convert.hrc"
+#include "swabstdlg.hxx"
+
+namespace swui
+{
+ SwAbstractDialogFactory * GetFactory();
+}
+
+//keep the state of the buttons on runtime
+static int nSaveButtonState = -1; // 0: tab, 1: semicolon, 2: paragraph, 3: other, -1: not yet used
+static sal_Bool bIsKeepColumn = sal_True;
+static sal_Unicode uOther = ',';
+
+void SwConvertTableDlg::GetValues( sal_Unicode& rDelim,
+ SwInsertTableOptions& rInsTblOpts,
+ SwTableAutoFmt *& prTAFmt )
+{
+ if( aTabBtn.IsChecked() )
+ {
+ //0x0b mustn't be set when re-converting table into text
+ bIsKeepColumn = !aKeepColumn.IsVisible() || aKeepColumn.IsChecked();
+ rDelim = bIsKeepColumn ? 0x09 : 0x0b;
+ nSaveButtonState = 0;
+ }
+ else if( aSemiBtn.IsChecked() )
+ {
+ rDelim = ';';
+ nSaveButtonState = 1;
+ }
+ else if( aOtherBtn.IsChecked() && aOtherEd.GetText().Len() )
+ {
+ uOther = aOtherEd.GetText().GetChar( 0 );
+ rDelim = uOther;
+ nSaveButtonState = 3;
+ }
+ else
+ {
+ nSaveButtonState = 2;
+ rDelim = cParaDelim;
+ if(aOtherBtn.IsChecked())
+ {
+ nSaveButtonState = 3;
+ uOther = 0;
+ }
+ }
+
+
+ sal_uInt16 nInsMode = 0;
+ if (aBorderCB.IsChecked())
+ nInsMode |= tabopts::DEFAULT_BORDER;
+ if (aHeaderCB.IsChecked())
+ nInsMode |= tabopts::HEADLINE;
+ if (aRepeatHeaderCB.IsEnabled() && aRepeatHeaderCB.IsChecked())
+ rInsTblOpts.mnRowsToRepeat = sal_uInt16( aRepeatHeaderNF.GetValue() );
+ else
+ rInsTblOpts.mnRowsToRepeat = 0;
+ if (!aDontSplitCB.IsChecked())
+ nInsMode |= tabopts::SPLIT_LAYOUT;
+
+ if( pTAutoFmt )
+ prTAFmt = new SwTableAutoFmt( *pTAutoFmt );
+
+ rInsTblOpts.mnInsMode = nInsMode;
+}
+
+
+SwConvertTableDlg::SwConvertTableDlg( SwView& rView, bool bToTable )
+
+ : SfxModalDialog( &rView.GetViewFrame()->GetWindow(), SW_RES(DLG_CONV_TEXT_TABLE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ aTabBtn (this, SW_RES(CB_TAB)),
+ aSemiBtn (this, SW_RES(CB_SEMI)),
+ aParaBtn (this, SW_RES(CB_PARA)),
+ aOtherBtn (this, SW_RES(RB_OTHER)),
+ aOtherEd (this, SW_RES(ED_OTHER)),
+ aKeepColumn (this, SW_RES(CB_KEEPCOLUMN)),
+ aDelimFL (this, SW_RES(FL_DELIM)),
+
+ aHeaderCB (this, SW_RES(CB_HEADER)),
+ aRepeatHeaderCB (this, SW_RES(CB_REPEAT_HEADER)),
+
+ aRepeatHeaderFT (this, SW_RES(FT_REPEAT_HEADER)),
+ aRepeatHeaderBeforeFT (this),
+ aRepeatHeaderNF (this, SW_RES(NF_REPEAT_HEADER)),
+ aRepeatHeaderAfterFT (this),
+ aRepeatHeaderCombo (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT),
+
+ aOptionsFL (this, SW_RES(FL_OPTIONS)),
+ aDontSplitCB (this, SW_RES(CB_DONT_SPLIT)),
+ aBorderCB (this, SW_RES(CB_BORDER)),
+ aAutoFmtBtn(this,SW_RES(BT_AUTOFORMAT)),
+
+ aOkBtn(this,SW_RES(BT_OK)),
+ aCancelBtn(this,SW_RES(BT_CANCEL)),
+ aHelpBtn(this, SW_RES(BT_HELP)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ sConvertTextTable(SW_RES(STR_CONVERT_TEXT_TABLE)),
+ pTAutoFmt( 0 ),
+ pShell( &rView.GetWrtShell() )
+{
+ FreeResource();
+ if(nSaveButtonState > -1)
+ {
+ switch (nSaveButtonState)
+ {
+ case 0:
+ aTabBtn.Check();
+ aKeepColumn.Check(bIsKeepColumn);
+ break;
+ case 1: aSemiBtn.Check();break;
+ case 2: aParaBtn.Check();break;
+ case 3:
+ aOtherBtn.Check();
+ if(uOther)
+ aOtherEd.SetText(uOther);
+ break;
+ }
+
+ }
+ if( bToTable )
+ {
+ SetText( sConvertTextTable );
+ aAutoFmtBtn.SetClickHdl(LINK(this, SwConvertTableDlg, AutoFmtHdl));
+ aAutoFmtBtn.Show();
+ aKeepColumn.Show();
+ aKeepColumn.Enable( aTabBtn.IsChecked() );
+ aRepeatHeaderCombo.Arrange( aRepeatHeaderFT );
+ }
+ else
+ {
+ //Einfuege-Optionen verstecken
+ aHeaderCB .Show(sal_False);
+ aRepeatHeaderCB .Show(sal_False);
+ aDontSplitCB .Show(sal_False);
+ aBorderCB .Show(sal_False);
+ aOptionsFL .Show(sal_False);
+ aRepeatHeaderCombo.Show(sal_False);
+
+ //Groesse anpassen
+ Size aSize(GetSizePixel());
+ aSize.Height() = 8 + aHelpBtn.GetSizePixel().Height() + aHelpBtn.GetPosPixel().Y();
+ SetOutputSizePixel(aSize);
+ }
+ aKeepColumn.SaveValue();
+
+ Link aLk( LINK(this, SwConvertTableDlg, BtnHdl) );
+ aTabBtn.SetClickHdl( aLk );
+ aSemiBtn.SetClickHdl( aLk );
+ aParaBtn.SetClickHdl( aLk );
+ aOtherBtn.SetClickHdl(aLk );
+ aOtherEd.Enable( aOtherBtn.IsChecked() );
+
+ const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+
+ sal_Bool bHTMLMode = 0 != (::GetHtmlMode(rView.GetDocShell())&HTMLMODE_ON);
+
+ SwInsertTableOptions aInsOpts = pModOpt->GetInsTblFlags(bHTMLMode);
+ sal_uInt16 nInsTblFlags = aInsOpts.mnInsMode;
+
+ aHeaderCB.Check( 0 != (nInsTblFlags & tabopts::HEADLINE) );
+ aRepeatHeaderCB.Check(aInsOpts.mnRowsToRepeat > 0);
+ aDontSplitCB.Check( 0 == (nInsTblFlags & tabopts::SPLIT_LAYOUT));
+ aBorderCB.Check( 0!= (nInsTblFlags & tabopts::DEFAULT_BORDER) );
+
+ aHeaderCB.SetClickHdl(LINK(this, SwConvertTableDlg, CheckBoxHdl));
+ aRepeatHeaderCB.SetClickHdl(LINK(this, SwConvertTableDlg, ReapeatHeaderCheckBoxHdl));
+ ReapeatHeaderCheckBoxHdl();
+ CheckBoxHdl();
+}
+
+SwConvertTableDlg:: ~SwConvertTableDlg()
+{
+ delete pTAutoFmt;
+}
+
+IMPL_LINK( SwConvertTableDlg, AutoFmtHdl, PushButton*, pButton )
+{
+ SwAbstractDialogFactory* pFact = swui::GetFactory();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pShell, DLG_AUTOFMT_TABLE, sal_False, pTAutoFmt);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( RET_OK == pDlg->Execute())
+ pDlg->FillAutoFmtOfIndex( pTAutoFmt );
+ delete pDlg;
+ return 0;
+}
+
+IMPL_LINK( SwConvertTableDlg, BtnHdl, Button*, pButton )
+{
+ if( pButton == &aTabBtn )
+ aKeepColumn.SetState( aKeepColumn.GetSavedValue() );
+ else
+ {
+ if( aKeepColumn.IsEnabled() )
+ aKeepColumn.SaveValue();
+ aKeepColumn.Check( sal_True );
+ }
+ aKeepColumn.Enable( aTabBtn.IsChecked() );
+ aOtherEd.Enable( aOtherBtn.IsChecked() );
+ return 0;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+IMPL_LINK(SwConvertTableDlg, CheckBoxHdl, CheckBox*, EMPTYARG)
+{
+ aRepeatHeaderCB.Enable(aHeaderCB.IsChecked());
+ ReapeatHeaderCheckBoxHdl();
+
+ return 0;
+}
+
+IMPL_LINK(SwConvertTableDlg, ReapeatHeaderCheckBoxHdl, void*, EMPTYARG)
+{
+ sal_Bool bEnable = aHeaderCB.IsChecked() && aRepeatHeaderCB.IsChecked();
+ aRepeatHeaderBeforeFT.Enable(bEnable);
+ aRepeatHeaderAfterFT.Enable(bEnable);
+ aRepeatHeaderNF.Enable(bEnable);
+
+ return 0;
+}
diff --git a/sw/source/ui/table/convert.hrc b/sw/source/ui/table/convert.hrc
new file mode 100644
index 000000000000..7f7cbbec768f
--- /dev/null
+++ b/sw/source/ui/table/convert.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define CB_TAB 1
+#define CB_SEMI 3
+#define CB_PARA 4
+#define FL_DELIM 5
+#define RB_OTHER 6
+#define ED_OTHER 7
+#define CB_KEEPCOLUMN 8
+#define STR_CONVERT_TEXT_TABLE 9
+#define CB_HEADER 13
+#define CB_REPEAT_HEADER 14
+#define CB_DONT_SPLIT 15
+#define CB_BORDER 16
+#define FL_OPTIONS 17
+#define FT_REPEAT_HEADER 18
+#define NF_REPEAT_HEADER 19
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_AUTOFORMAT 102
+#define BT_HELP 103
+#define WIN_REPEAT_HEADER 104
diff --git a/sw/source/ui/table/convert.src b/sw/source/ui/table/convert.src
new file mode 100644
index 000000000000..c15b4ad4456c
--- /dev/null
+++ b/sw/source/ui/table/convert.src
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "convert.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_CONV_TEXT_TABLE
+{
+ HelpID = CMD_FN_CONVERT_TEXT_TABLE ;
+ OUTPUTSIZE = TRUE ;
+ Size = MAP_APPFONT ( 203 , 169 ) ;
+ Text [ en-US ] = "Convert Table to Text" ;
+ MOVEABLE = TRUE ;
+ SVLOOK = TRUE ;
+ RadioButton CB_TAB
+ {
+ HelpID = "sw:RadioButton:DLG_CONV_TEXT_TABLE:CB_TAB";
+ Pos = MAP_APPFONT ( 12 , 17 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Tabs" ;
+ TABSTOP = TRUE ;
+ Group = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton CB_SEMI
+ {
+ HelpID = "sw:RadioButton:DLG_CONV_TEXT_TABLE:CB_SEMI";
+ Pos = MAP_APPFONT ( 75 , 17 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Semicolons" ;
+ TABSTOP = TRUE ;
+ };
+ RadioButton CB_PARA
+ {
+ HelpID = "sw:RadioButton:DLG_CONV_TEXT_TABLE:CB_PARA";
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Paragraph" ;
+ TABSTOP = TRUE ;
+ };
+ RadioButton RB_OTHER
+ {
+ HelpID = "sw:RadioButton:DLG_CONV_TEXT_TABLE:RB_OTHER";
+ Pos = MAP_APPFONT ( 75 , 33 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "~Other: " ;
+ };
+ Edit ED_OTHER
+ {
+ HelpID = "sw:Edit:DLG_CONV_TEXT_TABLE:ED_OTHER";
+ Border = TRUE ;
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 123 , 32 ) ;
+ Size = MAP_APPFONT ( 9 , 12 ) ;
+ Text = "," ;
+ MaxTextLength = 1 ;
+ };
+ CheckBox CB_KEEPCOLUMN
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_KEEPCOLUMN";
+ Pos = MAP_APPFONT ( 12 , 49 ) ;
+ Size = MAP_APPFONT ( 128 , 10 ) ;
+ Check = TRUE;
+ Hide = TRUE ;
+ Text [ en-US ] = "Equal width for all columns" ;
+ };
+ FixedLine FL_DELIM
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 135 , 8 ) ;
+ Text [ en-US ] = "Separate text at" ;
+ Group = TRUE ;
+ };
+ CheckBox CB_HEADER
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_HEADER";
+ Pos = MAP_APPFONT ( 12 , 84 ) ;
+ Size = MAP_APPFONT ( 123 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Heading";
+ };
+ CheckBox CB_REPEAT_HEADER
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_REPEAT_HEADER";
+ Pos = MAP_APPFONT ( 22 , 97 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ Text [ en-US ] = "Repeat heading";
+ TabStop = TRUE ;
+ };
+ FixedText FT_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 125 , 113 ) ;
+ Size = MAP_APPFONT ( 66 , 10 ) ;
+ Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ;
+ };
+ NumericField NF_REPEAT_HEADER
+ {
+ HelpID = "sw:NumericField:DLG_CONV_TEXT_TABLE:NF_REPEAT_HEADER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 191 , 112 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 1000 ;
+ First = 1 ;
+ };
+ Window WIN_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 30 , 110 ) ;
+ Size = MAP_APPFONT ( 2 , 1 ) ;
+ };
+ CheckBox CB_DONT_SPLIT
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_DONT_SPLIT";
+ Pos = MAP_APPFONT ( 12 , 126 ) ;
+ Size = MAP_APPFONT ( 123 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Don't split table";
+ };
+ CheckBox CB_BORDER
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_BORDER";
+ Pos = MAP_APPFONT ( 12 , 139 ) ;
+ Size = MAP_APPFONT ( 123 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Border";
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 71 ) ;
+ Size = MAP_APPFONT ( 135 , 8 ) ;
+ Text [ en-US ] = "Options";
+ };
+ String STR_CONVERT_TEXT_TABLE
+ {
+ Text [ en-US ] = "Convert Text to Table" ;
+ };
+ OkButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 147 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TABSTOP = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 147 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TABSTOP = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 147 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TABSTOP = TRUE ;
+ };
+ PushButton BT_AUTOFORMAT
+ {
+ HelpID = "sw:PushButton:DLG_CONV_TEXT_TABLE:BT_AUTOFORMAT";
+ Pos = MAP_APPFONT ( 12 , 152 ) ;
+ Size = MAP_APPFONT ( 86 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Auto~Format..." ;
+ };
+};
+
+
+
diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
new file mode 100644
index 000000000000..e6ad93335c0d
--- /dev/null
+++ b/sw/source/ui/table/instable.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <vcl/msgbox.hxx>
+
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "itabenum.hxx"
+#include "instable.hxx"
+#include "tblafmt.hxx"
+#include "modcfg.hxx"
+#include "swmodule.hxx"
+#include <svx/htmlmode.hxx>
+#include <viewopt.hxx>
+
+#include "table.hrc"
+#include "instable.hrc"
+
+#include "swabstdlg.hxx"
+
+namespace swui
+{
+ SwAbstractDialogFactory * GetFactory();
+}
+
+#define ROW_COL_PROD 16384
+
+void SwInsTableDlg::GetValues( String& rName, sal_uInt16& rRow, sal_uInt16& rCol,
+ SwInsertTableOptions& rInsTblOpts, String& rAutoName,
+ SwTableAutoFmt *& prTAFmt )
+{
+ sal_uInt16 nInsMode = 0;
+ rName = aNameEdit.GetText();
+ rRow = (sal_uInt16)aRowEdit.GetValue();
+ rCol = (sal_uInt16)aColEdit.GetValue();
+
+ if (aBorderCB.IsChecked())
+ nInsMode |= tabopts::DEFAULT_BORDER;
+ if (aHeaderCB.IsChecked())
+ nInsMode |= tabopts::HEADLINE;
+ if (aRepeatHeaderCB.IsEnabled() && aRepeatHeaderCB.IsChecked())
+ rInsTblOpts.mnRowsToRepeat = sal_uInt16( aRepeatHeaderNF.GetValue() );
+ else
+ rInsTblOpts.mnRowsToRepeat = 0;
+ if (!aDontSplitCB.IsChecked())
+ nInsMode |= tabopts::SPLIT_LAYOUT;
+ if( pTAutoFmt )
+ {
+ prTAFmt = new SwTableAutoFmt( *pTAutoFmt );
+ rAutoName = prTAFmt->GetName();
+ }
+
+ rInsTblOpts.mnInsMode = nInsMode;
+}
+
+// CTOR / DTOR -----------------------------------------------------------
+
+
+SwInsTableDlg::SwInsTableDlg( SwView& rView )
+ : SfxModalDialog( rView.GetWindow(), SW_RES(DLG_INSERT_TABLE) ),
+ aNameFT (this, SW_RES(FT_NAME)),
+ aNameEdit (this, SW_RES(ED_NAME)),
+
+ aFL (this, SW_RES(FL_TABLE)),
+ aColLbl (this, SW_RES(FT_COL)),
+ aColEdit (this, SW_RES(ED_COL)),
+ aRowLbl (this, SW_RES(FT_ROW)),
+ aRowEdit (this, SW_RES(ED_ROW)),
+
+ aOptionsFL (this, SW_RES(FL_OPTIONS)),
+ aHeaderCB (this, SW_RES(CB_HEADER)),
+ aRepeatHeaderCB (this, SW_RES(CB_REPEAT_HEADER)),
+ aRepeatHeaderFT (this, SW_RES(FT_REPEAT_HEADER)),
+ aRepeatHeaderBeforeFT (this),
+ aRepeatHeaderNF (this, SW_RES(NF_REPEAT_HEADER)),
+ aRepeatHeaderAfterFT (this),
+ aRepeatHeaderCombo (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT),
+
+ aDontSplitCB (this, SW_RES(CB_DONT_SPLIT)),
+ aBorderCB (this, SW_RES(CB_BORDER)),
+
+ aOkBtn (this, SW_RES(BT_OK)),
+ aCancelBtn (this, SW_RES(BT_CANCEL)),
+ aHelpBtn (this, SW_RES(BT_HELP)),
+ aAutoFmtBtn (this, SW_RES(BT_AUTOFORMAT)),
+
+ pShell(&rView.GetWrtShell()),
+ pTAutoFmt( 0 ),
+ nEnteredValRepeatHeaderNF( -1 )
+{
+ FreeResource();
+ aNameEdit.SetText(pShell->GetUniqueTblName());
+ aNameEdit.SetModifyHdl(LINK(this, SwInsTableDlg, ModifyName));
+ aColEdit.SetModifyHdl(LINK(this, SwInsTableDlg, ModifyRowCol));
+ aRowEdit.SetModifyHdl(LINK(this, SwInsTableDlg, ModifyRowCol));
+
+ aRowEdit.SetMax(ROW_COL_PROD/aColEdit.GetValue());
+ aColEdit.SetMax(ROW_COL_PROD/aRowEdit.GetValue());
+ aAutoFmtBtn.SetClickHdl(LINK(this, SwInsTableDlg, AutoFmtHdl));
+
+ sal_Bool bHTMLMode = 0 != (::GetHtmlMode(rView.GetDocShell())&HTMLMODE_ON);
+ const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+
+ SwInsertTableOptions aInsOpts = pModOpt->GetInsTblFlags(bHTMLMode);
+ sal_uInt16 nInsTblFlags = aInsOpts.mnInsMode;
+
+ aHeaderCB.Check( 0 != (nInsTblFlags & tabopts::HEADLINE) );
+ aRepeatHeaderCB.Check(aInsOpts.mnRowsToRepeat > 0);
+ if(bHTMLMode)
+ {
+ aDontSplitCB.Hide();
+ aBorderCB.SetPosPixel(aDontSplitCB.GetPosPixel());
+ }
+ else
+ {
+ aDontSplitCB.Check( 0 == (nInsTblFlags & tabopts::SPLIT_LAYOUT) );
+ }
+ aBorderCB.Check( 0 != (nInsTblFlags & tabopts::DEFAULT_BORDER) );
+
+ aRepeatHeaderNF.SetModifyHdl( LINK( this, SwInsTableDlg, ModifyRepeatHeaderNF_Hdl ) );
+ aHeaderCB.SetClickHdl(LINK(this, SwInsTableDlg, CheckBoxHdl));
+ aRepeatHeaderCB.SetClickHdl(LINK(this, SwInsTableDlg, ReapeatHeaderCheckBoxHdl));
+ ReapeatHeaderCheckBoxHdl();
+ CheckBoxHdl();
+
+ sal_Int64 nMax = aRowEdit.GetValue();
+ if( nMax <= 1 )
+ nMax = 1;
+ else
+ --nMax;
+ aRepeatHeaderNF.SetMax( nMax );
+
+ aRepeatHeaderCombo.Arrange( aRepeatHeaderFT );
+}
+
+SwInsTableDlg::~SwInsTableDlg()
+{
+ delete pTAutoFmt;
+}
+
+IMPL_LINK_INLINE_START( SwInsTableDlg, ModifyName, Edit *, pEdit )
+{
+ String sTblName = pEdit->GetText();
+ if(sTblName.Search(' ') != STRING_NOTFOUND)
+ {
+ sTblName.EraseAllChars( );
+ pEdit->SetText(sTblName);
+ }
+
+ aOkBtn.Enable(pShell->GetTblStyle( sTblName ) == 0);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwInsTableDlg, ModifyName, Edit *, EMPTYARG )
+
+/*-----------------15.04.98 11:36-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwInsTableDlg, ModifyRowCol, NumericField *, pField )
+{
+ if(pField == &aColEdit)
+ {
+ sal_Int64 nCol = aColEdit.GetValue();
+ if(!nCol)
+ nCol = 1;
+ aRowEdit.SetMax(ROW_COL_PROD/nCol);
+ }
+ else
+ {
+ sal_Int64 nRow = aRowEdit.GetValue();
+ if(!nRow)
+ nRow = 1;
+ aColEdit.SetMax(ROW_COL_PROD/nRow);
+
+ // adjust depending NF for repeated rows
+ sal_Int64 nMax = ( nRow == 1 )? 1 : nRow - 1 ;
+ sal_Int64 nActVal = aRepeatHeaderNF.GetValue();
+
+ aRepeatHeaderNF.SetMax( nMax );
+
+ if( nActVal > nMax )
+ aRepeatHeaderNF.SetValue( nMax );
+ else if( nActVal < nEnteredValRepeatHeaderNF )
+ aRepeatHeaderNF.SetValue( ( nEnteredValRepeatHeaderNF < nMax )? nEnteredValRepeatHeaderNF : nMax );
+ }
+ return 0;
+}
+
+IMPL_LINK( SwInsTableDlg, AutoFmtHdl, PushButton*, pButton )
+{
+ SwAbstractDialogFactory* pFact = swui::GetFactory();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton,pShell, DLG_AUTOFMT_TABLE, sal_False, pTAutoFmt );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( RET_OK == pDlg->Execute())
+ pDlg->FillAutoFmtOfIndex( pTAutoFmt );
+ delete pDlg;
+ return 0;
+}
+
+IMPL_LINK(SwInsTableDlg, CheckBoxHdl, CheckBox*, EMPTYARG)
+{
+ aRepeatHeaderCB.Enable(aHeaderCB.IsChecked());
+ ReapeatHeaderCheckBoxHdl();
+
+ return 0;
+}
+
+IMPL_LINK(SwInsTableDlg, ReapeatHeaderCheckBoxHdl, void*, EMPTYARG)
+{
+ aRepeatHeaderCombo.Enable(aHeaderCB.IsChecked() && aRepeatHeaderCB.IsChecked());
+
+ return 0;
+}
+
+IMPL_LINK(SwInsTableDlg, ModifyRepeatHeaderNF_Hdl, void*, EMPTYARG)
+{
+ nEnteredValRepeatHeaderNF = aRepeatHeaderNF.GetValue();
+ return 0;
+}
+
diff --git a/sw/source/ui/table/instable.hrc b/sw/source/ui/table/instable.hrc
new file mode 100644
index 000000000000..6077541a3c01
--- /dev/null
+++ b/sw/source/ui/table/instable.hrc
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FT_COL 1
+#define FT_ROW 2
+#define ED_COL 4
+#define ED_ROW 5
+#define FL_TABLE 10
+#define ED_NAME 11
+#define FT_NAME 12
+#define CB_HEADER 13
+#define CB_REPEAT_HEADER 14
+#define CB_DONT_SPLIT 15
+#define CB_BORDER 16
+#define FL_OPTIONS 17
+#define FT_REPEAT_HEADER 18
+#define NF_REPEAT_HEADER 19
+
+#define BT_OK 20
+#define BT_CANCEL 21
+#define BT_HELP 22
+#define BT_AUTOFORMAT 23
+
+#define WIN_REPEAT_HEADER 25
+
diff --git a/sw/source/ui/table/instable.src b/sw/source/ui/table/instable.src
new file mode 100644
index 000000000000..d83ba3402e72
--- /dev/null
+++ b/sw/source/ui/table/instable.src
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "instable.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ // #define DLG_INSERT_TABLE 256
+ModalDialog DLG_INSERT_TABLE
+{
+ HelpID = CMD_FN_INSERT_TABLE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 280 , 166 ) ;
+ Text [ en-US ] = "Insert Table" ;
+ Moveable = TRUE ;
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:DLG_INSERT_TABLE:ED_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 53 , 6 ) ;
+ Size = MAP_APPFONT ( 158, 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 45, 8 ) ;
+ Text [ en-US ] = "Name";
+ };
+ FixedText FT_COL
+ {
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 39 , 8 ) ;
+ Text [ en-US ] = "~Columns" ;
+ Left = TRUE ;
+ };
+ NumericField ED_COL
+ {
+ HelpID = "sw:NumericField:DLG_INSERT_TABLE:ED_COL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 53 , 32 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Value = 2 ;
+ First = 1 ;
+ Last = 99 ;
+ };
+ FixedText FT_ROW
+ {
+ Pos = MAP_APPFONT ( 12 , 50 ) ;
+ Size = MAP_APPFONT ( 39 , 8 ) ;
+ Text [ en-US ] = "~Rows" ;
+ Left = TRUE ;
+ };
+ NumericField ED_ROW
+ {
+ HelpID = "sw:NumericField:DLG_INSERT_TABLE:ED_ROW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 53 , 48 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Value = 2 ;
+ First = 1 ;
+ Last = 99 ;
+ };
+ FixedLine FL_TABLE
+ {
+ Pos = MAP_APPFONT ( 6 , 21 ) ;
+ Size = MAP_APPFONT ( 212 , 8 ) ;
+ Text [ en-US ] = "Size";
+ };
+ CheckBox CB_HEADER
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_TABLE:CB_HEADER";
+ Pos = MAP_APPFONT ( 12 , 74 ) ;
+ Size = MAP_APPFONT (113 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Heading";
+ };
+ CheckBox CB_REPEAT_HEADER
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_TABLE:CB_REPEAT_HEADER";
+ Pos = MAP_APPFONT ( 21 , 88 ) ;
+ Size = MAP_APPFONT ( 104 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Repeat heading";
+ };
+ FixedText FT_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 30 , 105 ) ;
+ Size = MAP_APPFONT ( 95 , 10 ) ;
+ Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ;
+ };
+ NumericField NF_REPEAT_HEADER
+ {
+ HelpID = "sw:NumericField:DLG_INSERT_TABLE:NF_REPEAT_HEADER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 104 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 1000 ;
+ First = 1 ;
+ };
+ Window WIN_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 30 , 102 ) ;
+ Size = MAP_APPFONT ( 2 , 1 ) ;
+ };
+ CheckBox CB_DONT_SPLIT
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_TABLE:CB_DONT_SPLIT";
+ Pos = MAP_APPFONT ( 12 , 118 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ Text [ en-US ] = "Don't split table";
+ TabStop = TRUE ;
+ };
+ CheckBox CB_BORDER
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_TABLE:CB_BORDER";
+ Pos = MAP_APPFONT ( 12 , 132 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Border";
+ };
+ PushButton BT_AUTOFORMAT
+ {
+ HelpID = "sw:PushButton:DLG_INSERT_TABLE:BT_AUTOFORMAT";
+ Pos = MAP_APPFONT ( 12 , 146 ) ;
+ Size = MAP_APPFONT ( 86 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Auto~Format..." ;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 63 ) ;
+ Size = MAP_APPFONT ( 212 , 8 ) ;
+ Text [ en-US ] = "Options";
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 224 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 224 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 224 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
diff --git a/sw/source/ui/table/mergetbl.cxx b/sw/source/ui/table/mergetbl.cxx
new file mode 100644
index 000000000000..377959ec89cc
--- /dev/null
+++ b/sw/source/ui/table/mergetbl.cxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <swtypes.hxx>
+#include <mergetbl.hxx>
+#ifndef _MERGETBL_HRC
+#include <mergetbl.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+
+
+SwMergeTblDlg::SwMergeTblDlg( Window *pParent, sal_Bool& rWithPrev )
+ : SvxStandardDialog(pParent, SW_RES(DLG_MERGE_TABLE)),
+ aOKPB( this, SW_RES(PB_OK )),
+ aCancelPB( this, SW_RES(PB_CANCEL )),
+ aHelpPB( this, SW_RES(PB_HELP )),
+ aMergeFL( this, SW_RES(FL_MERGE )),
+ aMergePrevRB( this, SW_RES(RB_MERGE_PREV)),
+ aMergeNextRB( this, SW_RES(RB_MERGE_NEXT)),
+ rMergePrev( rWithPrev )
+{
+ FreeResource();
+ aMergePrevRB.Check();
+}
+
+void SwMergeTblDlg::Apply()
+{
+ rMergePrev = aMergePrevRB.IsChecked();
+}
+
+
+
diff --git a/sw/source/ui/table/mergetbl.hrc b/sw/source/ui/table/mergetbl.hrc
new file mode 100644
index 000000000000..cee06b6ef20d
--- /dev/null
+++ b/sw/source/ui/table/mergetbl.hrc
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define PB_OK 1
+#define PB_CANCEL 2
+#define PB_HELP 3
+#define FL_MERGE 4
+#define RB_MERGE_PREV 5
+#define RB_MERGE_NEXT 6
diff --git a/sw/source/ui/table/mergetbl.src b/sw/source/ui/table/mergetbl.src
new file mode 100644
index 000000000000..f88ec62923f4
--- /dev/null
+++ b/sw/source/ui/table/mergetbl.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "mergetbl.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_MERGE_TABLE
+{
+ HelpID = CMD_FN_TABLE_MERGE_TABLE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 207 , 57 ) ;
+ Moveable = TRUE ;
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 151 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 151 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 151 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_MERGE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 139 , 8 ) ;
+ Text [ en-US ] = "Mode" ;
+ };
+ RadioButton RB_MERGE_PREV
+ {
+ HelpID = "sw:RadioButton:DLG_MERGE_TABLE:RB_MERGE_PREV";
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Check = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Join with ~previous table";
+ };
+ RadioButton RB_MERGE_NEXT
+ {
+ HelpID = "sw:RadioButton:DLG_MERGE_TABLE:RB_MERGE_NEXT";
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Text [ en-US ] = "Join with ~next table";
+ };
+ Text [ en-US ] = "Merge Tables";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx
new file mode 100644
index 000000000000..1fb108276bc1
--- /dev/null
+++ b/sw/source/ui/table/rowht.cxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/dlgutil.hxx>
+
+
+#include <fmtfsize.hxx>
+#include <swtypes.hxx>
+#include <rowht.hxx>
+#include <wrtsh.hxx>
+#include <frmatr.hxx>
+#ifndef _WDOCSH_HXX
+#include <wdocsh.hxx>
+#endif
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <swmodule.hxx>
+#include <usrpref.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _ROWHT_HRC
+#include <rowht.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+
+
+
+
+void SwTableHeightDlg::Apply()
+{
+ SwTwips nHeight = static_cast< SwTwips >(aHeightEdit.Denormalize(aHeightEdit.GetValue(FUNIT_TWIP)));
+ SwFmtFrmSize aSz(ATT_FIX_SIZE, 0, nHeight);
+
+ SwFrmSize eFrmSize = (SwFrmSize) aAutoHeightCB.IsChecked() ?
+ ATT_MIN_SIZE : ATT_FIX_SIZE;
+ if(eFrmSize != aSz.GetHeightSizeType())
+ {
+ aSz.SetHeightSizeType(eFrmSize);
+ }
+ rSh.SetRowHeight( aSz );
+}
+
+// CTOR / DTOR -----------------------------------------------------------
+
+
+SwTableHeightDlg::SwTableHeightDlg( Window *pParent, SwWrtShell &rS ) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_ROW_HEIGHT)),
+
+ aHeightEdit(this, SW_RES(ED_HEIGHT)),
+ aAutoHeightCB(this, SW_RES(CB_AUTOHEIGHT)),
+ aHeightFL(this, SW_RES(FL_HEIGHT)),
+ aOKBtn(this, SW_RES(BT_OK)),
+ aCancelBtn(this, SW_RES(BT_CANCEL)),
+ aHelpBtn( this, SW_RES( BT_HELP ) ),
+ rSh( rS )
+{
+ FreeResource();
+
+ FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell,
+ rSh.GetView().GetDocShell() ) )->GetMetric();
+ ::SetFieldUnit( aHeightEdit, eFieldUnit );
+
+ aHeightEdit.SetMin(MINLAY, FUNIT_TWIP);
+ if(!aHeightEdit.GetMin())
+ aHeightEdit.SetMin(1);
+ SwFmtFrmSize *pSz;
+ rSh.GetRowHeight( pSz );
+ if ( pSz )
+ {
+ long nHeight = pSz->GetHeight();
+ aAutoHeightCB.Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
+ aHeightEdit.SetValue(aHeightEdit.Normalize(nHeight), FUNIT_TWIP);
+
+ delete pSz;
+ }
+}
+
+
+
diff --git a/sw/source/ui/table/rowht.hrc b/sw/source/ui/table/rowht.hrc
new file mode 100644
index 000000000000..e844f3c65a8d
--- /dev/null
+++ b/sw/source/ui/table/rowht.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define ED_HEIGHT 1
+#define CB_AUTOHEIGHT 2
+#define FL_HEIGHT 3
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
+
diff --git a/sw/source/ui/table/rowht.src b/sw/source/ui/table/rowht.src
new file mode 100644
index 000000000000..b9abcd05ce94
--- /dev/null
+++ b/sw/source/ui/table/rowht.src
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "rowht.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_ROW_HEIGHT
+{
+ HelpID = CMD_FN_TABLE_SET_ROW_HEIGHT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 157 , 60 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zeilenhöhe : Zellenhöhe */
+ Text [ en-US ] = "Row Height" ;
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 101 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 101 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 101 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ MetricField ED_HEIGHT
+ {
+ HelpID = "sw:MetricField:DLG_ROW_HEIGHT:ED_HEIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 5 ;
+ Maximum = 990 ;
+ DecimalDigits = 1 ;
+ Value = 10 ;
+ Unit = FUNIT_CM ;
+ First = 100 ;
+ Last = 9999 ;
+ };
+ CheckBox CB_AUTOHEIGHT
+ {
+ HelpID = "sw:CheckBox:DLG_ROW_HEIGHT:CB_AUTOHEIGHT";
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~dynamisch anpassen : auto. H~öhe */
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Fit to size" ;
+ };
+ FixedLine FL_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 89 , 8 ) ;
+ Text [ en-US ] = "Height" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/splittbl.cxx b/sw/source/ui/table/splittbl.cxx
new file mode 100644
index 000000000000..7037e2b0aa05
--- /dev/null
+++ b/sw/source/ui/table/splittbl.cxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <wrtsh.hxx>
+#include <splittbl.hxx>
+#include <splittbl.hrc>
+#include <table.hrc>
+#include <tblenum.hxx>
+/*-----------------17.03.98 10:56-------------------
+
+--------------------------------------------------*/
+SwSplitTblDlg::SwSplitTblDlg( Window *pParent, SwWrtShell &rSh ) :
+ SvxStandardDialog(pParent, SW_RES(DLG_SPLIT_TABLE)),
+ aOKPB( this, SW_RES(PB_OK )),
+ aCancelPB( this, SW_RES(PB_CANCEL )),
+ aHelpPB( this, SW_RES(PB_HELP )),
+ aSplitFL( this, SW_RES(FL_SPLIT )),
+ aCntntCopyRB( this, SW_RES(RB_CNTNT )),
+ aBoxAttrCopyWithParaRB( this, SW_RES(RB_BOX_PARA )),
+ aBoxAttrCopyNoParaRB( this, SW_RES(RB_BOX_NOPARA)),
+ aBorderCopyRB( this, SW_RES(RB_BORDER )),
+ rShell(rSh),
+ m_nSplit( HEADLINE_CNTNTCOPY )
+{
+ FreeResource();
+ aCntntCopyRB.Check();
+}
+
+/*-----------------17.03.98 10:56-------------------
+
+--------------------------------------------------*/
+void SwSplitTblDlg::Apply()
+{
+ m_nSplit = HEADLINE_CNTNTCOPY;
+ if(aBoxAttrCopyWithParaRB.IsChecked())
+ m_nSplit = HEADLINE_BOXATRCOLLCOPY;
+ if(aBoxAttrCopyNoParaRB.IsChecked())
+ m_nSplit = HEADLINE_BOXATTRCOPY;
+ else if(aBorderCopyRB.IsChecked())
+ m_nSplit = HEADLINE_BORDERCOPY;
+
+ rShell.SplitTable( m_nSplit );
+
+}
+
+
+
diff --git a/sw/source/ui/table/splittbl.hrc b/sw/source/ui/table/splittbl.hrc
new file mode 100644
index 000000000000..83882b374ecb
--- /dev/null
+++ b/sw/source/ui/table/splittbl.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define PB_OK 1
+#define PB_CANCEL 2
+#define PB_HELP 3
+#define FL_SPLIT 4
+#define RB_CNTNT 5
+#define RB_BOX_NOPARA 6
+#define RB_BOX_PARA 7
+#define RB_BORDER 8
diff --git a/sw/source/ui/table/splittbl.src b/sw/source/ui/table/splittbl.src
new file mode 100644
index 000000000000..0ba49f00a271
--- /dev/null
+++ b/sw/source/ui/table/splittbl.src
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "splittbl.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_SPLIT_TABLE
+{
+ HelpID = CMD_FN_TABLE_SPLIT_TABLE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 207 , 76 ) ;
+ Moveable = TRUE ;
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 151 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 151 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 151 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SPLIT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 139 , 8 ) ;
+ Text [ en-US ] = "Mode" ;
+ };
+ RadioButton RB_CNTNT
+ {
+ HelpID = "sw:RadioButton:DLG_SPLIT_TABLE:RB_CNTNT";
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Check = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Copy heading" ;
+ };
+ RadioButton RB_BOX_PARA
+ {
+ HelpID = "sw:RadioButton:DLG_SPLIT_TABLE:RB_BOX_PARA";
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Text [ en-US ] = "C~ustom heading (apply Style)" ;
+ };
+ RadioButton RB_BOX_NOPARA
+ {
+ HelpID = "sw:RadioButton:DLG_SPLIT_TABLE:RB_BOX_NOPARA";
+ Pos = MAP_APPFONT ( 12 , 45 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Text [ en-US ] = "Cu~stom heading" ;
+ };
+ RadioButton RB_BORDER
+ {
+ HelpID = "sw:RadioButton:DLG_SPLIT_TABLE:RB_BORDER";
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Text [ en-US ] = "~No heading" ;
+ };
+ Text [ en-US ] = "Split Table" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/swtablerep.cxx b/sw/source/ui/table/swtablerep.cxx
new file mode 100644
index 000000000000..a6b96ab8930c
--- /dev/null
+++ b/sw/source/ui/table/swtablerep.cxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <tools/list.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svl/ctloptions.hxx>
+#include <swmodule.hxx>
+#include <fmtornt.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtlsplt.hxx>
+
+#include <svtools/htmlcfg.hxx>
+#include <fmtrowsplt.hxx>
+#include <svx/htmlmode.hxx>
+
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <viewopt.hxx>
+#include <uitool.hxx>
+#include <frmatr.hxx>
+
+#ifndef _TABLEPG_HXX
+#include <tablepg.hxx>
+#endif
+#include <tablemgr.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+#include <SwStyleNameMapper.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _TABLEDLG_HRC
+#include <tabledlg.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+#include "swtablerep.hxx"
+
+#ifdef DEBUG_TBLDLG
+
+void DbgTColumn(TColumn* pTColumn, sal_uInt16 nCount)
+{
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ String sMsg(i);
+ sMsg += pTColumn[i].bVisible ? " v " : " h ";
+ sMsg += pTColumn[i].nWidth;
+ DBG_ERROR(sMsg)
+ }
+}
+#endif
+
+
+/*-----------------20.08.96 09.43-------------------
+--------------------------------------------------*/
+SwTableRep::SwTableRep( const SwTabCols& rTabCol, sal_Bool bCplx )
+ :
+ nTblWidth(0),
+ nSpace(0),
+ nLeftSpace(0),
+ nRightSpace(0),
+ nAlign(0),
+ nWidthPercent(0),
+ bComplex(bCplx),
+ bLineSelected(sal_False),
+ bWidthChanged(sal_False),
+ bColsChanged(sal_False)
+{
+ nAllCols = nColCount = rTabCol.Count();
+ pTColumns = new TColumn[ nColCount + 1 ];
+ SwTwips nStart = 0,
+ nEnd;
+ for( sal_uInt16 i = 0; i < nAllCols; ++i )
+ {
+ nEnd = rTabCol[ i ] - rTabCol.GetLeft();
+ pTColumns[ i ].nWidth = nEnd - nStart;
+ pTColumns[ i ].bVisible = !rTabCol.IsHidden(i);
+ if(!pTColumns[ i ].bVisible)
+ nColCount --;
+ nStart = nEnd;
+ }
+ pTColumns[ nAllCols ].nWidth = rTabCol.GetRight() - rTabCol.GetLeft() - nStart;
+ pTColumns[ nAllCols ].bVisible = sal_True;
+ nColCount++;
+ nAllCols++;
+}
+
+/*-----------------20.08.96 09.43-------------------
+--------------------------------------------------*/
+SwTableRep::~SwTableRep()
+{
+ delete[] pTColumns;
+}
+
+/*-----------------20.08.96 13.33-------------------
+--------------------------------------------------*/
+sal_Bool SwTableRep::FillTabCols( SwTabCols& rTabCols ) const
+{
+ long nOldLeft = rTabCols.GetLeft(),
+ nOldRight = rTabCols.GetRight();
+
+ sal_Bool bSingleLine = sal_False;
+ sal_uInt16 i;
+
+ for ( i = 0; i < rTabCols.Count(); ++i )
+ if(!pTColumns[i].bVisible)
+ {
+ bSingleLine = sal_True;
+ break;
+ }
+
+#ifdef DEBUG_TBLDLG
+#define DbgTColumn(pTColumns, nAllCols);
+#endif
+
+ SwTwips nPos = 0;
+ SwTwips nLeft = GetLeftSpace();
+ rTabCols.SetLeft(nLeft);
+ if(bSingleLine)
+ {
+ // die unsichtbaren Trenner werden aus den alten TabCols genommen
+ // die sichtbaren kommen aus pTColumns
+ TColumn* pOldTColumns = new TColumn[nAllCols + 1];
+ SwTwips nStart = 0,
+ nEnd;
+ for(i = 0; i < nAllCols - 1; i++)
+ {
+ nEnd = rTabCols[i] - rTabCols.GetLeft();
+ pOldTColumns[i].nWidth = nEnd - nStart;
+ pOldTColumns[i].bVisible = !rTabCols.IsHidden(i);
+ nStart = nEnd;
+ }
+ pOldTColumns[nAllCols - 1].nWidth = rTabCols.GetRight() - rTabCols.GetLeft() - nStart;
+ pOldTColumns[nAllCols - 1].bVisible = sal_True;
+
+#ifdef DEBUG_TBLDLG
+#define DbgTColumn(pOldTColumns, nAllCols);
+#endif
+
+ sal_uInt16 nOldPos = 0;
+ sal_uInt16 nNewPos = 0;
+ SwTwips nOld = 0;
+ SwTwips nNew = 0;
+ sal_Bool bOld = sal_False;
+ sal_Bool bFirst = sal_True;
+ i = 0;
+
+ while ( i < nAllCols -1 )
+ {
+ while((bFirst || bOld ) && nOldPos < nAllCols )
+ {
+ nOld += pOldTColumns[nOldPos].nWidth;
+ nOldPos++;
+ if(!pOldTColumns[nOldPos - 1].bVisible)
+ break;
+ }
+ while((bFirst || !bOld ) && nNewPos < nAllCols )
+ {
+ nNew += pTColumns[nNewPos].nWidth;
+ nNewPos++;
+ if(pOldTColumns[nNewPos - 1].bVisible)
+ break;
+ }
+ bFirst = sal_False;
+ // sie muessen sortiert eingefuegt werden
+ bOld = nOld < nNew;
+ nPos = sal_uInt16(bOld ? nOld : nNew);
+ rTabCols[i] = nPos + nLeft;
+ rTabCols.SetHidden( i, bOld );
+ i++;
+ }
+ rTabCols.SetRight(nLeft + nTblWidth);
+
+ delete[] pOldTColumns;
+ }
+ else
+ {
+ for ( i = 0; i < nAllCols - 1; ++i )
+ {
+ nPos += pTColumns[i].nWidth;
+ rTabCols[i] = nPos + rTabCols.GetLeft();
+ rTabCols.SetHidden( i, !pTColumns[i].bVisible );
+ rTabCols.SetRight(nLeft + pTColumns[nAllCols - 1].nWidth + nPos);
+ }
+ }
+
+// Rundungsfehler abfangen
+ if(Abs((long)nOldLeft - (long)rTabCols.GetLeft()) < 3)
+ rTabCols.SetLeft(nOldLeft);
+
+ if(Abs((long)nOldRight - (long)rTabCols.GetRight()) < 3)
+ rTabCols.SetRight(nOldRight);
+
+ if(GetRightSpace() >= 0 &&
+ rTabCols.GetRight() > rTabCols.GetRightMax())
+ rTabCols.SetRight(rTabCols.GetRightMax());
+ return bSingleLine;
+}
diff --git a/sw/source/ui/table/table.src b/sw/source/ui/table/table.src
new file mode 100644
index 000000000000..7a0ab5472347
--- /dev/null
+++ b/sw/source/ui/table/table.src
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+InfoBox MSG_ERR_TABLE_MERGE
+{
+ Message [ en-US ] = "Selected table cells are too complex to merge." ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
new file mode 100644
index 000000000000..38b0e6e54799
--- /dev/null
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -0,0 +1,1981 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <hintids.hxx>
+#include <tools/list.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svl/ctloptions.hxx>
+#include <swmodule.hxx>
+#include <fmtornt.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtlsplt.hxx>
+
+#include <svtools/htmlcfg.hxx>
+#include <fmtrowsplt.hxx>
+#include <svx/htmlmode.hxx>
+
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <viewopt.hxx>
+#include <uitool.hxx>
+#include <frmatr.hxx>
+#include <tabledlg.hxx>
+#ifndef _TABLEPG_HXX
+#include <tablepg.hxx>
+#endif
+#include <tablemgr.hxx>
+#include <pagedesc.hxx>
+#include <uiitems.hxx>
+#include <poolfmt.hxx>
+#include <SwStyleNameMapper.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _TABLEDLG_HRC
+#include <tabledlg.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/flagsdef.hxx>
+#include <svx/svxdlg.hxx>
+
+using namespace ::com::sun::star;
+
+
+#ifdef DEBUG_TBLDLG
+void DbgTblRep(SwTableRep* pRep)
+{
+ DBG_ERROR(String(pRep->GetColCount()))
+ DBG_ERROR(String(pRep->GetAllColCount()))
+ SwTwips nSum = 0;
+ for(sal_uInt16 i = 0; i < pRep->GetAllColCount(); i++)
+ {
+ String sMsg(i);
+ sMsg += pRep->GetColumns()[i].bVisible ? " v " : " h ";
+ sMsg += pRep->GetColumns()[i].nWidth;
+ nSum +=pRep->GetColumns()[i].nWidth;
+ DBG_ERROR(sMsg)
+ }
+ String sMsg("Spaltensumme: ");
+ sMsg += nSum;
+ sMsg += " Tblbreite: ";
+ sMsg += pRep->GetWidth();
+ DBG_ERROR(sMsg)
+ sMsg = "Gesamt/Links/Rechts: ";
+ sMsg += pRep->GetSpace();
+ sMsg += '/';
+ sMsg += pRep->GetLeftSpace();
+ sMsg += '/';
+ sMsg += pRep->GetRightSpace();
+ DBG_ERROR(sMsg)
+ sMsg = "Align: ";
+ sMsg += pRep->GetAlign();
+ DBG_ERROR(sMsg)
+
+};
+
+#endif
+
+
+SwFormatTablePage::SwFormatTablePage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SW_RES( TP_FORMAT_TABLE ), rSet ),
+ aOptionsFL(this, SW_RES( FL_OPTIONS )),
+ aNameFT(this, SW_RES( FT_NAME )),
+ aNameED(this, SW_RES( ED_NAME )),
+ aWidthFT(this, SW_RES( FT_WIDTH )),
+ aWidthMF(this, SW_RES( ED_WIDTH )),
+ aRelWidthCB(this, SW_RES( CB_REL_WIDTH )),
+
+ aPosFL(this, SW_RES( FL_POS )),
+ aFullBtn(this, SW_RES( RB_FULL )),
+ aLeftBtn(this, SW_RES( RB_LEFT )),
+ aFromLeftBtn(this, SW_RES( RB_FROM_LEFT )),
+ aRightBtn(this, SW_RES( RB_RIGHT )),
+ aCenterBtn(this, SW_RES( RB_CENTER )),
+ aFreeBtn(this, SW_RES( RB_FREE )),
+
+ aDistFL(this, SW_RES( FL_DIST )),
+ aLeftFT(this, SW_RES( FT_LEFT_DIST )),
+ aLeftMF(this, SW_RES( ED_LEFT_DIST )),
+ aRightFT(this, SW_RES( FT_RIGHT_DIST )),
+ aRightMF(this, SW_RES( ED_RIGHT_DIST )),
+ aTopFT (this, SW_RES( FT_TOP_DIST )),
+ aTopMF(this, SW_RES( ED_TOP_DIST )),
+ aBottomFT(this, SW_RES( FT_BOTTOM_DIST )),
+ aBottomMF(this, SW_RES( ED_BOTTOM_DIST )),
+
+ aPropertiesFL(this, SW_RES( FL_PROPERTIES )),
+ aTextDirectionFT(this, SW_RES( FT_TEXTDIRECTION )),
+ aTextDirectionLB(this, SW_RES( LB_TEXTDIRECTION )),
+
+ pTblData(0),
+ nSaveWidth(0),
+ nMinTableWidth(MINLAY),
+ bModified(sal_False),
+ bFull(0),
+ bHtmlMode(sal_False)
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem))
+ bHtmlMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
+
+ sal_Bool bCTL = SW_MOD()->GetCTLOptions().IsCTLFontEnabled();
+ if( !bHtmlMode && bCTL )
+ {
+ aPropertiesFL.Show();
+ aTextDirectionFT.Show();
+ aTextDirectionLB.Show();
+ }
+
+ Init();
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwFormatTablePage::Init()
+{
+ aLeftMF.MetricField::SetMin(-999999);
+ aRightMF.MetricField::SetMin(-999999);
+
+ // handler
+ Link aLk = LINK( this, SwFormatTablePage, AutoClickHdl );
+ aFullBtn.SetClickHdl( aLk );
+ aFreeBtn.SetClickHdl( aLk );
+ aLeftBtn.SetClickHdl( aLk );
+ aFromLeftBtn.SetClickHdl( aLk );
+ aRightBtn.SetClickHdl( aLk );
+ aCenterBtn.SetClickHdl( aLk );
+
+ aLk = LINK( this, SwFormatTablePage, UpDownLoseFocusHdl );
+ aTopMF.SetUpHdl( aLk );
+ aBottomMF.SetUpHdl( aLk );
+ aRightMF.SetUpHdl( aLk );
+ aLeftMF.SetUpHdl( aLk );
+ aWidthMF.SetUpHdl( aLk );
+
+ aTopMF.SetDownHdl( aLk );
+ aBottomMF.SetDownHdl( aLk );
+ aRightMF.SetDownHdl( aLk );
+ aLeftMF.SetDownHdl( aLk );
+ aWidthMF.SetDownHdl( aLk );
+
+ aTopMF.SetLoseFocusHdl( aLk );
+ aBottomMF.SetLoseFocusHdl( aLk );
+ aRightMF.SetLoseFocusHdl( aLk );
+ aLeftMF.SetLoseFocusHdl( aLk );
+ aWidthMF.SetLoseFocusHdl( aLk );
+
+ aRelWidthCB.SetClickHdl(LINK( this, SwFormatTablePage, RelWidthClickHdl ));
+}
+
+/*------------------------------------------------------------------------*/
+
+IMPL_LINK( SwFormatTablePage, RelWidthClickHdl, CheckBox *, pBtn )
+{
+ DBG_ASSERT(pTblData, "Tabellendaten nicht da?");
+ sal_Bool bIsChecked = pBtn->IsChecked();
+ sal_Int64 nLeft = aLeftMF.DenormalizePercent(aLeftMF.GetValue(FUNIT_TWIP ));
+ sal_Int64 nRight = aRightMF.DenormalizePercent(aRightMF.GetValue(FUNIT_TWIP ));
+ aWidthMF.ShowPercent(bIsChecked);
+ aLeftMF.ShowPercent(bIsChecked);
+ aRightMF.ShowPercent(bIsChecked);
+
+ if (bIsChecked)
+ {
+ aWidthMF.SetRefValue(pTblData->GetSpace());
+ aLeftMF.SetRefValue(pTblData->GetSpace());
+ aRightMF.SetRefValue(pTblData->GetSpace());
+ aLeftMF.MetricField::SetMin(0); // wird vom Percentfield ueberschrieben
+ aRightMF.MetricField::SetMin(0);// -""-
+ aLeftMF.MetricField::SetMax(99); //
+ aRightMF.MetricField::SetMax(99);//
+ aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(nLeft ), FUNIT_TWIP );
+ aRightMF.SetPrcntValue(aRightMF.NormalizePercent(nRight ), FUNIT_TWIP );
+ }
+ else
+ ModifyHdl(&aLeftMF); // Werte wieder korrigieren
+
+ if(aFreeBtn.IsChecked())
+ {
+ sal_Bool bEnable = !pBtn->IsChecked();
+ aRightMF.Enable(bEnable);
+ aRightFT.Enable(bEnable);
+ }
+ bModified = sal_True;
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK( SwFormatTablePage, AutoClickHdl, CheckBox *, pBox )
+{
+ sal_Bool bRestore = sal_True,
+ bLeftEnable = sal_False,
+ bRightEnable= sal_False,
+ bWidthEnable= sal_False,
+ bOthers = sal_True;
+ if( (RadioButton *) pBox == &aFullBtn )
+ {
+ aLeftMF.SetPrcntValue(0);
+ aRightMF.SetPrcntValue(0);
+ nSaveWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP )));
+ aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(pTblData->GetSpace() ), FUNIT_TWIP );
+ bFull = sal_True;
+ bRestore = sal_False;
+ }
+ else if( (RadioButton *) pBox == &aLeftBtn )
+ {
+ bRightEnable = bWidthEnable = sal_True;
+ aLeftMF.SetPrcntValue(0);
+ }
+ else if( (RadioButton *) pBox == &aFromLeftBtn )
+ {
+ bLeftEnable = bWidthEnable = sal_True;
+ aRightMF.SetPrcntValue(0);
+ }
+ else if( (RadioButton *) pBox == &aRightBtn )
+ {
+ bLeftEnable = bWidthEnable = sal_True;
+ aRightMF.SetPrcntValue(0);
+ }
+ else if( ( RadioButton * ) pBox == &aCenterBtn )
+ {
+ bLeftEnable = bWidthEnable = sal_True;
+ }
+ else if( ( RadioButton * ) pBox == &aFreeBtn )
+ {
+ RightModifyHdl(&aRightMF);
+ bLeftEnable = sal_True;
+ bWidthEnable = sal_True;
+ bOthers = sal_False;
+ }
+ aLeftMF.Enable(bLeftEnable);
+ aLeftFT.Enable(bLeftEnable);
+ aWidthMF.Enable(bWidthEnable);
+ aWidthFT.Enable(bWidthEnable);
+ if ( bOthers )
+ {
+ aRightMF.Enable(bRightEnable);
+ aRightFT.Enable(bRightEnable);
+ aRelWidthCB.Enable(bWidthEnable);
+ }
+
+ if(bFull && bRestore)
+ {
+ // nachdem auf autom. geschaltet wurde, wurde die Breite gemerkt,
+ // um sie beim Zurueckschalten restaurieren zu koennen
+ bFull = sal_False;
+ aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(nSaveWidth ), FUNIT_TWIP );
+ }
+ ModifyHdl(&aWidthMF);
+ bModified = sal_True;
+ return 0;
+}
+
+/*----------------------------------------------------------------------*/
+IMPL_LINK( SwFormatTablePage, RightModifyHdl, MetricField *, EMPTYARG )
+{
+ if(aFreeBtn.IsChecked())
+ {
+ sal_Bool bEnable = aRightMF.GetValue() == 0;
+// aWidthMF.Enable(bEnable);
+ aRelWidthCB.Enable(bEnable);
+// aWidthFT.Enable(bEnable);
+ if ( !bEnable )
+ {
+ aRelWidthCB.Check(sal_False);
+ RelWidthClickHdl(&aRelWidthCB);
+ }
+ bEnable = aRelWidthCB.IsChecked();
+ aRightMF.Enable(!bEnable);
+ aRightFT.Enable(!bEnable);
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK_INLINE_START( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit )
+{
+ if( &aRightMF == pEdit)
+ RightModifyHdl(pEdit);
+ ModifyHdl( pEdit );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit )
+
+void SwFormatTablePage::ModifyHdl( Edit* pEdit )
+{
+
+ SwTwips nCurWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP )));
+ SwTwips nPrevWidth = nCurWidth;
+ SwTwips nRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP )));
+ SwTwips nLeft = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP )));
+ SwTwips nDiff;
+
+ if( pEdit == &aWidthMF )
+ {
+ if( nCurWidth < MINLAY )
+ nCurWidth = MINLAY;
+ nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ;
+ //rechtsbuendig nur linken Rand veraendern
+ if(aRightBtn.IsChecked())
+ nLeft -= nDiff;
+ //linksbuendig nur rechten Rand veraendern
+ else if(aLeftBtn.IsChecked())
+ nRight -= nDiff;
+ //linker Rand und Breite erlaubt - erst rechts - dann links
+ else if(aFromLeftBtn.IsChecked())
+ {
+ if( nRight >= nDiff )
+ nRight -= nDiff;
+ else
+ {
+ nDiff -= nRight;
+ nRight = 0;
+ if(nLeft >= nDiff)
+ nLeft -= nDiff;
+ else
+ {
+ nRight += nLeft - nDiff;
+ nLeft = 0;
+ nCurWidth = pTblData->GetSpace();
+ }
+
+ }
+ }
+ //zentriert beide Seiten gleichmaessig veraendern
+ else if(aCenterBtn.IsChecked())
+ {
+ if((nLeft != nRight))
+ {
+ nDiff += nLeft + nRight;
+ nLeft = nDiff/2;
+ nRight = nDiff/2;
+ }
+ else
+ {
+ nLeft -= nDiff/2;
+ nRight -= nDiff/2;
+ }
+ }
+ //freie Ausrichtung: beide Raender verkleinern
+ else if(aFreeBtn.IsChecked())
+ {
+ nLeft -= nDiff/2;
+ nRight -= nDiff/2;
+ }
+ }
+ if( pEdit == &aRightMF )
+ {
+
+ if( nRight + nLeft > pTblData->GetSpace() - MINLAY )
+ nRight = pTblData->GetSpace() -nLeft - MINLAY;
+
+ nCurWidth = pTblData->GetSpace() - nLeft - nRight;
+ }
+ if( pEdit == &aLeftMF )
+ {
+ if(!aFromLeftBtn.IsChecked())
+ {
+ sal_Bool bCenter = aCenterBtn.IsChecked();
+ if( bCenter )
+ nRight = nLeft;
+ if(nRight + nLeft > pTblData->GetSpace() - MINLAY )
+ {
+ nLeft = bCenter ? (pTblData->GetSpace() - MINLAY) /2 :
+ (pTblData->GetSpace() - MINLAY) - nRight;
+ nRight = bCenter ? (pTblData->GetSpace() - MINLAY) /2 : nRight;
+ }
+ nCurWidth = pTblData->GetSpace() - nLeft - nRight;
+ }
+ else
+ {
+ //hier wird bei Aenderung an der linken Seite zuerst der
+ //rechte Rand veraendert, dann die Breite
+ nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ;
+
+ nRight -= nDiff;
+ nCurWidth = pTblData->GetSpace() - nLeft - nRight;
+ }
+ }
+ if (nCurWidth != nPrevWidth )
+ aWidthMF.SetPrcntValue( aWidthMF.NormalizePercent( nCurWidth ), FUNIT_TWIP );
+ aRightMF.SetPrcntValue( aRightMF.NormalizePercent( nRight ), FUNIT_TWIP );
+ aLeftMF.SetPrcntValue( aLeftMF.NormalizePercent( nLeft ), FUNIT_TWIP );
+ bModified = sal_True;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+SfxTabPage* SwFormatTablePage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwFormatTablePage( pParent, rAttrSet );
+}
+
+/*------------------------------------------------------------------------
+-------------------------------------------------------------------------*/
+sal_Bool SwFormatTablePage::FillItemSet( SfxItemSet& rCoreSet )
+{
+ // Testen, ob eins der Control noch den Focus hat
+ if(aWidthMF.HasFocus())
+ ModifyHdl(&aWidthMF);
+ else if(aLeftMF.HasFocus())
+ ModifyHdl(&aLeftMF);
+ else if(aRightMF.HasFocus())
+ ModifyHdl(&aRightMF);
+ else if(aTopMF.HasFocus())
+ ModifyHdl(&aTopMF);
+ else if(aBottomMF.HasFocus())
+ ModifyHdl(&aBottomMF);
+
+ if(bModified)
+ {
+ if( aBottomMF.GetText() != aBottomMF.GetSavedValue() ||
+ aTopMF.GetText() != aTopMF.GetSavedValue() )
+ {
+ SvxULSpaceItem aULSpace(RES_UL_SPACE);
+ aULSpace.SetUpper( (sal_uInt16) aTopMF.Denormalize(
+ aTopMF.GetValue( FUNIT_TWIP )));
+ aULSpace.SetLower( (sal_uInt16) aBottomMF.Denormalize(
+ aBottomMF.GetValue( FUNIT_TWIP )));
+ rCoreSet.Put(aULSpace);
+ }
+
+ }
+ if(aNameED.GetText() != aNameED.GetSavedValue())
+ {
+ rCoreSet.Put(SfxStringItem( FN_PARAM_TABLE_NAME, aNameED.GetText()));
+ bModified = sal_True;
+ }
+
+ sal_uInt16 nPos;
+ if( aTextDirectionLB.IsVisible() &&
+ ( nPos = aTextDirectionLB.GetSelectEntryPos() ) !=
+ aTextDirectionLB.GetSavedValue() )
+ {
+ sal_uInt32 nDirection = (sal_uInt32)(sal_uIntPtr)aTextDirectionLB.GetEntryData( nPos );
+ rCoreSet.Put( SvxFrameDirectionItem( (SvxFrameDirection)nDirection, RES_FRAMEDIR));
+ bModified = sal_True;
+ }
+
+ return bModified;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwFormatTablePage::Reset( const SfxItemSet& )
+{
+ const SfxItemSet& rSet = GetItemSet();
+ const SfxPoolItem* pItem;
+
+ if(bHtmlMode)
+ {
+ aNameED .Disable();
+ aTopFT .Hide();
+ aTopMF .Hide();
+ aBottomFT.Hide();
+ aBottomMF.Hide();
+ aFreeBtn.Enable(sal_False);
+ }
+ FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
+ SetMetric( aWidthMF, aMetric );
+ SetMetric( aRightMF, aMetric );
+ SetMetric( aLeftMF, aMetric );
+ SetMetric( aTopMF, aMetric );
+ SetMetric( aBottomMF, aMetric );
+
+ //Name
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, sal_False, &pItem ))
+ {
+ aNameED.SetText(((const SfxStringItem*)pItem)->GetValue());
+ aNameED.SaveValue();
+ }
+
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, sal_False, &pItem ))
+ {
+ pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue();
+ nMinTableWidth = pTblData->GetColCount() * MINLAY;
+
+ if(pTblData->GetWidthPercent())
+ {
+ aRelWidthCB.Check(sal_True);
+ RelWidthClickHdl(&aRelWidthCB);
+ aWidthMF.SetPrcntValue(pTblData->GetWidthPercent(), FUNIT_CUSTOM);
+
+ aWidthMF.SaveValue();
+ nSaveWidth = static_cast< SwTwips >(aWidthMF.GetValue(FUNIT_CUSTOM));
+ }
+ else
+ {
+ aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(
+ pTblData->GetWidth()), FUNIT_TWIP);
+ aWidthMF.SaveValue();
+ nSaveWidth = pTblData->GetWidth();
+ nMinTableWidth = Min( nSaveWidth, nMinTableWidth );
+ }
+
+ aWidthMF.SetRefValue(pTblData->GetSpace());
+ aWidthMF.SetLast(aWidthMF.NormalizePercent( pTblData->GetSpace() ));
+ aLeftMF.SetLast(aLeftMF.NormalizePercent( pTblData->GetSpace() ));
+ aRightMF.SetLast(aRightMF.NormalizePercent( pTblData->GetSpace() ));
+
+ aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(
+ pTblData->GetLeftSpace()), FUNIT_TWIP);
+ aRightMF.SetPrcntValue(aRightMF.NormalizePercent(
+ pTblData->GetRightSpace()), FUNIT_TWIP);
+ aLeftMF.SaveValue();
+ aRightMF.SaveValue();
+
+ nOldAlign = pTblData->GetAlign();
+
+ sal_Bool bSetRight = sal_False, bRightEnable = sal_False,
+ bSetLeft = sal_False, bLeftEnable = sal_False;
+ switch( nOldAlign )
+ {
+ case text::HoriOrientation::NONE:
+ aFreeBtn.Check();
+ if(aRelWidthCB.IsChecked())
+ bSetRight = sal_True;
+ break;
+ case text::HoriOrientation::FULL:
+ {
+ bSetRight = bSetLeft = sal_True;
+ aFullBtn.Check();
+ aWidthMF.Enable(sal_False);
+ aRelWidthCB.Enable(sal_False);
+ aWidthFT.Enable(sal_False);
+ }
+ break;
+ case text::HoriOrientation::LEFT:
+ {
+ bSetLeft = sal_True;
+ aLeftBtn.Check();
+ }
+ break;
+ case text::HoriOrientation::LEFT_AND_WIDTH :
+ {
+ bSetRight = sal_True;
+ aFromLeftBtn.Check();
+ }
+ break;
+ case text::HoriOrientation::RIGHT:
+ {
+ bSetRight = sal_True;
+ aRightBtn.Check();
+ }
+ break;
+ case text::HoriOrientation::CENTER:
+ {
+ bSetRight = sal_True;
+ aCenterBtn.Check();
+ }
+ break;
+ }
+ if ( bSetRight )
+ {
+ aRightMF.Enable(bRightEnable);
+ aRightFT.Enable(bRightEnable);
+ }
+ if ( bSetLeft )
+ {
+ aLeftMF.Enable(bLeftEnable);
+ aLeftFT.Enable(bLeftEnable);
+ }
+
+ }
+
+ //Raender
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_UL_SPACE, sal_False,&pItem ))
+ {
+ aTopMF.SetValue(aTopMF.Normalize(
+ ((const SvxULSpaceItem*)pItem)->GetUpper()), FUNIT_TWIP);
+ aBottomMF.SetValue(aBottomMF.Normalize(
+ ((const SvxULSpaceItem*)pItem)->GetLower()), FUNIT_TWIP);
+ aTopMF.SaveValue();
+ aBottomMF.SaveValue();
+ }
+
+ //text direction
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem ) )
+ {
+ sal_uInt32 nVal = ((SvxFrameDirectionItem*)pItem)->GetValue();
+ sal_uInt16 nPos = aTextDirectionLB.GetEntryPos( (void*) nVal );
+ aTextDirectionLB.SelectEntryPos( nPos );
+ aTextDirectionLB.SaveValue();
+ }
+
+ aWidthMF.SetMax( 2*aWidthMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
+ aRightMF.SetMax( aRightMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
+ aLeftMF.SetMax( aLeftMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
+ aWidthMF.SetMin( aWidthMF.NormalizePercent( nMinTableWidth ), FUNIT_TWIP );
+
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwFormatTablePage::ActivatePage( const SfxItemSet& rSet )
+{
+ DBG_ASSERT(pTblData, "Tabellendaten nicht da?");
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP ))
+ {
+ SwTwips nCurWidth = text::HoriOrientation::FULL != pTblData->GetAlign() ?
+ pTblData->GetWidth() :
+ pTblData->GetSpace();
+ if(pTblData->GetWidthPercent() == 0 &&
+ nCurWidth != aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP )))
+ {
+ aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(
+ nCurWidth), FUNIT_TWIP);
+ aWidthMF.SaveValue();
+ nSaveWidth = nCurWidth;
+ aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(
+ pTblData->GetLeftSpace()), FUNIT_TWIP);
+ aLeftMF.SaveValue();
+ aRightMF.SetPrcntValue(aRightMF.NormalizePercent(
+ pTblData->GetRightSpace()), FUNIT_TWIP);
+ aRightMF.SaveValue();
+ }
+ }
+
+}
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+int SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet )
+{
+ // os: VCL sorgt nicht dafuer, dass das aktive Control im
+ // dialog bei OK den focus verliert
+ aNameED.GrabFocus();
+ // Test des Tabellennamens auf Leerzeichen
+ String sTblName = aNameED.GetText();
+ if(sTblName.Search(' ') != STRING_NOTFOUND)
+ {
+ InfoBox(this, SW_RES(MSG_WRONG_TABLENAME)).Execute();
+ aNameED.GrabFocus();
+ return KEEP_PAGE;
+ }
+ if(_pSet)
+ {
+ FillItemSet(*_pSet);
+ if(bModified)
+ {
+ SwTwips lLeft = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP )));
+ SwTwips lRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP )));
+
+
+ if( aLeftMF.GetText() != aLeftMF.GetSavedValue() ||
+ aRightMF.GetText() != aRightMF.GetSavedValue() )
+ {
+ pTblData->SetWidthChanged();
+ pTblData->SetLeftSpace( lLeft);
+ pTblData->SetRightSpace( lRight);
+ }
+
+ SwTwips lWidth;
+ if (aRelWidthCB.IsChecked() && aRelWidthCB.IsEnabled())
+ {
+ lWidth = pTblData->GetSpace() - lRight - lLeft;
+ sal_uInt16 nPercentWidth = (sal_uInt16)aWidthMF.GetValue(FUNIT_CUSTOM);
+ if(pTblData->GetWidthPercent() != nPercentWidth)
+ {
+ pTblData->SetWidthPercent(nPercentWidth);
+ pTblData->SetWidthChanged();
+ }
+ }
+ else
+ {
+ pTblData->SetWidthPercent(0);
+ lWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP )));
+ }
+ pTblData->SetWidth(lWidth);
+
+ SwTwips nColSum = 0;
+ sal_uInt16 i;
+
+ for( i = 0; i < pTblData->GetColCount(); i++)
+ {
+ nColSum += pTblData->GetColumns()[i].nWidth;
+ }
+ if(nColSum != pTblData->GetWidth())
+ {
+ SwTwips nMinWidth = Min( (long)MINLAY,
+ (long) (pTblData->GetWidth() /
+ pTblData->GetColCount() - 1));
+ SwTwips nDiff = nColSum - pTblData->GetWidth();
+ while ( Abs(nDiff) > pTblData->GetColCount() + 1 )
+ {
+ SwTwips nSub = nDiff / pTblData->GetColCount();
+ for( i = 0; i < pTblData->GetColCount(); i++)
+ {
+ if(pTblData->GetColumns()[i].nWidth - nMinWidth > nSub)
+ {
+ pTblData->GetColumns()[i].nWidth -= nSub;
+ nDiff -= nSub;
+ }
+ else
+ {
+ nDiff -= pTblData->GetColumns()[i].nWidth - nMinWidth;
+ pTblData->GetColumns()[i].nWidth = nMinWidth;
+ }
+
+ }
+ }
+ }
+
+ sal_Int16 nAlign = 0;
+ if(aRightBtn.IsChecked())
+ nAlign = text::HoriOrientation::RIGHT;
+ else if(aLeftBtn.IsChecked())
+ nAlign = text::HoriOrientation::LEFT;
+ else if(aFromLeftBtn.IsChecked())
+ nAlign = text::HoriOrientation::LEFT_AND_WIDTH;
+ else if(aCenterBtn.IsChecked())
+ nAlign = text::HoriOrientation::CENTER;
+ else if(aFreeBtn.IsChecked())
+ nAlign = text::HoriOrientation::NONE;
+ else if(aFullBtn.IsChecked())
+ {
+ nAlign = text::HoriOrientation::FULL;
+ lWidth = lAutoWidth;
+ }
+ if(nAlign != pTblData->GetAlign())
+ {
+ pTblData->SetWidthChanged();
+ pTblData->SetAlign(nAlign);
+ }
+
+
+ // if( text::HoriOrientation::CENTER && lWidth != (SwTwips)aWidthMF.GetSavedValue())
+ if(pTblData->GetWidth() != lWidth )
+ {
+ pTblData->SetWidthChanged();
+ pTblData->SetWidth(
+ nAlign == text::HoriOrientation::FULL ? pTblData->GetSpace() : lWidth );
+ }
+ if(pTblData->HasWidthChanged())
+ _pSet->Put(SwPtrItem(FN_TABLE_REP, pTblData));
+ }
+#ifdef DEBUG_TBLDLG
+DbgTblRep(pTblData)
+#endif
+ }
+ return sal_True;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Seite Spaltenkonfiguration
+------------------------------------------------------------------------*/
+SwTableColumnPage::SwTableColumnPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SW_RES( TP_TABLE_COLUMN ), rSet ),
+ aModifyTableCB(this, SW_RES(CB_MOD_TBL)),
+ aProportionalCB(this, SW_RES(CB_PROP)),
+ aSpaceFT(this, SW_RES(FT_SPACE)),
+ aSpaceED(this, SW_RES(ED_SPACE)),
+
+ aUpBtn(this, SW_RES(COL_BTN_UP)),
+ aFT1(this, SW_RES(COL_FT_1)),
+ aMF1(this, SW_RES(COL_MF_1)),
+ aFT2(this, SW_RES(COL_FT_2)),
+ aMF2(this, SW_RES(COL_MF_2)),
+ aFT3(this, SW_RES(COL_FT_3)),
+ aMF3(this, SW_RES(COL_MF_3)),
+ aFT4(this, SW_RES(COL_FT_4)),
+ aMF4(this, SW_RES(COL_MF_4)),
+ aFT5(this, SW_RES(COL_FT_5)),
+ aMF5(this, SW_RES(COL_MF_5)),
+ aFT6(this, SW_RES(COL_FT_6)),
+ aMF6(this, SW_RES(COL_MF_6)),
+ aDownBtn(this, SW_RES(COL_BTN_DOWN)),
+ aColFL(this, SW_RES(COL_FL_LAYOUT)),
+
+ nTableWidth(0),
+ nMinWidth( MINLAY ),
+ nNoOfCols( 0 ),
+ nNoOfVisibleCols( 0 ),
+ bModified(sal_False),
+ bModifyTbl(sal_False),
+ bPercentMode(sal_False)
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ pFieldArr[0] = &aMF1;
+ pFieldArr[1] = &aMF2;
+ pFieldArr[2] = &aMF3;
+ pFieldArr[3] = &aMF4;
+ pFieldArr[4] = &aMF5;
+ pFieldArr[5] = &aMF6;
+
+ pTextArr[0] = &aFT1;
+ pTextArr[1] = &aFT2;
+ pTextArr[2] = &aFT3;
+ pTextArr[3] = &aFT4;
+ pTextArr[4] = &aFT5;
+ pTextArr[5] = &aFT6;
+
+ const SfxPoolItem* pItem;
+ Init((SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False,&pItem )
+ && ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON));
+
+};
+/*------------------------------------------------------------------------
+ Beschreibung: Seite Spaltenkonfiguration
+------------------------------------------------------------------------*/
+ SwTableColumnPage::~SwTableColumnPage()
+{
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+SfxTabPage* SwTableColumnPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwTableColumnPage( pParent, rAttrSet );
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::Reset( const SfxItemSet& )
+{
+ const SfxItemSet& rSet = GetItemSet();
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, sal_False, &pItem ))
+ {
+ pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue();
+ nNoOfVisibleCols = pTblData->GetColCount();
+ nNoOfCols = pTblData->GetAllColCount();
+ nTableWidth = pTblData->GetAlign() != text::HoriOrientation::FULL &&
+ pTblData->GetAlign() != text::HoriOrientation::LEFT_AND_WIDTH?
+ pTblData->GetWidth() : pTblData->GetSpace();
+
+ sal_uInt16 i;
+ for( i = 0; i < nNoOfCols; i++ )
+ {
+ if( pTblData->GetColumns()[i].nWidth < nMinWidth )
+ nMinWidth = pTblData->GetColumns()[i].nWidth;
+ }
+ sal_Int64 nMinTwips = pFieldArr[0]->NormalizePercent( nMinWidth );
+ sal_Int64 nMaxTwips = pFieldArr[0]->NormalizePercent( nTableWidth );
+ for( i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
+ {
+ pFieldArr[i]->SetPrcntValue( pFieldArr[i]->NormalizePercent(
+ GetVisibleWidth(i) ), FUNIT_TWIP );
+ pFieldArr[i]->SetMin( nMinTwips , FUNIT_TWIP );
+ pFieldArr[i]->SetMax( nMaxTwips , FUNIT_TWIP );
+ pFieldArr[i]->Enable();
+ pTextArr[i]->Enable();
+ }
+
+ if( nNoOfVisibleCols > MET_FIELDS )
+ aUpBtn.Enable();
+ i = nNoOfVisibleCols;
+ while( i < MET_FIELDS )
+ {
+ pFieldArr[i]->SetText( aEmptyStr );
+ pTextArr[i]->Hide();
+ i++;
+ }
+ }
+ ActivatePage(rSet);
+
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::Init(sal_Bool bWeb)
+{
+ FieldUnit aMetric = ::GetDfltMetric(bWeb);
+ Link aLkUp = LINK( this, SwTableColumnPage, UpHdl );
+ Link aLkDown = LINK( this, SwTableColumnPage, DownHdl );
+ Link aLkLF = LINK( this, SwTableColumnPage, LoseFocusHdl );
+ for( sal_uInt16 i = 0; i < MET_FIELDS; i++ )
+ {
+ aValueTbl[i] = i;
+ SetMetric(*pFieldArr[i], aMetric);
+ pFieldArr[i]->SetUpHdl( aLkUp );
+ pFieldArr[i]->SetDownHdl( aLkDown );
+ pFieldArr[i]->SetLoseFocusHdl( aLkLF );
+
+ }
+ SetMetric(aSpaceED, aMetric);
+
+ Link aLk = LINK( this, SwTableColumnPage, AutoClickHdl );
+ aUpBtn.SetClickHdl( aLk );
+ aDownBtn.SetClickHdl( aLk );
+
+ aLk = LINK( this, SwTableColumnPage, ModeHdl );
+ aModifyTableCB .SetClickHdl( aLk );
+ aProportionalCB.SetClickHdl( aLk );
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK( SwTableColumnPage, AutoClickHdl, CheckBox *, pBox )
+{
+ //Anzeigefenster verschieben
+ if(pBox == (CheckBox *)&aDownBtn)
+ {
+ if(aValueTbl[0] > 0)
+ {
+ for( sal_uInt16 i=0; i < MET_FIELDS; i++ )
+ aValueTbl[i] -= 1;
+ }
+ }
+ if(pBox == (CheckBox *)&aUpBtn)
+ {
+ if( aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 )
+ {
+ for(sal_uInt16 i=0;i < MET_FIELDS;i++)
+ aValueTbl[i] += 1;
+ }
+ }
+ for( sal_uInt16 i = 0; (i < nNoOfVisibleCols ) && ( i < MET_FIELDS); i++ )
+ {
+ String sEntry('~');
+ sEntry += String::CreateFromInt32( aValueTbl[i] + 1 );
+ pTextArr[i]->SetText( sEntry );
+ }
+
+ aDownBtn.Enable(aValueTbl[0] > 0);
+ aUpBtn.Enable(aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 );
+ UpdateCols(0);
+ return 0;
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK_INLINE_START( SwTableColumnPage, UpHdl, PercentField *, pEdit )
+{
+ bModified = sal_True;
+ ModifyHdl( pEdit );
+ return 0;
+};
+IMPL_LINK_INLINE_END( SwTableColumnPage, UpHdl, PercentField *, pEdit )
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK_INLINE_START( SwTableColumnPage, DownHdl, PercentField *, pEdit )
+{
+ bModified = sal_True;
+ ModifyHdl( pEdit );
+ return 0;
+};
+IMPL_LINK_INLINE_END( SwTableColumnPage, DownHdl, PercentField *, pEdit )
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK_INLINE_START( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit )
+{
+ if(pEdit->IsModified())
+ {
+ bModified = sal_True;
+ ModifyHdl( pEdit );
+ }
+ return 0;
+};
+IMPL_LINK_INLINE_END( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit )
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK( SwTableColumnPage, ModeHdl, CheckBox*, pBox )
+{
+ sal_Bool bCheck = pBox->IsChecked();
+ if(pBox == &aProportionalCB)
+ {
+ if(bCheck)
+ aModifyTableCB.Check();
+ aModifyTableCB.Enable(!bCheck && bModifyTbl);
+ }
+ return 0;
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+sal_Bool SwTableColumnPage::FillItemSet( SfxItemSet& )
+{
+ for( sal_uInt16 i = 0; i < MET_FIELDS; i++ )
+ {
+ if(pFieldArr[i]->HasFocus())
+ {
+ LoseFocusHdl(pFieldArr[i]);
+ break;
+ }
+ }
+
+ if(bModified)
+ {
+ pTblData->SetColsChanged();
+ }
+ return bModified;
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::ModifyHdl( PercentField* pEdit )
+{
+ sal_uInt16 nAktPos;
+ sal_uInt16 i;
+
+ for( i = 0; i < MET_FIELDS; i++)
+ if(pEdit == pFieldArr[i])
+ break;
+
+ SetVisibleWidth(aValueTbl[i], static_cast< SwTwips >(pEdit->DenormalizePercent(pEdit->GetValue( FUNIT_TWIP ))) );
+ nAktPos = aValueTbl[i];
+
+ UpdateCols( nAktPos );
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::UpdateCols( sal_uInt16 nAktPos )
+{
+ SwTwips nSum = 0;
+ sal_uInt16 i;
+
+ for( i = 0; i < nNoOfCols; i++ )
+ {
+ nSum += (pTblData->GetColumns())[i].nWidth;
+ }
+ SwTwips nDiff = nSum - nTableWidth;
+
+ sal_Bool bModifyTable = aModifyTableCB.IsChecked();
+ sal_Bool bProp = aProportionalCB.IsChecked();
+
+ if(!bModifyTable && !bProp )
+ {
+// Tabellenbreite bleibt, Differenz wird mit der/den
+// naechsten Zellen ausgeglichen
+ while( nDiff )
+ {
+ if( ++nAktPos == nNoOfVisibleCols)
+ nAktPos = 0;
+ if( nDiff < 0 )
+ {
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
+ nDiff = 0;
+ }
+ else if( GetVisibleWidth(nAktPos) >= nDiff + nMinWidth )
+ {
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
+ nDiff = 0;
+ }
+ if( nDiff > 0 && GetVisibleWidth(nAktPos) > nMinWidth )
+ {
+ if( nDiff >= (GetVisibleWidth(nAktPos) - nMinWidth) )
+ {
+ nDiff -= (GetVisibleWidth(nAktPos) - nMinWidth);
+ SetVisibleWidth(nAktPos, nMinWidth);
+ }
+ else
+ {
+ nDiff = 0;
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
+ }
+ DBG_ASSERT(nDiff >= 0, "nDiff < 0 kann hier nicht sein!");
+ }
+ }
+ }
+ else if(bModifyTable && !bProp)
+ {
+// Differenz wird ueber die Tabellenbreite ausgeglichen,
+// andere Spalten bleiben unveraendert
+ DBG_ASSERT(nDiff <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" );
+ SwTwips nActSpace = pTblData->GetSpace() - nTableWidth;
+ if(nDiff > nActSpace)
+ {
+ nTableWidth = pTblData->GetSpace();
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nActSpace );
+ }
+ else
+ {
+ nTableWidth += nDiff;
+ }
+ }
+ else if(bModifyTable & bProp)
+ {
+// Alle Spalten werden proportional mitveraendert, die Tabellenbreite wird
+// entsprechend angepasst
+ DBG_ASSERT(nDiff * nNoOfVisibleCols <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" );
+ long nAdd = nDiff;
+ if(nDiff * nNoOfVisibleCols > pTblData->GetSpace() - nTableWidth)
+ {
+ nAdd = (pTblData->GetSpace() - nTableWidth) / nNoOfVisibleCols;
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nAdd );
+ nDiff = nAdd;
+ }
+ if(nAdd)
+ for(i = 0; i < nNoOfVisibleCols; i++ )
+ {
+ if(i == nAktPos)
+ continue;
+ SwTwips nVisWidth;
+ if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
+ {
+ nAdd += nVisWidth - MINLAY;
+ SetVisibleWidth(i, MINLAY);
+ }
+ else
+ {
+ SetVisibleWidth(i, nVisWidth + nDiff);
+ nAdd += nDiff;
+ }
+
+ }
+ nTableWidth += nAdd;
+
+ }
+ else
+ {
+// Die Differenz wird gleichmaessig auf alle anderen Spalten aufgeteilt
+// die Tabellenbreite bleibt konstant
+/*
+ SwTwips nDiffn = nDiff/(nNoOfVisibleCols - 1);
+ if(nDiff < 0 && (nNoOfVisibleCols - 1) * nDiffn != nDiff)
+ nDiffn-- ;
+ sal_uInt16 nStart = nAktPos++;
+ if(nAktPos == nNoOfVisibleCols)
+ nStart = 0;
+ for(sal_uInt16 i = 0; i < nNoOfVisibleCols; i++ )
+ {
+ if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
+ {
+ nAdd += nVisWidth - MINLAY;
+ SetVisibleWidth(i, MINLAY);
+ }
+ }
+*/
+
+ }
+
+#ifdef DEBUG_TBLDLG
+DbgTblRep(pTblData)
+#endif
+
+ if(!bPercentMode)
+ aSpaceED.SetValue(aSpaceED.Normalize( pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP);
+
+ for( i = 0; ( i < nNoOfVisibleCols ) && ( i < MET_FIELDS ); i++)
+ {
+ pFieldArr[i]->SetPrcntValue(pFieldArr[i]->NormalizePercent(
+ GetVisibleWidth(aValueTbl[i]) ), FUNIT_TWIP);
+ pFieldArr[i]->ClearModifyFlag();
+ }
+
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::ActivatePage( const SfxItemSet& )
+{
+ bPercentMode = pTblData->GetWidthPercent() != 0;
+ for( sal_uInt16 i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
+ {
+ pFieldArr[i]->SetRefValue(pTblData->GetWidth());
+ pFieldArr[i]->ShowPercent( bPercentMode );
+ }
+
+ sal_uInt16 nTblAlign = pTblData->GetAlign();
+ if((text::HoriOrientation::FULL != nTblAlign && nTableWidth != pTblData->GetWidth()) ||
+ (text::HoriOrientation::FULL == nTblAlign && nTableWidth != pTblData->GetSpace()))
+ {
+ nTableWidth = text::HoriOrientation::FULL == nTblAlign ?
+ pTblData->GetSpace() :
+ pTblData->GetWidth();
+ UpdateCols(0);
+ }
+ bModifyTbl = sal_True;
+ if(pTblData->GetWidthPercent() ||
+ text::HoriOrientation::FULL == nTblAlign ||
+ pTblData->IsLineSelected() )
+ bModifyTbl = sal_False;
+ if(bPercentMode)
+ {
+ aModifyTableCB .Check(sal_False);
+ aProportionalCB .Check(sal_False);
+ }
+ else if( !bModifyTbl )
+ {
+ aProportionalCB.Check(sal_False);
+ aModifyTableCB.Check(sal_False);
+ }
+ aSpaceFT.Enable(!bPercentMode);
+ aSpaceED.Enable(!bPercentMode);
+ aModifyTableCB.Enable( !bPercentMode && bModifyTbl );
+ aProportionalCB.Enable(!bPercentMode && bModifyTbl );
+
+/* if(pTblData->IsLineSelected() && pTblData->IsComplex())
+ {
+
+ }*/
+ aSpaceED.SetValue(aSpaceED.Normalize(
+ pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP);
+
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+int SwTableColumnPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if(_pSet)
+ {
+ FillItemSet(*_pSet);
+ if(text::HoriOrientation::FULL != pTblData->GetAlign() && pTblData->GetWidth() != nTableWidth)
+ {
+ pTblData->SetWidth(nTableWidth);
+ SwTwips nDiff = pTblData->GetSpace() - pTblData->GetWidth() -
+ pTblData->GetLeftSpace() - pTblData->GetRightSpace();
+ switch( pTblData->GetAlign() )
+ {
+ case text::HoriOrientation::RIGHT:
+ pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff);
+ break;
+ case text::HoriOrientation::LEFT:
+ pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff);
+ break;
+ case text::HoriOrientation::NONE:
+ {
+ SwTwips nDiff2 = nDiff/2;
+ if( nDiff > 0 ||
+ (-nDiff2 < pTblData->GetRightSpace() && - nDiff2 < pTblData->GetLeftSpace()))
+ {
+ pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff2);
+ pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff2);
+ }
+ else
+ {
+ if(pTblData->GetRightSpace() > pTblData->GetLeftSpace())
+ {
+ pTblData->SetLeftSpace(0);
+ pTblData->SetRightSpace(pTblData->GetSpace() - pTblData->GetWidth());
+ }
+ else
+ {
+ pTblData->SetRightSpace(0);
+ pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth());
+ }
+ }
+ }
+ break;
+ case text::HoriOrientation::CENTER:
+ pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff/2);
+ pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff/2);
+ break;
+ case text::HoriOrientation::LEFT_AND_WIDTH :
+ if(nDiff > pTblData->GetRightSpace())
+ {
+ pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth());
+ }
+ pTblData->SetRightSpace(
+ pTblData->GetSpace() - pTblData->GetWidth() - pTblData->GetLeftSpace());
+ break;
+ }
+ pTblData->SetWidthChanged();
+ }
+#ifdef DEBUG_TBLDLG
+DbgTblRep(pTblData)
+#endif
+ _pSet->Put(SwPtrItem( FN_TABLE_REP, pTblData ));
+ }
+ return sal_True;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+SwTwips SwTableColumnPage::GetVisibleWidth(sal_uInt16 nPos)
+{
+ sal_uInt16 i=0;
+
+ while( nPos )
+ {
+ if(pTblData->GetColumns()[i].bVisible && nPos)
+ nPos--;
+ i++;
+ }
+ SwTwips nReturn = pTblData->GetColumns()[i].nWidth;
+ DBG_ASSERT(i < nNoOfCols, "Array index out of range");
+ while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
+ nReturn += pTblData->GetColumns()[++i].nWidth;
+
+// return (*ppTableColumns)[i].nWidth;
+ return nReturn;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth)
+{
+ sal_uInt16 i=0;
+ while( nPos )
+ {
+ if(pTblData->GetColumns()[i].bVisible && nPos)
+ nPos--;
+ i++;
+ }
+ DBG_ASSERT(i < nNoOfCols, "Array index out of range");
+ pTblData->GetColumns()[i].nWidth = nNewWidth;
+ while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
+ pTblData->GetColumns()[++i].nWidth = 0;
+
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+SwTableTabDlg::SwTableTabDlg(Window* pParent, SfxItemPool& ,
+ const SfxItemSet* pItemSet, SwWrtShell* pSh ) :
+ SfxTabDialog(pParent, SW_RES(DLG_FORMAT_TABLE), pItemSet,0),
+ pShell(pSh),
+ nHtmlMode(::GetHtmlMode(pSh->GetView().GetDocShell()))
+{
+ FreeResource();
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AddTabPage(TP_FORMAT_TABLE, &SwFormatTablePage::Create, 0 );
+ AddTabPage(TP_TABLE_TEXTFLOW, &SwTextFlowPage::Create, 0 );
+ AddTabPage(TP_TABLE_COLUMN, &SwTableColumnPage::Create, 0 );
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
+ AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
+}
+
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ if( TP_BACKGROUND == nId )
+ {
+ sal_Int32 nFlagType = SVX_SHOW_TBLCTL;
+ if(!( nHtmlMode & HTMLMODE_ON ) ||
+ nHtmlMode & HTMLMODE_SOME_STYLES)
+ nFlagType |= SVX_SHOW_SELECTOR;
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
+ rPage.PageCreated(aSet);
+ }
+ else if(TP_BORDER == nId)
+ {
+ aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_TABLE));
+ rPage.PageCreated(aSet);
+ }
+ else if(TP_TABLE_TEXTFLOW == nId)
+ {
+ ((SwTextFlowPage&)rPage).SetShell(pShell);
+ const sal_uInt16 eType = pShell->GetFrmType(0,sal_True);
+ if( !(FRMTYPE_BODY & eType) )
+ ((SwTextFlowPage&)rPage).DisablePageBreak();
+ }
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+SwTextFlowPage::SwTextFlowPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SW_RES( TP_TABLE_TEXTFLOW ), rSet ),
+ aFlowFL (this, SW_RES(FL_FLOW )),
+ aPgBrkCB (this, SW_RES(CB_PAGEBREAK )),
+ aPgBrkRB (this, SW_RES(RB_BREAKPAGE )),
+ aColBrkRB (this, SW_RES(RB_BREAKCOLUMN )),
+ aPgBrkBeforeRB (this, SW_RES(RB_PAGEBREAKBEFORE)),
+ aPgBrkAfterRB (this, SW_RES(RB_PAGEBREAKAFTER )),
+ aPageCollCB (this, SW_RES(CB_PAGECOLL )),
+ aPageCollLB (this, SW_RES(LB_PAGECOLL )),
+ aPageNoFT (this, SW_RES(FT_PAGENUM )),
+ aPageNoNF (this, SW_RES(NF_PAGENUM )),
+ aSplitCB (this, SW_RES(CB_SPLIT )),
+ aSplitRowCB (this, SW_RES(CB_SPLIT_ROW )),
+ aKeepCB (this, SW_RES(CB_KEEP )),
+ aHeadLineCB (this, SW_RES(CB_HEADLINE )),
+ aRepeatHeaderFT (this, SW_RES(FT_REPEAT_HEADER )),
+ aRepeatHeaderBeforeFT (this),
+ aRepeatHeaderNF (this, SW_RES(NF_REPEAT_HEADER )),
+ aRepeatHeaderAfterFT (this),
+ aRepeatHeaderCombo (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT),
+ aTextDirectionFT(this, SW_RES(FT_TEXTDIRECTION )),
+ aTextDirectionLB(this, SW_RES(LB_TEXTDIRECTION )),
+
+ aVertOrientFL (this, SW_RES(FL_VERT_ORIENT )),
+ aVertOrientFT(this, SW_RES(FT_VERTORIENT )),
+ aVertOrientLB(this, SW_RES(LB_VERTORIENT )),
+
+ pShell(0),
+
+ bPageBreak(sal_True),
+ bHtmlMode(sal_False)
+{
+ FreeResource();
+
+ aPgBrkCB.SetClickHdl(LINK(this, SwTextFlowPage, PageBreakHdl_Impl));
+ aPgBrkBeforeRB.SetClickHdl(
+ LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) );
+ aPgBrkAfterRB.SetClickHdl(
+ LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) );
+ aPageCollCB.SetClickHdl(
+ LINK( this, SwTextFlowPage, ApplyCollClickHdl_Impl ) );
+ aColBrkRB.SetClickHdl(
+ LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
+ aPgBrkRB.SetClickHdl(
+ LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
+ aSplitCB.SetClickHdl(
+ LINK( this, SwTextFlowPage, SplitHdl_Impl));
+ aSplitRowCB.SetClickHdl(
+ LINK( this, SwTextFlowPage, SplitRowHdl_Impl));
+ aHeadLineCB.SetClickHdl( LINK( this, SwTextFlowPage, HeadLineCBClickHdl ) );
+
+#ifndef SW_FILEFORMAT_40
+ const SfxPoolItem *pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False,&pItem )
+ && ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
+#endif
+ {
+ aKeepCB.Hide();
+ aSplitCB.Hide();
+ aSplitRowCB.Hide();
+ }
+
+ aRepeatHeaderCombo.Arrange( aRepeatHeaderFT );
+
+ HeadLineCBClickHdl();
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+ SwTextFlowPage::~SwTextFlowPage()
+{
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+SfxTabPage* SwTextFlowPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwTextFlowPage(pParent, rAttrSet);
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+sal_Bool SwTextFlowPage::FillItemSet( SfxItemSet& rSet )
+{
+ sal_Bool bModified = sal_False;
+
+ //Ueberschrift wiederholen
+ if(aHeadLineCB.IsChecked() != aHeadLineCB.GetSavedValue() ||
+ String::CreateFromInt32( static_cast< sal_Int32 >(aRepeatHeaderNF.GetValue()) ) != aRepeatHeaderNF.GetSavedValue() )
+ {
+ bModified |= 0 != rSet.Put(
+ SfxUInt16Item(FN_PARAM_TABLE_HEADLINE, aHeadLineCB.IsChecked()? sal_uInt16(aRepeatHeaderNF.GetValue()) : 0 ));
+ }
+ if(aKeepCB.IsChecked() != aKeepCB.GetSavedValue())
+ bModified |= 0 != rSet.Put( SvxFmtKeepItem( aKeepCB.IsChecked(), RES_KEEP));
+
+ if(aSplitCB.IsChecked() != aSplitCB.GetSavedValue())
+ bModified |= 0 != rSet.Put( SwFmtLayoutSplit( aSplitCB.IsChecked()));
+
+ if(aSplitRowCB.IsChecked() != aSplitRowCB.GetSavedValue())
+ bModified |= 0 != rSet.Put( SwFmtRowSplit( aSplitRowCB.IsChecked()));
+
+
+ const SvxFmtBreakItem* pBreak = (const SvxFmtBreakItem*)GetOldItem( rSet, RES_BREAK );
+ const SwFmtPageDesc* pDesc = (const SwFmtPageDesc*) GetOldItem( rSet, RES_PAGEDESC );
+
+
+ sal_Bool bState = aPageCollCB.IsChecked();
+
+ //Wenn Seitenvorlage, dann kein Break
+ sal_Bool bPageItemPut = sal_False;
+ if ( bState != aPageCollCB.GetSavedValue() ||
+ ( bState &&
+ aPageCollLB.GetSelectEntryPos() != aPageCollLB.GetSavedValue() )
+ || (aPageNoNF.IsEnabled() && aPageNoNF.IsValueModified()) )
+ {
+ String sPage;
+
+ if ( bState )
+ {
+ sPage = aPageCollLB.GetSelectEntry();
+ }
+ sal_uInt16 nPgNum = static_cast< sal_uInt16 >(aPageNoNF.GetValue());
+ if ( !pDesc || !pDesc->GetPageDesc() ||
+ ( pDesc->GetPageDesc() && ((pDesc->GetPageDesc()->GetName() != sPage) ||
+ aPageNoNF.GetSavedValue() != (String)nPgNum)))
+ {
+ SwFmtPageDesc aFmt( pShell->FindPageDescByName( sPage, sal_True ) );
+ aFmt.SetNumOffset(bState ? nPgNum : 0);
+ bModified |= 0 != rSet.Put( aFmt );
+ bPageItemPut = bState;
+ }
+ }
+ sal_Bool bIsChecked = aPgBrkCB.IsChecked();
+ if ( !bPageItemPut &&
+ ( bState != aPageCollCB.GetSavedValue() ||
+ bIsChecked != aPgBrkCB.GetSavedValue() ||
+ aPgBrkBeforeRB.IsChecked() != aPgBrkBeforeRB.GetSavedValue() ||
+ aPgBrkRB.IsChecked() != aPgBrkRB.GetSavedValue() ))
+ {
+ SvxFmtBreakItem aBreak(
+ (const SvxFmtBreakItem&)GetItemSet().Get( RES_BREAK ) );
+
+ if(bIsChecked)
+ {
+ sal_Bool bBefore = aPgBrkBeforeRB.IsChecked();
+
+ if ( aPgBrkRB.IsChecked() )
+ {
+ if ( bBefore )
+ aBreak.SetValue( SVX_BREAK_PAGE_BEFORE );
+ else
+ aBreak.SetValue( SVX_BREAK_PAGE_AFTER );
+ }
+ else
+ {
+ if ( bBefore )
+ aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE );
+ else
+ aBreak.SetValue( SVX_BREAK_COLUMN_AFTER );
+ }
+ }
+ else
+ {
+ aBreak.SetValue( SVX_BREAK_NONE );
+ }
+
+ if ( !pBreak || !( *(const SvxFmtBreakItem*)pBreak == aBreak ) )
+ {
+ bModified |= 0 != rSet.Put( aBreak );
+ }
+ }
+
+ if(aTextDirectionLB.GetSelectEntryPos() != aTextDirectionLB.GetSavedValue())
+ {
+ bModified |= 0 != rSet.Put(
+ SvxFrameDirectionItem(
+ (SvxFrameDirection)(sal_uLong)aTextDirectionLB.GetEntryData(aTextDirectionLB.GetSelectEntryPos())
+ , FN_TABLE_BOX_TEXTDIRECTION));
+ }
+
+ if(aVertOrientLB.GetSelectEntryPos() != aVertOrientLB.GetSavedValue())
+ {
+ sal_uInt16 nOrient = USHRT_MAX;
+ switch(aVertOrientLB.GetSelectEntryPos())
+ {
+ case 0 : nOrient = text::VertOrientation::NONE; break;
+ case 1 : nOrient = text::VertOrientation::CENTER; break;
+ case 2 : nOrient = text::VertOrientation::BOTTOM; break;
+ }
+ if(nOrient != USHRT_MAX)
+ bModified |= 0 != rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, nOrient));
+ }
+
+ return bModified;
+
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+void SwTextFlowPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ sal_Bool bFlowAllowed = !bHtmlMode || pHtmlOpt->IsPrintLayoutExtension();
+ if(bFlowAllowed)
+ {
+ // Einfuegen der vorhandenen Seitenvorlagen in die Listbox
+ const sal_uInt16 nCount = pShell->GetPageDescCnt();
+ sal_uInt16 i;
+
+ for( i = 0; i < nCount; ++i)
+ {
+ const SwPageDesc &rPageDesc = pShell->GetPageDesc(i);
+ aPageCollLB.InsertEntry(rPageDesc.GetName());
+ }
+
+ String aFmtName;
+ for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i)
+ if( LISTBOX_ENTRY_NOTFOUND == aPageCollLB.GetEntryPos(
+ aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ) ))
+ aPageCollLB.InsertEntry( aFmtName );
+
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_KEEP, sal_False, &pItem ))
+ {
+ aKeepCB.Check( ((const SvxFmtKeepItem*)pItem)->GetValue() );
+ aKeepCB.SaveValue();
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_LAYOUT_SPLIT, sal_False, &pItem ))
+ {
+ aSplitCB.Check( ((const SwFmtLayoutSplit*)pItem)->GetValue() );
+ }
+ else
+ aSplitCB.Check();
+
+ aSplitCB.SaveValue();
+ SplitHdl_Impl(&aSplitCB);
+
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, sal_False, &pItem ))
+ {
+ aSplitRowCB.Check( ((const SwFmtRowSplit*)pItem)->GetValue() );
+ }
+ else
+ aSplitRowCB.SetState(STATE_DONTKNOW);
+ aSplitRowCB.SaveValue();
+
+ if(bPageBreak)
+ {
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC, sal_False, &pItem ))
+ {
+ String sPageDesc;
+ const SwPageDesc* pDesc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
+ aPageNoNF.SetValue(((const SwFmtPageDesc*)pItem)->GetNumOffset());
+ if(pDesc)
+ sPageDesc = pDesc->GetName();
+ if ( sPageDesc.Len() &&
+ aPageCollLB.GetEntryPos( sPageDesc ) != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aPageCollLB.SelectEntry( sPageDesc );
+ aPageCollCB.Check();
+
+ aPgBrkCB.Enable();
+ aPgBrkRB.Enable();
+ aColBrkRB.Enable();
+ aPgBrkBeforeRB.Enable();
+ aPgBrkAfterRB.Enable();
+ aPageCollCB.Enable();
+ aPgBrkCB.Check();
+
+ aPgBrkCB.Check( sal_True );
+ aColBrkRB.Check( sal_False );
+ aPgBrkBeforeRB.Check( sal_True );
+ aPgBrkAfterRB.Check( sal_False );
+ }
+ else
+ {
+ aPageCollLB.SetNoSelection();
+ aPageCollCB.Check(sal_False);
+ }
+ }
+
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_BREAK, sal_False, &pItem ))
+ {
+ const SvxFmtBreakItem* pPageBreak = (const SvxFmtBreakItem*)pItem;
+ SvxBreak eBreak = (SvxBreak)pPageBreak->GetValue();
+
+ if ( eBreak != SVX_BREAK_NONE )
+ {
+ aPgBrkCB.Check();
+ aPageCollCB.Enable(sal_False);
+ aPageCollLB.Enable(sal_False);
+ aPageNoFT.Enable(sal_False);
+ aPageNoNF.Enable(sal_False);
+ }
+ switch ( eBreak )
+ {
+ case SVX_BREAK_PAGE_BEFORE:
+ aPgBrkRB.Check( sal_True );
+ aColBrkRB.Check( sal_False );
+ aPgBrkBeforeRB.Check( sal_True );
+ aPgBrkAfterRB.Check( sal_False );
+ break;
+ case SVX_BREAK_PAGE_AFTER:
+ aPgBrkRB.Check( sal_True );
+ aColBrkRB.Check( sal_False );
+ aPgBrkBeforeRB.Check( sal_False );
+ aPgBrkAfterRB.Check( sal_True );
+ break;
+ case SVX_BREAK_COLUMN_BEFORE:
+ aPgBrkRB.Check( sal_False );
+ aColBrkRB.Check( sal_True );
+ aPgBrkBeforeRB.Check( sal_True );
+ aPgBrkAfterRB.Check( sal_False );
+ break;
+ case SVX_BREAK_COLUMN_AFTER:
+ aPgBrkRB.Check( sal_False );
+ aColBrkRB.Check( sal_True );
+ aPgBrkBeforeRB.Check( sal_False );
+ aPgBrkAfterRB.Check( sal_True );
+ break;
+ default:; //prevent warning
+ }
+
+ }
+ if ( aPgBrkBeforeRB.IsChecked() )
+ PageBreakPosHdl_Impl( &aPgBrkBeforeRB );
+ else if ( aPgBrkAfterRB.IsChecked() )
+ PageBreakPosHdl_Impl( &aPgBrkAfterRB );
+ PageBreakHdl_Impl( &aPgBrkCB );
+ }
+ }
+ else
+ {
+ aPgBrkRB.Enable(sal_False);
+ aColBrkRB.Enable(sal_False);
+ aPgBrkBeforeRB.Enable(sal_False);
+ aPgBrkAfterRB.Enable(sal_False);
+ aKeepCB .Enable(sal_False);
+ aSplitCB.Enable(sal_False);
+ aPgBrkCB.Enable(sal_False);
+ aPageCollCB.Enable(sal_False);
+ aPageCollLB.Enable(sal_False);
+ }
+
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, sal_False, &pItem ))
+ {
+ sal_uInt16 nRep = ((const SfxUInt16Item*)pItem)->GetValue();
+ aHeadLineCB.Check( nRep > 0 );
+ aHeadLineCB.SaveValue();
+ aRepeatHeaderNF.SetValue( nRep );
+ aRepeatHeaderNF.SaveValue();
+ }
+ if ( rSet.GetItemState(FN_TABLE_BOX_TEXTDIRECTION) > SFX_ITEM_AVAILABLE )
+ {
+ sal_uLong nDirection = ((const SvxFrameDirectionItem&)rSet.Get(FN_TABLE_BOX_TEXTDIRECTION)).GetValue();
+ aTextDirectionLB.SelectEntryPos(aTextDirectionLB.GetEntryPos( (const void*)nDirection ));
+ }
+
+ if ( rSet.GetItemState(FN_TABLE_SET_VERT_ALIGN) > SFX_ITEM_AVAILABLE )
+ {
+ sal_uInt16 nVert = ((const SfxUInt16Item&)rSet.Get(FN_TABLE_SET_VERT_ALIGN)).GetValue();
+ sal_uInt16 nPos = 0;
+ switch(nVert)
+ {
+ case text::VertOrientation::NONE: nPos = 0; break;
+ case text::VertOrientation::CENTER: nPos = 1; break;
+ case text::VertOrientation::BOTTOM: nPos = 2; break;
+ }
+ aVertOrientLB.SelectEntryPos(nPos);
+ }
+
+ aPageCollCB.SaveValue();
+ aPageCollLB.SaveValue();
+ aPgBrkCB.SaveValue();
+ aPgBrkRB.SaveValue();
+ aColBrkRB.SaveValue();
+ aPgBrkBeforeRB.SaveValue();
+ aPgBrkAfterRB.SaveValue();
+ aPageNoNF.SaveValue();
+ aTextDirectionLB.SaveValue();
+ aVertOrientLB.SaveValue();
+
+ HeadLineCBClickHdl();
+}
+/*-----------------16.04.98 14:48-------------------
+
+--------------------------------------------------*/
+
+void SwTextFlowPage::SetShell(SwWrtShell* pSh)
+{
+ pShell = pSh;
+ bHtmlMode = 0 != (::GetHtmlMode(pShell->GetView().GetDocShell()) & HTMLMODE_ON);
+ if(bHtmlMode)
+ {
+ aPageNoNF.Enable(sal_False);
+ aPageNoFT.Enable(sal_False);
+ }
+}
+
+/*-----------------12.12.96 16.18-------------------
+--------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, PageBreakHdl_Impl, CheckBox*, EMPTYARG )
+{
+ if( aPgBrkCB.IsChecked() )
+ {
+ aPgBrkRB. Enable();
+ aColBrkRB. Enable();
+ aPgBrkBeforeRB. Enable();
+ aPgBrkAfterRB. Enable();
+
+ if ( aPgBrkRB.IsChecked() && aPgBrkBeforeRB.IsChecked() )
+ {
+ aPageCollCB.Enable();
+
+ sal_Bool bEnable = aPageCollCB.IsChecked() &&
+ aPageCollLB.GetEntryCount();
+ aPageCollLB.Enable(bEnable);
+ if(!bHtmlMode)
+ {
+ aPageNoFT.Enable(bEnable);
+ aPageNoNF.Enable(bEnable);
+ }
+ }
+ }
+ else
+ {
+ aPageCollCB.Check( sal_False );
+ aPageCollCB.Enable(sal_False);
+ aPageCollLB.Enable(sal_False);
+ aPageNoFT.Enable(sal_False);
+ aPageNoNF.Enable(sal_False);
+ aPgBrkRB. Enable(sal_False);
+ aColBrkRB. Enable(sal_False);
+ aPgBrkBeforeRB. Enable(sal_False);
+ aPgBrkAfterRB. Enable(sal_False);
+ }
+ return 0;
+}
+
+/*-----------------12.12.96 16.18-------------------
+--------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, ApplyCollClickHdl_Impl, CheckBox*, EMPTYARG )
+{
+ sal_Bool bEnable = sal_False;
+ if ( aPageCollCB.IsChecked() &&
+ aPageCollLB.GetEntryCount() )
+ {
+ bEnable = sal_True;
+ aPageCollLB.SelectEntryPos( 0 );
+ }
+ else
+ {
+ aPageCollLB.SetNoSelection();
+ }
+ aPageCollLB.Enable(bEnable);
+ if(!bHtmlMode)
+ {
+ aPageNoFT.Enable(bEnable);
+ aPageNoNF.Enable(bEnable);
+ }
+ return 0;
+}
+
+/*-----------------12.12.96 16.18-------------------
+--------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, PageBreakPosHdl_Impl, RadioButton*, pBtn )
+{
+ if ( aPgBrkCB.IsChecked() )
+ {
+ if ( pBtn == &aPgBrkBeforeRB && aPgBrkRB.IsChecked() )
+ {
+ aPageCollCB.Enable();
+
+ sal_Bool bEnable = aPageCollCB.IsChecked() &&
+ aPageCollLB.GetEntryCount();
+
+ aPageCollLB.Enable(bEnable);
+ if(!bHtmlMode)
+ {
+ aPageNoFT.Enable(bEnable);
+ aPageNoNF.Enable(bEnable);
+ }
+ }
+ else if ( pBtn == &aPgBrkAfterRB )
+ {
+ aPageCollCB .Check( sal_False );
+ aPageCollCB .Enable(sal_False);
+ aPageCollLB .Enable(sal_False);
+ aPageNoFT .Enable(sal_False);
+ aPageNoNF .Enable(sal_False);
+ }
+ }
+ return 0;
+}
+
+/*-----------------12.12.96 16.18-------------------
+--------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, PageBreakTypeHdl_Impl, RadioButton*, pBtn )
+{
+ if ( pBtn == &aColBrkRB || aPgBrkAfterRB.IsChecked() )
+ {
+ aPageCollCB .Check(sal_False);
+ aPageCollCB .Enable(sal_False);
+ aPageCollLB .Enable(sal_False);
+ aPageNoFT .Enable(sal_False);
+ aPageNoNF .Enable(sal_False);
+ }
+ else if ( aPgBrkBeforeRB.IsChecked() )
+ PageBreakPosHdl_Impl( &aPgBrkBeforeRB );
+ return 0;
+}
+/*-----------------17.11.2003 11:30-----------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, SplitHdl_Impl, CheckBox*, pBox )
+{
+ aSplitRowCB.Enable(pBox->IsChecked());
+ return 0;
+}
+/*-----------------17.11.2003 11:30-----------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, SplitRowHdl_Impl, TriStateBox*, pBox )
+{
+ pBox->EnableTriState(sal_False);
+ return 0;
+}
+
+IMPL_LINK( SwTextFlowPage, HeadLineCBClickHdl, void*, EMPTYARG )
+{
+ aRepeatHeaderCombo.Enable(aHeadLineCB.IsChecked());
+
+ return 0;
+}
+
+/*-----------------30.05.97 07:37-------------------
+
+--------------------------------------------------*/
+void SwTextFlowPage::DisablePageBreak()
+{
+ bPageBreak = sal_False;
+ aPgBrkCB .Disable();
+ aPgBrkRB .Disable();
+ aColBrkRB .Disable();
+ aPgBrkBeforeRB .Disable();
+ aPgBrkAfterRB .Disable();
+ aPageCollCB .Disable();
+ aPageCollLB .Disable();
+ aPageNoFT .Disable();
+ aPageNoNF .Disable();
+}
+
+
+
diff --git a/sw/source/ui/table/tabledlg.hrc b/sw/source/ui/table/tabledlg.hrc
new file mode 100644
index 000000000000..843bec591d9e
--- /dev/null
+++ b/sw/source/ui/table/tabledlg.hrc
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "globals.hrc"
+
+#define ED_WIDTH 1
+#define FL_WIDTH 3
+#define CB_REL_WIDTH 4
+#define RB_LEFT 10
+#define RB_RIGHT 11
+#define RB_CENTER 12
+#define RB_FREE 13
+#define RB_FULL 14
+#define FL_POS 15
+#define ED_LEFT_DIST 51
+#define ED_RIGHT_DIST 52
+#define FT_RIGHT_DIST 53
+#define FT_LEFT_DIST 54
+#define FT_TOP_DIST 20
+#define ED_TOP_DIST 21
+#define FT_BOTTOM_DIST 22
+#define ED_BOTTOM_DIST 23
+#define FL_DIST 24
+#define FT_WIDTH 25
+#define FT_SCOL 30
+#define DLB_SCOL 31
+#define FT_POS 32
+#define DLB_SPOS 33
+#define FT_SSZ 34
+#define ED_SSZ 36
+#define FL_SHADE 37
+#define CB_HEADLINE 40
+#define FT_REPEAT_HEADER 40
+#define NF_REPEAT_HEADER 40
+#define WIN_REPEAT_HEADER 40
+#define FL_HEADLINE 41
+#define FL_PROPERTIES 42
+#define FT_TEXTDIRECTION 43
+#define LB_TEXTDIRECTION 44
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_MORE 102
+#define ED_NAME 103
+#define FT_NAME 104
+#define FL_OPTIONS 105
+#define FL_NAME 106
+#define COL_FT_1 107
+#define COL_MF_1 108
+#define COL_FT_2 109
+#define COL_MF_2 110
+#define COL_FT_3 111
+#define COL_MF_3 112
+#define COL_FT_4 113
+#define COL_MF_4 114
+#define COL_FT_5 115
+#define COL_MF_5 116
+#define COL_FT_6 117
+#define COL_MF_6 118
+#define COL_FL_LAYOUT 119
+#define COL_BTN_UP 120
+#define COL_BTN_DOWN 121
+#define CB_MOD_TBL 122
+#define CB_PROP 123
+
+#define FT_SPACE 125
+#define ED_SPACE 126
+
+#define FL_FLOW 130
+#define CB_PAGEBREAK 131
+#define RB_BREAKPAGE 132
+#define RB_BREAKCOLUMN 133
+#define RB_PAGEBREAKBEFORE 134
+#define RB_PAGEBREAKAFTER 135
+#define CB_PAGECOLL 136
+#define LB_PAGECOLL 137
+#define FT_PAGENUM 138
+#define NF_PAGENUM 139
+#define CB_KEEP 144
+#define CB_SPLIT 145
+#define CB_SPLIT_ROW 146
+
+#define FL_VERT_ORIENT 140
+#define RB_FROM_LEFT 144
+
+#define FT_VERTORIENT 150
+#define LB_VERTORIENT 151
diff --git a/sw/source/ui/table/tabledlg.src b/sw/source/ui/table/tabledlg.src
new file mode 100644
index 000000000000..79300699bd33
--- /dev/null
+++ b/sw/source/ui/table/tabledlg.src
@@ -0,0 +1,789 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "tabledlg.hrc"
+#include "helpid.h"
+#define TEXT_TEXTFLOW \
+ Text [ en-US ] = "Text Flow" ; \
+
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabDialog DLG_FORMAT_TABLE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Table Format" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ SVLook = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FORMAT_TABLE ;
+ Text [ en-US ] = "Table" ;
+ PageResID = TP_FORMAT_TABLE ;
+ };
+ PageItem
+ {
+ Identifier = TP_TABLE_TEXTFLOW ;
+ TEXT_TEXTFLOW
+ };
+ PageItem
+ {
+ Identifier = TP_TABLE_COLUMN ;
+ Text [ en-US ] = "Columns" ;
+ PageResID = TP_TABLE_COLUMN ;
+ };
+ PageItem
+ {
+ Identifier = TP_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ PageResID = TP_BORDER ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = TP_BACKGROUND ;
+ };
+ };
+ };
+};
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabPage TP_FORMAT_TABLE
+{
+ HelpID = HID_FORMAT_TABLE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:TP_FORMAT_TABLE:ED_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 14 ) ;
+ Size = MAP_APPFONT ( 112 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "W~idth" ;
+ };
+ MetricField ED_WIDTH
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_WIDTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 30 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Value = 0 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ CheckBox CB_REL_WIDTH
+ {
+ HelpID = "sw:CheckBox:TP_FORMAT_TABLE:CB_REL_WIDTH";
+ Pos = MAP_APPFONT ( 118 , 32 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Relati~ve" ;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 184 , 8 ) ;
+ Text [ en-US ] = "Properties" ;
+ };
+ RadioButton RB_FULL
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_FULL";
+ Pos = MAP_APPFONT ( 202 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "A~utomatic" ;
+ };
+ RadioButton RB_LEFT
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_LEFT";
+ Pos = MAP_APPFONT ( 202 , 28 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~Left" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_FROM_LEFT
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_FROM_LEFT";
+ Pos = MAP_APPFONT ( 202 , 42 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~From left";
+ };
+ RadioButton RB_RIGHT
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_RIGHT";
+ Pos = MAP_APPFONT ( 202 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "R~ight" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_CENTER
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_CENTER";
+ Pos = MAP_APPFONT ( 202 , 70 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~Center" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_FREE
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_FREE";
+ Pos = MAP_APPFONT ( 202 , 84 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Manual" ;
+ };
+ FixedLine FL_POS
+ {
+ Pos = MAP_APPFONT ( 196 , 3 ) ;
+ Size = MAP_APPFONT ( 58 , 8 ) ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ FixedLine FL_DIST
+ {
+ Pos = MAP_APPFONT ( 6 , 48 ) ;
+ Size = MAP_APPFONT ( 184 , 8 ) ;
+ Text [ en-US ] = "Spacing" ;
+ };
+ FixedText FT_LEFT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "Lef~t" ;
+ };
+ MetricField ED_LEFT_DIST
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_LEFT_DIST";
+ Pos = MAP_APPFONT ( 147 , 59 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_RIGHT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 77 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "Ri~ght" ;
+ };
+
+ MetricField ED_RIGHT_DIST
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_RIGHT_DIST";
+ Pos = MAP_APPFONT ( 147 , 75 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TOP_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 93 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "~Above" ;
+ };
+ MetricField ED_TOP_DIST
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_TOP_DIST";
+ Pos = MAP_APPFONT ( 147 , 91 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_BOTTOM_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 109 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "~Below" ;
+ };
+ MetricField ED_BOTTOM_DIST
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_BOTTOM_DIST";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 147 , 107 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 1000 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ FixedLine FL_PROPERTIES
+ {
+ Pos = MAP_APPFONT ( 6 , 125 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText FT_TEXTDIRECTION
+ {
+ Pos = MAP_APPFONT ( 12 , 138 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Text ~direction";
+ };
+ ListBox LB_TEXTDIRECTION
+ {
+ HelpID = "sw:ListBox:TP_FORMAT_TABLE:LB_TEXTDIRECTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 136 ) ;
+ Size = MAP_APPFONT ( 176 , 50 ) ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Left-to-right" ; 0; > ;
+ < "Right-to-left" ; 1; > ;
+ < "Use superordinate object settings" ; 4; > ;
+ };
+ };
+};
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabPage TP_TABLE_COLUMN
+{
+ HelpID = HID_TABLE_COLUMN ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ CheckBox CB_MOD_TBL
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_COLUMN:CB_MOD_TBL";
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 180 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Adapt table ~width" ;
+ };
+ CheckBox CB_PROP
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_COLUMN:CB_PROP";
+ Pos = MAP_APPFONT ( 6 , 20 ) ;
+ Size = MAP_APPFONT ( 180 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ad~just columns proportionally" ;
+ };
+ FixedText FT_SPACE
+ {
+ Pos = MAP_APPFONT ( 6 , 36 ) ;
+ Size = MAP_APPFONT ( 85 , 8 ) ;
+ Text [ en-US ] = "Remaining space" ;
+ };
+ MetricField ED_SPACE
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:ED_SPACE";
+ ReadOnly = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 95 , 34 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ ImageButton COL_BTN_DOWN
+ {
+ HelpID = "sw:ImageButton:TP_TABLE_COLUMN:COL_BTN_DOWN";
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 65 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_ARROW_LEFT ;
+ };
+ ImageButton COL_BTN_UP
+ {
+ HelpID = "sw:ImageButton:TP_TABLE_COLUMN:COL_BTN_UP";
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 234 , 65 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_ARROW_RIGHT ;
+ };
+ FixedText COL_FT_1
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 30 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~1" ;
+ Left = TRUE ;
+ Center = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_1
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_1";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 13 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_2
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 68 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~2" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_2
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_2";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 52 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_3
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 107 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~3" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_3
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_3";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 91 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_4
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 146 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~4" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_4
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_4";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_5
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 185 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~5" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_5
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_5";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 169 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_6
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 204 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~6" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_6
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_6";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 208 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedLine COL_FL_LAYOUT
+ {
+ Pos = MAP_APPFONT ( 6 , 50 ) ;
+ Size = MAP_APPFONT ( 240 , 8 ) ;
+ Text [ en-US ] = "Column width" ;
+ };
+};
+/**************************************************************************/
+/* */
+/* Textfluss */
+/* */
+/**************************************************************************/
+TabPage TP_TABLE_TEXTFLOW
+{
+ HelpId = HID_TABLE_TEXTFLOW ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ TEXT_TEXTFLOW
+ Hide = TRUE;
+ FixedLine FL_FLOW
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ TEXT_TEXTFLOW
+ };
+ CheckBox CB_PAGEBREAK
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_PAGEBREAK";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "~Break" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ RadioButton RB_BREAKPAGE
+ {
+ HelpID = "sw:RadioButton:TP_TABLE_TEXTFLOW:RB_BREAKPAGE";
+ Pos = MAP_APPFONT ( 105 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Page" ;
+ Group = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_BREAKCOLUMN
+ {
+ HelpID = "sw:RadioButton:TP_TABLE_TEXTFLOW:RB_BREAKCOLUMN";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 178 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ // ### ACHTUNG: Neuer Text in Resource? S~palte : ~Spalte
+ Text [ en-US ] = "Col~umn" ;
+ };
+ RadioButton RB_PAGEBREAKBEFORE
+ {
+ HelpID = "sw:RadioButton:TP_TABLE_TEXTFLOW:RB_PAGEBREAKBEFORE";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 105 , 28 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Be~fore" ;
+ Group = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_PAGEBREAKAFTER
+ {
+ HelpID = "sw:RadioButton:TP_TABLE_TEXTFLOW:RB_PAGEBREAKAFTER";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 178 , 28 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~After" ;
+ };
+ CheckBox CB_PAGECOLL
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_PAGECOLL";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "With Page St~yle" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ ListBox LB_PAGECOLL
+ {
+ HelpID = "sw:ListBox:TP_TABLE_TEXTFLOW:LB_PAGECOLL";
+ Pos = MAP_APPFONT ( 105 , 42 ) ;
+ Size = MAP_APPFONT ( 61 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_PAGENUM
+ {
+ Pos = MAP_APPFONT ( 171 , 44 ) ;
+ Size = MAP_APPFONT ( 47 , 10 ) ;
+ Text [ en-US ] = "Page ~number" ;
+ };
+ NumericField NF_PAGENUM
+ {
+ HelpID = "sw:NumericField:TP_TABLE_TEXTFLOW:NF_PAGENUM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 222 , 42 ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ Value = 0 ;
+ First = 0 ;
+ Last = 9999 ;
+ };
+ CheckBox CB_SPLIT
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_SPLIT";
+ Pos = MAP_APPFONT ( 12 , 58 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Allow ~table to split across pages and columns" ;
+ };
+ TriStateBox CB_SPLIT_ROW
+ {
+ HelpID = "sw:TriStateBox:TP_TABLE_TEXTFLOW:CB_SPLIT_ROW";
+ Pos = MAP_APPFONT ( 21 , 71 ) ;
+ Size = MAP_APPFONT ( 227 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Allow row to break a~cross pages and columns" ;
+ };
+ CheckBox CB_KEEP
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_KEEP";
+ Pos = MAP_APPFONT ( 12 , 85 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~Keep with next paragraph" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CB_HEADLINE
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_HEADLINE";
+ Pos = MAP_APPFONT ( 12 , 99 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "R~epeat heading" ;
+ };
+ FixedText FT_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 31 , 114 ) ;
+ Size = MAP_APPFONT ( 95 , 10 ) ;
+ Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ;
+ };
+ NumericField NF_REPEAT_HEADER
+ {
+ HelpID = "sw:NumericField:TP_TABLE_TEXTFLOW:NF_REPEAT_HEADER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 131 , 113 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 1000 ;
+ First = 1 ;
+ };
+ Window WIN_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 21 , 113 ) ;
+ Size = MAP_APPFONT ( 2 , 1 ) ;
+ };
+ FixedText FT_TEXTDIRECTION
+ {
+ Pos = MAP_APPFONT ( 12 , 132 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Text ~direction" ;
+ };
+ ListBox LB_TEXTDIRECTION
+ {
+ HelpID = "sw:ListBox:TP_TABLE_TEXTFLOW:LB_TEXTDIRECTION";
+ Pos = MAP_APPFONT ( 85 , 130 ) ;
+ Size = MAP_APPFONT ( 163 , 50 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Left-to-right" ; 0; > ;
+ < "Right-to-left (vertical)" ; 2; > ;
+ < "Use superordinate object settings" ; 4; > ;
+ };
+ };
+ FixedLine FL_VERT_ORIENT
+ {
+ Pos = MAP_APPFONT ( 6 , 149 ) ;
+ Size = MAP_APPFONT ( 251 , 8 ) ;
+ Text [ en-US ] = "Alignment" ;
+ };
+
+ FixedText FT_VERTORIENT
+ {
+ Pos = MAP_APPFONT ( 12 , 164 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Vertical alignment" ;
+ };
+ ListBox LB_VERTORIENT
+ {
+ HelpID = "sw:ListBox:TP_TABLE_TEXTFLOW:LB_VERTORIENT";
+ Pos = MAP_APPFONT ( 85 , 162 ) ;
+ Size = MAP_APPFONT ( 61 , 50 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Top" ; 0; > ;
+ < "Centered" ; 1; > ;
+ < "Bottom" ; 2; > ;
+ };
+ };
+};
+InfoBox MSG_WRONG_TABLENAME
+{
+ Message [ en-US ] = "The name of the table must not contain spaces." ;
+};
+
diff --git a/sw/source/ui/table/tablemgr.cxx b/sw/source/ui/table/tablemgr.cxx
new file mode 100644
index 000000000000..7d4272880643
--- /dev/null
+++ b/sw/source/ui/table/tablemgr.cxx
@@ -0,0 +1,382 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+
+#include <sot/storage.hxx>
+#include <sot/clsids.hxx>
+
+#include "edtwin.hxx"
+#include "errhdl.hxx"
+#include "wrtsh.hxx"
+#include "cmdid.h"
+#include "frmatr.hxx"
+#include "view.hxx"
+#include "basesh.hxx"
+#include "swundo.hxx"
+#include "tablemgr.hxx"
+#include "frmfmt.hxx"
+#include "instable.hxx"
+#include "swerror.h"
+#include "table.hrc"
+#include "swabstdlg.hxx"
+#include "swcli.hxx"
+#include "docsh.hxx"
+#include "unotbl.hxx"
+#include "unochart.hxx"
+
+using namespace ::com::sun::star;
+
+/*------------------------------------------------------------------------
+ Beschreibung: Zeilenhoehe einstellen (Dialog)
+------------------------------------------------------------------------*/
+
+
+void SwTableFUNC::ColWidthDlg( Window *pParent )
+{
+ InitTabCols();
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateSwTableWidthDlg( pParent, *this ,DLG_COL_WIDTH );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Breite ermitteln
+ --------------------------------------------------------------------*/
+
+
+SwTwips SwTableFUNC::GetColWidth(sal_uInt16 nNum) const
+{
+ SwTwips nWidth = 0;
+
+ if( aCols.Count() > 0 )
+ {
+ if(aCols.Count() == GetColCount())
+ {
+ nWidth = (SwTwips)((nNum == aCols.Count()) ?
+ aCols.GetRight() - aCols[nNum-1] :
+ nNum == 0 ? aCols[nNum] - aCols.GetLeft() :
+ aCols[nNum] - aCols[nNum-1]);
+ }
+ else
+ {
+ SwTwips nRValid = nNum < GetColCount() ?
+ aCols[(sal_uInt16)GetRightSeparator((int)nNum)]:
+ aCols.GetRight();
+ SwTwips nLValid = nNum ?
+ aCols[(sal_uInt16)GetRightSeparator((int)nNum - 1)]:
+ aCols.GetLeft();
+ nWidth = nRValid - nLValid;
+ }
+ }
+ else
+ nWidth = aCols.GetRight();
+
+ return nWidth;
+}
+
+
+
+SwTwips SwTableFUNC::GetMaxColWidth( sal_uInt16 nNum ) const
+{
+ ASSERT(nNum <= aCols.Count(), "Index out of Area");
+
+ if ( GetColCount() > 0 )
+ {
+ // Die max. Breite ergibt sich aus der eigenen Breite und
+ // der Breite der Nachbarzellen um je MINLAY verringert
+ SwTwips nMax = nNum == 0 ?
+ GetColWidth(1) - MINLAY :
+ nNum == GetColCount() ?
+ GetColWidth( nNum-1 ) - MINLAY :
+ GetColWidth(nNum - 1) + GetColWidth( nNum + 1 ) - 2 * MINLAY;
+
+ return nMax + GetColWidth(nNum) ;
+ }
+ else
+ return GetColWidth(nNum);
+}
+
+
+
+void SwTableFUNC::SetColWidth(sal_uInt16 nNum, SwTwips nNewWidth )
+{
+ // aktuelle Breite setzen
+ // alle folgenden Verschieben
+ sal_Bool bCurrentOnly = sal_False;
+ SwTwips nWidth = 0;
+
+ if ( aCols.Count() > 0 )
+ {
+ if(aCols.Count() != GetColCount())
+ bCurrentOnly = sal_True;
+ nWidth = GetColWidth(nNum);
+
+ int nDiff = (int)(nNewWidth - nWidth);
+ if( !nNum )
+ aCols[ static_cast< sal_uInt16 >(GetRightSeparator(0)) ] += nDiff;
+ else if( nNum < GetColCount() )
+ {
+ if(nDiff < GetColWidth(nNum + 1) - MINLAY)
+ aCols[ static_cast< sal_uInt16 >(GetRightSeparator(nNum)) ] += nDiff;
+ else
+ {
+ int nDiffLeft = nDiff - (int)GetColWidth(nNum + 1) + (int)MINLAY;
+ aCols[ static_cast< sal_uInt16 >(GetRightSeparator(nNum)) ] += (nDiff - nDiffLeft);
+ aCols[ static_cast< sal_uInt16 >(GetRightSeparator(nNum - 1)) ] -= nDiffLeft;
+ }
+ }
+ else
+ aCols[ static_cast< sal_uInt16 >(GetRightSeparator(nNum-1)) ] -= nDiff;
+ }
+ else
+ aCols.SetRight( Min( nNewWidth, aCols.GetRightMax()) );
+
+ pSh->StartAllAction();
+ pSh->SetTabCols( aCols, bCurrentOnly );
+ pSh->EndAllAction();
+}
+
+
+
+void SwTableFUNC::InitTabCols()
+{
+ ASSERT(pSh, keine Shell);
+
+ if( pFmt && pSh)
+ pSh->GetTabCols( aCols );
+}
+
+
+
+SwTableFUNC::SwTableFUNC(SwWrtShell *pShell, sal_Bool bCopyFmt)
+ : pFmt(pShell->GetTableFmt()),
+ pSh(pShell),
+ bCopy(bCopyFmt)
+{
+ // gfs. das Format fuer die Bearbeitung kopieren
+ if( pFmt && bCopy )
+ pFmt = new SwFrmFmt( *pFmt );
+}
+
+
+
+SwTableFUNC::~SwTableFUNC()
+{
+ if(bCopy)
+ delete pFmt;
+}
+
+void SwTableFUNC::UpdateChart()
+{
+ //Update der Felder in der Tabelle vom User ausgeloesst, alle
+ //Charts zu der Tabelle werden auf den neuesten Stand gebracht.
+ SwFrmFmt *pFmt2 = pSh->GetTableFmt();
+ if ( pFmt2 && pSh->HasOLEObj( pFmt2->GetName() ) )
+ {
+ pSh->StartAllAction();
+ pSh->UpdateCharts( pFmt2->GetName() );
+ pSh->EndAllAction();
+ }
+}
+
+uno::Reference< frame::XModel > SwTableFUNC::InsertChart(
+ uno::Reference< chart2::data::XDataProvider > &rxDataProvider,
+ sal_Bool bFillWithData,
+ const rtl::OUString &rCellRange,
+ SwFlyFrmFmt** ppFlyFrmFmt )
+{
+ uno::Reference< frame::XModel > xChartModel;
+ pSh->StartUndo( UNDO_UI_INSERT_CHART );
+ pSh->StartAllAction();
+
+ String aName;
+ if (pSh->IsCrsrInTbl())
+ {
+ aName = pSh->GetTableFmt()->GetName();
+ // insert node before table
+ pSh->MoveTable( fnTableCurr, fnTableStart );
+ pSh->Up( sal_False, 1, sal_False );
+ if ( pSh->IsCrsrInTbl() )
+ {
+ if ( aName != pSh->GetTableFmt()->GetName() )
+ pSh->Down( sal_False, 1, sal_False ); // two adjacent tables
+ }
+ pSh->SplitNode();
+ }
+
+ // insert chart
+ ::rtl::OUString aObjName;
+ comphelper::EmbeddedObjectContainer aCnt;
+ uno::Reference < embed::XEmbeddedObject > xObj =
+ aCnt.CreateEmbeddedObject( SvGlobalName( SO3_SCH_CLASSID ).GetByteSequence(), aObjName );
+
+ ::svt::EmbeddedObjectRef aEmbObjRef( xObj, ::com::sun::star::embed::Aspects::MSOLE_CONTENT );
+ if ( xObj.is() )
+ {
+
+ SwFlyFrmFmt* pTmp = 0;
+ pSh->InsertOleObject( aEmbObjRef, &pTmp );
+ if (ppFlyFrmFmt)
+ *ppFlyFrmFmt = pTmp;
+
+ uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
+ if( xCompSupp.is())
+ {
+ xChartModel.set( xCompSupp->getComponent(), uno::UNO_QUERY );
+ if( xChartModel.is() )
+ xChartModel->lockControllers(); //#i79578# don't request a new replacement image for charts to often - block change notifications
+ }
+
+ // set the table name at the OLE-node
+ if (aName.Len())
+ pSh->SetChartName( aName );
+ }
+ pSh->EndAllAction();
+
+ if ( xObj.is() )
+ {
+ // Let the chart be activated after the inserting
+ SfxInPlaceClient* pClient = pSh->GetView().FindIPClient( xObj, &pSh->GetView().GetEditWin() );
+ if ( !pClient )
+ {
+ pClient = new SwOleClient( &pSh->GetView(), &pSh->GetView().GetEditWin(), aEmbObjRef );
+ pSh->SetCheckForOLEInCaption( sal_True );
+ }
+ pSh->CalcAndSetScale( aEmbObjRef );
+ //#50270# Error brauchen wir nicht handeln, das erledigt das
+ //DoVerb in der SfxViewShell
+ ErrCode nErr = pClient->DoVerb( SVVERB_SHOW );
+ (void) nErr;
+ }
+
+ uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartModel, uno::UNO_QUERY );
+ if (bFillWithData && xDataReceiver.is() && rxDataProvider.is())
+ {
+ xDataReceiver->attachDataProvider( rxDataProvider );
+
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pSh->GetView().GetDocShell()->GetModel(), uno::UNO_QUERY );
+ xDataReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
+
+ // default values for ranges that do not consist of a single row or column
+ bool bHasCategories = true;
+ bool bFirstCellAsLabel = true;
+ chart::ChartDataRowSource eDataRowSource = chart::ChartDataRowSource_COLUMNS;
+
+ SwRangeDescriptor aDesc;
+ FillRangeDescriptor( aDesc, rCellRange );
+ bool bSingleRowCol = aDesc.nTop == aDesc.nBottom || aDesc.nLeft == aDesc.nRight;
+ if (bSingleRowCol)
+ {
+ aDesc.Normalize();
+ sal_Int32 nRowLen = aDesc.nRight - aDesc.nLeft + 1;
+ sal_Int32 nColLen = aDesc.nBottom - aDesc.nTop + 1;
+
+ bHasCategories = false;
+ if (nRowLen == 1 && nColLen == 1)
+ bFirstCellAsLabel = false;
+ else if (nRowLen > 1)
+ eDataRowSource = chart::ChartDataRowSource_ROWS;
+ else if (nColLen > 1)
+ eDataRowSource = chart::ChartDataRowSource_COLUMNS;
+ else {
+ DBG_ERROR( "unexpected state" );
+ }
+ }
+
+ uno::Sequence< beans::PropertyValue > aArgs( 4 );
+ aArgs[0] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1,
+ uno::makeAny( rCellRange ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[1] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("HasCategories"), -1,
+ uno::makeAny( bHasCategories ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[2] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1,
+ uno::makeAny( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[3] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("DataRowSource"), -1,
+ uno::makeAny( eDataRowSource ), beans::PropertyState_DIRECT_VALUE );
+ xDataReceiver->setArguments( aArgs );
+ }
+
+ pSh->EndUndo( UNDO_UI_INSERT_CHART );
+
+ if( xChartModel.is() )
+ xChartModel->unlockControllers(); //#i79578# don't request a new replacement image for charts to often
+ return xChartModel;
+}
+
+sal_uInt16 SwTableFUNC::GetCurColNum() const
+{
+ sal_uInt16 nPos = pSh->GetCurTabColNum();
+ sal_uInt16 nCount = 0;
+ for(sal_uInt16 i = 0; i < nPos; i++ )
+ if(aCols.IsHidden(i))
+ nCount ++;
+ return nPos - nCount;
+}
+
+
+
+
+sal_uInt16 SwTableFUNC::GetColCount() const
+{
+ sal_uInt16 nCount = 0;
+ for(sal_uInt16 i = 0; i < aCols.Count(); i++ )
+ if(aCols.IsHidden(i))
+ nCount ++;
+ return aCols.Count() - nCount;
+}
+
+
+
+int SwTableFUNC::GetRightSeparator(int nNum) const
+{
+ DBG_ASSERT( nNum < (int)GetColCount() ,"Index out of range");
+ int i = 0;
+ while( nNum >= 0 )
+ {
+ if( !aCols.IsHidden( static_cast< sal_uInt16 >(i)) )
+ nNum--;
+ i++;
+ }
+ return i - 1;
+}
+
+
+
diff --git a/sw/source/ui/table/tablepg.hxx b/sw/source/ui/table/tablepg.hxx
new file mode 100644
index 000000000000..aa9dd2490ec1
--- /dev/null
+++ b/sw/source/ui/table/tablepg.hxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWTABLEPG_HXX
+#define _SWTABLEPG_HXX
+#include <sfx2/tabdlg.hxx>
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <actctrl.hxx>
+#include "prcntfld.hxx"
+#include "swtypes.hxx"
+#include "textcontrolcombo.hxx"
+
+class SwWrtShell;
+class SwTableRep;
+
+struct TColumn
+{
+ SwTwips nWidth;
+ sal_Bool bVisible;
+};
+
+class SwFormatTablePage : public SfxTabPage
+{
+ FixedLine aOptionsFL;
+ FixedText aNameFT;
+ TableNameEdit aNameED;
+ FixedText aWidthFT;
+ PercentField aWidthMF;
+ CheckBox aRelWidthCB;
+
+ FixedLine aPosFL;
+ RadioButton aFullBtn;
+ RadioButton aLeftBtn;
+ RadioButton aFromLeftBtn;
+ RadioButton aRightBtn;
+ RadioButton aCenterBtn;
+ RadioButton aFreeBtn;
+
+ FixedLine aDistFL;
+ FixedText aLeftFT;
+ PercentField aLeftMF;
+ FixedText aRightFT;
+ PercentField aRightMF;
+ FixedText aTopFT;
+ MetricField aTopMF;
+ FixedText aBottomFT;
+ MetricField aBottomMF;
+
+ FixedLine aPropertiesFL;
+ FixedText aTextDirectionFT;
+ ListBox aTextDirectionLB;
+
+ SwTableRep* pTblData;
+ SwTwips nSaveWidth;
+ SwTwips nMinTableWidth;
+ sal_uInt16 nOldAlign;
+ sal_Bool bModified;
+ sal_Bool bFull:1;
+ sal_Bool bHtmlMode : 1;
+
+ void Init();
+ void ModifyHdl( Edit* pEdit );
+
+ DECL_LINK( AutoClickHdl, CheckBox * );
+ DECL_LINK( RelWidthClickHdl, CheckBox * );
+ DECL_LINK( RightModifyHdl, MetricField * );
+ DECL_LINK( UpDownLoseFocusHdl, MetricField * );
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+ SwFormatTablePage( Window* pParent, const SfxItemSet& rSet );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+};
+
+/*-------------------------------------------------------
+ TabPage Format/Tabelle/Spalten
+--------------------------------------------------------- */
+#define MET_FIELDS 6 //Anzahl der verwendeten MetricFields
+
+class SwTableColumnPage : public SfxTabPage
+{
+ CheckBox aModifyTableCB;
+ CheckBox aProportionalCB;
+ FixedText aSpaceFT;
+ MetricField aSpaceED;
+
+ ImageButton aUpBtn;
+ FixedText aFT1;
+ PercentField aMF1;
+ FixedText aFT2;
+ PercentField aMF2;
+ FixedText aFT3;
+ PercentField aMF3;
+ FixedText aFT4;
+ PercentField aMF4;
+ FixedText aFT5;
+ PercentField aMF5;
+ FixedText aFT6;
+ PercentField aMF6;
+ ImageButton aDownBtn;
+ FixedLine aColFL;
+
+ SwTableRep* pTblData;
+ PercentField* pFieldArr[MET_FIELDS];
+ FixedText* pTextArr[MET_FIELDS];
+ SwTwips nTableWidth;
+ SwTwips nMinWidth;
+ sal_uInt16 nNoOfCols;
+ sal_uInt16 nNoOfVisibleCols;
+ //Breite merken, wenn auf autom. Ausrichtung gestellt wird
+ sal_uInt16 aValueTbl[MET_FIELDS];//primaere Zuordnung der MetricFields
+ sal_Bool bModified:1;
+ sal_Bool bModifyTbl:1;
+ sal_Bool bPercentMode:1;
+
+ void Init(sal_Bool bWeb);
+ DECL_LINK( AutoClickHdl, CheckBox * );
+ void ModifyHdl( PercentField* pEdit );
+ DECL_LINK( UpHdl, PercentField * );
+ DECL_LINK( DownHdl, PercentField * );
+ DECL_LINK( LoseFocusHdl, PercentField * );
+ DECL_LINK( ModeHdl, CheckBox * );
+ void UpdateCols( sal_uInt16 nAktPos );
+ SwTwips GetVisibleWidth(sal_uInt16 nPos);
+ void SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth);
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+ SwTableColumnPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwTableColumnPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+};
+
+/*-----------------12.12.96 11.48-------------------
+ Textfluss
+--------------------------------------------------*/
+class SwTextFlowPage : public SfxTabPage
+{
+ FixedLine aFlowFL;
+ CheckBox aPgBrkCB;
+ RadioButton aPgBrkRB;
+ RadioButton aColBrkRB;
+ RadioButton aPgBrkBeforeRB;
+ RadioButton aPgBrkAfterRB;
+ CheckBox aPageCollCB;
+ ListBox aPageCollLB;
+ FixedText aPageNoFT;
+ NumericField aPageNoNF;
+ CheckBox aSplitCB;
+ TriStateBox aSplitRowCB;
+ CheckBox aKeepCB;
+ CheckBox aHeadLineCB;
+ FixedText aRepeatHeaderFT; // "dummy" to build before and after FT
+ FixedText aRepeatHeaderBeforeFT;
+ NumericField aRepeatHeaderNF;
+ FixedText aRepeatHeaderAfterFT;
+ TextControlCombo aRepeatHeaderCombo;
+ FixedText aTextDirectionFT;
+ ListBox aTextDirectionLB;
+
+ FixedLine aVertOrientFL;
+ FixedText aVertOrientFT;
+ ListBox aVertOrientLB;
+
+ SwWrtShell* pShell;
+
+ sal_Bool bPageBreak;
+ sal_Bool bHtmlMode;
+
+
+ DECL_LINK( PageBreakHdl_Impl, CheckBox* );
+ DECL_LINK( ApplyCollClickHdl_Impl, CheckBox* );
+ DECL_LINK( PageBreakPosHdl_Impl, RadioButton* );
+ DECL_LINK( PageBreakTypeHdl_Impl, RadioButton* );
+ DECL_LINK( SplitHdl_Impl, CheckBox* );
+ DECL_LINK( SplitRowHdl_Impl, TriStateBox* );
+ DECL_LINK( HeadLineCBClickHdl, void* p = 0 );
+
+
+ SwTextFlowPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwTextFlowPage();
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetShell(SwWrtShell* pSh);
+
+ void DisablePageBreak();
+};
+
+#endif
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
new file mode 100644
index 000000000000..41aaca4a4f65
--- /dev/null
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -0,0 +1,1057 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <svl/zforlist.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <comphelper/processfactory.hxx>
+#include <svtools/scriptedtext.hxx>
+#include <svtools/accessibilityoptions.hxx>
+#include <svx/framelinkarray.hxx>
+#include "swmodule.hxx"
+#include "swtypes.hxx"
+#ifndef _VIEW_HXX
+#include "view.hxx"
+#endif
+#include "wrtsh.hxx"
+#include "tblafmt.hxx"
+#ifndef _TAUTOFMT_HXX
+#include "tautofmt.hxx"
+#endif
+#include "shellres.hxx"
+#ifndef _TAUTOFMT_HRC
+#include "tautofmt.hrc"
+#endif
+
+using namespace com::sun::star;
+
+#define FRAME_OFFSET 4
+
+//========================================================================
+
+class AutoFmtPreview : public Window
+{
+public:
+ AutoFmtPreview( Window* pParent, const ResId& rRes, SwWrtShell* pWrtShell );
+ ~AutoFmtPreview();
+
+ void NotifyChange( const SwTableAutoFmt& rNewData );
+
+protected:
+ virtual void Paint( const Rectangle& rRect );
+
+private:
+ SwTableAutoFmt aCurData;
+ VirtualDevice aVD;
+ SvtScriptedTextHelper aScriptedText;
+ svx::frame::Array maArray; /// Implementation to draw the frame borders.
+ sal_Bool bFitWidth;
+ bool mbRTL;
+ Size aPrvSize;
+ long nLabelColWidth;
+ long nDataColWidth1;
+ long nDataColWidth2;
+ long nRowHeight;
+ const String aStrJan;
+ const String aStrFeb;
+ const String aStrMar;
+ const String aStrNorth;
+ const String aStrMid;
+ const String aStrSouth;
+ const String aStrSum;
+ SvNumberFormatter* pNumFmt;
+
+ uno::Reference< lang::XMultiServiceFactory > m_xMSF;
+ uno::Reference< i18n::XBreakIterator > m_xBreak;
+
+ //-------------------------------------------
+ void Init ();
+ void DoPaint ( const Rectangle& rRect );
+ void CalcCellArray ( sal_Bool bFitWidth );
+ void CalcLineMap ();
+ void PaintCells ();
+
+ sal_uInt8 GetFormatIndex( size_t nCol, size_t nRow ) const;
+ const SvxBoxItem& GetBoxItem( size_t nCol, size_t nRow ) const;
+
+ void DrawString( size_t nCol, size_t nRow );
+ void DrawStrings();
+ void DrawBackground();
+
+ void MakeFonts ( sal_uInt8 nIndex, Font& rFont, Font& rCJKFont, Font& rCTLFont );
+ String MakeNumberString( String cellString, sal_Bool bAddDec );
+};
+
+//========================================================================
+
+class SwStringInputDlg : public ModalDialog
+{
+public:
+ SwStringInputDlg( Window* pParent,
+ const String& rTitle,
+ const String& rEditTitle,
+ const String& rDefault );
+ ~SwStringInputDlg();
+
+ void GetInputString( String& rString ) const;
+
+private:
+ Edit aEdInput; // Edit erhaelt so den Focus
+ FixedText aFtEditTitle;
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+};
+
+
+SwStringInputDlg::SwStringInputDlg( Window* pParent,
+ const String& rTitle,
+ const String& rEditTitle,
+ const String& rDefault ) :
+ ModalDialog ( pParent, SW_RES( DLG_SWDLG_STRINPUT ) ),
+ //
+ aEdInput ( this, SW_RES( ED_INPUT ) ),
+ aFtEditTitle ( this, SW_RES( FT_LABEL ) ),
+ aBtnOk ( this, SW_RES( BTN_OK ) ),
+ aBtnCancel ( this, SW_RES( BTN_CANCEL ) )
+{
+ SetText( rTitle );
+ aFtEditTitle.SetText( rEditTitle );
+ aEdInput.SetText( rDefault );
+ //-------------
+ FreeResource();
+}
+
+//------------------------------------------------------------------------
+
+void SwStringInputDlg::GetInputString( String& rString ) const
+{
+ rString = aEdInput.GetText();
+}
+
+
+__EXPORT SwStringInputDlg::~SwStringInputDlg()
+{
+}
+
+//========================================================================
+// AutoFormat-Dialog:
+
+
+SwAutoFormatDlg::SwAutoFormatDlg( Window* pParent, SwWrtShell* pWrtShell,
+ sal_Bool bSetAutoFormat, const SwTableAutoFmt* pSelFmt )
+ : SfxModalDialog( pParent, SW_RES( DLG_AUTOFMT_TABLE ) ),
+ //
+ aFlFormat ( this, SW_RES( FL_FORMAT ) ),
+ aLbFormat ( this, SW_RES( LB_FORMAT ) ),
+
+ aBtnNumFormat ( this, SW_RES( BTN_NUMFORMAT ) ),
+ aBtnBorder ( this, SW_RES( BTN_BORDER ) ),
+ aBtnFont ( this, SW_RES( BTN_FONT ) ),
+ aBtnPattern ( this, SW_RES( BTN_PATTERN ) ),
+ aBtnAlignment ( this, SW_RES( BTN_ALIGNMENT ) ),
+ aFlFormats ( this, SW_RES( FL_FORMATS ) ),
+ aBtnOk ( this, SW_RES( BTN_OK ) ),
+ aBtnCancel ( this, SW_RES( BTN_CANCEL ) ),
+ aBtnHelp ( this, SW_RES( BTN_HELP ) ),
+ aBtnAdd ( this, SW_RES( BTN_ADD ) ),
+ aBtnRemove ( this, SW_RES( BTN_REMOVE ) ),
+ aBtnRename ( this, SW_RES( BTN_RENAME ) ),
+ aBtnMore ( this, SW_RES( BTN_MORE ) ),
+ aStrTitle ( SW_RES( STR_ADD_TITLE ) ),
+ aStrLabel ( SW_RES( STR_ADD_LABEL ) ),
+ aStrClose ( SW_RES( STR_BTN_CLOSE ) ),
+ aStrDelTitle ( SW_RES( STR_DEL_TITLE ) ),
+ aStrDelMsg ( SW_RES( STR_DEL_MSG ) ),
+ aStrRenameTitle ( SW_RES( STR_RENAME_TITLE ) ),
+ aStrInvalidFmt ( SW_RES( STR_INVALID_AFNAME )),
+ pWndPreview ( new AutoFmtPreview( this, SW_RES( WND_PREVIEW ), pWrtShell )),
+ //
+ pShell ( pWrtShell ),
+ nIndex ( 0 ),
+ nDfltStylePos ( 0 ),
+ bCoreDataChanged( sal_False ),
+ bSetAutoFmt ( bSetAutoFormat )
+{
+ pTableTbl = new SwTableAutoFmtTbl;
+ pTableTbl->Load();
+
+ Init( pSelFmt );
+ //------------- >
+ FreeResource();
+}
+
+//------------------------------------------------------------------------
+
+
+__EXPORT SwAutoFormatDlg::~SwAutoFormatDlg()
+{
+ delete pWndPreview;
+
+ if( bCoreDataChanged )
+ pTableTbl->Save();
+ delete pTableTbl;
+}
+
+//------------------------------------------------------------------------
+
+
+void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt )
+{
+ Link aLk( LINK( this, SwAutoFormatDlg, CheckHdl ) );
+ aBtnBorder.SetClickHdl( aLk );
+ aBtnFont.SetClickHdl( aLk );
+ aBtnPattern.SetClickHdl( aLk );
+ aBtnAlignment.SetClickHdl( aLk );
+ aBtnNumFormat.SetClickHdl( aLk );
+
+ aBtnAdd.SetClickHdl ( LINK( this, SwAutoFormatDlg, AddHdl ) );
+ aBtnRemove.SetClickHdl ( LINK( this, SwAutoFormatDlg, RemoveHdl ) );
+ aBtnRename.SetClickHdl ( LINK( this, SwAutoFormatDlg, RenameHdl ) );
+ aBtnOk.SetClickHdl ( LINK( this, SwAutoFormatDlg, OkHdl ) );
+ aLbFormat.SetSelectHdl( LINK( this, SwAutoFormatDlg, SelFmtHdl ) );
+
+ aBtnMore.AddWindow( &aBtnNumFormat );
+ aBtnMore.AddWindow( &aBtnBorder );
+ aBtnMore.AddWindow( &aBtnFont );
+ aBtnMore.AddWindow( &aBtnPattern );
+ aBtnMore.AddWindow( &aBtnAlignment );
+ aBtnMore.AddWindow( &aFlFormats );
+ aBtnMore.AddWindow( &aBtnRename );
+
+ aBtnAdd.Enable( bSetAutoFmt );
+
+ nIndex = 0;
+ if( !bSetAutoFmt )
+ {
+ // dann muss die Liste um den Eintrag <Keins> erweitert werden.
+ aLbFormat.InsertEntry( ViewShell::GetShellRes()->aStrNone );
+ nDfltStylePos = 1;
+ nIndex = 255;
+ }
+
+ for( sal_uInt8 i = 0, nCount = (sal_uInt8)pTableTbl->Count(); i < nCount; i++ )
+ {
+ SwTableAutoFmt* pFmt = (*pTableTbl)[ i ];
+ aLbFormat.InsertEntry( pFmt->GetName() );
+ if( pSelFmt && pFmt->GetName() == pSelFmt->GetName() )
+ nIndex = i;
+ }
+
+ aLbFormat.SelectEntryPos( 255 != nIndex ? (nDfltStylePos + nIndex) : 0 );
+ SelFmtHdl( 0 );
+}
+
+//------------------------------------------------------------------------
+
+
+void SwAutoFormatDlg::UpdateChecks( const SwTableAutoFmt& rFmt, sal_Bool bEnable )
+{
+ aBtnNumFormat.Enable( bEnable );
+ aBtnNumFormat.Check( rFmt.IsValueFormat() );
+
+ aBtnBorder.Enable( bEnable );
+ aBtnBorder.Check( rFmt.IsFrame() );
+
+ aBtnFont.Enable( bEnable );
+ aBtnFont.Check( rFmt.IsFont() );
+
+ aBtnPattern.Enable( bEnable );
+ aBtnPattern.Check( rFmt.IsBackground() );
+
+ aBtnAlignment.Enable( bEnable );
+ aBtnAlignment.Check( rFmt.IsJustify() );
+}
+
+void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
+{
+ if( 255 != nIndex )
+ {
+ if( rToFill )
+ *rToFill = *(*pTableTbl)[ nIndex ];
+ else
+ rToFill = new SwTableAutoFmt( *(*pTableTbl)[ nIndex ] );
+ }
+ else if( rToFill )
+ delete rToFill, rToFill = 0;
+}
+
+
+/*------------------------------------------------------------------------
+ Handler:
+ ---------*/
+
+
+IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn )
+{
+ SwTableAutoFmtPtr pData = (*pTableTbl)[nIndex];
+ sal_Bool bCheck = ((CheckBox*)pBtn)->IsChecked(), bDataChgd = sal_True;
+
+ if( pBtn == &aBtnNumFormat )
+ pData->SetValueFormat( bCheck );
+ else if ( pBtn == &aBtnBorder )
+ pData->SetFrame( bCheck );
+ else if ( pBtn == &aBtnFont )
+ pData->SetFont( bCheck );
+ else if ( pBtn == &aBtnPattern )
+ pData->SetBackground( bCheck );
+ else if ( pBtn == &aBtnAlignment )
+ pData->SetJustify( bCheck );
+// else if ( pBtn == &aBtnAdjust )
+// pData->SetIncludeWidthHeight( bCheck );
+ else
+ bDataChgd = sal_False;
+
+ if( bDataChgd )
+ {
+ if( !bCoreDataChanged )
+ {
+ aBtnCancel.SetText( aStrClose );
+ bCoreDataChanged = sal_True;
+ }
+
+ pWndPreview->NotifyChange( *pData );
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwAutoFormatDlg, AddHdl, void *, EMPTYARG )
+{
+ sal_Bool bOk = sal_False, bFmtInserted = sal_False;
+ while( !bOk )
+ {
+ SwStringInputDlg* pDlg = new SwStringInputDlg( this,
+ aStrTitle,
+ aStrLabel,
+ aEmptyStr );
+ if( RET_OK == pDlg->Execute() )
+ {
+ String aFormatName;
+ pDlg->GetInputString( aFormatName );
+
+ if( aFormatName.Len() > 0 )
+ {
+ sal_uInt16 n;
+ for( n = 0; n < pTableTbl->Count(); ++n )
+ if( (*pTableTbl)[n]->GetName() == aFormatName )
+ break;
+
+ if( n >= pTableTbl->Count() )
+ {
+ // Format mit dem Namen noch nicht vorhanden, also
+ // aufnehmen
+ SwTableAutoFmtPtr pNewData = new
+ SwTableAutoFmt( aFormatName );
+ pShell->GetTableAutoFmt( *pNewData );
+
+ // Sortiert einfuegen!!
+ for( n = 1; n < pTableTbl->Count(); ++n )
+ if( (*pTableTbl)[ n ]->GetName() > aFormatName )
+ break;
+
+ pTableTbl->Insert( pNewData, n );
+ aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
+ aLbFormat.SelectEntryPos( nDfltStylePos + n );
+ bFmtInserted = sal_True;
+ aBtnAdd.Enable( sal_False );
+ if ( !bCoreDataChanged )
+ {
+ aBtnCancel.SetText( aStrClose );
+ bCoreDataChanged = sal_True;
+ }
+
+ SelFmtHdl( 0 );
+ bOk = sal_True;
+ }
+ }
+
+ if( !bFmtInserted )
+ {
+ bOk = RET_CANCEL == ErrorBox( this,
+ WinBits( WB_OK_CANCEL | WB_DEF_OK),
+ aStrInvalidFmt
+ ).Execute();
+ }
+ }
+ else
+ bOk = sal_True;
+ delete pDlg;
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SwAutoFormatDlg, RemoveHdl, void *, EMPTYARG )
+{
+ String aMessage = aStrDelMsg ;
+ aMessage.AppendAscii("\n\n");
+ aMessage += aLbFormat.GetSelectEntry() ;
+ aMessage += '\n';
+
+ MessBox* pBox = new MessBox( this, WinBits( WB_OK_CANCEL ),
+ aStrDelTitle, aMessage);
+
+ if ( pBox->Execute() == RET_OK )
+ {
+ aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
+ aLbFormat.SelectEntryPos( nDfltStylePos + nIndex-1 );
+
+ pTableTbl->DeleteAndDestroy( nIndex );
+ nIndex--;
+
+ if( !nIndex )
+ {
+ aBtnRemove.Enable(sal_False);
+ aBtnRename.Enable(sal_False);
+ }
+
+ if( !bCoreDataChanged )
+ {
+ aBtnCancel.SetText( aStrClose );
+ bCoreDataChanged = sal_True;
+ }
+ }
+ delete pBox;
+
+ SelFmtHdl( 0 );
+
+ return 0;
+}
+
+IMPL_LINK( SwAutoFormatDlg, RenameHdl, void *, EMPTYARG )
+{
+ sal_Bool bOk = sal_False;
+ while( !bOk )
+ {
+ SwStringInputDlg* pDlg = new SwStringInputDlg( this,
+ aStrRenameTitle, aLbFormat.GetSelectEntry(),
+ aEmptyStr );
+ if( pDlg->Execute() == RET_OK )
+ {
+ sal_Bool bFmtRenamed = sal_False;
+ String aFormatName;
+ pDlg->GetInputString( aFormatName );
+
+ if ( aFormatName.Len() > 0 )
+ {
+ sal_uInt16 n;
+ for( n = 0; n < pTableTbl->Count(); ++n )
+ if ((*pTableTbl)[n]->GetName() == aFormatName)
+ break;
+
+ if( n >= pTableTbl->Count() )
+ {
+ // Format mit dem Namen noch nicht vorhanden, also
+ // umbenennen
+
+ aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
+ SwTableAutoFmtPtr p = (*pTableTbl)[ nIndex ];
+ pTableTbl->Remove( nIndex );
+
+ p->SetName( aFormatName );
+
+ // Sortiert einfuegen!!
+ for( n = 1; n < pTableTbl->Count(); ++n )
+ if( (*pTableTbl)[ n ]->GetName() > aFormatName )
+ break;
+
+ pTableTbl->Insert( p, n );
+ aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
+ aLbFormat.SelectEntryPos( nDfltStylePos + n );
+
+ if ( !bCoreDataChanged )
+ {
+ aBtnCancel.SetText( aStrClose );
+ bCoreDataChanged = sal_True;
+ }
+
+ SelFmtHdl( 0 );
+ bOk = sal_True;
+ bFmtRenamed = sal_True;
+ }
+ }
+
+ if( !bFmtRenamed )
+ {
+ bOk = RET_CANCEL == ErrorBox( this,
+ WinBits( WB_OK_CANCEL | WB_DEF_OK),
+ aStrInvalidFmt
+ ).Execute();
+ }
+ }
+ else
+ bOk = sal_True;
+ delete pDlg;
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SwAutoFormatDlg, SelFmtHdl, void *, EMPTYARG )
+{
+ sal_Bool bBtnEnable = sal_False;
+ sal_uInt8 nSelPos = (sal_uInt8) aLbFormat.GetSelectEntryPos(), nOldIdx = nIndex;
+ if( nSelPos >= nDfltStylePos )
+ {
+ nIndex = nSelPos - nDfltStylePos;
+ pWndPreview->NotifyChange( *(*pTableTbl)[nIndex] );
+ bBtnEnable = 0 != nIndex;
+ UpdateChecks( *(*pTableTbl)[nIndex], sal_True );
+ }
+ else
+ {
+ nIndex = 255;
+
+ SwTableAutoFmt aTmp( ViewShell::GetShellRes()->aStrNone );
+ aTmp.SetFont( sal_False );
+ aTmp.SetJustify( sal_False );
+ aTmp.SetFrame( sal_False );
+ aTmp.SetBackground( sal_False );
+ aTmp.SetValueFormat( sal_False );
+ aTmp.SetWidthHeight( sal_False );
+
+ if( nOldIdx != nIndex )
+ pWndPreview->NotifyChange( aTmp );
+ UpdateChecks( aTmp, sal_False );
+ }
+
+ aBtnRemove.Enable( bBtnEnable );
+ aBtnRename.Enable( bBtnEnable );
+
+ return 0;
+}
+//------------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SwAutoFormatDlg, OkHdl, Button *, EMPTYARG )
+{
+ if( bSetAutoFmt )
+ pShell->SetTableAutoFmt( *(*pTableTbl)[ nIndex ] );
+ EndDialog( RET_OK );
+ return sal_True;
+}
+IMPL_LINK_INLINE_END( SwAutoFormatDlg, OkHdl, Button *, EMPTYARG )
+
+//========================================================================
+// AutoFmtPreview
+
+//------------------------------------------------------------------------
+
+AutoFmtPreview::AutoFmtPreview( Window* pParent, const ResId& rRes, SwWrtShell* pWrtShell ) :
+ Window ( pParent, rRes ),
+
+ aCurData ( aEmptyStr ),
+ aVD ( *this ),
+ aScriptedText ( aVD ),
+ bFitWidth ( sal_False ),
+ mbRTL ( false ),
+ aPrvSize ( GetSizePixel().Width() - 6, GetSizePixel().Height() - 30 ),
+ nLabelColWidth ( (aPrvSize.Width() - 4) / 4 - 12 ),
+ nDataColWidth1 ( (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 3 ),
+ nDataColWidth2 ( (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 4 ),
+ nRowHeight ( (aPrvSize.Height() - 4) / 5 ),
+ aStrJan ( SW_RES( STR_JAN ) ),
+ aStrFeb ( SW_RES( STR_FEB ) ),
+ aStrMar ( SW_RES( STR_MAR ) ),
+ aStrNorth ( SW_RES( STR_NORTH ) ),
+ aStrMid ( SW_RES( STR_MID ) ),
+ aStrSouth ( SW_RES( STR_SOUTH ) ),
+ aStrSum ( SW_RES( STR_SUM ) ),
+ m_xMSF ( comphelper::getProcessServiceFactory() )
+{
+ if (!pWrtShell->IsCrsrInTbl()) // We haven't created the table yet
+ mbRTL = Application::GetSettings().GetLayoutRTL();
+ else
+ mbRTL = pWrtShell->IsTableRightToLeft();
+
+ DBG_ASSERT( m_xMSF.is(), "AutoFmtPreview: no MultiServiceFactory");
+ if ( m_xMSF.is() )
+ {
+ m_xBreak = uno::Reference< i18n::XBreakIterator >(
+ m_xMSF->createInstance (
+ rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),
+ uno::UNO_QUERY);
+ }
+ pNumFmt = new SvNumberFormatter( m_xMSF, LANGUAGE_SYSTEM );
+
+ Init();
+}
+
+//------------------------------------------------------------------------
+
+__EXPORT AutoFmtPreview::~AutoFmtPreview()
+{
+ delete pNumFmt;
+}
+
+//------------------------------------------------------------------------
+
+static void lcl_SetFontProperties(
+ Font& rFont,
+ const SvxFontItem& rFontItem,
+ const SvxWeightItem& rWeightItem,
+ const SvxPostureItem& rPostureItem )
+{
+ rFont.SetFamily ( rFontItem.GetFamily() );
+ rFont.SetName ( rFontItem.GetFamilyName() );
+ rFont.SetStyleName ( rFontItem.GetStyleName() );
+ rFont.SetCharSet ( rFontItem.GetCharSet() );
+ rFont.SetPitch ( rFontItem.GetPitch() );
+ rFont.SetWeight ( (FontWeight)rWeightItem.GetValue() );
+ rFont.SetItalic ( (FontItalic)rPostureItem.GetValue() );
+}
+
+#define SETONALLFONTS( MethodName, Value ) \
+rFont.MethodName( Value ); \
+rCJKFont.MethodName( Value ); \
+rCTLFont.MethodName( Value );
+
+void AutoFmtPreview::MakeFonts( sal_uInt8 nIndex, Font& rFont, Font& rCJKFont, Font& rCTLFont )
+{
+ const SwBoxAutoFmt& rBoxFmt = aCurData.GetBoxFmt( nIndex );
+
+ rFont = rCJKFont = rCTLFont = GetFont();
+ Size aFontSize( rFont.GetSize().Width(), 10 );
+
+ lcl_SetFontProperties( rFont, rBoxFmt.GetFont(), rBoxFmt.GetWeight(), rBoxFmt.GetPosture() );
+ lcl_SetFontProperties( rCJKFont, rBoxFmt.GetCJKFont(), rBoxFmt.GetCJKWeight(), rBoxFmt.GetCJKPosture() );
+ lcl_SetFontProperties( rCTLFont, rBoxFmt.GetCTLFont(), rBoxFmt.GetCTLWeight(), rBoxFmt.GetCTLPosture() );
+
+ SETONALLFONTS( SetUnderline, (FontUnderline)rBoxFmt.GetUnderline().GetValue() );
+ SETONALLFONTS( SetOverline, (FontUnderline)rBoxFmt.GetOverline().GetValue() );
+ SETONALLFONTS( SetStrikeout, (FontStrikeout)rBoxFmt.GetCrossedOut().GetValue() );
+ SETONALLFONTS( SetOutline, rBoxFmt.GetContour().GetValue() );
+ SETONALLFONTS( SetShadow, rBoxFmt.GetShadowed().GetValue() );
+ SETONALLFONTS( SetColor, rBoxFmt.GetColor().GetValue() );
+ SETONALLFONTS( SetSize, aFontSize );
+ SETONALLFONTS( SetTransparent, sal_True );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt8 AutoFmtPreview::GetFormatIndex( size_t nCol, size_t nRow ) const
+{
+ static const sal_uInt8 pnFmtMap[] =
+ {
+ 0, 1, 2, 1, 3,
+ 4, 5, 6, 5, 7,
+ 8, 9, 10, 9, 11,
+ 4, 5, 6, 5, 7,
+ 12, 13, 14, 13, 15
+ };
+ return pnFmtMap[ maArray.GetCellIndex( nCol, nRow, mbRTL ) ];
+}
+
+const SvxBoxItem& AutoFmtPreview::GetBoxItem( size_t nCol, size_t nRow ) const
+{
+ return aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBox();
+}
+
+//------------------------------------------------------------------------
+
+void AutoFmtPreview::DrawString( size_t nCol, size_t nRow )
+{
+ //------------------------
+ // Ausgabe des Zelltextes:
+ //------------------------
+ sal_uLong nNum;
+ double nVal;
+ String cellString;
+ sal_uInt8 nIndex = static_cast< sal_uInt8 >( maArray.GetCellIndex( nCol, nRow, mbRTL ) );
+
+ switch( nIndex )
+ {
+ case 1: cellString = aStrJan; break;
+ case 2: cellString = aStrFeb; break;
+ case 3: cellString = aStrMar; break;
+ case 5: cellString = aStrNorth; break;
+ case 10: cellString = aStrMid; break;
+ case 15: cellString = aStrSouth; break;
+ case 4:
+ case 20: cellString = aStrSum; break;
+
+ case 6:
+ case 8:
+ case 16:
+ case 18: nVal = nIndex;
+ nNum = 5;
+ goto MAKENUMSTR;
+ case 17:
+ case 7: nVal = nIndex;
+ nNum = 6;
+ goto MAKENUMSTR;
+ case 11:
+ case 12:
+ case 13: nVal = nIndex;
+ nNum = 12 == nIndex ? 10 : 9;
+ goto MAKENUMSTR;
+
+ case 9: nVal = 21; nNum = 7; goto MAKENUMSTR;
+ case 14: nVal = 36; nNum = 11; goto MAKENUMSTR;
+ case 19: nVal = 51; nNum = 7; goto MAKENUMSTR;
+ case 21: nVal = 33; nNum = 13; goto MAKENUMSTR;
+ case 22: nVal = 36; nNum = 14; goto MAKENUMSTR;
+ case 23: nVal = 39; nNum = 13; goto MAKENUMSTR;
+ case 24: nVal = 108; nNum = 15; goto MAKENUMSTR;
+MAKENUMSTR:
+ if( aCurData.IsValueFormat() )
+ {
+ String sFmt; LanguageType eLng, eSys;
+ aCurData.GetBoxFmt( (sal_uInt8)nNum ).GetValueFormat( sFmt, eLng, eSys );
+
+ short nType;
+ sal_Bool bNew;
+ xub_StrLen nCheckPos;
+ sal_uInt32 nKey = pNumFmt->GetIndexPuttingAndConverting( sFmt, eLng,
+ eSys, nType, bNew, nCheckPos);
+ Color* pDummy;
+ pNumFmt->GetOutputString( nVal, nKey, cellString, &pDummy );
+ }
+ else
+ cellString = String::CreateFromInt32((sal_Int32)nVal);
+ break;
+
+ }
+
+ if( cellString.Len() )
+ {
+ Size aStrSize;
+ sal_uInt8 nFmtIndex = GetFormatIndex( nCol, nRow );
+ Rectangle cellRect = maArray.GetCellRect( nCol, nRow );
+ Point aPos = cellRect.TopLeft();
+ sal_uInt16 nRightX = 0;
+// sal_Bool bJustify = aCurData.IsJustify();
+// ScHorJustifyAttr aHorJustifyItem;
+// CellHorJustify eJustification;
+
+ Size theMaxStrSize( cellRect.GetWidth() - FRAME_OFFSET,
+ cellRect.GetHeight() - FRAME_OFFSET );
+ if( aCurData.IsFont() )
+ {
+ Font aFont, aCJKFont, aCTLFont;
+ MakeFonts( nFmtIndex, aFont, aCJKFont, aCTLFont );
+ aScriptedText.SetFonts( &aFont, &aCJKFont, &aCTLFont );
+ }
+ else
+ aScriptedText.SetDefaultFont();
+
+ aScriptedText.SetText( cellString, m_xBreak );
+ aStrSize = aScriptedText.GetTextSize();
+
+ if( aCurData.IsFont() &&
+ theMaxStrSize.Height() < aStrSize.Height() )
+ {
+ // wenn der String in diesem Font nicht
+ // in die Zelle passt, wird wieder der
+ // Standard-Font genommen:
+ aScriptedText.SetDefaultFont();
+ aStrSize = aScriptedText.GetTextSize();
+ }
+
+ while( theMaxStrSize.Width() <= aStrSize.Width() &&
+ cellString.Len() > 1 )
+ {
+// if( eJustification == SVX_HOR_JUSTIFY_RIGHT )
+// cellString.Erase( 0, 1 );
+// else
+ cellString.Erase( cellString.Len() - 1 );
+ aScriptedText.SetText( cellString, m_xBreak );
+ aStrSize = aScriptedText.GetTextSize();
+ }
+
+ nRightX = (sal_uInt16)( cellRect.GetWidth()
+ - aStrSize.Width()
+ - FRAME_OFFSET );
+ //-------------
+ // Ausrichtung:
+ //-------------
+ /* if ( bJustify )
+ {
+ aCurData.GetHorJustify( nFmtIndex, aHorJustifyItem );
+ eJustification = (CellHorJustify)aHorJustifyItem.GetValue();
+ }
+ else
+ {
+ eJustification = SC_HOR_JUSTIFY_STANDARD;
+ }*/
+
+ //-----------------------------
+ // vertikal (immer zentrieren):
+ //-----------------------------
+ aPos.Y() += (nRowHeight - (sal_uInt16)aStrSize.Height()) / 2;
+
+ //-----------
+ // horizontal
+ //-----------
+/* if ( eJustification != SC_HOR_JUSTIFY_STANDARD )*/
+ if( mbRTL )
+ aPos.X() += nRightX;
+ else if (aCurData.IsJustify())
+ {
+ sal_uInt16 nHorPos = (sal_uInt16)
+ ((cellRect.GetWidth()-aStrSize.Width())/2);
+ const SvxAdjustItem& rAdj = aCurData.GetBoxFmt(nFmtIndex).GetAdjust();
+ switch ( rAdj.GetAdjust() )
+ {
+ case SVX_ADJUST_LEFT:
+ aPos.X() += FRAME_OFFSET;
+ break;
+ case SVX_ADJUST_RIGHT:
+ aPos.X() += nRightX;
+ break;
+ default:
+ aPos.X() += nHorPos;
+ break;
+ }
+ }
+ else
+ {
+ //---------------------
+ // Standardausrichtung:
+ //---------------------
+ if ( (nCol == 0) || (nIndex == 4) )
+ {
+ // Text-Label links oder Summe linksbuendig
+ aPos.X() += FRAME_OFFSET;
+ }
+ else
+ {
+ // Zahlen/Datum rechtsbuendig
+ aPos.X() += nRightX;
+ }
+ }
+
+ //-------------------------------
+ aScriptedText.DrawText( aPos );
+ //-------------------------------
+ }
+}
+
+#undef FRAME_OFFSET
+
+//------------------------------------------------------------------------
+
+void AutoFmtPreview::DrawStrings()
+{
+ for( size_t nRow = 0; nRow < 5; ++nRow )
+ for( size_t nCol = 0; nCol < 5; ++nCol )
+ DrawString( nCol, nRow );
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::DrawBackground()
+{
+ for( size_t nRow = 0; nRow < 5; ++nRow )
+ {
+ for( size_t nCol = 0; nCol < 5; ++nCol )
+ {
+ SvxBrushItem aBrushItem( aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBackground() );
+
+ aVD.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ aVD.SetLineColor();
+ aVD.SetFillColor( aBrushItem.GetColor() );
+ aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) );
+ aVD.Pop();
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::PaintCells()
+{
+ // 1) background
+ if ( aCurData.IsBackground() )
+ DrawBackground();
+
+ // 2) values
+ DrawStrings();
+
+ // 3) border
+ if ( aCurData.IsFrame() )
+ maArray.DrawArray( aVD );
+}
+
+//------------------------------------------------------------------------
+
+
+void __EXPORT AutoFmtPreview::Init()
+{
+ SetBorderStyle( GetBorderStyle() | WINDOW_BORDER_MONO );
+ maArray.Initialize( 5, 5 );
+ maArray.SetUseDiagDoubleClipping( false );
+ CalcCellArray( sal_False );
+ CalcLineMap();
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::CalcCellArray( sal_Bool _bFitWidth )
+{
+ maArray.SetXOffset( 2 );
+ maArray.SetAllColWidths( _bFitWidth ? nDataColWidth2 : nDataColWidth1 );
+ maArray.SetColWidth( 0, nLabelColWidth );
+ maArray.SetColWidth( 4, nLabelColWidth );
+
+ maArray.SetYOffset( 2 );
+ maArray.SetAllRowHeights( nRowHeight );
+
+ aPrvSize.Width() = maArray.GetWidth() + 4;
+ aPrvSize.Height() = maArray.GetHeight() + 4;
+}
+
+//------------------------------------------------------------------------
+
+inline void lclSetStyleFromBorder( svx::frame::Style& rStyle, const SvxBorderLine* pBorder )
+{
+ rStyle.Set( pBorder, 0.05, 5 );
+}
+
+void AutoFmtPreview::CalcLineMap()
+{
+ for( size_t nRow = 0; nRow < 5; ++nRow )
+ {
+ for( size_t nCol = 0; nCol < 5; ++nCol )
+ {
+ svx::frame::Style aStyle;
+
+ const SvxBoxItem& rItem = GetBoxItem( nCol, nRow );
+ lclSetStyleFromBorder( aStyle, rItem.GetLeft() );
+ maArray.SetCellStyleLeft( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, rItem.GetRight() );
+ maArray.SetCellStyleRight( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, rItem.GetTop() );
+ maArray.SetCellStyleTop( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, rItem.GetBottom() );
+ maArray.SetCellStyleBottom( nCol, nRow, aStyle );
+
+// FIXME - uncomment to draw diagonal borders
+// lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, true ).GetLine() );
+// maArray.SetCellStyleTLBR( nCol, nRow, aStyle );
+// lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, false ).GetLine() );
+// maArray.SetCellStyleBLTR( nCol, nRow, aStyle );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::NotifyChange( const SwTableAutoFmt& rNewData )
+{
+ aCurData = rNewData;
+ bFitWidth = aCurData.IsJustify();//sal_True; //???
+ CalcCellArray( bFitWidth );
+ CalcLineMap();
+ DoPaint( Rectangle( Point(0,0), GetSizePixel() ) );
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ )
+{
+ sal_uInt32 nOldDrawMode = aVD.GetDrawMode();
+ if( GetSettings().GetStyleSettings().GetHighContrastMode() &&
+ SW_MOD()->GetAccessibilityOptions().GetIsForBorders() )
+ aVD.SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
+
+ Bitmap thePreview;
+ Point aCenterPos;
+ Size theWndSize = GetSizePixel();
+ Size thePrevSize;
+ Color oldColor;
+ Font aFont;
+
+ aFont = aVD.GetFont();
+ aFont.SetTransparent( sal_True );
+
+ aVD.SetFont ( aFont );
+ aVD.SetLineColor ();
+ const Color& rWinColor = GetSettings().GetStyleSettings().GetWindowColor();
+ aVD.SetBackground ( Wallpaper(rWinColor) );
+ aVD.SetFillColor ( rWinColor );
+ aVD.SetOutputSizePixel ( aPrvSize );
+
+ //--------------------------------
+ // Zellen auf virtual Device malen
+ // und Ergebnis sichern
+ //--------------------------------
+ PaintCells();
+ thePreview = aVD.GetBitmap( Point(0,0), aPrvSize );
+
+ //--------------------------------------
+ // Rahmen malen und Vorschau zentrieren:
+ // (virtual Device fuer Fensterausgabe)
+ //--------------------------------------
+ aVD.SetOutputSizePixel( theWndSize );
+ oldColor = aVD.GetLineColor();
+ aVD.SetLineColor();
+ aVD.DrawRect( Rectangle( Point(0,0), theWndSize ) );
+ SetLineColor( oldColor );
+ aCenterPos = Point( (theWndSize.Width() - aPrvSize.Width() ) / 2,
+ (theWndSize.Height() - aPrvSize.Height()) / 2 );
+ aVD.DrawBitmap( aCenterPos, thePreview );
+
+ //----------------------------
+ // Ausgabe im Vorschaufenster:
+ //----------------------------
+ DrawBitmap( Point(0,0), aVD.GetBitmap( Point(0,0), theWndSize ) );
+
+ aVD.SetDrawMode( nOldDrawMode );
+}
+
+//------------------------------------------------------------------------
+
+void __EXPORT AutoFmtPreview::Paint( const Rectangle& rRect )
+{
+ DoPaint( rRect );
+}
diff --git a/sw/source/ui/table/tautofmt.hrc b/sw/source/ui/table/tautofmt.hrc
new file mode 100644
index 000000000000..5ffd2d3eb8d3
--- /dev/null
+++ b/sw/source/ui/table/tautofmt.hrc
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_TAUTOFMT_HRC
+#define SW_TAUTOFMT_HRC
+
+#include "table.hrc"
+// allgemein
+#define BTN_OK 100
+#define BTN_CANCEL 102
+#define BTN_HELP 103
+#define BTN_MORE 104
+#define BTN_ADD 105
+#define BTN_REMOVE 106
+#define BTN_RENAME 107
+#define FT_LABEL 110
+#define FL_FRAME 111
+#define STR_BTN_CLOSE 200
+
+// Autoformat
+#define LB_FORMAT 1
+#define FL_FORMAT 9
+#define FL_FORMATS 29
+#define WND_PREVIEW 19
+#define BTN_NUMFORMAT 20
+#define BTN_BORDER 21
+#define BTN_FONT 23
+#define BTN_PATTERN 24
+#define BTN_ALIGNMENT 25
+//#define BTN_ADJUST 26
+#define STR_ADD_TITLE 100
+#define STR_ADD_LABEL 101
+#define STR_DEL_TITLE 102
+#define STR_DEL_MSG 103
+#define STR_INVALID_AFNAME 104
+#define STR_RENAME_TITLE 105
+ // Autoformat-Preview:
+#define STR_JAN 121
+#define STR_FEB 122
+#define STR_MAR 123
+#define STR_NORTH 124
+#define STR_MID 125
+#define STR_SOUTH 126
+#define STR_SUM 127
+
+// Gruppierung setzen/aufheben:
+#define BTN_GROUP_COLS 1
+#define BTN_GROUP_ROWS 3
+#define STR_GROUP 1
+#define STR_UNGROUP 2
+
+
+#define ED_INPUT 1
+
+#endif
diff --git a/sw/source/ui/table/tautofmt.src b/sw/source/ui/table/tautofmt.src
new file mode 100644
index 000000000000..e338dc9a4b73
--- /dev/null
+++ b/sw/source/ui/table/tautofmt.src
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tautofmt.hrc"
+#include "helpid.h"
+ModalDialog DLG_AUTOFMT_TABLE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_AUTOFMT_TABLE ;
+ Size = MAP_APPFONT ( 312 , 120 ) ;
+ Text [ en-US ] = "AutoFormat" ;
+ Moveable = TRUE ;
+ FixedLine FL_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 243 , 8 ) ;
+ Text [ en-US ] = "Format" ;
+ };
+ ListBox LB_FORMAT
+ {
+ HelpID = "sw:ListBox:DLG_AUTOFMT_TABLE:LB_FORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 65 , 100 ) ;
+ TabStop = TRUE ;
+ };
+ Window WND_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 83 , 14 ) ;
+ Size = MAP_APPFONT ( 161 , 100 ) ;
+ Border = TRUE;
+ };
+ CheckBox BTN_NUMFORMAT
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_NUMFORMAT";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 131 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Number format" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_BORDER
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_BORDER";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 147 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Borders" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_FONT
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_FONT";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 85 , 131 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "F~ont" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_PATTERN
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_PATTERN";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 85 , 147 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Pattern" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_ALIGNMENT
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_ALIGNMENT";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 150 , 131 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "Alignmen~t" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_FORMATS
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 120 ) ;
+ Size = MAP_APPFONT ( 243 , 8 ) ;
+ Text [ en-US ] = "Formatting" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 255 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 255 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ MoreButton BTN_MORE
+ {
+ HelpID = "sw:MoreButton:DLG_AUTOFMT_TABLE:BTN_MORE";
+ Pos = MAP_APPFONT ( 255 , 101 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~More" ;
+ TabStop = TRUE ;
+ MapUnit = MAP_APPFONT ;
+ Delta = 48 ;
+ };
+ PushButton BTN_ADD
+ {
+ HelpID = "sw:PushButton:DLG_AUTOFMT_TABLE:BTN_ADD";
+ Pos = MAP_APPFONT ( 255 , 64 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add" ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_REMOVE
+ {
+ HelpID = "sw:PushButton:DLG_AUTOFMT_TABLE:BTN_REMOVE";
+ Pos = MAP_APPFONT ( 255 , 81 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete" ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_RENAME
+ {
+ HelpID = "sw:PushButton:DLG_AUTOFMT_TABLE:BTN_RENAME";
+ Pos = MAP_APPFONT ( 255 , 123 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Rename" ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 255 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_ADD_TITLE
+ {
+ Text [ en-US ] = "Add AutoFormat" ;
+ };
+ String STR_ADD_LABEL
+ {
+ Text [ en-US ] = "Name" ;
+ };
+ String STR_DEL_TITLE
+ {
+ Text [ en-US ] = "Delete AutoFormat" ;
+ };
+ String STR_DEL_MSG
+ {
+ Text [ en-US ] = "The following AutoFormat entry will be deleted:" ;
+ };
+ String STR_RENAME_TITLE
+ {
+ Text [ en-US ] = "Rename AutoFormat" ;
+ };
+ String STR_BTN_CLOSE
+ {
+ Text [ en-US ] = "~Close" ;
+ };
+ String STR_JAN
+ {
+ Text [ en-US ] = "Jan" ;
+ };
+ String STR_FEB
+ {
+ Text [ en-US ] = "Feb" ;
+ };
+ String STR_MAR
+ {
+ Text [ en-US ] = "Mar" ;
+ };
+ String STR_NORTH
+ {
+ Text [ en-US ] = "North" ;
+ };
+ String STR_MID
+ {
+ Text [ en-US ] = "Mid" ;
+ };
+ String STR_SOUTH
+ {
+ Text [ en-US ] = "South" ;
+ };
+ String STR_SUM
+ {
+ Text [ en-US ] = "Sum" ;
+ };
+ String STR_INVALID_AFNAME
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Sie haben einen ungültigen Namen angegeben.\nDas AutoFormat konnte nicht angelegt werden.\nWählen Sie einen anderen Namen. : Sie haben einen ungültigen Namen angegeben.\nDas Autoformat konnte nicht angelegt werden.\nWählen Sie einen anderen Namen. */
+ /* ### ACHTUNG: Neuer Text in Resource? Sie haben einen ungültigen Namen angegeben.\nDas AutoFormat konnte nicht angelegt werden.\nWählen Sie einen anderen Namen. : Sie haben einen ungültigen Namen angegeben.\nDas Autoformat konnte nicht angelegt werden.\nWählen Sie einen anderen Namen. */
+ Text [ en-US ] = "You have entered an invalid name.\nThe desired AutoFormat could not be created. \nTry again using a different name." ;
+ };
+};
+ModalDialog DLG_SWDLG_STRINPUT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 172 , 63 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ HelpID = HID_SWDLG_STRINPUT ;
+ Edit ED_INPUT
+ {
+ HelpID = "sw:Edit:DLG_SWDLG_STRINPUT:ED_INPUT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 24 ) ;
+ Size = MAP_APPFONT ( 104 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_LABEL
+ {
+ Pos = MAP_APPFONT ( 6 , 13 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text = "Label" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 116 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 116 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+