summaryrefslogtreecommitdiff
path: root/reportdesign/source/ui/dlg
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign/source/ui/dlg')
-rw-r--r--reportdesign/source/ui/dlg/AddField.cxx535
-rw-r--r--reportdesign/source/ui/dlg/CondFormat.cxx625
-rw-r--r--reportdesign/source/ui/dlg/CondFormat.hrc87
-rw-r--r--reportdesign/source/ui/dlg/CondFormat.src445
-rw-r--r--reportdesign/source/ui/dlg/Condition.cxx740
-rw-r--r--reportdesign/source/ui/dlg/Condition.hxx198
-rw-r--r--reportdesign/source/ui/dlg/DateTime.cxx273
-rw-r--r--reportdesign/source/ui/dlg/DateTime.hrc55
-rw-r--r--reportdesign/source/ui/dlg/DateTime.src128
-rw-r--r--reportdesign/source/ui/dlg/Formula.cxx273
-rw-r--r--reportdesign/source/ui/dlg/GroupExchange.cxx76
-rw-r--r--reportdesign/source/ui/dlg/GroupExchange.hxx53
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.cxx1539
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.hrc79
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.src496
-rw-r--r--reportdesign/source/ui/dlg/Navigator.cxx986
-rw-r--r--reportdesign/source/ui/dlg/Navigator.src187
-rw-r--r--reportdesign/source/ui/dlg/PageNumber.cxx162
-rw-r--r--reportdesign/source/ui/dlg/PageNumber.hrc59
-rw-r--r--reportdesign/source/ui/dlg/PageNumber.src164
-rw-r--r--reportdesign/source/ui/dlg/dlgpage.cxx93
-rw-r--r--reportdesign/source/ui/dlg/dlgpage.src304
-rw-r--r--reportdesign/source/ui/dlg/makefile.mk77
23 files changed, 7634 insertions, 0 deletions
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
new file mode 100644
index 000000000000..dc6681bbd1e6
--- /dev/null
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -0,0 +1,535 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_reportdesign.hxx"
+#include "AddField.hxx"
+#include "UITools.hxx"
+#include <svx/dbaexchange.hxx>
+#include <svx/svdpagv.hxx>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+
+#include <vcl/waitobj.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/stl_types.hxx>
+#include "rptui_slotid.hrc"
+
+#include <connectivity/dbtools.hxx>
+#include "helpids.hrc"
+#include "RptResId.hrc"
+#include "CondFormat.hrc"
+#include "ModuleHelper.hxx"
+#include "uistrings.hrc"
+#include <comphelper/property.hxx>
+#include <svtools/imgdef.hxx>
+
+namespace rptui
+{
+const long STD_WIN_SIZE_X = 180;
+const long STD_WIN_SIZE_Y = 320;
+
+const long LISTBOX_BORDER = 2;
+
+using namespace ::com::sun::star;
+using namespace sdbc;
+using namespace sdb;
+using namespace uno;
+using namespace datatransfer;
+using namespace beans;
+using namespace lang;
+using namespace container;
+using namespace ::svx;
+class OAddFieldWindowListBox : public SvTreeListBox
+{
+ OAddFieldWindow* m_pTabWin;
+
+ OAddFieldWindowListBox(const OAddFieldWindowListBox&);
+ void operator =(const OAddFieldWindowListBox&);
+protected:
+// virtual void Command( const CommandEvent& rEvt );
+
+public:
+ OAddFieldWindowListBox( OAddFieldWindow* _pParent );
+ virtual ~OAddFieldWindowListBox();
+
+ sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ uno::Sequence< beans::PropertyValue > getSelectedFieldDescriptors();
+
+protected:
+ // DragSourceHelper
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+private:
+ using SvTreeListBox::ExecuteDrop;
+};
+// -----------------------------------------------------------------------------
+uno::Sequence< beans::PropertyValue > OAddFieldWindowListBox::getSelectedFieldDescriptors()
+{
+ uno::Sequence< beans::PropertyValue > aArgs(GetSelectionCount());
+ sal_Int32 i = 0;
+ SvLBoxEntry* pSelected = FirstSelected();
+ while( pSelected )
+ {
+ // build a descriptor for the currently selected field
+ ::svx::ODataAccessDescriptor aDescriptor;
+ m_pTabWin->fillDescriptor(pSelected,aDescriptor);
+ aArgs[i++].Value <<= aDescriptor.createPropertyValueSequence();
+ pSelected = NextSelected(pSelected);
+ }
+ return aArgs;
+}
+//==================================================================
+// class OAddFieldWindowListBox
+//==================================================================
+DBG_NAME( rpt_OAddFieldWindowListBox );
+//------------------------------------------------------------------------------
+OAddFieldWindowListBox::OAddFieldWindowListBox( OAddFieldWindow* _pParent )
+ :SvTreeListBox( _pParent, WB_TABSTOP|WB_BORDER|WB_SORT )
+ ,m_pTabWin( _pParent )
+{
+ DBG_CTOR( rpt_OAddFieldWindowListBox,NULL);
+ SetHelpId( HID_RPT_FIELD_SEL );
+ SetSelectionMode(MULTIPLE_SELECTION);
+ SetDragDropMode( 0xFFFF );
+ SetHighlightRange( );
+}
+
+//------------------------------------------------------------------------------
+OAddFieldWindowListBox::~OAddFieldWindowListBox()
+{
+ DBG_DTOR( rpt_OAddFieldWindowListBox,NULL);
+}
+
+//------------------------------------------------------------------------------
+sal_Int8 OAddFieldWindowListBox::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
+{
+ return DND_ACTION_NONE;
+}
+
+//------------------------------------------------------------------------------
+sal_Int8 OAddFieldWindowListBox::ExecuteDrop( const ExecuteDropEvent& /*rEvt*/ )
+{
+ return DND_ACTION_NONE;
+}
+
+//------------------------------------------------------------------------------
+void OAddFieldWindowListBox::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
+{
+ if ( GetSelectionCount() < 1 )
+ // no drag without a field
+ return;
+
+ OMultiColumnTransferable* pDataContainer = new OMultiColumnTransferable(getSelectedFieldDescriptors());
+ Reference< XTransferable> xEnsureDelete = pDataContainer;
+
+ EndSelection();
+ pDataContainer->StartDrag( this, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
+}
+//========================================================================
+// class OAddFieldWindow
+//========================================================================
+DBG_NAME( rpt_OAddFieldWindow );
+//-----------------------------------------------------------------------
+OAddFieldWindow::OAddFieldWindow(Window* pParent
+ ,const uno::Reference< beans::XPropertySet >& _xRowSet
+ )
+ :FloatingWindow(pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE))
+ ,::comphelper::OPropertyChangeListener(m_aMutex)
+ ,::comphelper::OContainerListener(m_aMutex)
+ ,m_xRowSet(_xRowSet)
+ ,m_aActions(this,ModuleRes(RID_TB_SORTING))
+ ,m_pListBox(new OAddFieldWindowListBox( this ))
+ ,m_aFixedLine(this, ModuleRes(ADDFIELD_FL_HELP_SEPARATOR) )
+ ,m_aHelpText(this, ModuleRes(ADDFIELD_HELP_FIELD) )
+ ,m_aInsertButton(this, WB_TABSTOP|WB_CENTER)
+ ,m_nCommandType(0)
+ ,m_bEscapeProcessing(sal_False)
+ ,m_pChangeListener(NULL)
+ ,m_pContainerListener(NULL)
+{
+ DBG_CTOR( rpt_OAddFieldWindow,NULL);
+ SetHelpId( HID_RPT_FIELD_SEL_WIN );
+ SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
+ SetMinOutputSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
+
+ m_aActions.SetStyle(m_aActions.GetStyle()|WB_LINESPACING);
+ m_aActions.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
+
+ m_aActions.SetSelectHdl(LINK(this, OAddFieldWindow, OnSortAction));
+ setToolBox(&m_aActions);
+ m_aActions.CheckItem(SID_FM_SORTUP);
+ m_aActions.EnableItem(SID_ADD_CONTROL_PAIR, FALSE);
+
+ m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
+ m_pListBox->SetSelectHdl(LINK( this, OAddFieldWindow, OnSelectHdl ) );
+ m_pListBox->SetDeselectHdl(LINK( this, OAddFieldWindow, OnSelectHdl ) );
+ m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
+ m_pListBox->Show();
+ const String sTitle(ModuleRes(RID_STR_INSERT));
+ m_aInsertButton.SetText(sTitle);
+ m_aInsertButton.SetClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
+ m_aInsertButton.Show();
+
+ m_aFixedLine.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
+ m_aHelpText.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
+
+ SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
+ //Show();
+
+ if ( m_xRowSet.is() )
+ {
+ try
+ {
+ // be notified when the settings of report definition change
+ m_pChangeListener = new ::comphelper::OPropertyChangeMultiplexer( this, m_xRowSet );
+ m_pChangeListener->addProperty( PROPERTY_COMMAND );
+ m_pChangeListener->addProperty( PROPERTY_COMMANDTYPE );
+ m_pChangeListener->addProperty( PROPERTY_ESCAPEPROCESSING );
+ m_pChangeListener->addProperty( PROPERTY_FILTER );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+OAddFieldWindow::~OAddFieldWindow()
+{
+ if (m_pChangeListener.is())
+ m_pChangeListener->dispose();
+ if ( m_pContainerListener.is() )
+ m_pContainerListener->dispose();
+ DBG_DTOR( rpt_OAddFieldWindow,NULL);
+}
+
+//-----------------------------------------------------------------------
+void OAddFieldWindow::GetFocus()
+{
+ if ( m_pListBox.get() )
+ m_pListBox->GrabFocus();
+ else
+ FloatingWindow::GetFocus();
+}
+//-----------------------------------------------------------------------
+uno::Sequence< beans::PropertyValue > OAddFieldWindow::getSelectedFieldDescriptors()
+{
+ return m_pListBox->getSelectedFieldDescriptors();
+}
+
+//-----------------------------------------------------------------------
+long OAddFieldWindow::PreNotify( NotifyEvent& _rNEvt )
+{
+ if ( EVENT_KEYINPUT == _rNEvt.GetType() )
+ {
+ const KeyCode& rKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode();
+ if ( ( 0 == rKeyCode.GetModifier() ) && ( KEY_RETURN == rKeyCode.GetCode() ) )
+ {
+ if ( m_aCreateLink.IsSet() )
+ {
+ m_aCreateLink.Call(this);
+ return 1;
+ }
+ }
+ }
+
+ return FloatingWindow::PreNotify( _rNEvt );
+}
+//-----------------------------------------------------------------------
+void OAddFieldWindow::_propertyChanged( const beans::PropertyChangeEvent& _evt ) throw( uno::RuntimeException )
+{
+ OSL_ENSURE( _evt.Source == m_xRowSet, "OAddFieldWindow::_propertyChanged: where did this come from?" );
+ (void)_evt;
+ Update();
+}
+
+//-----------------------------------------------------------------------
+namespace
+{
+ void lcl_addToList( OAddFieldWindowListBox& _rListBox, const uno::Sequence< ::rtl::OUString >& _rEntries )
+ {
+ const ::rtl::OUString* pEntries = _rEntries.getConstArray();
+ sal_Int32 nEntries = _rEntries.getLength();
+ for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
+ _rListBox.InsertEntry( *pEntries );
+ }
+}
+
+//-----------------------------------------------------------------------
+void OAddFieldWindow::Update()
+{
+ if ( m_pContainerListener.is() )
+ m_pContainerListener->dispose();
+ m_pContainerListener = NULL;
+ m_xColumns.clear();
+
+ try
+ {
+ // ListBox loeschen
+ m_pListBox->Clear();
+ const USHORT nItemCount = m_aActions.GetItemCount();
+ for (USHORT j = 0; j< nItemCount; ++j)
+ {
+ m_aActions.EnableItem(m_aActions.GetItemId(j),FALSE);
+ }
+
+ String aTitle(ModuleRes(RID_STR_FIELDSELECTION));
+ SetText(aTitle);
+ if ( m_xRowSet.is() )
+ {
+ ::rtl::OUString sCommand( m_aCommandName );
+ sal_Int32 nCommandType( m_nCommandType );
+ sal_Bool bEscapeProcessing( m_bEscapeProcessing );
+ ::rtl::OUString sFilter( m_sFilter );
+
+ OSL_VERIFY( m_xRowSet->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand );
+ OSL_VERIFY( m_xRowSet->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nCommandType );
+ OSL_VERIFY( m_xRowSet->getPropertyValue( PROPERTY_ESCAPEPROCESSING ) >>= bEscapeProcessing );
+ OSL_VERIFY( m_xRowSet->getPropertyValue( PROPERTY_FILTER ) >>= sFilter );
+
+ m_aCommandName = sCommand;
+ m_nCommandType = nCommandType;
+ m_bEscapeProcessing = bEscapeProcessing;
+ m_sFilter = sFilter;
+
+ // add the columns to the list
+ uno::Reference< sdbc::XConnection> xCon = getConnection();
+ if ( xCon.is() && m_aCommandName.getLength() )
+ m_xColumns = dbtools::getFieldsByCommandDescriptor( xCon, GetCommandType(), GetCommand(), m_xHoldAlive );
+ if ( m_xColumns.is() )
+ {
+ lcl_addToList( *m_pListBox, m_xColumns->getElementNames() );
+ uno::Reference< container::XContainer> xContainer(m_xColumns,uno::UNO_QUERY);
+ if ( xContainer.is() )
+ m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
+ }
+
+ // add the parameter columns to the list
+ uno::Reference< ::com::sun::star::sdbc::XRowSet > xRowSet(m_xRowSet,uno::UNO_QUERY);
+ Sequence< ::rtl::OUString > aParamNames( getParameterNames( xRowSet ) );
+ lcl_addToList( *m_pListBox, aParamNames );
+
+ // set title
+ aTitle.AppendAscii(" ");
+ aTitle += m_aCommandName.getStr();
+ SetText( aTitle );
+ if ( m_aCommandName.getLength() )
+ {
+ for (USHORT i = 0; i < nItemCount; ++i)
+ {
+ m_aActions.EnableItem(m_aActions.GetItemId(i));
+ }
+ }
+ OnSelectHdl(NULL);
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//-----------------------------------------------------------------------
+void OAddFieldWindow::Resize()
+{
+ FloatingWindow::Resize();
+
+ const Size aWindowSize( GetOutputSizePixel() );
+
+
+ const Size aRelated(LogicToPixel( Size( RELATED_CONTROLS, RELATED_CONTROLS ), MAP_APPFONT ));
+ const Size aFixedTextSize(LogicToPixel( Size( FIXEDTEXT_WIDTH, FIXEDTEXT_HEIGHT ), MAP_APPFONT ));
+
+ // ToolBar
+ Size aToolbarSize( m_aActions.GetSizePixel() );
+ Point aToolbarPos( aRelated.Width(), aRelated.Height());
+ m_aActions.SetPosPixel(Point(aToolbarPos.X(), aToolbarPos.Y()));
+
+ Size aLBSize( aWindowSize );
+ aLBSize.Width() -= ( 2 * aRelated.Width() );
+
+ // help text
+ const Size aHelpTextSize = m_aHelpText.CalcMinimumSize(aLBSize.Width());
+
+ // ListBox
+ Point aLBPos( aRelated.Width(), aRelated.Height() + aToolbarSize.Height() + aRelated.Height() );
+
+ aLBSize.Height() -= aToolbarSize.Height(); // Toolbar
+ aLBSize.Height() -= (6*aRelated.Height()); // 6 * gap
+ aLBSize.Height() -= aFixedTextSize.Height(); // fixed line
+ aLBSize.Height() -= aHelpTextSize.Height(); // help text
+ m_pListBox->SetPosSizePixel( aLBPos, aLBSize );
+
+ // FixedLine
+ Size aFLSize( aLBSize.Width(),aFixedTextSize.Height() );
+ Point aFLPos( aRelated.Width(), aLBPos.Y() + aLBSize.Height() + aRelated.Height());
+ m_aFixedLine.SetPosSizePixel( aFLPos, aFLSize );
+
+ // Help text
+ Point aFTPos( aRelated.Width(), aFLPos.Y() + aFLSize.Height() + aRelated.Height() );
+ m_aHelpText.SetPosSizePixel( aFTPos, aHelpTextSize );
+}
+// -----------------------------------------------------------------------------
+uno::Reference< sdbc::XConnection> OAddFieldWindow::getConnection() const
+{
+ return uno::Reference< sdbc::XConnection>(m_xRowSet->getPropertyValue( PROPERTY_ACTIVECONNECTION ),uno::UNO_QUERY);
+}
+// -----------------------------------------------------------------------------
+void OAddFieldWindow::fillDescriptor(SvLBoxEntry* _pSelected,::svx::ODataAccessDescriptor& _rDescriptor)
+{
+ if ( _pSelected && m_xColumns.is() )
+ {
+ uno::Reference<container::XChild> xChild(getConnection(),uno::UNO_QUERY);
+ if ( xChild.is( ) )
+ {
+ uno::Reference<sdb::XDocumentDataSource> xDocument( xChild->getParent(), uno::UNO_QUERY );
+ if ( xDocument.is() )
+ {
+ uno::Reference<frame::XModel> xModel(xDocument->getDatabaseDocument(),uno::UNO_QUERY);
+ if ( xModel.is() )
+ _rDescriptor[ daDatabaseLocation ] <<= xModel->getURL();
+ } // if ( xDocument.is() )
+ }
+
+ _rDescriptor[ ::svx::daCommand ] <<= GetCommand();
+ _rDescriptor[ ::svx::daCommandType ] <<= GetCommandType();
+ _rDescriptor[ ::svx::daEscapeProcessing ] <<= GetEscapeProcessing();
+ _rDescriptor[ ::svx::daConnection ] <<= getConnection();
+
+ ::rtl::OUString sColumnName = m_pListBox->GetEntryText( _pSelected );
+ _rDescriptor[ ::svx::daColumnName ] <<= sColumnName;
+ if ( m_xColumns->hasByName( sColumnName ) )
+ _rDescriptor[ ::svx::daColumnObject ] <<= m_xColumns->getByName(sColumnName);
+ }
+}
+// -----------------------------------------------------------------------------
+void OAddFieldWindow::_elementInserted( const container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( m_pListBox.get() )
+ {
+ ::rtl::OUString sName;
+ if ( _rEvent.Accessor >>= sName )
+ m_pListBox->InsertEntry(sName);
+ }
+}
+// -----------------------------------------------------------------------------
+void OAddFieldWindow::_elementRemoved( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( m_pListBox.get() )
+ {
+ m_pListBox->Clear();
+ if ( m_xColumns.is() )
+ lcl_addToList( *m_pListBox, m_xColumns->getElementNames() );
+ }
+}
+// -----------------------------------------------------------------------------
+void OAddFieldWindow::_elementReplaced( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
+{
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( OAddFieldWindow, OnSelectHdl, void* ,/*_pAddFieldDlg*/)
+{
+ m_aActions.EnableItem(SID_ADD_CONTROL_PAIR, ( m_pListBox.get() && m_pListBox->GetSelectionCount() > 0 ));
+
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( OAddFieldWindow, OnDoubleClickHdl, void* ,/*_pAddFieldDlg*/)
+{
+ if ( m_aCreateLink.IsSet() )
+ m_aCreateLink.Call(this);
+
+ return 0L;
+}
+//------------------------------------------------------------------------------
+ImageList OAddFieldWindow::getImageList(sal_Int16 _eBitmapSet,sal_Bool _bHiContast) const
+{
+ sal_Int16 nN = IMG_ADDFIELD_DLG_SC;
+ sal_Int16 nH = IMG_ADDFIELD_DLG_SCH;
+ if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE )
+ {
+ nN = IMG_ADDFIELD_DLG_LC;
+ nH = IMG_ADDFIELD_DLG_LCH;
+ }
+ return ImageList(ModuleRes( _bHiContast ? nH : nN ));
+}
+//------------------------------------------------------------------
+void OAddFieldWindow::resizeControls(const Size& _rDiff)
+{
+ // we use large images so we must change them
+ if ( _rDiff.Width() || _rDiff.Height() )
+ {
+ Invalidate();
+ }
+}
+//------------------------------------------------------------------
+IMPL_LINK( OAddFieldWindow, OnSortAction, ToolBox*, /*NOTINTERESTEDIN*/ )
+{
+ const USHORT nCurItem = m_aActions.GetCurItemId();
+ if ( SID_ADD_CONTROL_PAIR == nCurItem )
+ OnDoubleClickHdl(NULL);
+ else
+ {
+ if ( SID_FM_REMOVE_FILTER_SORT == nCurItem || !m_aActions.IsItemChecked(nCurItem) )
+ {
+ const USHORT nItemCount = m_aActions.GetItemCount();
+ for (USHORT j = 0; j< nItemCount; ++j)
+ {
+ const USHORT nItemId = m_aActions.GetItemId(j);
+ if ( nCurItem != nItemId )
+ m_aActions.CheckItem(nItemId,FALSE);
+ }
+ SvSortMode eSortMode = SortNone;
+ if ( SID_FM_REMOVE_FILTER_SORT != nCurItem )
+ {
+ m_aActions.CheckItem(nCurItem,!m_aActions.IsItemChecked(nCurItem));
+ if ( m_aActions.IsItemChecked(SID_FM_SORTUP) )
+ eSortMode = SortAscending;
+ else if ( m_aActions.IsItemChecked(SID_FM_SORTDOWN) )
+ eSortMode = SortDescending;
+ } // if ( SID_FM_REMOVE_FILTER_SORT != nCurItem )
+
+ m_pListBox->GetModel()->SetSortMode(eSortMode);
+ if ( SID_FM_REMOVE_FILTER_SORT == nCurItem )
+ Update();
+
+ m_pListBox->GetModel()->Resort();
+ }
+ }
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+// =============================================================================
+} // namespace rptui
+// =============================================================================
+
diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx
new file mode 100644
index 000000000000..d3617749d10b
--- /dev/null
+++ b/reportdesign/source/ui/dlg/CondFormat.cxx
@@ -0,0 +1,625 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_reportdesign.hxx"
+
+#include "CondFormat.hxx"
+#include "CondFormat.hrc"
+
+#include "uistrings.hrc"
+#include "RptResId.hrc"
+#include "rptui_slotid.hrc"
+#include "ModuleHelper.hxx"
+#include "helpids.hrc"
+#include "UITools.hxx"
+#include "uistrings.hrc"
+#include "ReportController.hxx"
+#include "Condition.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+/** === end UNO includes === **/
+
+#include <svx/globlmn.hrc>
+#include <svx/svxids.hrc>
+
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <vcl/msgbox.hxx>
+
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <comphelper/property.hxx>
+
+#include <algorithm>
+#include "UndoActions.hxx"
+
+// .............................................................................
+namespace rptui
+{
+// .............................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::uno::Any;
+ /** === end UNO using === **/
+ using namespace ::com::sun::star::report;
+
+ //========================================================================
+ // UpdateLocker
+ //========================================================================
+ class UpdateLocker
+ {
+ Window& m_rWindow;
+
+ public:
+ UpdateLocker( Window& _rWindow )
+ :m_rWindow( _rWindow )
+ {
+ _rWindow.SetUpdateMode( FALSE );
+ }
+ ~UpdateLocker()
+ {
+ m_rWindow.SetUpdateMode( TRUE );
+ }
+ };
+
+ //========================================================================
+ // class ConditionalFormattingDialog
+ //========================================================================
+ DBG_NAME(rpt_ConditionalFormattingDialog)
+ ConditionalFormattingDialog::ConditionalFormattingDialog(
+ Window* _pParent, const Reference< XReportControlModel >& _rxFormatConditions, ::rptui::OReportController& _rController )
+ :ModalDialog( _pParent, ModuleRes(RID_CONDFORMAT) )
+ ,m_aConditionPlayground( this, ModuleRes( WND_COND_PLAYGROUND ) )
+ ,m_aSeparator(this, ModuleRes(FL_SEPARATOR1))
+ ,m_aPB_OK(this, ModuleRes(PB_OK))
+ ,m_aPB_CANCEL(this, ModuleRes(PB_CANCEL))
+ ,m_aPB_Help(this, ModuleRes(PB_HELP))
+ ,m_aCondScroll( this, ModuleRes( SB_ALL_CONDITIONS ) )
+ ,m_rController( _rController )
+ ,m_xFormatConditions( _rxFormatConditions )
+ ,m_bDeletingCondition( false )
+ {
+ DBG_CTOR(rpt_ConditionalFormattingDialog,NULL);
+ OSL_ENSURE( m_xFormatConditions.is(), "ConditionalFormattingDialog::ConditionalFormattingDialog: ReportControlModel is NULL -> Prepare for GPF!" );
+
+ m_xCopy.set( m_xFormatConditions->createClone(), UNO_QUERY_THROW );
+
+ m_aCondScroll.SetScrollHdl( LINK( this, ConditionalFormattingDialog, OnScroll ) );
+
+ impl_initializeConditions();
+
+ FreeResource();
+ }
+
+ //------------------------------------------------------------------------
+ ConditionalFormattingDialog::~ConditionalFormattingDialog()
+ {
+ m_aConditions.clear();
+ DBG_DTOR(rpt_ConditionalFormattingDialog,NULL);
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_updateConditionIndicies()
+ {
+ sal_Int32 nIndex = 0;
+ for ( Conditions::const_iterator cond = m_aConditions.begin();
+ cond != m_aConditions.end();
+ ++cond, ++nIndex
+ )
+ {
+ (*cond)->setConditionIndex( nIndex, impl_getConditionCount() );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_conditionCountChanged()
+ {
+ if ( m_aConditions.empty() )
+ impl_addCondition_nothrow( 0 );
+
+ impl_updateScrollBarRange();
+ impl_updateConditionIndicies();
+ impl_layoutAll();
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::addCondition( size_t _nAddAfterIndex )
+ {
+ OSL_PRECOND( _nAddAfterIndex < impl_getConditionCount(), "ConditionalFormattingDialog::addCondition: illegal condition index!" );
+ impl_addCondition_nothrow( _nAddAfterIndex + 1 );
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::deleteCondition( size_t _nCondIndex )
+ {
+ impl_deleteCondition_nothrow( _nCondIndex );
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_addCondition_nothrow( size_t _nNewCondIndex )
+ {
+ UpdateLocker aLockUpdates( *this );
+
+ try
+ {
+ if ( _nNewCondIndex > (size_t)m_xCopy->getCount() )
+ throw IllegalArgumentException();
+
+ Reference< XFormatCondition > xCond = m_xCopy->createFormatCondition();
+ ::comphelper::copyProperties(m_xCopy.get(),xCond.get());
+ m_xCopy->insertByIndex( _nNewCondIndex, makeAny( xCond ) );
+
+ ConditionPtr pCon( new Condition( &m_aConditionPlayground, *this, m_rController ) );
+ pCon->setCondition( xCond );
+ m_aConditions.insert( m_aConditions.begin() + _nNewCondIndex, pCon );
+
+ pCon->SetPosSizePixel( 0, 0, impl_getConditionWidth(), 0, WINDOW_POSSIZE_WIDTH );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ impl_conditionCountChanged();
+
+ impl_ensureConditionVisible( _nNewCondIndex );
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_focusCondition( size_t _nCondIndex )
+ {
+ OSL_PRECOND( _nCondIndex < impl_getConditionCount(),
+ "ConditionalFormattingDialog::impl_focusCondition: illegal index!" );
+
+ impl_ensureConditionVisible( _nCondIndex );
+ m_aConditions[ _nCondIndex ]->GrabFocus();
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_deleteCondition_nothrow( size_t _nCondIndex )
+ {
+ UpdateLocker aLockUpdates( *this );
+
+ OSL_PRECOND( _nCondIndex < impl_getConditionCount(),
+ "ConditionalFormattingDialog::impl_deleteCondition_nothrow: illegal index!" );
+
+ bool bLastCondition = ( impl_getConditionCount() == 1 );
+
+ bool bSetNewFocus = false;
+ size_t nNewFocusIndex( _nCondIndex );
+ try
+ {
+ if ( !bLastCondition )
+ m_xCopy->removeByIndex( _nCondIndex );
+
+ Conditions::iterator pos = m_aConditions.begin() + _nCondIndex;
+ if ( bLastCondition )
+ {
+ Reference< XFormatCondition > xFormatCondition( m_xCopy->getByIndex( 0 ), UNO_QUERY_THROW );
+ xFormatCondition->setFormula( ::rtl::OUString() );
+ (*pos)->setCondition( xFormatCondition );
+ }
+ else
+ {
+ bSetNewFocus = (*pos)->HasChildPathFocus();
+ m_bDeletingCondition = true;
+ m_aConditions.erase( pos );
+ m_bDeletingCondition = false;
+ }
+
+ if ( bSetNewFocus )
+ {
+ if ( nNewFocusIndex >= impl_getConditionCount() )
+ nNewFocusIndex = impl_getConditionCount() - 1;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ impl_conditionCountChanged();
+ if ( bSetNewFocus )
+ impl_focusCondition( nNewFocusIndex );
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_moveCondition_nothrow( size_t _nCondIndex, bool _bMoveUp )
+ {
+ size_t nOldConditionIndex( _nCondIndex );
+ size_t nNewConditionIndex( _bMoveUp ? _nCondIndex - 1 : _nCondIndex + 1 );
+
+ // do this in two steps, so we don't become inconsistent if any of the UNO actions fails
+ Any aMovedCondition;
+ ConditionPtr pMovedCondition;
+ try
+ {
+ aMovedCondition = m_xCopy->getByIndex( (sal_Int32)nOldConditionIndex );
+ m_xCopy->removeByIndex( (sal_Int32)nOldConditionIndex );
+
+ Conditions::iterator aRemovePos( m_aConditions.begin() + nOldConditionIndex );
+ pMovedCondition = *aRemovePos;
+ m_aConditions.erase( aRemovePos );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ return;
+ }
+
+ try
+ {
+ m_xCopy->insertByIndex( (sal_Int32)nNewConditionIndex, aMovedCondition );
+ m_aConditions.insert( m_aConditions.begin() + nNewConditionIndex, pMovedCondition );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // at least the two swapped conditions need to know their new index
+ impl_updateConditionIndicies();
+
+ // re-layout all conditions
+ Point aDummy;
+ impl_layoutConditions( aDummy );
+
+ // ensure the moved condition is visible
+ impl_ensureConditionVisible( nNewConditionIndex );
+ }
+
+ // -----------------------------------------------------------------------------
+ long ConditionalFormattingDialog::impl_getConditionWidth() const
+ {
+ const Size aDialogSize( GetOutputSizePixel() );
+ const Size aScrollBarWidth( LogicToPixel( Size( SCROLLBAR_WIDTH + UNRELATED_CONTROLS, 0 ), MAP_APPFONT ) );
+ return aDialogSize.Width() - aScrollBarWidth.Width();
+ }
+
+ // -----------------------------------------------------------------------------
+ IMPL_LINK( ConditionalFormattingDialog, OnScroll, ScrollBar*, /*_pNotInterestedIn*/ )
+ {
+ size_t nFirstCondIndex( impl_getFirstVisibleConditionIndex() );
+ size_t nFocusCondIndex = impl_getFocusedConditionIndex( nFirstCondIndex );
+
+ Point aDummy;
+ impl_layoutConditions( aDummy );
+
+ if ( nFocusCondIndex < nFirstCondIndex )
+ impl_focusCondition( nFirstCondIndex );
+ else if ( nFocusCondIndex >= nFirstCondIndex + MAX_CONDITIONS )
+ impl_focusCondition( nFirstCondIndex + MAX_CONDITIONS - 1 );
+
+ return 0;
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_layoutConditions( Point& _out_rBelowLastVisible )
+ {
+ // position the condition's playground
+ long nConditionWidth = impl_getConditionWidth();
+ long nConditionHeight = LogicToPixel( Size( 0, CONDITION_HEIGHT ), MAP_APPFONT ).Height();
+ size_t nVisibleConditions = ::std::min( impl_getConditionCount(), MAX_CONDITIONS );
+ Size aPlaygroundSize( nConditionWidth, nVisibleConditions * nConditionHeight );
+ m_aConditionPlayground.SetSizePixel( aPlaygroundSize );
+ _out_rBelowLastVisible = Point( 0, aPlaygroundSize.Height() );
+
+ // position the single conditions
+ Point aConditionPos( 0, -1 * nConditionHeight * impl_getFirstVisibleConditionIndex() );
+ for ( Conditions::const_iterator cond = m_aConditions.begin();
+ cond != m_aConditions.end();
+ ++cond
+ )
+ {
+ (*cond)->SetPosSizePixel( aConditionPos.X(), aConditionPos.Y(), nConditionWidth, nConditionHeight );
+ aConditionPos.Move( 0, nConditionHeight );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_layoutAll()
+ {
+ // condition's positions
+ Point aPos;
+ impl_layoutConditions( aPos );
+
+ // scrollbar size and visibility
+ m_aCondScroll.SetPosSizePixel( 0, 0, 0, aPos.Y(), WINDOW_POSSIZE_HEIGHT );
+ if ( !impl_needScrollBar() )
+ // normalize the position, so it can, in all situations, be used as top index
+ m_aCondScroll.SetThumbPos( 0 );
+
+ // the separator and the buttons below it
+ aPos += LogicToPixel( Point( 0 , RELATED_CONTROLS ), MAP_APPFONT );
+ m_aSeparator.SetPosSizePixel( 0, aPos.Y(), 0, 0, WINDOW_POSSIZE_Y );
+
+ aPos += LogicToPixel( Point( 0 , UNRELATED_CONTROLS ), MAP_APPFONT );
+ Window* pWindows[] = { &m_aPB_OK, &m_aPB_CANCEL, &m_aPB_Help };
+ for ( size_t i= 0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i )
+ {
+ pWindows[i]->SetPosSizePixel( 0, aPos.Y(), 0, 0, WINDOW_POSSIZE_Y );
+ }
+
+ aPos += LogicToPixel( Point( 0, BUTTON_HEIGHT + RELATED_CONTROLS ), MAP_APPFONT );
+ SetPosSizePixel( 0, 0, 0, aPos.Y(), WINDOW_POSSIZE_HEIGHT );
+ }
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_initializeConditions()
+ {
+ try
+ {
+ sal_Int32 nCount = m_xCopy->getCount();
+ for ( sal_Int32 i = 0; i < nCount ; ++i )
+ {
+ ConditionPtr pCon( new Condition( &m_aConditionPlayground, *this, m_rController ) );
+ Reference< XFormatCondition > xCond( m_xCopy->getByIndex(i), UNO_QUERY );
+ pCon->setCondition( xCond );
+ pCon->updateToolbar( xCond.get() );
+ m_aConditions.push_back( pCon );
+ }
+ }
+ catch(Exception&)
+ {
+ OSL_ENSURE(0,"Can not access format condition!");
+ }
+
+ impl_conditionCountChanged();
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::applyCommand( size_t _nCondIndex, USHORT _nCommandId, const ::Color _aColor )
+ {
+ OSL_PRECOND( _nCommandId, "ConditionalFormattingDialog::applyCommand: illegal command id!" );
+ try
+ {
+ Reference< XReportControlFormat > xReportControlFormat( m_xCopy->getByIndex( _nCondIndex ), UNO_QUERY_THROW );
+
+ Sequence< PropertyValue > aArgs(3);
+
+ aArgs[0].Name = REPORTCONTROLFORMAT;
+ aArgs[0].Value <<= xReportControlFormat;
+
+ aArgs[1].Name = CURRENT_WINDOW;
+ aArgs[1].Value <<= VCLUnoHelper::GetInterface(this);
+
+ aArgs[2].Name = PROPERTY_FONTCOLOR;
+ aArgs[2].Value <<= (sal_uInt32)_aColor.GetColor();
+
+ // we use this way to create undo actions
+ m_rController.executeUnChecked(_nCommandId,aArgs);
+ m_aConditions[ _nCondIndex ]->updateToolbar(xReportControlFormat);
+ }
+ catch( Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::moveConditionUp( size_t _nCondIndex )
+ {
+ OSL_PRECOND( _nCondIndex > 0, "ConditionalFormattingDialog::moveConditionUp: cannot move up the first condition!" );
+ if ( _nCondIndex > 0 )
+ impl_moveCondition_nothrow( _nCondIndex, true );
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::moveConditionDown( size_t _nCondIndex )
+ {
+ OSL_PRECOND( _nCondIndex < impl_getConditionCount(), "ConditionalFormattingDialog::moveConditionDown: cannot move down the last condition!" );
+ if ( _nCondIndex < impl_getConditionCount() )
+ impl_moveCondition_nothrow( _nCondIndex, false );
+ }
+
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString ConditionalFormattingDialog::getDataField() const
+ {
+ ::rtl::OUString sDataField;
+ try
+ {
+ sDataField = m_xFormatConditions->getDataField();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sDataField;
+ }
+
+ // -----------------------------------------------------------------------------
+ short ConditionalFormattingDialog::Execute()
+ {
+ short nRet = ModalDialog::Execute();
+ if ( nRet == RET_OK )
+ {
+ String sUndoAction( ModuleRes( RID_STR_UNDO_CONDITIONAL_FORMATTING ) );
+ UndoManagerListAction aListAction(*m_rController.getUndoMgr(),sUndoAction);
+ try
+ {
+ sal_Int32 j(0), i(0);;
+ for ( Conditions::const_iterator cond = m_aConditions.begin();
+ cond != m_aConditions.end();
+ ++cond, ++i
+ )
+ {
+ Reference< XFormatCondition > xCond( m_xCopy->getByIndex(i), UNO_QUERY_THROW );
+ (*cond)->fillFormatCondition( xCond );
+
+ if ( (*cond)->isEmpty() )
+ continue;
+
+ Reference< XFormatCondition > xNewCond;
+ sal_Bool bAppend = j >= m_xFormatConditions->getCount();
+ if ( bAppend )
+ {
+ xNewCond = m_xFormatConditions->createFormatCondition();
+ m_xFormatConditions->insertByIndex( i, makeAny( xNewCond ) );
+ }
+ else
+ xNewCond.set( m_xFormatConditions->getByIndex(j), UNO_QUERY );
+ ++j;
+
+ ::comphelper::copyProperties(xCond.get(),xNewCond.get());
+ }
+
+ for ( sal_Int32 k = m_xFormatConditions->getCount()-1; k >= j; --k )
+ m_xFormatConditions->removeByIndex(k);
+
+ ::comphelper::copyProperties( m_xCopy.get(), m_xFormatConditions.get() );
+ }
+ catch ( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ nRet = RET_NO;
+ }
+ }
+ return nRet;
+ }
+
+ // -----------------------------------------------------------------------------
+ long ConditionalFormattingDialog::PreNotify( NotifyEvent& _rNEvt )
+ {
+ switch ( _rNEvt.GetType() )
+ {
+ case EVENT_KEYINPUT:
+ {
+ const KeyEvent* pKeyEvent( _rNEvt.GetKeyEvent() );
+ const KeyCode& rKeyCode = pKeyEvent->GetKeyCode();
+ if ( rKeyCode.IsMod1() && rKeyCode.IsMod2() )
+ {
+ if ( rKeyCode.GetCode() == 0x0508 ) // -
+ {
+ impl_deleteCondition_nothrow( impl_getFocusedConditionIndex( 0 ) );
+ return 1;
+ }
+ if ( rKeyCode.GetCode() == 0x0507 ) // +
+ {
+ impl_addCondition_nothrow( impl_getFocusedConditionIndex( impl_getConditionCount() - 1 ) + 1 );
+ return 1;
+ }
+ }
+ }
+ break;
+ case EVENT_GETFOCUS:
+ {
+ if ( m_bDeletingCondition )
+ break;
+
+ const Window* pGetFocusWindow( _rNEvt.GetWindow() );
+
+ // determine whether the new focus window is part of an (currently invisible) condition
+ const Window* pConditionCandidate = pGetFocusWindow->GetParent();
+ const Window* pPlaygroundCandidate = pConditionCandidate ? pConditionCandidate->GetParent() : NULL;
+ while ( ( pPlaygroundCandidate )
+ && ( pPlaygroundCandidate != this )
+ && ( pPlaygroundCandidate != &m_aConditionPlayground )
+ )
+ {
+ pConditionCandidate = pConditionCandidate->GetParent();
+ pPlaygroundCandidate = pConditionCandidate ? pConditionCandidate->GetParent() : NULL;
+ }
+ if ( pPlaygroundCandidate == &m_aConditionPlayground )
+ {
+ impl_ensureConditionVisible( dynamic_cast< const Condition& >( *pConditionCandidate ).getConditionIndex() );
+ }
+ }
+ break;
+ }
+
+ return ModalDialog::PreNotify( _rNEvt );
+ }
+
+ // -----------------------------------------------------------------------------
+ size_t ConditionalFormattingDialog::impl_getFirstVisibleConditionIndex() const
+ {
+ return (size_t)m_aCondScroll.GetThumbPos();
+ }
+
+ // -----------------------------------------------------------------------------
+ size_t ConditionalFormattingDialog::impl_getLastVisibleConditionIndex() const
+ {
+ return ::std::min( impl_getFirstVisibleConditionIndex() + MAX_CONDITIONS, impl_getConditionCount() ) - 1;
+ }
+
+ // -----------------------------------------------------------------------------
+ size_t ConditionalFormattingDialog::impl_getFocusedConditionIndex( sal_Int32 _nFallBackIfNone ) const
+ {
+ size_t nIndex( 0 );
+ for ( Conditions::const_iterator cond = m_aConditions.begin();
+ cond != m_aConditions.end();
+ ++cond, ++nIndex
+ )
+ {
+ if ( (*cond)->HasChildPathFocus() )
+ return nIndex;
+ }
+ return _nFallBackIfNone;
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_updateScrollBarRange()
+ {
+ long nMax = ( impl_getConditionCount() > MAX_CONDITIONS ) ? impl_getConditionCount() - MAX_CONDITIONS + 1 : 0;
+
+ m_aCondScroll.SetRangeMin( 0 );
+ m_aCondScroll.SetRangeMax( nMax );
+ m_aCondScroll.SetVisibleSize( 1 );
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_scrollTo( size_t _nTopCondIndex )
+ {
+ OSL_PRECOND( _nTopCondIndex + MAX_CONDITIONS <= impl_getConditionCount(),
+ "ConditionalFormattingDialog::impl_scrollTo: illegal index!" );
+ m_aCondScroll.SetThumbPos( _nTopCondIndex );
+ OnScroll( &m_aCondScroll );
+ }
+
+ // -----------------------------------------------------------------------------
+ void ConditionalFormattingDialog::impl_ensureConditionVisible( size_t _nCondIndex )
+ {
+ OSL_PRECOND( _nCondIndex < impl_getConditionCount(),
+ "ConditionalFormattingDialog::impl_ensureConditionVisible: illegal index!" );
+
+ if ( _nCondIndex < impl_getFirstVisibleConditionIndex() )
+ impl_scrollTo( _nCondIndex );
+ else if ( _nCondIndex > impl_getLastVisibleConditionIndex() )
+ impl_scrollTo( _nCondIndex - MAX_CONDITIONS + 1 );
+ }
+
+// .............................................................................
+} // rptui
+// .............................................................................
diff --git a/reportdesign/source/ui/dlg/CondFormat.hrc b/reportdesign/source/ui/dlg/CondFormat.hrc
new file mode 100644
index 000000000000..89e0e1b88246
--- /dev/null
+++ b/reportdesign/source/ui/dlg/CondFormat.hrc
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * 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 RPTUI_CONDFORMAT_HRC
+#define RPTUI_CONDFORMAT_HRC
+
+#define CHECKBOX_HEIGHT 8
+#define FIXEDTEXT_WIDTH 60
+#define FIXEDTEXT_HEIGHT 8
+#define EDIT_WIDTH 75
+#define RELATED_CONTROLS 4
+#define UNRELATED_CONTROLS 7
+#define EDIT_HEIGHT 12
+#define BUTTON_HEIGHT 14
+#define BUTTON_WIDTH 50
+#define COND_TYPE_WIDTH 50
+#define COND_OP_WIDTH 75
+#define OPERATOR_SEP_WIDTH 15
+#define SCROLLBAR_WIDTH 8
+#define IMAGE_BUTTON_WIDTH 12
+#define IMAGE_BUTTON_HEIGHT 14
+
+
+#define FL_FORMAT 1
+#define FL_CONDITION_HEADER 2
+#define CRTL_FORMAT_PREVIEW 3
+#define TB_FORMAT 4
+#define LB_COND_TYPE 5
+#define LB_OP 6
+#define ED_CONDITION_LHS 7
+#define FT_AND 8
+#define PB_OK 9
+#define PB_CANCEL 10
+#define PB_HELP 11
+#define FL_SEPARATOR1 12
+#define ED_CONDITION_RHS 13
+#define CT_CONDITION 14
+#define CT_DEFAULT 15
+#define CT_CONDITION_1 16
+#define CT_CONDITION_2 17
+#define SB_ALL_CONDITIONS 18
+#define WND_COND_PLAYGROUND 19
+#define BTN_MOVE_UP 20
+#define BTN_MOVE_DOWN 21
+#define BTN_ADD_CONDITION 22
+#define BTN_REMOVE_CONDITION 23
+#define IMG_MOVE_UP_HC 24
+#define IMG_MOVE_DOWN_HC 25
+
+#define ROW_0_POS ( RELATED_CONTROLS )
+#define ROW_0_HEIGTH ( FIXEDTEXT_HEIGHT )
+#define ROW_1_POS ( ROW_0_POS + ROW_0_HEIGTH + UNRELATED_CONTROLS )
+#define ROW_1_HEIGTH ( EDIT_HEIGHT )
+#define ROW_2_POS ( ROW_1_POS + ROW_1_HEIGTH + UNRELATED_CONTROLS )
+#define ROW_2_HEIGHT ( 3 * FIXEDTEXT_HEIGHT )
+#define ROW_3_POS ( ROW_2_POS + ROW_2_HEIGHT + RELATED_CONTROLS )
+#define ROW_3_HEIGHT ( IMAGE_BUTTON_HEIGHT )
+
+#define CONDITION_WIDTH ( 6*UNRELATED_CONTROLS + COND_TYPE_WIDTH + COND_OP_WIDTH + 2*EDIT_WIDTH + OPERATOR_SEP_WIDTH )
+#define COND_DLG_WIDTH ( CONDITION_WIDTH + SCROLLBAR_WIDTH + UNRELATED_CONTROLS )
+#define CONDITION_HEIGHT ( ROW_3_POS + ROW_3_HEIGHT )
+#define COND_DLG_HEIGHT ( CONDITION_HEIGHT + 3*RELATED_CONTROLS + BUTTON_HEIGHT + 1 )
+
+#endif // RPTUI_PAGENUMBER_HRC
diff --git a/reportdesign/source/ui/dlg/CondFormat.src b/reportdesign/source/ui/dlg/CondFormat.src
new file mode 100644
index 000000000000..14fe6649aff1
--- /dev/null
+++ b/reportdesign/source/ui/dlg/CondFormat.src
@@ -0,0 +1,445 @@
+/*************************************************************************
+ *
+ * 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 "CondFormat.hrc"
+#include "RptResId.hrc"
+#include "helpids.hrc"
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#include "rptui_slotid.hrc"
+
+Control WIN_CONDITION
+{
+ Size = MAP_APPFONT ( CONDITION_WIDTH , CONDITION_HEIGHT ) ;
+ HelpId = HID_RPT_COND_DLG;
+ DialogControl = TRUE;
+ Hide = TRUE;
+
+ FixedLine FL_CONDITION_HEADER
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS, ROW_0_POS ) ;
+ Size = MAP_APPFONT ( CONDITION_WIDTH - 2 * RELATED_CONTROLS, ROW_0_HEIGTH ) ;
+ };
+
+ ListBox LB_COND_TYPE
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS, ROW_1_POS ) ;
+ Size = MAP_APPFONT( COND_TYPE_WIDTH, 60 );
+ Border = TRUE;
+ DropDown = TRUE;
+ TabStop = TRUE;
+ Sort = FALSE;
+ StringList [ en-US ] =
+ {
+ < "Field Value Is" ; Default ; > ;
+ < "Expression Is" ; Default ; > ;
+ };
+ };
+
+ ListBox LB_OP
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS + COND_TYPE_WIDTH + UNRELATED_CONTROLS, ROW_1_POS ) ;
+ Size = MAP_APPFONT( COND_OP_WIDTH, 60 );
+ Border = TRUE;
+ DropDown = TRUE;
+ TabStop = TRUE;
+ Sort = FALSE;
+ StringList [ en-US ] =
+ {
+ < "between" ; 0; > ;
+ < "not between" ; 1; > ;
+ < "equal to" ; 2; > ;
+ < "not equal to" ; 3; > ;
+ < "greater than" ; 4; > ;
+ < "less than" ; 5; > ;
+ < "greater than or equal to" ; 6; > ;
+ < "less than or equal to" ; 7; > ;
+ };
+ };
+
+ Edit ED_CONDITION_LHS
+ {
+ Pos = MAP_APPFONT ( 3*UNRELATED_CONTROLS + COND_TYPE_WIDTH + COND_OP_WIDTH, ROW_1_POS ) ;
+ Size = MAP_APPFONT( EDIT_WIDTH, EDIT_HEIGHT );
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+
+ FixedText FT_AND
+ {
+ Pos = MAP_APPFONT ( 4*UNRELATED_CONTROLS + COND_TYPE_WIDTH + COND_OP_WIDTH + EDIT_WIDTH,
+ ROW_1_POS + ( FIXEDTEXT_HEIGHT - EDIT_HEIGHT ) / 2 );
+ Size = MAP_APPFONT( OPERATOR_SEP_WIDTH , FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "and";
+ };
+
+ Edit ED_CONDITION_RHS
+ {
+ Pos = MAP_APPFONT ( 5*UNRELATED_CONTROLS + COND_TYPE_WIDTH + COND_OP_WIDTH + EDIT_WIDTH + OPERATOR_SEP_WIDTH,
+ ROW_1_POS );
+ Size = MAP_APPFONT( EDIT_WIDTH, EDIT_HEIGHT );
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+
+ ImageButton BTN_MOVE_UP
+ {
+ Pos = MAP_APPFONT ( CONDITION_WIDTH - UNRELATED_CONTROLS - IMAGE_BUTTON_WIDTH, ROW_1_POS ) ;
+ Size = MAP_APPFONT ( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Symbol = IMAGEBUTTON_ARROW_UP ;
+ };
+
+ ImageButton BTN_MOVE_DOWN
+ {
+ Pos = MAP_APPFONT ( CONDITION_WIDTH - UNRELATED_CONTROLS - IMAGE_BUTTON_WIDTH, ROW_1_POS + IMAGE_BUTTON_HEIGHT + RELATED_CONTROLS ) ;
+ Size = MAP_APPFONT ( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Symbol = IMAGEBUTTON_ARROW_DOWN ;
+ };
+
+ ToolBox TB_FORMAT
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS + RELATED_CONTROLS, ROW_2_POS ) ;
+ ButtonType = BUTTON_SYMBOL;
+ Align = BOXALIGN_TOP;
+ HelpId = HID_RPT_CONDFORMAT_TB;
+ Customize = FALSE;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_WEIGHT
+ Checkable = TRUE;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_POSTURE
+ Checkable = TRUE;
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_UNDERLINE
+ Checkable = TRUE;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR;
+ };
+ ToolBoxItem
+ {
+ ITEM_TOOLBAR_BACKGROUND_COLOR
+ DropDown = TRUE;
+ };
+ ToolBoxItem
+ {
+ ITEM_TOOLBAR_ATTR_CHAR_COLOR
+ Identifier = SID_ATTR_CHAR_COLOR2;
+ Command = ".uno:FontColor";
+ };
+ ToolBoxItem
+ {
+ ITEM_FORMAT_CHAR_DLG
+ };
+ };
+ };
+
+ Window CRTL_FORMAT_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 2*UNRELATED_CONTROLS, ROW_2_POS ) ;
+ Size = MAP_APPFONT ( CONDITION_WIDTH - UNRELATED_CONTROLS, ROW_2_HEIGHT ) ;
+ Border = TRUE ;
+ HelpId = HID_RPT_CRTL_FORMAT_PREVIEW;
+ Text [ en-US ] = "Example";
+ };
+
+ PushButton BTN_ADD_CONDITION
+ {
+ Pos = MAP_APPFONT( CONDITION_WIDTH - 2*UNRELATED_CONTROLS - 2*IMAGE_BUTTON_WIDTH - RELATED_CONTROLS, ROW_3_POS );
+ Size = MAP_APPFONT( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT );
+ Text = "+";
+ };
+
+ PushButton BTN_REMOVE_CONDITION
+ {
+ Pos = MAP_APPFONT( CONDITION_WIDTH - 2*UNRELATED_CONTROLS - 2*IMAGE_BUTTON_WIDTH - RELATED_CONTROLS, ROW_3_POS );
+ Size = MAP_APPFONT( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT );
+ Text = "-";
+ };
+
+ Image IMG_MOVE_UP_HC
+ {
+ ImageBitmap = Bitmap { File = "arrow_move_up_hc" ; };
+ };
+
+ Image IMG_MOVE_DOWN_HC
+ {
+ ImageBitmap = Bitmap { File = "arrow_move_down_hc" ; };
+ };
+};
+
+ModalDialog RID_CONDFORMAT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( COND_DLG_WIDTH, COND_DLG_HEIGHT ) ;
+ Text [ en-US ] = "Conditional Formatting" ;
+ HelpId = HID_RPT_CONDFORMAT_DLG;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ Window WND_COND_PLAYGROUND
+ {
+ Pos = MAP_APPFONT ( 0, 0 ) ;
+ Size = MAP_APPFONT ( CONDITION_WIDTH, CONDITION_HEIGHT ) ;
+ DialogControl = TRUE;
+ Hide = FALSE;
+ };
+
+ FixedLine FL_SEPARATOR1
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS, CONDITION_HEIGHT + RELATED_CONTROLS ) ;
+ Size = MAP_APPFONT ( CONDITION_WIDTH - 2*RELATED_CONTROLS , 1 ) ;
+ };
+
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( CONDITION_WIDTH - 3*BUTTON_WIDTH - 2*UNRELATED_CONTROLS - RELATED_CONTROLS, CONDITION_HEIGHT + 2*RELATED_CONTROLS + 1) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( CONDITION_WIDTH - 2*BUTTON_WIDTH - 2*UNRELATED_CONTROLS , CONDITION_HEIGHT + 2*RELATED_CONTROLS + 1) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+
+ HelpButton PB_HELP
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( CONDITION_WIDTH - BUTTON_WIDTH - UNRELATED_CONTROLS, CONDITION_HEIGHT + 2*RELATED_CONTROLS + 1) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ Text [ en-US ] = "~Help";
+ };
+
+ ScrollBar SB_ALL_CONDITIONS
+ {
+ Pos = MAP_APPFONT ( CONDITION_WIDTH, RELATED_CONTROLS ) ;
+ Size = MAP_APPFONT ( SCROLLBAR_WIDTH, CONDITION_HEIGHT + RELATED_CONTROLS ) ;
+ };
+};
+
+String STR_NUMBERED_CONDITION
+{
+ Text [ en-US ] = "Condition $number$";
+};
+
+String STR_COLOR_WHITE
+{
+ Text [ en-US ] = "White" ;
+};
+String STR_CHARCOLOR
+{
+ Text [ en-US ] = "Font color" ;
+};
+String STR_CHARBACKGROUND
+{
+ Text [ en-US ] = "Background";
+};
+String STR_TRANSPARENT
+{
+ Text [ en-US ] = "No Fill" ;
+};
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }
+
+//-------------------------------------------------------------------------
+ImageList IMG_CONDFORMAT_DLG_SC
+{
+ MASKCOLOR;
+ FileList =
+ {
+ < "res/commandimagelist/sc_bold.png" ; SID_ATTR_CHAR_WEIGHT ; > ;
+ < "res/commandimagelist/sc_italic.png" ; SID_ATTR_CHAR_POSTURE ; > ;
+ < "res/commandimagelist/sc_underline.png" ; SID_ATTR_CHAR_UNDERLINE ; > ;
+ < "res/commandimagelist/sc_backgroundcolor.png" ; SID_BACKGROUND_COLOR ; > ;
+ < "res/commandimagelist/sc_fontcolor.png" ; SID_ATTR_CHAR_COLOR2 ; > ;
+ < "res/commandimagelist/sc_fontdialog.png" ; SID_CHAR_DLG ; > ;
+ };
+};
+
+ImageList IMG_CONDFORMAT_DLG_SCH
+{
+ MASKCOLOR;
+ FileList =
+ {
+ < "res/commandimagelist/sch_bold.png" ; SID_ATTR_CHAR_WEIGHT ; > ;
+ < "res/commandimagelist/sch_italic.png" ; SID_ATTR_CHAR_POSTURE ; > ;
+ < "res/commandimagelist/sch_underline.png" ; SID_ATTR_CHAR_UNDERLINE ; > ;
+ < "res/commandimagelist/sch_backgroundcolor.png" ; SID_BACKGROUND_COLOR ; > ;
+ < "res/commandimagelist/sch_fontcolor.png" ; SID_ATTR_CHAR_COLOR2 ; > ;
+ < "res/commandimagelist/sch_fontdialog.png" ; SID_CHAR_DLG ; > ;
+ };
+};
+ImageList IMG_CONDFORMAT_DLG_LC
+{
+ MASKCOLOR;
+ FileList =
+ {
+ < "res/commandimagelist/lc_bold.png" ; SID_ATTR_CHAR_WEIGHT ; > ;
+ < "res/commandimagelist/lc_italic.png" ; SID_ATTR_CHAR_POSTURE ; > ;
+ < "res/commandimagelist/lc_underline.png" ; SID_ATTR_CHAR_UNDERLINE ; > ;
+ < "res/commandimagelist/lc_backgroundcolor.png" ; SID_BACKGROUND_COLOR ; > ;
+ < "res/commandimagelist/lc_fontcolor.png" ; SID_ATTR_CHAR_COLOR2 ; > ;
+ < "res/commandimagelist/lc_fontdialog.png" ; SID_CHAR_DLG ; > ;
+ };
+};
+ImageList IMG_CONDFORMAT_DLG_LCH
+{
+ MASKCOLOR;
+ FileList =
+ {
+ < "res/commandimagelist/lch_bold.png" ; SID_ATTR_CHAR_WEIGHT ; > ;
+ < "res/commandimagelist/lch_italic.png" ; SID_ATTR_CHAR_POSTURE ; > ;
+ < "res/commandimagelist/lch_underline.png" ; SID_ATTR_CHAR_UNDERLINE ; > ;
+ < "res/commandimagelist/lch_backgroundcolor.png" ; SID_BACKGROUND_COLOR ; > ;
+ < "res/commandimagelist/lch_fontcolor.png" ; SID_ATTR_CHAR_COLOR2 ; > ;
+ < "res/commandimagelist/lch_fontdialog.png" ; SID_CHAR_DLG ; > ;
+ };
+};
+
+
+
+ImageList 31000
+{
+ MASKCOLOR;
+ prefix = "sc";
+ IdList = {05500;};
+ IdCount = 1;
+
+};
+
+ToolBox RID_TB_SORTING
+{
+ Pos = MAP_APPFONT ( 0,0 ) ;
+ ButtonType = BUTTON_SYMBOL;
+ Align = BOXALIGN_TOP;
+ Customize = FALSE;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = SID_FM_SORTUP;
+ Text [ en-US ] = "Sort Ascending" ;
+ Checkable = TRUE;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_FM_SORTDOWN;
+ Text [ en-US ] = "Sort Descending" ;
+ Checkable = TRUE;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_FM_REMOVE_FILTER_SORT;
+ Text [ en-US ] = "Remove sorting" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ADD_CONTROL_PAIR;
+ Text [ en-US ] = "Insert" ;
+ };
+ };
+};
+
+ImageList IMG_ADDFIELD_DLG_SC
+{
+ MASKCOLOR;
+ FileList =
+ {
+ < "res/commandimagelist/sc_sortup.png" ; SID_FM_SORTUP ; > ;
+ < "res/commandimagelist/sc_sortdown.png" ; SID_FM_SORTDOWN ; > ;
+ < "res/commandimagelist/sc_removefiltersort.png" ; SID_FM_REMOVE_FILTER_SORT ; > ;
+ };
+};
+
+ImageList IMG_ADDFIELD_DLG_SCH
+{
+ MASKCOLOR;
+ FileList =
+ {
+ < "res/commandimagelist/sch_sortup.png" ; SID_FM_SORTUP ; > ;
+ < "res/commandimagelist/sch_sortdown.png" ; SID_FM_SORTDOWN ; > ;
+ < "res/commandimagelist/sch_removefiltersort.png" ; SID_FM_REMOVE_FILTER_SORT ; > ;
+ };
+};
+
+ImageList IMG_ADDFIELD_DLG_LC
+{
+ MASKCOLOR;
+ FileList =
+ {
+ < "res/commandimagelist/lc_sortup.png" ; SID_FM_SORTUP ; > ;
+ < "res/commandimagelist/lc_sortdown.png" ; SID_FM_SORTDOWN ; > ;
+ < "res/commandimagelist/lc_removefiltersort.png" ; SID_FM_REMOVE_FILTER_SORT ; > ;
+ };
+};
+
+ImageList IMG_ADDFIELD_DLG_LCH
+{
+ MASKCOLOR;
+ FileList =
+ {
+ < "res/commandimagelist/lch_sortup.png" ; SID_FM_SORTUP ; > ;
+ < "res/commandimagelist/lch_sortdown.png" ; SID_FM_SORTDOWN ; > ;
+ < "res/commandimagelist/lch_removefiltersort.png" ; SID_FM_REMOVE_FILTER_SORT ; > ;
+ };
+};
+
+FixedLine ADDFIELD_FL_HELP_SEPARATOR
+{
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ;
+ Size = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ;
+ Text [ en-US ] = "Help";
+};
+
+FixedText ADDFIELD_HELP_FIELD
+{
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ;
+ Size = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "Highlight the fields to insert into the selected section of the template, then click Insert or press Enter.";
+};
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
new file mode 100644
index 000000000000..e3591ae03534
--- /dev/null
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -0,0 +1,740 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_reportdesign.hxx"
+
+#include "Condition.hxx"
+#include "UITools.hxx"
+#include "CondFormat.hxx"
+#include "CondFormat.hrc"
+#include "RptResId.hrc"
+#include "ReportController.hxx"
+#include "ModuleHelper.hxx"
+#include "ColorChanger.hxx"
+#include "RptResId.hrc"
+#include "helpids.hrc"
+#include "reportformula.hxx"
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XImageManager.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/ui/ImageType.hpp>
+
+#define ITEMID_COLOR
+#define ITEMID_BRUSH
+#include <svx/tbcontrl.hxx>
+#include <svx/svxids.hrc>
+#include <svx/xtable.hxx>
+#include <svx/tbxcolorupdate.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <svtools/imgdef.hxx>
+#include <unotools/pathoptions.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/bmpacc.hxx>
+#include <tools/diagnose_ex.h>
+#include <rtl/ustrbuf.hxx>
+
+namespace rptui
+{
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+ConditionField::ConditionField( Condition* _pParent, const ResId& _rResId ) : Edit(_pParent,_rResId)
+,m_pParent(_pParent)
+,m_aFormula(this)
+{
+ m_pSubEdit = new Edit(this,0);
+ SetSubEdit(m_pSubEdit);
+ m_pSubEdit->EnableRTL( FALSE );
+ m_pSubEdit->SetPosPixel( Point() );
+
+ m_aFormula.SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("...")));
+ m_aFormula.SetClickHdl( LINK( this, ConditionField, OnFormula ) );
+ m_aFormula.Show();
+ m_pSubEdit->Show();
+ Resize();
+}
+// -----------------------------------------------------------------------------
+ConditionField::~ConditionField()
+{
+ SetSubEdit(NULL);
+ delete m_pSubEdit;
+}
+// -----------------------------------------------------------------------------
+void ConditionField::Resize()
+{
+ Edit::Resize();
+ const Size aSize = GetOutputSizePixel();
+ const Size aButtonSize( LogicToPixel( Size( 12, 0 ), MAP_APPFONT ).Width(),aSize.Height());
+ const Point aButtonPos(aSize.Width() - aButtonSize.Width(), 0);
+ m_aFormula.SetPosSizePixel(aButtonPos,aButtonSize);
+ m_pSubEdit->SetPosSizePixel(Point(0,0),Size(aButtonPos.X() ,aSize.Height()));
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( ConditionField, OnFormula, Button*, /*_pClickedButton*/ )
+{
+ ::rtl::OUString sFormula(m_pSubEdit->GetText());
+ const sal_Int32 nLen = sFormula.getLength();
+ if ( nLen )
+ {
+ ReportFormula aFormula( sFormula );
+ sFormula = aFormula.getCompleteFormula();
+ } // if ( nLen )
+ uno::Reference< awt::XWindow> xInspectorWindow = VCLUnoHelper::GetInterface(this);
+ uno::Reference< beans::XPropertySet> xProp(m_pParent->getController().getRowSet(),uno::UNO_QUERY);
+ if ( rptui::openDialogFormula_nothrow( sFormula, m_pParent->getController().getContext(),xInspectorWindow,xProp ) )
+ {
+ ReportFormula aFormula( sFormula );
+ m_pSubEdit->SetText(aFormula.getUndecoratedContent());
+ }
+ return 0L;
+}
+//========================================================================
+// class SvxColorWindow_Impl --------------------------------------------------
+//========================================================================
+#ifndef WB_NO_DIRECTSELECT
+#define WB_NO_DIRECTSELECT ((WinBits)0x04000000)
+#endif
+
+#define PALETTE_X 10
+#define PALETTE_Y 10
+#define PALETTE_SIZE (PALETTE_X * PALETTE_Y)
+class OColorPopup : public FloatingWindow
+{
+ DECL_LINK( SelectHdl, void * );
+ Condition* m_pCondition;
+ USHORT m_nSlotId;
+public:
+ OColorPopup(Window* _pParent,Condition* _pCondition);
+ ValueSet m_aColorSet;
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void Resize();
+
+ void StartSelection();
+ void SetSlotId(USHORT _nSlotId);
+};
+// -----------------------------------------------------------------------------
+OColorPopup::OColorPopup(Window* _pParent,Condition* _pCondition)
+:FloatingWindow(_pParent, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK|WB_DIALOGCONTROL ))
+,m_pCondition(_pCondition)
+,m_nSlotId(0)
+,m_aColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) )
+{
+ m_aColorSet.SetHelpId( HID_RPT_POPUP_COLOR_CTRL );
+ SetHelpId( HID_RPT_POPUP_COLOR );
+ const Size aSize12( 13, 13 );
+ ::std::auto_ptr<XColorTable> pColorTable(new XColorTable( SvtPathOptions().GetPalettePath() ));
+ short i = 0;
+ long nCount = pColorTable->Count();
+ XColorEntry* pEntry = NULL;
+ Color aColWhite( COL_WHITE );
+ String aStrWhite( ModuleRes(STR_COLOR_WHITE) );
+
+ if ( nCount > PALETTE_SIZE )
+ // Show scrollbar if more than PALLETTE_SIZE colors are available
+ m_aColorSet.SetStyle( m_aColorSet.GetStyle() | WB_VSCROLL );
+
+ for ( i = 0; i < nCount; i++ )
+ {
+ pEntry = pColorTable->GetColor(i);
+ m_aColorSet.InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() );
+ }
+
+ while ( i < PALETTE_SIZE )
+ {
+ // fill empty elements if less then PALLETTE_SIZE colors are available
+ m_aColorSet.InsertItem( i+1, aColWhite, aStrWhite );
+ i++;
+ }
+
+ m_aColorSet.SetSelectHdl( LINK( this, OColorPopup, SelectHdl ) );
+ m_aColorSet.SetColCount( PALETTE_X );
+ m_aColorSet.SetLineCount( PALETTE_Y );
+ Size aSize = m_aColorSet.CalcWindowSizePixel( aSize12 );
+ aSize.Width() += 4;
+ aSize.Height() += 4;
+ SetOutputSizePixel( aSize );
+ m_aColorSet.Show();
+}
+// -----------------------------------------------------------------------------
+void OColorPopup::KeyInput( const KeyEvent& rKEvt )
+{
+ m_aColorSet.KeyInput(rKEvt);
+}
+
+// -----------------------------------------------------------------------------
+void OColorPopup::Resize()
+{
+ Size aSize = GetOutputSizePixel();
+ aSize.Width() -= 4;
+ aSize.Height() -= 4;
+ m_aColorSet.SetPosSizePixel( Point(2,2), aSize );
+}
+
+// -----------------------------------------------------------------------------
+void OColorPopup::StartSelection()
+{
+ m_aColorSet.StartSelection();
+}
+// -----------------------------------------------------------------------------
+void OColorPopup::SetSlotId(USHORT _nSlotId)
+{
+ m_nSlotId = _nSlotId;
+ if ( SID_ATTR_CHAR_COLOR_BACKGROUND == _nSlotId || SID_BACKGROUND_COLOR == _nSlotId )
+ {
+ m_aColorSet.SetStyle( m_aColorSet.GetStyle() | WB_NONEFIELD );
+ m_aColorSet.SetText( String(ModuleRes( STR_TRANSPARENT )) );
+ } // if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId )
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( OColorPopup, SelectHdl, void *, EMPTYARG )
+{
+ USHORT nItemId = m_aColorSet.GetSelectItemId();
+ Color aColor( nItemId == 0 ? Color( COL_TRANSPARENT ) : m_aColorSet.GetItemColor( nItemId ) );
+
+ /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls.
+ This instance may be deleted in the meantime (i.e. when a dialog is opened
+ while in Dispatch()), accessing members will crash in this case. */
+ m_aColorSet.SetNoSelection();
+
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ m_pCondition->ApplyCommand( m_nSlotId, aColor );
+ return 0;
+}
+
+// =============================================================================
+// = Condition
+// =============================================================================
+// -----------------------------------------------------------------------------
+Condition::Condition( Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController )
+ :Control(_pParent, ModuleRes(WIN_CONDITION))
+ ,m_rController( _rController )
+ ,m_rAction( _rAction )
+ ,m_aHeader(this, ModuleRes(FL_CONDITION_HEADER))
+ ,m_aConditionType(this, ModuleRes(LB_COND_TYPE))
+ ,m_aOperationList( this, ModuleRes(LB_OP))
+ ,m_aCondLHS(this, ModuleRes(ED_CONDITION_LHS))
+ ,m_aOperandGlue(this, ModuleRes(FT_AND))
+ ,m_aCondRHS(this, ModuleRes(ED_CONDITION_RHS))
+ ,m_aActions(this, ModuleRes(TB_FORMAT))
+ ,m_aPreview(this, ModuleRes(CRTL_FORMAT_PREVIEW))
+ ,m_aMoveUp( this, ModuleRes( BTN_MOVE_UP ) )
+ ,m_aMoveDown( this, ModuleRes( BTN_MOVE_DOWN ) )
+ ,m_aAddCondition( this, ModuleRes( BTN_ADD_CONDITION ) )
+ ,m_aRemoveCondition( this, ModuleRes( BTN_REMOVE_CONDITION ) )
+ ,m_pColorFloat(NULL)
+ ,m_pBtnUpdaterFontColor(NULL)
+ ,m_pBtnUpdaterBackgroundColor(NULL)
+ ,m_nCondIndex( 0 )
+ ,m_nLastKnownWindowWidth( -1 )
+ ,m_bInDestruction( false )
+{
+ m_aMoveUp.SetModeImage( ModuleRes( IMG_MOVE_UP_HC ), BMP_COLOR_HIGHCONTRAST );
+ m_aMoveDown.SetModeImage( ModuleRes( IMG_MOVE_DOWN_HC ), BMP_COLOR_HIGHCONTRAST );
+
+ FreeResource();
+ m_aActions.SetStyle(m_aActions.GetStyle()|WB_LINESPACING);
+ m_aCondLHS.GrabFocus();
+
+ m_aConditionType.SetSelectHdl( LINK( this, Condition, OnTypeSelected ) );
+
+ m_aOperationList.SetDropDownLineCount( 10 );
+ m_aOperationList.SetSelectHdl( LINK( this, Condition, OnOperationSelected ) );
+
+ m_aActions.SetSelectHdl(LINK(this, Condition, OnFormatAction));
+ m_aActions.SetDropdownClickHdl( LINK( this, Condition, DropdownClick ) );
+ setToolBox(&m_aActions);
+
+ m_aMoveUp.SetClickHdl( LINK( this, Condition, OnConditionAction ) );
+ m_aMoveDown.SetClickHdl( LINK( this, Condition, OnConditionAction ) );
+ m_aAddCondition.SetClickHdl( LINK( this, Condition, OnConditionAction ) );
+ m_aRemoveCondition.SetClickHdl( LINK( this, Condition, OnConditionAction ) );
+
+ m_aMoveUp.SetStyle( m_aMoveUp.GetStyle() | WB_NOPOINTERFOCUS );
+ m_aMoveDown.SetStyle( m_aMoveDown.GetStyle() | WB_NOPOINTERFOCUS );
+ m_aAddCondition.SetStyle( m_aMoveUp.GetStyle() | WB_NOPOINTERFOCUS | WB_CENTER | WB_VCENTER );
+ m_aRemoveCondition.SetStyle( m_aMoveDown.GetStyle() | WB_NOPOINTERFOCUS | WB_CENTER | WB_VCENTER );
+
+ Font aFont( m_aAddCondition.GetFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ m_aAddCondition.SetFont( aFont );
+ m_aRemoveCondition.SetFont( aFont );
+
+ m_aOperandGlue.SetStyle( m_aOperandGlue.GetStyle() | WB_VCENTER );
+
+ m_aConditionType.SelectEntryPos( 0 );
+ m_aOperationList.SelectEntryPos( 0 );
+
+ // the toolbar got its site automatically, ensure that the preview is positioned
+ // right of it
+ Size aRelatedControls( LogicToPixel( Size( RELATED_CONTROLS, 0 ), MAP_APPFONT ) );
+ Point aToolbarPos( m_aActions.GetPosPixel() );
+ Size aToolbarSize( m_aActions.GetSizePixel() );
+ m_aPreview.SetPosSizePixel( aToolbarPos.X() + aToolbarSize.Width() + 2 * aRelatedControls.Width(),
+ 0, 0, 0, WINDOW_POSSIZE_X );
+
+ // ensure the toolbar is vertically centered, relative to the preview
+ Size aPreviewSize( m_aPreview.GetSizePixel() );
+ m_aActions.SetPosSizePixel( 0, aToolbarPos.Y() + ( aPreviewSize.Height() - aToolbarSize.Height() ) / 2, 0, 0, WINDOW_POSSIZE_Y );
+
+ m_pBtnUpdaterBackgroundColor = new ::svx::ToolboxButtonColorUpdater(
+ SID_BACKGROUND_COLOR, SID_BACKGROUND_COLOR, &m_aActions );
+ m_pBtnUpdaterFontColor = new ::svx::ToolboxButtonColorUpdater(
+ SID_ATTR_CHAR_COLOR2, SID_ATTR_CHAR_COLOR2, &m_aActions, TBX_UPDATER_MODE_CHAR_COLOR_NEW );
+
+ Show();
+
+ impl_layoutAll();
+
+ ConditionalExpressionFactory::getKnownConditionalExpressions( m_aConditionalExpressions );
+}
+
+// -----------------------------------------------------------------------------
+Condition::~Condition()
+{
+ m_bInDestruction = true;
+
+ delete m_pColorFloat;
+ delete m_pBtnUpdaterFontColor;
+ delete m_pBtnUpdaterBackgroundColor;
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( Condition, DropdownClick, ToolBox*, /*pToolBar*/ )
+{
+ USHORT nId( m_aActions.GetCurItemId() );
+ if ( !m_pColorFloat )
+ m_pColorFloat = new OColorPopup(&m_aActions,this);
+
+ USHORT nTextId = 0;
+ switch(nId)
+ {
+ case SID_ATTR_CHAR_COLOR2:
+ nTextId = STR_CHARCOLOR;
+ break;
+ case SID_BACKGROUND_COLOR:
+ nTextId = STR_CHARBACKGROUND;
+ break;
+ default:
+ break;
+ } // switch(nId)
+ if ( nTextId )
+ m_pColorFloat->SetText(String(ModuleRes(nTextId)));
+ m_pColorFloat->SetSlotId(nId);
+ m_pColorFloat->SetPosPixel(m_aActions.GetItemPopupPosition(nId,m_pColorFloat->GetSizePixel()));
+ m_pColorFloat->StartPopupMode(&m_aActions);
+ m_pColorFloat->StartSelection();
+
+ return 1;
+}
+//------------------------------------------------------------------
+IMPL_LINK( Condition, OnFormatAction, ToolBox*, /*NOTINTERESTEDIN*/ )
+{
+ Color aCol(COL_AUTO);
+ ApplyCommand(m_aActions.GetCurItemId(),aCol);
+ return 0L;
+}
+
+//------------------------------------------------------------------
+IMPL_LINK( Condition, OnConditionAction, Button*, _pClickedButton )
+{
+ if ( _pClickedButton == &m_aMoveUp )
+ m_rAction.moveConditionUp( getConditionIndex() );
+ else if ( _pClickedButton == &m_aMoveDown )
+ m_rAction.moveConditionDown( getConditionIndex() );
+ else if ( _pClickedButton == &m_aAddCondition )
+ m_rAction.addCondition( getConditionIndex() );
+ else if ( _pClickedButton == &m_aRemoveCondition )
+ m_rAction.deleteCondition( getConditionIndex() );
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+void Condition::ApplyCommand( USHORT _nCommandId, const ::Color& _rColor)
+{
+ if ( _nCommandId == SID_ATTR_CHAR_COLOR2 )
+ m_pBtnUpdaterFontColor->Update( _rColor );
+ else if ( _nCommandId == SID_BACKGROUND_COLOR )
+ m_pBtnUpdaterBackgroundColor->Update( _rColor );
+
+ m_rAction.applyCommand( m_nCondIndex, _nCommandId, _rColor );
+}
+//------------------------------------------------------------------------------
+ImageList Condition::getImageList(sal_Int16 _eBitmapSet,sal_Bool _bHiContast) const
+{
+ sal_Int16 nN = IMG_CONDFORMAT_DLG_SC;
+ sal_Int16 nH = IMG_CONDFORMAT_DLG_SCH;
+ if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE )
+ {
+ nN = IMG_CONDFORMAT_DLG_LC;
+ nH = IMG_CONDFORMAT_DLG_LCH;
+ }
+ return ImageList(ModuleRes( _bHiContast ? nH : nN ));
+}
+//------------------------------------------------------------------
+void Condition::resizeControls(const Size& _rDiff)
+{
+ // we use large images so we must change them
+ if ( _rDiff.Width() || _rDiff.Height() )
+ {
+ Point aPos = LogicToPixel( Point( 2*RELATED_CONTROLS , 0), MAP_APPFONT );
+ Invalidate();
+ }
+}
+// -----------------------------------------------------------------------------
+void Condition::Paint( const Rectangle& rRect )
+{
+ Control::Paint(rRect);
+
+ // draw border
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ ColorChanger aColors( this, rStyleSettings.GetShadowColor(), rStyleSettings.GetDialogColor() );
+ DrawRect( impl_getToolBarBorderRect() );
+}
+// -----------------------------------------------------------------------------
+void Condition::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ // Check if we need to get new images for normal/high contrast mode
+ checkImageList();
+ }
+ else if ( nType == STATE_CHANGE_TEXT )
+ {
+ // The physical toolbar changed its outlook and shows another logical toolbar!
+ // We have to set the correct high contrast mode on the new tbx manager.
+ // pMgr->SetHiContrast( IsHiContrastMode() );
+ checkImageList();
+ }
+}
+// -----------------------------------------------------------------------------
+void Condition::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) ||
+ ( rDCEvt.GetType() == DATACHANGED_DISPLAY )) &&
+ ( rDCEvt.GetFlags() & SETTINGS_STYLE ))
+ {
+ // Check if we need to get new images for normal/high contrast mode
+ checkImageList();
+ }
+}
+
+// -----------------------------------------------------------------------------
+void Condition::GetFocus()
+{
+ Control::GetFocus();
+ if ( !m_bInDestruction )
+ m_aCondLHS.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+void Condition::Resize()
+{
+ Control::Resize();
+ impl_layoutAll();
+}
+
+// -----------------------------------------------------------------------------
+Rectangle Condition::impl_getToolBarBorderRect() const
+{
+ const Point aToolbarPos( m_aActions.GetPosPixel() );
+ const Size aToolbarSize( m_aActions.GetSizePixel() );
+ const Size aRelatedControls = LogicToPixel( Size( RELATED_CONTROLS, RELATED_CONTROLS ), MAP_APPFONT );
+
+ Rectangle aBorderRect( aToolbarPos, aToolbarSize );
+ aBorderRect.Left() -= aRelatedControls.Width();
+ aBorderRect.Top() -= aRelatedControls.Height();
+ aBorderRect.Right() += aRelatedControls.Width();
+ aBorderRect.Bottom() += aRelatedControls.Height();
+
+ return aBorderRect;
+}
+
+// -----------------------------------------------------------------------------
+void Condition::impl_layoutAll()
+{
+ // if our width changed, resize/-position some controls
+ const Size aSize( GetOutputSizePixel() );
+ if ( aSize.Width() == m_nLastKnownWindowWidth )
+ return;
+
+ m_nLastKnownWindowWidth = aSize.Width();
+
+ const Size aRelatedControls( LogicToPixel( Size( RELATED_CONTROLS, RELATED_CONTROLS ), MAP_APPFONT ) );
+ const Size aUnrelatedControls( LogicToPixel( Size( UNRELATED_CONTROLS, 0 ), MAP_APPFONT ) );
+ const Point aRow1( LogicToPixel( Point( 0, ROW_1_POS ), MAP_APPFONT ) );
+ const Point aRow3( LogicToPixel( Point( 0, ROW_3_POS ), MAP_APPFONT ) );
+
+ // resize the header line
+ m_aHeader.SetPosSizePixel( 0, 0, aSize.Width() - 2 * aRelatedControls.Width(), 0, WINDOW_POSSIZE_WIDTH );
+
+ // position the up/down buttons
+ const Size aButtonSize( LogicToPixel( Size( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT ), MAP_APPFONT ) );
+ Point aButtonPos( aSize.Width() - aUnrelatedControls.Width() - aButtonSize.Width(), aRow1.Y() );
+ m_aMoveUp.SetPosSizePixel( aButtonPos.X(), aButtonPos.Y(), aButtonSize.Width(), aButtonSize.Height() );
+ aButtonPos.Move( 0, aButtonSize.Height() + aRelatedControls.Height() );
+ m_aMoveDown.SetPosSizePixel( aButtonPos.X(), aButtonPos.Y(), aButtonSize.Width(), aButtonSize.Height() );
+
+ // resize the preview
+ const long nNewPreviewRight = aButtonPos.X() - aRelatedControls.Width();
+
+ const Point aPreviewPos( m_aPreview.GetPosPixel() );
+ OSL_ENSURE( aPreviewPos.X() < nNewPreviewRight, "Condition::impl_layoutAll: being *that* small should not be allowed!" );
+ m_aPreview.SetPosSizePixel( 0, 0, nNewPreviewRight - aPreviewPos.X(), 0, WINDOW_POSSIZE_WIDTH );
+
+ // position the add/remove buttons
+ aButtonPos = Point( nNewPreviewRight - aButtonSize.Width(), aRow3.Y() );
+ m_aRemoveCondition.SetPosSizePixel( aButtonPos.X(), aButtonPos.Y(), aButtonSize.Width(), aButtonSize.Height() );
+ aButtonPos.Move( -( aButtonSize.Width() + aRelatedControls.Width() ), 0 );
+ m_aAddCondition.SetPosSizePixel( aButtonPos.X(), aButtonPos.Y(), aButtonSize.Width(), aButtonSize.Height() );
+
+ // layout the operands input controls
+ impl_layoutOperands();
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( Condition, OnTypeSelected, ListBox*, /*_pNotInterestedIn*/ )
+{
+ impl_layoutOperands();
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( Condition, OnOperationSelected, ListBox*, /*_pNotInterestedIn*/ )
+{
+ impl_layoutOperands();
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+void Condition::impl_layoutOperands()
+{
+ const ConditionType eType( impl_getCurrentConditionType() );
+ const ComparisonOperation eOperation( impl_getCurrentComparisonOperation() );
+
+ const bool bIsExpression = ( eType == eExpression );
+ const bool bHaveRHS =
+ ( ( eType == eFieldValueComparison )
+ && ( ( eOperation == eBetween )
+ || ( eOperation == eNotBetween )
+ )
+ );
+
+ const Size aRelatedControls( LogicToPixel( Size( RELATED_CONTROLS, 0 ), MAP_APPFONT ) );
+ const Rectangle aPreviewRect( m_aPreview.GetPosPixel(), m_aPreview.GetSizePixel() );
+
+ // the "condition type" list box
+ const Rectangle aCondTypeRect( m_aConditionType.GetPosPixel(), m_aConditionType.GetSizePixel() );
+ const Point aOpListPos( aCondTypeRect.Right() + aRelatedControls.Width(), aCondTypeRect.Top() );
+ const Size aOpListSize( LogicToPixel( Size( COND_OP_WIDTH, 60 ), MAP_APPFONT ) );
+ m_aOperationList.SetPosSizePixel( aOpListPos.X(), aOpListPos.Y(),aOpListSize.Width(), aOpListSize.Height() );
+ m_aOperationList.Show( !bIsExpression );
+
+ // the LHS input field
+ Point aLHSPos( aOpListPos.X() + aOpListSize.Width() + aRelatedControls.Width(), aOpListPos.Y() );
+ if ( bIsExpression )
+ aLHSPos.X() = aOpListPos.X();
+ Size aLHSSize( LogicToPixel( Size( EDIT_WIDTH, EDIT_HEIGHT ), MAP_APPFONT ) );
+ if ( !bHaveRHS )
+ aLHSSize.Width() = aPreviewRect.Right() - aLHSPos.X();
+ m_aCondLHS.SetPosSizePixel( aLHSPos.X(), aLHSPos.Y(), aLHSSize.Width(), aLHSSize.Height() );
+
+ if ( bHaveRHS )
+ {
+ // the "and" text being the glue between LHS and RHS
+ const Point aOpGluePos( aLHSPos.X() + aLHSSize.Width() + aRelatedControls.Width(), aLHSPos.Y() );
+ const Size aOpGlueSize( m_aOperandGlue.GetTextWidth( m_aOperandGlue.GetText() ) + aRelatedControls.Width(), aLHSSize.Height() );
+ m_aOperandGlue.SetPosSizePixel( aOpGluePos.X(), aOpGluePos.Y(), aOpGlueSize.Width(), aOpGlueSize.Height() );
+
+ // the RHS input field
+ const Point aRHSPos( aOpGluePos.X() + aOpGlueSize.Width() + aRelatedControls.Width(), aOpGluePos.Y() );
+ const Size aRHSSize( aPreviewRect.Right() - aRHSPos.X(), aLHSSize.Height() );
+ m_aCondRHS.SetPosSizePixel( aRHSPos.X(), aRHSPos.Y(), aRHSSize.Width(), aRHSSize.Height() );
+ }
+
+ m_aOperandGlue.Show( bHaveRHS );
+ m_aCondRHS.Show( bHaveRHS );
+}
+
+// -----------------------------------------------------------------------------
+void Condition::impl_setCondition( const ::rtl::OUString& _rConditionFormula )
+{
+ // determine the condition's type and comparison operation
+ ConditionType eType( eFieldValueComparison );
+ ComparisonOperation eOperation( eBetween );
+
+ // LHS and RHS, matched below
+ ::rtl::OUString sLHS, sRHS;
+
+ if ( _rConditionFormula.getLength() )
+ {
+ // the unprefixed expression which forms the condition
+ ReportFormula aFormula( _rConditionFormula );
+ OSL_ENSURE( aFormula.getType() == ReportFormula::Expression, "Condition::setCondition: illegal formula!" );
+ ::rtl::OUString sExpression;
+ if ( aFormula.getType() == ReportFormula::Expression )
+ sExpression = aFormula.getExpression();
+ // as fallback, if the below matching does not succeed, assume
+ // the whole expression is the LHS
+ eType = eExpression;
+ sLHS = sExpression;
+
+ // the data field (or expression) to which our control is bound
+ const ReportFormula aFieldContentFormula( m_rAction.getDataField() );
+ const ::rtl::OUString sUnprefixedFieldContent( aFieldContentFormula.getBracketedFieldOrExpression() );
+
+ // check whether one of the Field Value Expression Factories recognizes the expression
+ for ( ConditionalExpressions::const_iterator exp = m_aConditionalExpressions.begin();
+ exp != m_aConditionalExpressions.end();
+ ++exp
+ )
+ {
+ if ( exp->second->matchExpression( sExpression, sUnprefixedFieldContent, sLHS, sRHS ) )
+ {
+ eType = eFieldValueComparison;
+ eOperation = exp->first;
+ break;
+ }
+ }
+ }
+
+ // update UI
+ m_aConditionType.SelectEntryPos( (USHORT)eType );
+ m_aOperationList.SelectEntryPos( (USHORT)eOperation );
+ m_aCondLHS.SetText( sLHS );
+ m_aCondRHS.SetText( sRHS );
+
+ // re-layout
+ impl_layoutOperands();
+}
+
+// -----------------------------------------------------------------------------
+void Condition::setCondition( const uno::Reference< report::XFormatCondition >& _rxCondition )
+{
+ OSL_PRECOND( _rxCondition.is(), "Condition::setCondition: empty condition object!" );
+ if ( !_rxCondition.is() )
+ return;
+
+ ::rtl::OUString sConditionFormula;
+ try
+ {
+ if ( _rxCondition.is() )
+ sConditionFormula = _rxCondition->getFormula();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ impl_setCondition( sConditionFormula );
+ updateToolbar( _rxCondition.get() );
+}
+
+// -----------------------------------------------------------------------------
+void Condition::updateToolbar(const uno::Reference< report::XReportControlFormat >& _xReportControlFormat)
+{
+ OSL_ENSURE(_xReportControlFormat.is(),"XReportControlFormat is NULL!");
+ if ( _xReportControlFormat.is() )
+ {
+ USHORT nItemCount = m_aActions.GetItemCount();
+ for (USHORT j = 0; j< nItemCount; ++j)
+ {
+ USHORT nItemId = m_aActions.GetItemId(j);
+ m_aActions.CheckItem( nItemId, m_rController.isFormatCommandEnabled( nItemId, _xReportControlFormat ) );
+ }
+
+ try
+ {
+ Font aBaseFont( Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont() );
+ SvxFont aFont( VCLUnoHelper::CreateFont( _xReportControlFormat->getFontDescriptor(), aBaseFont ) );
+ aFont.SetHeight( OutputDevice::LogicToLogic( Size( 0, (sal_Int32)aFont.GetHeight() ), MAP_POINT, MAP_TWIP ).Height());
+ aFont.SetEmphasisMark( static_cast< FontEmphasisMark >( _xReportControlFormat->getControlTextEmphasis() ) );
+ aFont.SetRelief( static_cast< FontRelief >( _xReportControlFormat->getCharRelief() ) );
+ aFont.SetColor( _xReportControlFormat->getCharColor() );
+ m_aPreview.SetFont( aFont );
+ m_aPreview.SetBackColor( _xReportControlFormat->getControlBackground() );
+ m_aPreview.SetTextLineColor( Color( _xReportControlFormat->getCharUnderlineColor() ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void Condition::fillFormatCondition(const uno::Reference< report::XFormatCondition >& _xCondition)
+{
+ const ConditionType eType( impl_getCurrentConditionType() );
+ const ComparisonOperation eOperation( impl_getCurrentComparisonOperation() );
+
+ const ::rtl::OUString sLHS( m_aCondLHS.GetText() );
+ const ::rtl::OUString sRHS( m_aCondRHS.GetText() );
+
+ ::rtl::OUString sUndecoratedFormula( sLHS );
+
+ if ( eType == eFieldValueComparison )
+ {
+ ReportFormula aFieldContentFormula( m_rAction.getDataField() );
+ ::rtl::OUString sUnprefixedFieldContent( aFieldContentFormula.getBracketedFieldOrExpression() );
+
+ PConditionalExpression pFactory( m_aConditionalExpressions[ eOperation ] );
+ sUndecoratedFormula = pFactory->assembleExpression( sUnprefixedFieldContent, sLHS, sRHS );
+ }
+
+ ReportFormula aFormula( ReportFormula::Expression, sUndecoratedFormula );
+ _xCondition->setFormula( aFormula.getCompleteFormula() );
+}
+// -----------------------------------------------------------------------------
+void Condition::setConditionIndex( size_t _nCondIndex, size_t _nCondCount )
+{
+ m_nCondIndex = _nCondIndex;
+ String sHeader( ModuleRes( STR_NUMBERED_CONDITION ) );
+ sHeader.SearchAndReplaceAscii( "$number$", String::CreateFromInt32( _nCondIndex + 1 ) );
+ m_aHeader.SetText( sHeader );
+
+ m_aMoveUp.Enable( _nCondIndex > 0 );
+ OSL_PRECOND( _nCondCount > 0, "Condition::setConditionIndex: having no conditions at all is nonsense!" );
+ m_aMoveDown.Enable( _nCondIndex < _nCondCount - 1 );
+}
+
+// -----------------------------------------------------------------------------
+bool Condition::isEmpty() const
+{
+ return m_aCondLHS.GetText().Len() == 0;
+}
+
+// =============================================================================
+} // rptui
+// =============================================================================
+
diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx
new file mode 100644
index 000000000000..12517480b3b5
--- /dev/null
+++ b/reportdesign/source/ui/dlg/Condition.hxx
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * 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 RPTUI_CONDITION_HXX
+#define RPTUI_CONDITION_HXX
+
+#include "conditionalexpression.hxx"
+
+#include <com/sun/star/report/XFormatCondition.hpp>
+
+#include <dbaccess/ToolBoxHelper.hxx>
+
+#include <svx/fntctrl.hxx>
+
+#include <svtools/valueset.hxx>
+
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/button.hxx>
+#include <vcl/toolbox.hxx>
+
+#include <memory>
+
+namespace svx { class ToolboxButtonColorUpdater; }
+
+namespace rptui
+{
+ class ConditionalFormattingDialog;
+ class OColorPopup;
+ class OReportController;
+ class IConditionalFormatAction;
+ class Condition;
+
+ class ConditionField : public Edit
+ {
+ Condition* m_pParent;
+ Edit* m_pSubEdit;
+ PushButton m_aFormula;
+
+ DECL_LINK( OnFormula, Button* );
+ public:
+ ConditionField( Condition* pParent, const ResId& rResId );
+ virtual ~ConditionField();
+ virtual void Resize();
+ };
+
+ //========================================================================
+ //= Condition
+ //========================================================================
+ class Condition :public Control
+ ,public dbaui::OToolBoxHelper
+ {
+ ::rptui::OReportController& m_rController;
+ IConditionalFormatAction& m_rAction;
+ FixedLine m_aHeader;
+ ListBox m_aConditionType;
+ ListBox m_aOperationList;
+ ConditionField m_aCondLHS;
+ FixedText m_aOperandGlue;
+ ConditionField m_aCondRHS;
+ ToolBox m_aActions;
+ SvxFontPrevWindow m_aPreview;
+ ImageButton m_aMoveUp;
+ ImageButton m_aMoveDown;
+ PushButton m_aAddCondition;
+ PushButton m_aRemoveCondition;
+ OColorPopup* m_pColorFloat;
+
+ ::svx::ToolboxButtonColorUpdater* m_pBtnUpdaterFontColor; // updates the color below the toolbar icon
+ ::svx::ToolboxButtonColorUpdater* m_pBtnUpdaterBackgroundColor;
+
+
+ size_t m_nCondIndex;
+ long m_nLastKnownWindowWidth;
+ bool m_bInDestruction;
+
+ ConditionalExpressions m_aConditionalExpressions;
+
+ DECL_LINK( OnFormatAction, ToolBox* );
+ DECL_LINK( DropdownClick, ToolBox* );
+ DECL_LINK( OnConditionAction, Button* );
+
+ public:
+ Condition( Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController );
+ virtual ~Condition();
+
+ /** will be called when the id of the image list is needed.
+ @param _eBitmapSet
+ <svtools/imgdef.hxx>
+ @param _bHiContast
+ <TRUE/> when in high contrast mode.
+ */
+ virtual ImageList getImageList(sal_Int16 _eBitmapSet,sal_Bool _bHiContast) const;
+
+ /** will be called when the controls need to be resized.
+ */
+ virtual void resizeControls(const Size& _rDiff);
+
+ /** sets the props at the control
+ @param _xCondition the source
+ */
+ void setCondition(const com::sun::star::uno::Reference< com::sun::star::report::XFormatCondition >& _xCondition);
+
+ /** fills from the control
+ _xCondition the destination
+ */
+ void fillFormatCondition(const com::sun::star::uno::Reference< com::sun::star::report::XFormatCondition >& _xCondition);
+
+ /** updates the toolbar
+ _xCondition the destination
+ */
+ void updateToolbar(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat >& _xCondition);
+
+ /// tells the condition its new index within the dialog's condition array
+ void setConditionIndex( size_t _nCondIndex, size_t _nCondCount );
+
+ /// returns the condition's index within the dialog's condition array
+ size_t getConditionIndex() const { return m_nCondIndex; }
+
+ /** determines whether the condition is actually empty
+ */
+ bool isEmpty() const;
+
+ /** forward to the parent class
+ */
+ void ApplyCommand(USHORT _nCommandId, const ::Color& _aColor );
+
+ inline ::rptui::OReportController& getController() const { return m_rController; }
+
+ protected:
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void GetFocus();
+
+ private:
+ void impl_layoutAll();
+ void impl_layoutOperands();
+
+ /// determines the rectangle to be occupied by the toolbar, including the border drawn around it
+ Rectangle impl_getToolBarBorderRect() const;
+
+ inline ConditionType
+ impl_getCurrentConditionType() const;
+
+ inline ComparisonOperation
+ impl_getCurrentComparisonOperation() const;
+
+ void impl_setCondition( const ::rtl::OUString& _rConditionFormula );
+
+ private:
+ DECL_LINK( OnTypeSelected, ListBox* );
+ DECL_LINK( OnOperationSelected, ListBox* );
+ };
+
+ // -------------------------------------------------------------------------
+ inline ConditionType Condition::impl_getCurrentConditionType() const
+ {
+ return sal::static_int_cast< ConditionType >( m_aConditionType.GetSelectEntryPos() );
+ }
+
+ // -------------------------------------------------------------------------
+ inline ComparisonOperation Condition::impl_getCurrentComparisonOperation() const
+ {
+ return sal::static_int_cast< ComparisonOperation >( m_aOperationList.GetSelectEntryPos() );
+ }
+
+// =============================================================================
+} // namespace rptui
+// =============================================================================
+#endif // RPTUI_CONDITION_HXX
+
diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx
new file mode 100644
index 000000000000..e2180098af0c
--- /dev/null
+++ b/reportdesign/source/ui/dlg/DateTime.cxx
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_reportdesign.hxx"
+#include "DateTime.hxx"
+#ifndef RPTUI_DATETIME_HRC
+#include "DateTime.hrc"
+#endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <tools/debug.hxx>
+#ifndef _RPTUI_DLGRESID_HRC
+#include "RptResId.hrc"
+#endif
+#ifndef _RPTUI_SLOTID_HRC_
+#include "rptui_slotid.hrc"
+#endif
+#ifndef _RPTUI_MODULE_HELPER_DBU_HXX_
+#include "ModuleHelper.hxx"
+#endif
+#ifndef RTPUI_REPORTDESIGN_HELPID_HRC
+#include "helpids.hrc"
+#endif
+#include <vcl/msgbox.hxx>
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _SBASLTID_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <connectivity/dbconversion.hxx>
+#include <unotools/syslocale.hxx>
+#ifndef RPTUI_TOOLS_HXX
+#include "UITools.hxx"
+#endif
+#include "RptDef.hxx"
+#ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
+#include "uistrings.hrc"
+#endif
+#include "ReportController.hxx"
+#include <com/sun/star/report/XFormattedField.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/util/XNumberFormatPreviewer.hpp>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <com/sun/star/i18n/NumberFormatIndex.hpp>
+#include <comphelper/numbers.hxx>
+#include <algorithm>
+
+namespace rptui
+{
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+DBG_NAME( rpt_ODateTimeDialog )
+//========================================================================
+// class ODateTimeDialog
+//========================================================================
+ODateTimeDialog::ODateTimeDialog( Window* _pParent
+ ,const uno::Reference< report::XSection >& _xHoldAlive
+ ,OReportController* _pController)
+ : ModalDialog( _pParent, ModuleRes(RID_DATETIME_DLG) )
+ ,m_aDate(this, ModuleRes(CB_DATE ) )
+ ,m_aFTDateFormat(this, ModuleRes(FT_DATE_FORMAT ) )
+ ,m_aDateListBox(this, ModuleRes(LB_DATE_TYPE ) )
+ ,m_aFL0(this, ModuleRes(FL_SEPARATOR0 ) )
+ ,m_aTime(this, ModuleRes(CB_TIME ) )
+ ,m_aFTTimeFormat(this, ModuleRes(FT_TIME_FORMAT ) )
+ ,m_aTimeListBox(this, ModuleRes(LB_TIME_TYPE ) )
+ ,m_aFL1(this, ModuleRes(FL_SEPARATOR1) )
+ ,m_aPB_OK(this, ModuleRes(PB_OK))
+ ,m_aPB_CANCEL(this, ModuleRes(PB_CANCEL))
+ ,m_aPB_Help(this, ModuleRes(PB_HELP))
+ ,m_aDateControlling()
+ ,m_aTimeControlling()
+ ,m_pController(_pController)
+ ,m_xHoldAlive(_xHoldAlive)
+{
+ DBG_CTOR( rpt_ODateTimeDialog,NULL);
+
+ try
+ {
+ SvtSysLocale aSysLocale;
+ m_nLocale = aSysLocale.GetLocaleData().getLocale();
+ // Fill listbox with all well known date types
+ InsertEntry(util::NumberFormat::DATE);
+ InsertEntry(util::NumberFormat::TIME);
+ }
+ catch(uno::Exception&)
+ {
+ }
+
+ m_aDateListBox.SetDropDownLineCount(20);
+ m_aDateListBox.SelectEntryPos(0);
+
+ m_aTimeListBox.SetDropDownLineCount(20);
+ m_aTimeListBox.SelectEntryPos(0);
+
+ // use nice enhancement, to toggle enable/disable if a checkbox is checked or not
+ m_aDateControlling.enableOnCheckMark( m_aDate, m_aFTDateFormat, m_aDateListBox);
+ m_aTimeControlling.enableOnCheckMark( m_aTime, m_aFTTimeFormat, m_aTimeListBox);
+
+ CheckBox* pCheckBoxes[] = { &m_aDate,&m_aTime};
+ for ( size_t i = 0 ; i < sizeof(pCheckBoxes)/sizeof(pCheckBoxes[0]); ++i)
+ pCheckBoxes[i]->SetClickHdl(LINK(this,ODateTimeDialog,CBClickHdl));
+
+ FreeResource();
+}
+// -----------------------------------------------------------------------------
+ void ODateTimeDialog::InsertEntry(sal_Int16 _nNumberFormatId)
+ {
+ const bool bTime = util::NumberFormat::TIME == _nNumberFormatId;
+ ListBox* pListBox = &m_aDateListBox;
+ if ( bTime )
+ pListBox = &m_aTimeListBox;
+
+ const uno::Reference< util::XNumberFormatter> xNumberFormatter = m_pController->getReportNumberFormatter();
+ const uno::Reference< util::XNumberFormats> xFormats = xNumberFormatter->getNumberFormatsSupplier()->getNumberFormats();
+ const uno::Sequence<sal_Int32> aFormatKeys = xFormats->queryKeys(_nNumberFormatId,m_nLocale,sal_True);
+ const sal_Int32* pIter = aFormatKeys.getConstArray();
+ const sal_Int32* pEnd = pIter + aFormatKeys.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ const sal_Int16 nPos = pListBox->InsertEntry(getFormatStringByKey(*pIter,xFormats,bTime));
+ pListBox->SetEntryData(nPos, reinterpret_cast<void*>(*pIter));
+ }
+ }
+//------------------------------------------------------------------------
+ODateTimeDialog::~ODateTimeDialog()
+{
+ DBG_DTOR( rpt_ODateTimeDialog,NULL);
+}
+// -----------------------------------------------------------------------------
+short ODateTimeDialog::Execute()
+{
+ DBG_CHKTHIS( rpt_ODateTimeDialog,NULL);
+ short nRet = ModalDialog::Execute();
+ if ( nRet == RET_OK && (m_aDate.IsChecked() || m_aTime.IsChecked()) )
+ {
+ try
+ {
+ sal_Int32 nLength = 0;
+ uno::Sequence<beans::PropertyValue> aValues( 6 );
+ aValues[nLength].Name = PROPERTY_SECTION;
+ aValues[nLength++].Value <<= m_xHoldAlive;
+
+ aValues[nLength].Name = PROPERTY_TIME_STATE;
+ aValues[nLength++].Value <<= m_aTime.IsChecked();
+
+ aValues[nLength].Name = PROPERTY_DATE_STATE;
+ aValues[nLength++].Value <<= m_aDate.IsChecked();
+
+ aValues[nLength].Name = PROPERTY_FORMATKEYDATE;
+ aValues[nLength++].Value <<= getFormatKey(sal_True);
+
+ aValues[nLength].Name = PROPERTY_FORMATKEYTIME;
+ aValues[nLength++].Value <<= getFormatKey(sal_False);
+
+ sal_Int32 nWidth = 0;
+ if ( m_aDate.IsChecked() )
+ {
+ String sDateFormat = m_aDateListBox.GetEntry( m_aDateListBox.GetSelectEntryPos() );
+ nWidth = LogicToLogic(PixelToLogic(Size(GetCtrlTextWidth(sDateFormat),0)).Width(),GetMapMode().GetMapUnit(),MAP_100TH_MM);
+ }
+ if ( m_aTime.IsChecked() )
+ {
+ String sDateFormat = m_aTimeListBox.GetEntry( m_aTimeListBox.GetSelectEntryPos() );
+ nWidth = ::std::max<sal_Int32>(LogicToLogic(PixelToLogic(Size(GetCtrlTextWidth(sDateFormat),0)).Width(),GetMapMode().GetMapUnit(),MAP_100TH_MM),nWidth);
+ }
+
+ if ( nWidth > 4000 )
+ {
+ aValues[nLength].Name = PROPERTY_WIDTH;
+ aValues[nLength++].Value <<= nWidth;
+ }
+
+ m_pController->executeChecked(SID_DATETIME,aValues);
+ }
+ catch(uno::Exception&)
+ {
+ nRet = RET_NO;
+ }
+ }
+ return nRet;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString ODateTimeDialog::getFormatStringByKey(::sal_Int32 _nNumberFormatKey,const uno::Reference< util::XNumberFormats>& _xFormats,bool _bTime)
+{
+ uno::Reference< beans::XPropertySet> xFormSet = _xFormats->getByKey(_nNumberFormatKey);
+ OSL_ENSURE(xFormSet.is(),"XPropertySet is null!");
+ ::rtl::OUString sFormat;
+ xFormSet->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FormatString"))) >>= sFormat;
+
+ double nValue = 0;
+ if ( _bTime )
+ {
+ Time aCurrentTime;
+ nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(aCurrentTime.GetTime()));
+ }
+ else
+ {
+ Date aCurrentDate;
+ static ::com::sun::star::util::Date STANDARD_DB_DATE(30,12,1899);
+ nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(static_cast<sal_Int32>(aCurrentDate.GetDate())),STANDARD_DB_DATE);
+ }
+
+ uno::Reference< util::XNumberFormatPreviewer> xPreViewer(m_pController->getReportNumberFormatter(),uno::UNO_QUERY);
+ OSL_ENSURE(xPreViewer.is(),"XNumberFormatPreviewer is null!");
+ return xPreViewer->convertNumberToPreviewString(sFormat,nValue,m_nLocale,sal_True);
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( ODateTimeDialog, CBClickHdl, CheckBox*, _pBox )
+{
+ (void)_pBox;
+ DBG_CHKTHIS( rpt_ODateTimeDialog,NULL);
+
+ if ( _pBox == &m_aDate || _pBox == &m_aTime)
+ {
+ sal_Bool bDate = m_aDate.IsChecked();
+ sal_Bool bTime = m_aTime.IsChecked();
+ if (!bDate && !bTime)
+ {
+ m_aPB_OK.Disable();
+ }
+ else
+ {
+ m_aPB_OK.Enable();
+ }
+ }
+ return 1L;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 ODateTimeDialog::getFormatKey(sal_Bool _bDate) const
+{
+ DBG_CHKTHIS( rpt_ODateTimeDialog,NULL);
+ sal_Int32 nFormatKey;
+ if ( _bDate )
+ {
+ // nFormat = m_aDateF1.IsChecked() ? i18n::NumberFormatIndex::DATE_SYSTEM_LONG : (m_aDateF2.IsChecked() ? i18n::NumberFormatIndex::DATE_SYS_DMMMYYYY : i18n::NumberFormatIndex::DATE_SYSTEM_SHORT);
+ nFormatKey = static_cast<sal_Int32>(reinterpret_cast<sal_IntPtr>(m_aDateListBox.GetEntryData( m_aDateListBox.GetSelectEntryPos() )));
+ }
+ else
+ {
+ // nFormat = m_aTimeF1.IsChecked() ? i18n::NumberFormatIndex::TIME_HHMMSS : (m_aTimeF2.IsChecked() ? i18n::NumberFormatIndex::TIME_HHMMSSAMPM : i18n::NumberFormatIndex::TIME_HHMM);
+ nFormatKey = static_cast<sal_Int32>(reinterpret_cast<sal_IntPtr>(m_aTimeListBox.GetEntryData( m_aTimeListBox.GetSelectEntryPos() )));
+ }
+ return nFormatKey;
+}
+// =============================================================================
+} // rptui
+// =============================================================================
diff --git a/reportdesign/source/ui/dlg/DateTime.hrc b/reportdesign/source/ui/dlg/DateTime.hrc
new file mode 100644
index 000000000000..02a421f10c18
--- /dev/null
+++ b/reportdesign/source/ui/dlg/DateTime.hrc
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * 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 RPTUI_DATETIME_HRC
+#define RPTUI_DATETIME_HRC
+
+#define CB_DATE (1)
+#define FT_DATE_FORMAT (2)
+#define LB_DATE_TYPE (3)
+#define FL_SEPARATOR0 (4)
+#define CB_TIME (5)
+#define FT_TIME_FORMAT (6)
+#define LB_TIME_TYPE (7)
+#define FL_SEPARATOR1 (8)
+#define PB_OK (9)
+#define PB_CANCEL (10)
+#define PB_HELP (11)
+
+#define CHECKBOX_HEIGHT 8
+#define FIXEDTEXT_HEIGHT 8
+#define RELATED_CONTROLS 4
+#define UNRELATED_CONTROLS 7
+#define EDIT_HEIGHT 12
+#define LISTBOX_HEIGHT 12
+#define BUTTON_HEIGHT 14
+#define BUTTON_WIDTH 50
+#define BROWSER_HEIGHT 75
+#define PAGE_WIDTH (RELATED_CONTROLS + 3*UNRELATED_CONTROLS + 3*BUTTON_WIDTH)
+#define PAGE_HEIGHT (2*RELATED_CONTROLS + 6*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT + BUTTON_HEIGHT)
+#define LISTBOX_WIDTH PAGE_WIDTH - 3*UNRELATED_CONTROLS - FIXEDTEXT_WIDTH
+
+#endif // RPTUI_DATETIME_HRC
diff --git a/reportdesign/source/ui/dlg/DateTime.src b/reportdesign/source/ui/dlg/DateTime.src
new file mode 100644
index 000000000000..0e30747fb78c
--- /dev/null
+++ b/reportdesign/source/ui/dlg/DateTime.src
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * 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 "DateTime.hrc"
+#include "RptResId.hrc"
+#include "helpids.hrc"
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _SBASLTID_HRC
+#include <svx/svxids.hrc>
+#endif
+
+
+ModalDialog RID_DATETIME_DLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( PAGE_WIDTH , PAGE_HEIGHT ) ;
+ Text [ en-US ] = "Date and Time" ;
+ HelpId = HID_RPT_DATETIME_DLG;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ CheckBox CB_DATE
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS , RELATED_CONTROLS /* + UNRELATED_CONTROLS + FIXEDTEXT_HEIGHT */) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*UNRELATED_CONTROLS, FIXEDTEXT_HEIGHT ) ;
+ Check = TRUE;
+ Text [ en-US ] = "Include Date";
+ };
+
+ FixedText FT_DATE_FORMAT
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS + 2*UNRELATED_CONTROLS, RELATED_CONTROLS + UNRELATED_CONTROLS + CHECKBOX_HEIGHT );
+ Size = MAP_APPFONT( BUTTON_WIDTH - RELATED_CONTROLS, FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Format";
+ };
+
+ ListBox LB_DATE_TYPE
+ {
+ Pos = MAP_APPFONT ( 2 * UNRELATED_CONTROLS + BUTTON_WIDTH, RELATED_CONTROLS + UNRELATED_CONTROLS + CHECKBOX_HEIGHT) ;
+ Size = MAP_APPFONT( PAGE_WIDTH - 3*UNRELATED_CONTROLS - BUTTON_WIDTH, 60 );
+ Border = TRUE;
+ DropDown = TRUE;
+ TabStop = TRUE;
+ Sort = FALSE;
+ };
+
+ FixedLine FL_SEPARATOR0
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS + 2*UNRELATED_CONTROLS + CHECKBOX_HEIGHT + LISTBOX_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , 1 ) ;
+ // Text [ en-US ] = "Time";
+ };
+ CheckBox CB_TIME
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS, RELATED_CONTROLS + 3*UNRELATED_CONTROLS + CHECKBOX_HEIGHT + LISTBOX_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*UNRELATED_CONTROLS, FIXEDTEXT_HEIGHT ) ;
+ Check = TRUE;
+ Text [ en-US ] = "Include Time";
+ };
+
+ FixedText FT_TIME_FORMAT
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS + 2*UNRELATED_CONTROLS, RELATED_CONTROLS + 4*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + LISTBOX_HEIGHT);
+ Size = MAP_APPFONT( BUTTON_WIDTH - RELATED_CONTROLS, FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Format";
+ };
+
+ ListBox LB_TIME_TYPE
+ {
+ Pos = MAP_APPFONT ( 2 * UNRELATED_CONTROLS + BUTTON_WIDTH, RELATED_CONTROLS + 4*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + LISTBOX_HEIGHT) ;
+ Size = MAP_APPFONT( PAGE_WIDTH - 3*UNRELATED_CONTROLS - BUTTON_WIDTH, 60 );
+ Border = TRUE;
+ DropDown = TRUE;
+ TabStop = TRUE;
+ Sort = FALSE;
+ };
+ FixedLine FL_SEPARATOR1
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS + 5*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , 1 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS, RELATED_CONTROLS + 6*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT +1) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS + UNRELATED_CONTROLS + BUTTON_WIDTH , RELATED_CONTROLS + 6*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT +1) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( RELATED_CONTROLS + 2*UNRELATED_CONTROLS + 2*BUTTON_WIDTH , RELATED_CONTROLS + 6*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT +1) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ Text [ en-US ] = "~Help";
+ };
+};
diff --git a/reportdesign/source/ui/dlg/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx
new file mode 100644
index 000000000000..c54380cb7d2a
--- /dev/null
+++ b/reportdesign/source/ui/dlg/Formula.cxx
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * 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_reportdesign.hxx"
+
+
+//----------------------------------------------------------------------------
+
+#include <vcl/svapp.hxx>
+#include <vcl/mnemonic.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/charclass.hxx>
+#include <unotools/viewoptions.hxx>
+#include <tools/urlobj.hxx>
+#include <formula/formdata.hxx>
+#include <formula/funcutl.hxx>
+#include <formula/tokenarray.hxx>
+
+#include "Formula.hxx"
+#include "AddField.hxx"
+#include "helpids.hrc"
+
+//============================================================================
+namespace rptui
+{
+ using namespace formula;
+ using namespace ::com::sun::star;
+
+// --------------------------------------------------------------------------
+// Initialisierung / gemeinsame Funktionen fuer Dialog
+// --------------------------------------------------------------------------
+
+FormulaDialog::FormulaDialog(Window* pParent
+ , const uno::Reference<lang::XMultiServiceFactory>& _xServiceFactory
+ , const ::boost::shared_ptr< IFunctionManager >& _pFunctionMgr
+ , const ::rtl::OUString& _sFormula
+ , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet)
+ : FormulaModalDialog( pParent, false,false,false,this,_pFunctionMgr.get(),this)
+ ,m_aFunctionManager(_pFunctionMgr)
+ ,m_pFormulaData(new FormEditData())
+ ,m_pAddField(NULL)
+ ,m_xRowSet(_xRowSet)
+ ,m_pEdit(NULL)
+ ,m_sFormula(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=")))
+ ,m_nStart(0)
+ ,m_nEnd(1)
+{
+ if ( _sFormula.getLength() > 0 )
+ {
+ if ( _sFormula.getStr()[0] != '=' )
+ m_sFormula += String(_sFormula);
+ else
+ m_sFormula = _sFormula;
+ }
+ m_xParser.set(_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOFormulaParser"))),uno::UNO_QUERY);
+ if ( m_xParser.is() )
+ m_xOpCodeMapper = m_xParser->getFormulaOpCodeMapper();
+ fill();
+}
+
+void FormulaDialog::notifyChange()
+{
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::fill()
+{
+ SetMeText(m_sFormula);
+ Update(m_sFormula);
+ CheckMatrix(m_sFormula);
+ Update();
+}
+
+FormulaDialog::~FormulaDialog()
+{
+ if ( m_pAddField )
+ {
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( HID_RPT_FIELD_SEL_WIN ) );
+ aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) );
+
+ ::std::auto_ptr<Window> aTemp2(m_pAddField);
+ m_pAddField = NULL;
+ }
+}
+
+// --------------------------------------------------------------------------
+// Funktionen fuer rechte Seite
+// --------------------------------------------------------------------------
+bool FormulaDialog::calculateValue( const String& rStrExp, String& rStrResult )
+{
+ rStrResult = rStrExp;
+ return false;
+}
+void FormulaDialog::doClose(BOOL _bOk)
+{
+ EndDialog(_bOk ? RET_OK : RET_CANCEL);
+}
+void FormulaDialog::insertEntryToLRUList(const IFunctionDescription* /*_pDesc*/)
+{
+}
+void FormulaDialog::showReference(const String& /*_sFormula*/)
+{
+}
+void FormulaDialog::dispatch(BOOL /*_bOK*/,BOOL /*_bMartixChecked*/)
+{
+}
+void FormulaDialog::setDispatcherLock( BOOL /*bLock*/ )
+{
+}
+void FormulaDialog::setReferenceInput(const FormEditData* /*_pData*/)
+{
+}
+void FormulaDialog::deleteFormData()
+{
+}
+void FormulaDialog::clear()
+{
+}
+void FormulaDialog::switchBack()
+{
+}
+FormEditData* FormulaDialog::getFormEditData() const
+{
+ return m_pFormulaData;
+}
+void FormulaDialog::setCurrentFormula(const String& _sReplacement)
+{
+ const xub_StrLen nOldLen = m_nEnd - m_nStart;
+ const xub_StrLen nNewLen = _sReplacement.Len();
+ if (nOldLen)
+ m_sFormula.Erase( m_nStart, nOldLen );
+ if (nNewLen)
+ m_sFormula.Insert( _sReplacement, m_nStart );
+ m_nEnd = m_nStart + nNewLen;
+}
+void FormulaDialog::setSelection(xub_StrLen _nStart,xub_StrLen _nEnd)
+{
+ if ( _nStart <= _nEnd )
+ {
+ m_nStart = _nStart;
+ m_nEnd = _nEnd;
+ }
+ else
+ {
+ m_nEnd = _nStart;
+ m_nStart = _nEnd;
+ }
+}
+void FormulaDialog::getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const
+{
+ _nStart = m_nStart;
+ _nEnd = m_nEnd;
+}
+String FormulaDialog::getCurrentFormula() const
+{
+ return m_sFormula;
+}
+IFunctionManager* FormulaDialog::getFunctionManager()
+{
+ return m_aFunctionManager.get();
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::ShowReference(const String& /*_sRef*/)
+{
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::HideReference( BOOL /*bDoneRefMode*/)
+{
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::ReleaseFocus( RefEdit* /*pEdit*/, RefButton* /*pButton*/)
+{
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::ToggleCollapsed( RefEdit* _pEdit, RefButton* _pButton)
+{
+ ::std::pair<RefButton*,RefEdit*> aPair = RefInputStartBefore( _pEdit, _pButton );
+ m_pEdit = aPair.second;
+ if ( m_pEdit )
+ m_pEdit->Hide();
+ if ( aPair.first )
+ aPair.first->Hide();
+
+ if ( !m_pAddField )
+ {
+ m_pAddField = new OAddFieldWindow(this,m_xRowSet);
+ m_pAddField->SetCreateHdl(LINK( this, FormulaDialog, OnClickHdl ) );
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( HID_RPT_FIELD_SEL_WIN ) );
+ if ( aDlgOpt.Exists() )
+ {
+ m_pAddField->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+
+ }
+
+ m_pAddField->Update();
+ } // if ( !m_pAddField )
+ RefInputStartAfter( aPair.second, aPair.first );
+ m_pAddField->Show();
+
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( FormulaDialog, OnClickHdl, OAddFieldWindow* ,_pAddFieldDlg)
+{
+ const uno::Sequence< beans::PropertyValue > aArgs = _pAddFieldDlg->getSelectedFieldDescriptors();
+ // we use this way to create undo actions
+ if ( m_pEdit && aArgs.getLength() == 1)
+ {
+ uno::Sequence< beans::PropertyValue > aValue;
+ aArgs[0].Value >>= aValue;
+ ::svx::ODataAccessDescriptor aDescriptor(aValue);
+ ::rtl::OUString sName;
+ aDescriptor[ ::svx::daColumnName ] >>= sName;
+ if ( sName.getLength() )
+ {
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("[")) + sName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("]"));
+ m_pEdit->SetText(sName);
+ }
+ } // if ( m_pEdit && aArgs.getLength() )
+ m_pEdit = NULL;
+ _pAddFieldDlg->Hide();
+ RefInputDoneAfter( TRUE );
+
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< sheet::XFormulaParser> FormulaDialog::getFormulaParser() const
+{
+ return m_xParser.get();
+}
+// -----------------------------------------------------------------------------
+uno::Reference< sheet::XFormulaOpCodeMapper> FormulaDialog::getFormulaOpCodeMapper() const
+{
+ return m_xOpCodeMapper;
+}
+// -----------------------------------------------------------------------------
+table::CellAddress FormulaDialog::getReferencePosition() const
+{
+ return table::CellAddress();
+}
+// -----------------------------------------------------------------------------
+::std::auto_ptr<formula::FormulaTokenArray> FormulaDialog::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList)
+{
+ ::std::auto_ptr<formula::FormulaTokenArray> pArray(new FormulaTokenArray());
+ pArray->Fill(_aTokenList, NULL);
+ return pArray;
+}
+// =============================================================================
+} // rptui
+// =============================================================================
diff --git a/reportdesign/source/ui/dlg/GroupExchange.cxx b/reportdesign/source/ui/dlg/GroupExchange.cxx
new file mode 100644
index 000000000000..cbce03c629fd
--- /dev/null
+++ b/reportdesign/source/ui/dlg/GroupExchange.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_reportdesign.hxx"
+#include "GroupExchange.hxx"
+#include <sot/formats.hxx>
+#include <sot/storage.hxx>
+
+namespace rptui
+{
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+
+ sal_uInt32 OGroupExchange::getReportGroupId()
+ {
+ static sal_uInt32 s_nReportFormat = (sal_uInt32)-1;
+ if ( (sal_uInt32)-1 == s_nReportFormat )
+ {
+ s_nReportFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"reportdesign.GroupFormat\"" ));
+ OSL_ENSURE((sal_uInt32)-1 != s_nReportFormat, "Bad exchange id!");
+ }
+ return s_nReportFormat;
+ }
+ OGroupExchange::OGroupExchange(const uno::Sequence< uno::Any >& _aGroupRow)
+ : m_aGroupRow(_aGroupRow)
+ {
+ }
+ // -----------------------------------------------------------------------------
+ void OGroupExchange::AddSupportedFormats()
+ {
+ if ( m_aGroupRow.getLength() )
+ {
+ AddFormat(OGroupExchange::getReportGroupId());
+ }
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool OGroupExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+ {
+ ULONG nFormat = SotExchange::GetFormat(rFlavor);
+ if(nFormat == OGroupExchange::getReportGroupId() )
+ {
+ return SetAny(uno::makeAny(m_aGroupRow),rFlavor);
+ }
+ return sal_False;
+ }
+ // -----------------------------------------------------------------------------
+ void OGroupExchange::ObjectReleased()
+ {
+ m_aGroupRow.realloc(0);
+ }
+ // -----------------------------------------------------------------------------
+}
diff --git a/reportdesign/source/ui/dlg/GroupExchange.hxx b/reportdesign/source/ui/dlg/GroupExchange.hxx
new file mode 100644
index 000000000000..7c8afeedeb03
--- /dev/null
+++ b/reportdesign/source/ui/dlg/GroupExchange.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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 RPTUI_GROUP_EXCHANGE_HXX
+#define RPTUI_GROUP_EXCHANGE_HXX
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <svtools/transfer.hxx>
+#include "GroupsSorting.hxx"
+
+namespace rptui
+{
+ /** clipboard class for group rows in the groups and sorting dialog
+ */
+ class OGroupExchange : public TransferableHelper
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> m_aGroupRow;
+ public:
+ OGroupExchange(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& _aGroupRow);
+
+ static sal_uInt32 getReportGroupId();
+ protected:
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void ObjectReleased();
+ };
+}
+#endif // RPTUI_GROUP_EXCHANGE_HXX
+
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
new file mode 100644
index 000000000000..7e83adbb4e49
--- /dev/null
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -0,0 +1,1539 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_reportdesign.hxx"
+#include "GroupsSorting.hxx"
+#include "GroupsSorting.hrc"
+#include <connectivity/dbtools.hxx>
+#include <svtools/editbrowsebox.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/report/GroupOn.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+
+#include <tools/debug.hxx>
+#include "RptResId.hrc"
+#include "rptui_slotid.hrc"
+#include "ModuleHelper.hxx"
+#include "helpids.hrc"
+
+#include <svx/globlmn.hrc>
+#include <svx/svxids.hrc>
+#include <svtools/imgdef.hxx>
+
+#include "GroupExchange.hxx"
+#include "UITools.hxx"
+#include "UndoActions.hxx"
+#include "uistrings.hrc"
+#include "ReportController.hxx"
+
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/property.hxx>
+#include <vcl/mnemonic.hxx>
+#include <vcl/msgbox.hxx>
+#include <algorithm>
+#include <boost/bind.hpp>
+
+#include <cppuhelper/bootstrap.hxx>
+
+#define HANDLE_ID 0
+#define FIELD_EXPRESSION 1
+#define GROUPS_START_LEN 5
+#define NO_GROUP -1
+
+namespace rptui
+{
+using namespace ::com::sun::star;
+using namespace svt;
+using namespace ::comphelper;
+
+typedef ::svt::EditBrowseBox OFieldExpressionControl_Base;
+typedef ::cppu::WeakImplHelper1< container::XContainerListener > TContainerListenerBase;
+class OFieldExpressionControl : public TContainerListenerBase
+ ,public OFieldExpressionControl_Base
+{
+ ::osl::Mutex m_aMutex;
+ ::std::vector<sal_Int32> m_aGroupPositions;
+ ::svt::ComboBoxControl* m_pComboCell;
+ sal_Int32 m_nDataPos;
+ sal_Int32 m_nCurrentPos;
+ ULONG m_nPasteEvent;
+ ULONG m_nDeleteEvent;
+ OGroupsSortingDialog* m_pParent;
+ bool m_bIgnoreEvent;
+
+
+ void fillListBox(const uno::Reference< beans::XPropertySet>& _xDest,long nRow,USHORT nColumnId);
+ BOOL SaveModified(bool _bAppend);
+
+ OFieldExpressionControl(const OFieldExpressionControl&); // NO COPY
+ void operator =(const OFieldExpressionControl&); // NO ASSIGN
+public:
+ OFieldExpressionControl( OGroupsSortingDialog* _pParent,const ResId& _rResId);
+ virtual ~OFieldExpressionControl();
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
+ // XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+
+ void fillColumns(const uno::Reference< container::XNameAccess>& _xColumns);
+ void lateInit();
+ sal_Bool IsDeleteAllowed( );
+ void DeleteRows();
+ void cut();
+ void copy();
+ void paste();
+
+ inline sal_Int32 getGroupPosition(sal_Int32 _nRow) const { return _nRow != BROWSER_ENDOFSELECTION ? m_aGroupPositions[_nRow] : sal_Int32(NO_GROUP); }
+
+ inline ::svt::ComboBoxControl* getExpressionControl() const { return m_pComboCell; }
+
+
+ /** returns the sequence with the selected groups
+ */
+ uno::Sequence<uno::Any> fillSelectedGroups();
+
+ /** move groups given by _aGroups
+ */
+ void moveGroups(const uno::Sequence<uno::Any>& _aGroups,sal_Int32 _nRow,sal_Bool _bSelect = sal_True);
+
+ virtual BOOL CursorMoving(long nNewRow, USHORT nNewCol);
+ using OFieldExpressionControl_Base::GetRowCount;
+protected:
+ virtual BOOL IsTabAllowed(BOOL bForward) const;
+
+
+ virtual void InitController( ::svt::CellControllerRef& rController, long nRow, USHORT nCol );
+ virtual ::svt::CellController* GetController( long nRow, USHORT nCol );
+ virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, USHORT nColId ) const;
+ virtual BOOL SeekRow( long nRow );
+ virtual BOOL SaveModified();
+ virtual String GetCellText( long nRow, USHORT nColId ) const;
+ virtual RowStatus GetRowStatus(long nRow) const;
+
+ virtual void KeyInput(const KeyEvent& rEvt);
+ virtual void Command( const CommandEvent& rEvt );
+
+ // D&D
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+ virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
+
+ using BrowseBox::AcceptDrop;
+ using BrowseBox::ExecuteDrop;
+
+private:
+
+ DECL_LINK( AsynchActivate, void* );
+ DECL_LINK( AsynchDeactivate, void* );
+ DECL_LINK( DelayedPaste, void* );
+ DECL_LINK( CBChangeHdl,ComboBox*);
+
+ void InsertRows( long nRow );
+
+public:
+ DECL_LINK( DelayedDelete, void* );
+
+};
+//========================================================================
+// class OFieldExpressionControl
+//========================================================================
+DBG_NAME( rpt_OFieldExpressionControl )
+//------------------------------------------------------------------------
+OFieldExpressionControl::OFieldExpressionControl( OGroupsSortingDialog* _pParent,const ResId& _rResId )
+ :EditBrowseBox( _pParent, _rResId,EBBF_NONE, WB_TABSTOP | BROWSER_COLUMNSELECTION | BROWSER_MULTISELECTION | BROWSER_AUTOSIZE_LASTCOL |
+ BROWSER_KEEPSELECTION | BROWSER_HLINESFULL | BROWSER_VLINESFULL)
+ ,m_aGroupPositions(GROUPS_START_LEN,-1)
+ ,m_pComboCell(NULL)
+ ,m_nDataPos(-1)
+ ,m_nCurrentPos(-1)
+ ,m_nPasteEvent(0)
+ ,m_nDeleteEvent(0)
+ ,m_pParent(_pParent)
+ ,m_bIgnoreEvent(false)
+{
+ DBG_CTOR( rpt_OFieldExpressionControl,NULL);
+ SetBorderStyle(WINDOW_BORDER_MONO);
+}
+
+//------------------------------------------------------------------------
+OFieldExpressionControl::~OFieldExpressionControl()
+{
+ acquire();
+ uno::Reference< report::XGroups > xGroups = m_pParent->getGroups();
+ xGroups->removeContainerListener(this);
+ //////////////////////////////////////////////////////////////////////
+ // delete events from queue
+ if( m_nPasteEvent )
+ Application::RemoveUserEvent( m_nPasteEvent );
+ if( m_nDeleteEvent )
+ Application::RemoveUserEvent( m_nDeleteEvent );
+
+ delete m_pComboCell;
+ DBG_DTOR( rpt_OFieldExpressionControl,NULL);
+}
+//------------------------------------------------------------------------------
+uno::Sequence<uno::Any> OFieldExpressionControl::fillSelectedGroups()
+{
+ uno::Sequence<uno::Any> aList;
+ ::std::vector<uno::Any> vClipboardList;
+ vClipboardList.reserve(GetSelectRowCount());
+
+ uno::Reference<report::XGroups> xGroups = m_pParent->getGroups();
+ sal_Int32 nCount = xGroups->getCount();
+ if ( nCount >= 1 )
+ {
+ for( long nIndex=FirstSelectedRow(); nIndex >= 0 ; nIndex=NextSelectedRow() )
+ {
+ try
+ {
+ if ( m_aGroupPositions[nIndex] != NO_GROUP )
+ {
+ uno::Reference< report::XGroup> xOrgGroup(xGroups->getByIndex(m_aGroupPositions[nIndex]),uno::UNO_QUERY);
+ /*uno::Reference< report::XGroup> xCopy = xGroups->createGroup();
+ ::comphelper::copyProperties(xOrgGroup.get(),xCopy.get());*/
+ vClipboardList.push_back( uno::makeAny(xOrgGroup) );
+ }
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Can not access group!");
+ }
+ }
+ if ( !vClipboardList.empty() )
+ aList = uno::Sequence< uno::Any >(&vClipboardList[0], vClipboardList.size());
+ } // if ( nCount > 1 )
+ return aList;
+}
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::StartDrag( sal_Int8 /*_nAction*/ , const Point& /*_rPosPixel*/ )
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ if ( m_pParent && !m_pParent->isReadOnly( ) )
+ {
+ uno::Sequence<uno::Any> aClipboardList = fillSelectedGroups();
+
+ if( aClipboardList.getLength() )
+ {
+ OGroupExchange* pData = new OGroupExchange(aClipboardList);
+ uno::Reference< ::com::sun::star::datatransfer::XTransferable> xRef = pData;
+ pData->StartDrag(this, DND_ACTION_MOVE );
+ } // if(!vClipboardList.empty())
+ }
+}
+//------------------------------------------------------------------------------
+sal_Int8 OFieldExpressionControl::AcceptDrop( const BrowserAcceptDropEvent& rEvt )
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ sal_Int8 nAction = DND_ACTION_NONE;
+ if ( IsEditing() )
+ {
+ USHORT nPos = m_pComboCell->GetSelectEntryPos();
+ if ( COMBOBOX_ENTRY_NOTFOUND != nPos || m_pComboCell->GetText().Len() )
+ SaveModified();
+ DeactivateCell();
+ }
+ if ( IsDropFormatSupported( OGroupExchange::getReportGroupId() ) && m_pParent->getGroups()->getCount() > 1 && rEvt.GetWindow() == &GetDataWindow() )
+ {
+ nAction = DND_ACTION_MOVE;
+ }
+ return nAction;
+}
+//------------------------------------------------------------------------------
+sal_Int8 OFieldExpressionControl::ExecuteDrop( const BrowserExecuteDropEvent& rEvt )
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ sal_Int8 nAction = DND_ACTION_NONE;
+ if ( IsDropFormatSupported( OGroupExchange::getReportGroupId() ) )
+ {
+ sal_Int32 nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), sal_False);
+ SetNoSelection();
+
+ TransferableDataHelper aDropped( rEvt.maDropEvent.Transferable );
+ uno::Any aDrop = aDropped.GetAny(OGroupExchange::getReportGroupId());
+ uno::Sequence< uno::Any > aGroups;
+ aDrop >>= aGroups;
+ if ( aGroups.getLength() )
+ {
+ moveGroups(aGroups,nRow);
+ nAction = DND_ACTION_MOVE;
+ }
+ }
+ return nAction;
+}
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::moveGroups(const uno::Sequence<uno::Any>& _aGroups,sal_Int32 _nRow,sal_Bool _bSelect)
+{
+ if ( _aGroups.getLength() )
+ {
+ m_bIgnoreEvent = true;
+ {
+ sal_Int32 nRow = _nRow;
+ String sUndoAction(ModuleRes(RID_STR_UNDO_MOVE_GROUP));
+ UndoManagerListAction aListAction(*m_pParent->m_pController->getUndoMgr(),sUndoAction);
+
+ uno::Reference< report::XGroups> xGroups = m_pParent->getGroups();
+ const uno::Any* pIter = _aGroups.getConstArray();
+ const uno::Any* pEnd = pIter + _aGroups.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ uno::Reference< report::XGroup> xGroup(*pIter,uno::UNO_QUERY);
+ if ( xGroup.is() )
+ {
+ uno::Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0].Name = PROPERTY_GROUP;
+ aArgs[0].Value <<= xGroup;
+ // we use this way to create undo actions
+ m_pParent->m_pController->executeChecked(SID_GROUP_REMOVE,aArgs);
+ aArgs.realloc(2);
+ if ( nRow > xGroups->getCount() )
+ nRow = xGroups->getCount();
+ if ( _bSelect )
+ SelectRow(nRow);
+ aArgs[1].Name = PROPERTY_POSITIONY;
+ aArgs[1].Value <<= nRow;
+ m_pParent->m_pController->executeChecked(SID_GROUP_APPEND,aArgs);
+ ++nRow;
+ }
+ } // for(;pIter != pEnd;++pIter)
+ }
+ m_bIgnoreEvent = false;
+ Invalidate();
+ } // if ( _aGroups.getLength() )
+}
+// -----------------------------------------------------------------------------
+void OFieldExpressionControl::fillColumns(const uno::Reference< container::XNameAccess>& _xColumns)
+{
+ m_pComboCell->Clear();
+ if ( _xColumns.is() )
+ {
+ uno::Sequence< ::rtl::OUString> aColumnNames = _xColumns->getElementNames();
+ const ::rtl::OUString* pIter = aColumnNames.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aColumnNames.getLength();
+ for(;pIter != pEnd;++pIter)
+ m_pComboCell->InsertEntry(*pIter);
+ } // if ( _xColumns.is() )
+}
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::lateInit()
+{
+ uno::Reference< report::XGroups > xGroups = m_pParent->getGroups();
+ sal_Int32 nGroupsCount = xGroups->getCount();
+ m_aGroupPositions.resize(::std::max<sal_Int32>(nGroupsCount,sal_Int32(GROUPS_START_LEN)),NO_GROUP);
+ ::std::vector<sal_Int32>::iterator aIter = m_aGroupPositions.begin();
+ for (sal_Int32 i = 0; i < nGroupsCount; ++i,++aIter)
+ *aIter = i;
+
+ if ( ColCount() == 0 )
+ {
+ Font aFont( GetDataWindow().GetFont() );
+ aFont.SetWeight( WEIGHT_NORMAL );
+ GetDataWindow().SetFont( aFont );
+
+ // Font fuer die Ueberschriften auf Light setzen
+ aFont = GetFont();
+ aFont.SetWeight( WEIGHT_LIGHT );
+ SetFont(aFont);
+
+ InsertHandleColumn(static_cast<USHORT>(GetTextWidth('0') * 4)/*, TRUE */);
+ InsertDataColumn( FIELD_EXPRESSION, String(ModuleRes(STR_RPT_EXPRESSION)), 100);
+
+ m_pComboCell = new ComboBoxControl( &GetDataWindow() );
+ m_pComboCell->SetSelectHdl(LINK(this,OFieldExpressionControl,CBChangeHdl));
+ m_pComboCell->SetHelpId(HID_RPT_FIELDEXPRESSION);
+
+ Control* pControls[] = {m_pComboCell};
+ for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+ {
+ pControls[i]->SetGetFocusHdl(LINK(m_pParent, OGroupsSortingDialog, OnControlFocusGot));
+ pControls[i]->SetLoseFocusHdl(LINK(m_pParent, OGroupsSortingDialog, OnControlFocusLost));
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // set browse mode
+ BrowserMode nMode(BROWSER_COLUMNSELECTION | BROWSER_MULTISELECTION | BROWSER_KEEPSELECTION |
+ BROWSER_HLINESFULL | BROWSER_VLINESFULL | BROWSER_AUTOSIZE_LASTCOL | BROWSER_AUTO_VSCROLL | BROWSER_AUTO_HSCROLL);
+ if( m_pParent->isReadOnly() )
+ nMode |= BROWSER_HIDECURSOR;
+ SetMode(nMode);
+ xGroups->addContainerListener(this);
+ }
+ else
+ // not the first call
+ RowRemoved(0, GetRowCount());
+
+ RowInserted(0, m_aGroupPositions.size(), TRUE);
+}
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+IMPL_LINK( OFieldExpressionControl, CBChangeHdl, ComboBox*, /*pComboBox*/ )
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+
+ SaveModified();
+ return 0L;
+}
+//------------------------------------------------------------------------------
+IMPL_LINK(OFieldExpressionControl, AsynchActivate, void*, EMPTYARG)
+{
+ ActivateCell();
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(OFieldExpressionControl, AsynchDeactivate, void*, EMPTYARG)
+{
+ DeactivateCell();
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+BOOL OFieldExpressionControl::IsTabAllowed(BOOL /*bForward*/) const
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ return FALSE;
+}
+
+//------------------------------------------------------------------------------
+BOOL OFieldExpressionControl::SaveModified()
+{
+ return SaveModified(true);
+}
+//------------------------------------------------------------------------------
+BOOL OFieldExpressionControl::SaveModified(bool _bAppendRow)
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ sal_Int32 nRow = GetCurRow();
+ if ( nRow != BROWSER_ENDOFSELECTION )
+ {
+ sal_Bool bAppend = sal_False;
+ try
+ {
+ uno::Reference< report::XGroup> xGroup;
+ if ( m_aGroupPositions[nRow] == NO_GROUP )
+ {
+ bAppend = sal_True;
+ String sUndoAction(ModuleRes(RID_STR_UNDO_APPEND_GROUP));
+ m_pParent->m_pController->getUndoMgr()->EnterListAction( sUndoAction, String() );
+ xGroup = m_pParent->getGroups()->createGroup();
+ xGroup->setHeaderOn(sal_True);
+
+ uno::Sequence< beans::PropertyValue > aArgs(2);
+ aArgs[0].Name = PROPERTY_GROUP;
+ aArgs[0].Value <<= xGroup;
+ // find position where to insert the new group
+ sal_Int32 nGroupPos = 0;
+ ::std::vector<sal_Int32>::iterator aIter = m_aGroupPositions.begin();
+ ::std::vector<sal_Int32>::iterator aEnd = m_aGroupPositions.begin() + nRow;
+ for(;aIter != aEnd;++aIter)
+ if ( *aIter != NO_GROUP )
+ nGroupPos = *aIter + 1;
+ aArgs[1].Name = PROPERTY_POSITIONY;
+ aArgs[1].Value <<= nGroupPos;
+ m_bIgnoreEvent = true;
+ m_pParent->m_pController->executeChecked(SID_GROUP_APPEND,aArgs);
+ m_bIgnoreEvent = false;
+ OSL_ENSURE(*aIter == NO_GROUP ,"Illegal iterator!");
+ *aIter++ = nGroupPos;
+
+ aEnd = m_aGroupPositions.end();
+ for(;aIter != aEnd;++aIter)
+ if ( *aIter != NO_GROUP )
+ ++*aIter;
+ }
+ else
+ xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
+ if ( xGroup.is() )
+ {
+ USHORT nPos = m_pComboCell->GetSelectEntryPos();
+ ::rtl::OUString sExpression;
+ if ( COMBOBOX_ENTRY_NOTFOUND == nPos )
+ sExpression = m_pComboCell->GetText();
+ else
+ {
+ sExpression = m_pComboCell->GetEntry(nPos);
+ }
+ xGroup->setExpression( sExpression );
+
+ ::rptui::adjustSectionName(xGroup,nPos);
+
+ if ( bAppend )
+ m_pParent->m_pController->getUndoMgr()->LeaveListAction();
+ }
+
+ if ( Controller() )
+ Controller()->ClearModified();
+ if ( _bAppendRow && GetRowCount() == m_pParent->getGroups()->getCount() )
+ {
+ RowInserted( GetRowCount()-1);
+ m_aGroupPositions.push_back(NO_GROUP);
+ }
+
+ GoToRow(nRow);
+ m_pParent->DisplayData(nRow);
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"OFieldExpressionControl::SaveModified: Exception caught!");
+ }
+ }
+
+ return TRUE;
+}
+//------------------------------------------------------------------------------
+String OFieldExpressionControl::GetCellText( long nRow, USHORT /*nColId*/ ) const
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ String sText;
+ if ( nRow != BROWSER_ENDOFSELECTION && m_aGroupPositions[nRow] != NO_GROUP )
+ {
+ try
+ {
+ uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
+ sText = xGroup->getExpression();
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught while getting expression value from the group");
+ }
+ } // if ( nRow != BROWSER_ENDOFSELECTION && nRow < m_pParent->getGroups()->getCount() )
+ return sText;
+}
+
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::InitController( CellControllerRef& /*rController*/, long nRow, USHORT nColumnId )
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+
+ m_pComboCell->SetText( GetCellText( nRow, nColumnId ) );
+}
+//------------------------------------------------------------------------------
+sal_Bool OFieldExpressionControl::CursorMoving(long nNewRow, sal_uInt16 nNewCol)
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+
+ if (!EditBrowseBox::CursorMoving(nNewRow, nNewCol))
+ return sal_False;
+ m_nDataPos = nNewRow;
+ long nOldDataPos = GetCurRow();
+ InvalidateStatusCell( m_nDataPos );
+ InvalidateStatusCell( nOldDataPos );
+
+ m_pParent->SaveData( nOldDataPos );
+ m_pParent->DisplayData( m_nDataPos );
+ return sal_True;
+}
+//------------------------------------------------------------------------------
+CellController* OFieldExpressionControl::GetController( long /*nRow*/, USHORT /*nColumnId*/ )
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ ComboBoxCellController* pCellController = new ComboBoxCellController( m_pComboCell );
+ pCellController->GetComboBox().SetReadOnly(!m_pParent->m_pController->isEditable());
+ return pCellController;
+}
+
+//------------------------------------------------------------------------------
+BOOL OFieldExpressionControl::SeekRow( long _nRow )
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ // die Basisklasse braucht den Aufruf, da sie sich dort merkt, welche Zeile gepainted wird
+ EditBrowseBox::SeekRow(_nRow);
+ m_nCurrentPos = _nRow;
+ return TRUE;
+}
+
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::PaintCell( OutputDevice& rDev, const Rectangle& rRect, USHORT nColumnId ) const
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ String aText =const_cast< OFieldExpressionControl*>(this)->GetCellText( m_nCurrentPos, nColumnId );
+
+ Point aPos( rRect.TopLeft() );
+ Size aTextSize( GetDataWindow().GetTextHeight(),GetDataWindow().GetTextWidth( aText ));
+
+ if( aPos.X() < rRect.Right() || aPos.X() + aTextSize.Width() > rRect.Right() ||
+ aPos.Y() < rRect.Top() || aPos.Y() + aTextSize.Height() > rRect.Bottom() )
+ rDev.SetClipRegion( rRect );
+
+ rDev.DrawText( aPos, aText );
+
+ if( rDev.IsClipRegion() )
+ rDev.SetClipRegion();
+}
+//------------------------------------------------------------------------------
+EditBrowseBox::RowStatus OFieldExpressionControl::GetRowStatus(long nRow) const
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ if (nRow >= 0 && nRow == m_nDataPos)
+ return EditBrowseBox::CURRENT;
+ if ( nRow != BROWSER_ENDOFSELECTION && nRow < static_cast<long>(m_aGroupPositions.size()) && m_aGroupPositions[nRow] != NO_GROUP )
+ {
+ try
+ {
+ uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
+ return (xGroup->getHeaderOn() || xGroup->getFooterOn())? EditBrowseBox::HEADERFOOTER : EditBrowseBox::CLEAN;
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception cathced while try to get a group!");
+ }
+ }
+ return EditBrowseBox::CLEAN;
+}
+// XEventListener
+//------------------------------------------------------------------------------
+void SAL_CALL OFieldExpressionControl::disposing(const lang::EventObject& /*e*/) throw( uno::RuntimeException )
+{
+}
+//------------------------------------------------------------------------------
+// XContainerListener
+//------------------------------------------------------------------------------
+void SAL_CALL OFieldExpressionControl::elementInserted(const container::ContainerEvent& evt) throw(uno::RuntimeException)
+{
+ if ( m_bIgnoreEvent )
+ return;
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+ sal_Int32 nGroupPos = 0;
+ if ( evt.Accessor >>= nGroupPos )
+ {
+ if ( nGroupPos >= GetRowCount() )
+ {
+ sal_Int32 nAddedRows = nGroupPos - GetRowCount();
+ RowInserted(nAddedRows);
+ for (sal_Int32 i = 0; i < nAddedRows; ++i)
+ m_aGroupPositions.push_back(NO_GROUP);
+ m_aGroupPositions[nGroupPos] = nGroupPos;
+ }
+ else
+ {
+ ::std::vector<sal_Int32>::iterator aFind = m_aGroupPositions.begin()+ nGroupPos;
+ if ( aFind == m_aGroupPositions.end() )
+ aFind = ::std::find(m_aGroupPositions.begin(),m_aGroupPositions.end(),NO_GROUP);
+
+ if ( aFind != m_aGroupPositions.end() )
+ {
+ if ( *aFind != NO_GROUP )
+ aFind = m_aGroupPositions.insert(aFind,nGroupPos);
+ else
+ *aFind = nGroupPos;
+
+ ::std::vector<sal_Int32>::iterator aEnd = m_aGroupPositions.end();
+ for(++aFind;aFind != aEnd;++aFind)
+ if ( *aFind != NO_GROUP )
+ ++*aFind;
+
+ //::std::vector<sal_Int32>::reverse_iterator aRIter = m_aGroupPositions.rbegin();
+ //::std::vector<sal_Int32>::reverse_iterator aREnd = m_aGroupPositions.rend();
+ //for (; aRIter != aREnd && *aRIter != NO_GROUP; ++aRIter)
+ // continue;
+ //if ( aRIter != aREnd )
+ // m_aGroupPositions.erase(m_aGroupPositions.begin() + (m_aGroupPositions.size() - 1 - (aRIter - m_aGroupPositions.rbegin())));
+ }
+ }
+ Invalidate();
+ }
+}
+//------------------------------------------------------------------------------
+void SAL_CALL OFieldExpressionControl::elementReplaced(const container::ContainerEvent& /*evt*/) throw(uno::RuntimeException)
+{
+}
+//------------------------------------------------------------------------------
+void SAL_CALL OFieldExpressionControl::elementRemoved(const container::ContainerEvent& evt) throw(uno::RuntimeException)
+{
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_bIgnoreEvent )
+ return;
+
+ sal_Int32 nGroupPos = 0;
+ if ( evt.Accessor >>= nGroupPos )
+ {
+ ::std::vector<sal_Int32>::iterator aFind = ::std::find(m_aGroupPositions.begin(),m_aGroupPositions.end(),nGroupPos);
+ if ( aFind != m_aGroupPositions.end() )
+ {
+ *aFind = NO_GROUP;
+ ::std::vector<sal_Int32>::iterator aEnd = m_aGroupPositions.end();
+ for(++aFind;aFind != aEnd;++aFind)
+ if ( *aFind != NO_GROUP )
+ --*aFind;
+ //PaintCell(*this,GetFieldRect(FIELD_EXPRESSION),FIELD_EXPRESSION);
+ Invalidate();
+ }
+ }
+}
+//------------------------------------------------------------------------------
+sal_Bool OFieldExpressionControl::IsDeleteAllowed( )
+{
+ return !m_pParent->isReadOnly() && GetSelectRowCount() > 0;
+}
+//------------------------------------------------------------------------
+void OFieldExpressionControl::KeyInput( const KeyEvent& rEvt )
+{
+ if (IsDeleteAllowed())
+ {
+ if (rEvt.GetKeyCode().GetCode() == KEY_DELETE && // Delete rows
+ !rEvt.GetKeyCode().IsShift() &&
+ !rEvt.GetKeyCode().IsMod1())
+ {
+ DeleteRows();
+ return;
+ }
+ }
+ EditBrowseBox::KeyInput(rEvt);
+}
+//------------------------------------------------------------------------
+void OFieldExpressionControl::Command(const CommandEvent& rEvt)
+{
+ switch (rEvt.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ if (!rEvt.IsMouseEvent())
+ {
+ EditBrowseBox::Command(rEvt);
+ return;
+ }
+
+ USHORT nColId = GetColumnAtXPosPixel(rEvt.GetMousePosPixel().X());
+
+ if ( nColId == HANDLE_ID )
+ {
+ //long nRow = GetRowAtYPosPixel(rEvt.GetMousePosPixel().Y());
+ PopupMenu aContextMenu(ModuleRes(RID_GROUPSROWPOPUPMENU));
+ sal_Bool bEnable = sal_False;
+ long nIndex = FirstSelectedRow();
+ while( nIndex >= 0 && !bEnable )
+ {
+ if ( m_aGroupPositions[nIndex] != NO_GROUP )
+ bEnable = sal_True;
+ nIndex = NextSelectedRow();
+ }
+ //aContextMenu.EnableItem( SID_CUT, IsDeleteAllowed() && bEnable);
+ //aContextMenu.EnableItem( SID_COPY, bEnable);
+ //TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent()));
+ //aContextMenu.EnableItem( SID_PASTE, aTransferData.HasFormat(SOT_FORMATSTR_ID_RPT_GRPED) );
+ aContextMenu.EnableItem( SID_DELETE, IsDeleteAllowed() && bEnable );
+ switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel()))
+ {
+ case SID_CUT:
+ cut();
+ break;
+ case SID_COPY:
+ copy();
+ break;
+ case SID_PASTE:
+ paste();
+ break;
+
+ case SID_DELETE:
+ if( m_nDeleteEvent )
+ Application::RemoveUserEvent( m_nDeleteEvent );
+ m_nDeleteEvent = Application::PostUserEvent( LINK(this, OFieldExpressionControl, DelayedDelete) );
+ break;
+ default:
+ break;
+ }
+ } // if ( nColId == HANDLE_ID )
+ // run through
+ }
+ default:
+ EditBrowseBox::Command(rEvt);
+ }
+
+}
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::DeleteRows()
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+
+ sal_Bool bIsEditing = IsEditing();
+ if (bIsEditing)
+ {
+ DeactivateCell();
+ }
+ long nIndex = FirstSelectedRow();
+ if (nIndex == -1)
+ {
+ nIndex = GetCurRow();
+ }
+ bool bFirstTime = true;
+
+ long nOldDataPos = nIndex;
+ uno::Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0].Name = PROPERTY_GROUP;
+ m_bIgnoreEvent = true;
+ while( nIndex >= 0 )
+ {
+ if ( m_aGroupPositions[nIndex] != NO_GROUP )
+ {
+ if ( bFirstTime )
+ {
+ bFirstTime = false;
+ String sUndoAction(ModuleRes(RID_STR_UNDO_REMOVE_SELECTION));
+ m_pParent->m_pController->getUndoMgr()->EnterListAction( sUndoAction, String() );
+ }
+
+ sal_Int32 nGroupPos = m_aGroupPositions[nIndex];
+ uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(nGroupPos);
+ aArgs[0].Value <<= xGroup;
+ // we use this way to create undo actions
+ m_pParent->m_pController->executeChecked(SID_GROUP_REMOVE,aArgs);
+
+ ::std::vector<sal_Int32>::iterator aFind = ::std::find(m_aGroupPositions.begin(),m_aGroupPositions.end(),nGroupPos);
+ *aFind = NO_GROUP;
+ ::std::vector<sal_Int32>::iterator aEnd = m_aGroupPositions.end();
+ for(++aFind;aFind != aEnd;++aFind)
+ if ( *aFind != NO_GROUP )
+ --*aFind;
+ }
+ nIndex = NextSelectedRow();
+ } // while( nIndex >= 0 )
+
+ if ( !bFirstTime )
+ m_pParent->m_pController->getUndoMgr()->LeaveListAction();
+
+ m_nDataPos = GetCurRow();
+ InvalidateStatusCell( nOldDataPos );
+ InvalidateStatusCell( m_nDataPos );
+ ActivateCell();
+ m_pParent->DisplayData( m_nDataPos );
+ m_bIgnoreEvent = false;
+ Invalidate();
+}
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::cut()
+{
+ copy();
+ DeleteRows();
+}
+
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::copy()
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ //////////////////////////////////////////////////////////////////////
+ // set to the right row and save it
+ m_pParent->SaveData( m_nDataPos );
+
+ uno::Sequence<uno::Any> aClipboardList = fillSelectedGroups();
+
+ if( aClipboardList.getLength() )
+ {
+ OGroupExchange* pData = new OGroupExchange(aClipboardList);
+ uno::Reference< ::com::sun::star::datatransfer::XTransferable> xRef = pData;
+ pData->CopyToClipboard(GetParent());
+ }
+}
+
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::paste()
+{
+ TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent()));
+ if(aTransferData.HasFormat(OGroupExchange::getReportGroupId()))
+ {
+ if( m_nPasteEvent )
+ Application::RemoveUserEvent( m_nPasteEvent );
+ m_nPasteEvent = Application::PostUserEvent( LINK(this, OFieldExpressionControl, DelayedPaste) );
+ }
+}
+//------------------------------------------------------------------------------
+IMPL_LINK( OFieldExpressionControl, DelayedPaste, void*, )
+{
+ m_nPasteEvent = 0;
+
+ sal_Int32 nPastePosition = GetSelectRowCount() ? FirstSelectedRow() : GetCurRow();
+
+ InsertRows( nPastePosition );
+ SetNoSelection();
+ GoToRow( nPastePosition );
+
+ return 0;
+}
+//------------------------------------------------------------------------------
+IMPL_LINK( OFieldExpressionControl, DelayedDelete, void*, )
+{
+ m_nDeleteEvent = 0;
+ DeleteRows();
+ return 0;
+}
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::InsertRows( long nRow )
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+
+ sal_Int32 nSize = 0;
+ //////////////////////////////////////////////////////////////////////
+ // get rows from clipboard
+ TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent()));
+ if(aTransferData.HasFormat(OGroupExchange::getReportGroupId()))
+ {
+ datatransfer::DataFlavor aFlavor;
+ SotExchange::GetFormatDataFlavor(OGroupExchange::getReportGroupId(), aFlavor);
+ uno::Sequence< uno::Any > aGroups;
+
+ if( (aTransferData.GetAny(aFlavor) >>= aGroups) && aGroups.getLength() )
+ {
+ m_bIgnoreEvent = false;
+ {
+ String sUndoAction(ModuleRes(RID_STR_UNDO_APPEND_GROUP));
+ UndoManagerListAction aListAction(*m_pParent->m_pController->getUndoMgr(),sUndoAction);
+
+ uno::Reference<report::XGroups> xGroups = m_pParent->getGroups();
+ sal_Int32 nGroupPos = 0;
+ ::std::vector<sal_Int32>::iterator aIter = m_aGroupPositions.begin();
+ ::std::vector<sal_Int32>::size_type nRowPos = static_cast< ::std::vector<sal_Int32>::size_type >(nRow);
+ if ( nRowPos < m_aGroupPositions.size() )
+ {
+ ::std::vector<sal_Int32>::iterator aEnd = m_aGroupPositions.begin() + nRowPos;
+ for(;aIter != aEnd;++aIter)
+ {
+ if ( *aIter != NO_GROUP )
+ nGroupPos = *aIter;
+ }
+ }
+ for(sal_Int32 i=0;i < aGroups.getLength();++i,++nSize)
+ {
+ uno::Sequence< beans::PropertyValue > aArgs(2);
+ aArgs[0].Name = PROPERTY_GROUP;
+ aArgs[0].Value = aGroups[i];
+ aArgs[1].Name = PROPERTY_POSITIONY;
+ aArgs[1].Value <<= nGroupPos;
+ m_pParent->m_pController->executeChecked(SID_GROUP_APPEND,aArgs);
+
+ ::std::vector<sal_Int32>::iterator aInsertPos = m_aGroupPositions.insert(aIter,nGroupPos);
+ ++aInsertPos;
+ aIter = aInsertPos;
+ ::std::vector<sal_Int32>::iterator aEnd = m_aGroupPositions.end();
+ for(;aInsertPos != aEnd;++aInsertPos)
+ if ( *aInsertPos != NO_GROUP )
+ ++*aInsertPos;
+ }
+ }
+ m_bIgnoreEvent = true;
+ }
+ }
+
+ RowInserted( nRow,nSize,sal_True );
+}
+//------------------------------------------------------------------------------
+
+DBG_NAME( rpt_OGroupsSortingDialog )
+//========================================================================
+// class OGroupsSortingDialog
+//========================================================================
+OGroupsSortingDialog::OGroupsSortingDialog( Window* _pParent
+ ,sal_Bool _bReadOnly
+ ,OReportController* _pController)
+ : FloatingWindow( _pParent, ModuleRes(RID_GROUPS_SORTING) )
+ ,OPropertyChangeListener(m_aMutex)
+ ,m_aFL2(this, ModuleRes(FL_SEPARATOR2) )
+ ,m_aMove(this, ModuleRes(FT_MOVELABEL) )
+/*
+ ,m_aPB_Up(this, ModuleRes(PB_UP) )
+ ,m_aPB_Down(this, ModuleRes(PB_DOWN) )
+ ,m_aPB_Delete(this, ModuleRes(PB_DELETE) )
+*/
+ ,m_aToolBox(this, ModuleRes(TB_TOOLBOX) )
+
+ ,m_aFL3(this, ModuleRes(FL_SEPARATOR3) )
+ ,m_aOrder(this, ModuleRes(FT_ORDER) )
+ ,m_aOrderLst(this, ModuleRes(LST_ORDER) )
+ ,m_aHeader(this, ModuleRes(FT_HEADER) )
+ ,m_aHeaderLst(this, ModuleRes(LST_HEADERLST) )
+ ,m_aFooter(this, ModuleRes(FT_FOOTER) )
+ ,m_aFooterLst(this, ModuleRes(LST_FOOTERLST) )
+ ,m_aGroupOn(this, ModuleRes(FT_GROUPON) )
+ ,m_aGroupOnLst(this, ModuleRes(LST_GROUPONLST) )
+ ,m_aGroupInterval(this, ModuleRes(FT_GROUPINTERVAL) )
+ ,m_aGroupIntervalEd(this, ModuleRes(ED_GROUPINTERVALLST) )
+ ,m_aKeepTogether(this, ModuleRes(FT_KEEPTOGETHER) )
+ ,m_aKeepTogetherLst(this, ModuleRes(LST_KEEPTOGETHERLST) )
+ ,m_aFL(this, ModuleRes(FL_SEPARATOR1) )
+ ,m_aHelpWindow(this, ModuleRes(HELP_FIELD) )
+ ,m_pFieldExpression( new OFieldExpressionControl(this,ModuleRes(WND_CONTROL)))
+ ,m_pController(_pController)
+ ,m_pCurrentGroupListener(NULL)
+ ,m_xGroups(m_pController->getReportDefinition()->getGroups())
+ ,m_bReadOnly(_bReadOnly)
+{
+ DBG_CTOR( rpt_OGroupsSortingDialog,NULL);
+
+
+ Control* pControlsLst[] = { &m_aHeaderLst, &m_aFooterLst, &m_aGroupOnLst, &m_aKeepTogetherLst, &m_aOrderLst, &m_aGroupIntervalEd};
+ for (size_t i = 0; i < sizeof(pControlsLst)/sizeof(pControlsLst[0]); ++i)
+ {
+ pControlsLst[i]->SetGetFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusGot));
+ pControlsLst[i]->SetLoseFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusLost));
+ pControlsLst[i]->Show(TRUE);
+ } // for (int i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+
+ for (size_t i = 0; i < (sizeof(pControlsLst)/sizeof(pControlsLst[0]))-1; ++i)
+ static_cast<ListBox*>(pControlsLst[i])->SetSelectHdl(LINK(this,OGroupsSortingDialog,LBChangeHdl));
+
+ Control* pControls[] = { &m_aHeader, &m_aFooter, &m_aGroupOn, &m_aGroupInterval, &m_aKeepTogether, &m_aOrder
+ , &m_aMove,&m_aFL2};
+ sal_Int32 nMaxTextWidth = 0;
+ MnemonicGenerator aMnemonicGenerator;
+ for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+ aMnemonicGenerator.RegisterMnemonic( pControls[i]->GetText() );
+
+ for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+ {
+ pControls[i]->Show(TRUE);
+ String sText = pControls[i]->GetText();
+ if ( aMnemonicGenerator.CreateMnemonic(sText) )
+ pControls[i]->SetText(sText);
+ sal_Int32 nTextWidth = GetTextWidth(sText);
+ nMaxTextWidth = ::std::max<sal_Int32>(nTextWidth,nMaxTextWidth);
+ }
+
+ Size aSize(UNRELATED_CONTROLS, PAGE_HEIGHT);
+ Size aSpace = LogicToPixel( aSize, MAP_APPFONT );
+ Size aOutSize(nMaxTextWidth + m_aHeader.GetSizePixel().Width() + 3*aSpace.Width(),aSpace.Height());
+ SetMinOutputSizePixel(aOutSize);
+ SetOutputSizePixel(aOutSize);
+// Resize();
+
+ m_pReportListener = new OPropertyChangeMultiplexer(this,m_pController->getReportDefinition().get());
+ m_pReportListener->addProperty(PROPERTY_COMMAND);
+ m_pReportListener->addProperty(PROPERTY_COMMANDTYPE);
+
+ m_pFieldExpression->lateInit();
+ fillColumns();
+ m_pFieldExpression->Show();
+
+ //m_aHelpWindow.SetReadOnly();
+ m_aHelpWindow.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
+ //BTN m_aPB_Up.SetClickHdl(LINK(this,OGroupsSortingDialog,ClickHdl));
+ //BTN m_aPB_Down.SetClickHdl(LINK(this,OGroupsSortingDialog,ClickHdl));
+ //BTN m_aPB_Delete.SetClickHdl(LINK(this,OGroupsSortingDialog,ClickHdl));
+
+ m_pFieldExpression->SetZOrder(&m_aFL2, WINDOW_ZORDER_BEHIND);
+
+ m_aMove.SetZOrder(m_pFieldExpression, WINDOW_ZORDER_BEHIND);
+ //BTN m_aPB_Up.SetZOrder(&m_aMove, WINDOW_ZORDER_BEHIND);
+ //BTN m_aPB_Down.SetZOrder(&m_aPB_Up, WINDOW_ZORDER_BEHIND);
+ // set Hi contrast bitmaps
+ //BTN m_aPB_Up.SetModeImage( ModuleRes(IMG_UP_H),BMP_COLOR_HIGHCONTRAST);
+ //BTN m_aPB_Down.SetModeImage( ModuleRes(IMG_DOWN_H),BMP_COLOR_HIGHCONTRAST);
+ m_aToolBox.SetStyle(m_aToolBox.GetStyle()|WB_LINESPACING);
+ m_aToolBox.SetSelectHdl(LINK(this, OGroupsSortingDialog, OnFormatAction));
+ m_aToolBox.SetImageListProvider(this);
+ setToolBox(&m_aToolBox);
+
+ checkButtons(0);
+ Resize();
+
+ FreeResource();
+}
+
+//------------------------------------------------------------------------
+OGroupsSortingDialog::~OGroupsSortingDialog()
+{
+ DBG_DTOR( rpt_OGroupsSortingDialog,NULL);
+ delete m_pFieldExpression;
+ m_xColumns.clear();
+ m_pReportListener->dispose();
+ if ( m_pCurrentGroupListener.is() )
+ m_pCurrentGroupListener->dispose();
+}
+// -----------------------------------------------------------------------------
+sal_Bool OGroupsSortingDialog::isReadOnly( ) const
+{
+ return m_bReadOnly;
+}
+//------------------------------------------------------------------------------
+void OGroupsSortingDialog::UpdateData( )
+{
+ m_pFieldExpression->Invalidate();
+ long nCurRow = m_pFieldExpression->GetCurRow();
+ m_pFieldExpression->DeactivateCell();
+ m_pFieldExpression->ActivateCell(nCurRow, m_pFieldExpression->GetCurColumnId());
+ DisplayData(nCurRow);
+}
+//------------------------------------------------------------------------------
+void OGroupsSortingDialog::DisplayData( sal_Int32 _nRow )
+{
+ DBG_CHKTHIS( rpt_OGroupsSortingDialog,NULL);
+ sal_Int32 nGroupPos = m_pFieldExpression->getGroupPosition(_nRow);
+ sal_Bool bEmpty = nGroupPos == NO_GROUP;
+ m_aHeaderLst.Enable(!bEmpty);
+ m_aFooterLst.Enable(!bEmpty);
+ m_aGroupOnLst.Enable(!bEmpty);
+ m_aGroupIntervalEd.Enable(!bEmpty);
+ m_aKeepTogetherLst.Enable(!bEmpty);
+ m_aOrderLst.Enable(!bEmpty);
+
+ m_aFL3.Enable(!bEmpty);
+ m_aHeader.Enable(!bEmpty);
+ m_aFooter.Enable(!bEmpty);
+ m_aGroupOn.Enable(!bEmpty);
+ m_aGroupInterval.Enable(!bEmpty);
+ m_aKeepTogether.Enable(!bEmpty);
+ m_aOrder.Enable(!bEmpty);
+
+ checkButtons(_nRow);
+
+ if ( m_pCurrentGroupListener.is() )
+ m_pCurrentGroupListener->dispose();
+ m_pCurrentGroupListener = NULL;
+ if ( !bEmpty && nGroupPos != NO_GROUP )
+ {
+ uno::Reference< report::XGroup> xGroup = getGroup(nGroupPos);
+
+ m_pCurrentGroupListener = new OPropertyChangeMultiplexer(this,xGroup.get());
+ m_pCurrentGroupListener->addProperty(PROPERTY_HEADERON);
+ m_pCurrentGroupListener->addProperty(PROPERTY_FOOTERON);
+
+ displayGroup(xGroup);
+ }
+}
+//------------------------------------------------------------------------------
+void OGroupsSortingDialog::SaveData( sal_Int32 _nRow)
+{
+ DBG_CHKTHIS( rpt_OGroupsSortingDialog,NULL);
+ sal_Int32 nGroupPos = m_pFieldExpression->getGroupPosition(_nRow);
+ if ( nGroupPos == NO_GROUP )
+ return;
+
+ uno::Reference< report::XGroup> xGroup = getGroup(nGroupPos);
+ if ( m_aHeaderLst.GetSavedValue() != m_aHeaderLst.GetSelectEntryPos() )
+ xGroup->setHeaderOn( m_aHeaderLst.GetSelectEntryPos() == 0 );
+ if ( m_aFooterLst.GetSavedValue() != m_aFooterLst.GetSelectEntryPos() )
+ xGroup->setFooterOn( m_aFooterLst.GetSelectEntryPos() == 0 );
+ if ( m_aKeepTogetherLst.GetSavedValue() != m_aKeepTogetherLst.GetSelectEntryPos() )
+ xGroup->setKeepTogether( m_aKeepTogetherLst.GetSelectEntryPos() );
+ if ( m_aGroupOnLst.GetSavedValue() != m_aGroupOnLst.GetSelectEntryPos() )
+ {
+ sal_Int16 nGroupOn = static_cast<sal_Int16>(reinterpret_cast<sal_IntPtr>(m_aGroupOnLst.GetEntryData(m_aGroupOnLst.GetSelectEntryPos())));
+ xGroup->setGroupOn( nGroupOn );
+ }
+ if ( m_aGroupIntervalEd.GetSavedValue().ToInt32() != m_aGroupIntervalEd.GetValue() )
+ {
+ xGroup->setGroupInterval( static_cast<sal_Int32>(m_aGroupIntervalEd.GetValue()) );
+ m_aGroupIntervalEd.SaveValue();
+ }
+ if ( m_aOrderLst.GetSavedValue() != m_aOrderLst.GetSelectEntryPos() )
+ xGroup->setSortAscending( m_aOrderLst.GetSelectEntryPos() == 0 );
+
+ ListBox* pControls[] = { &m_aHeaderLst,&m_aFooterLst,&m_aGroupOnLst,&m_aKeepTogetherLst,&m_aOrderLst};
+ for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+ pControls[i]->SaveValue();
+}
+
+// -----------------------------------------------------------------------------
+sal_Int32 OGroupsSortingDialog::getColumnDataType(const ::rtl::OUString& _sColumnName)
+{
+ sal_Int32 nDataType = sdbc::DataType::VARCHAR;
+ try
+ {
+ if ( !m_xColumns.is() )
+ fillColumns();
+ if ( m_xColumns.is() && m_xColumns->hasByName(_sColumnName) )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(m_xColumns->getByName(_sColumnName),uno::UNO_QUERY);
+ if ( xColumn.is() )
+ xColumn->getPropertyValue(PROPERTY_TYPE) >>= nDataType;
+ }
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Eception caught while getting the type of a column");
+ }
+
+ return nDataType;
+}
+//------------------------------------------------------------------------------
+IMPL_LINK(OGroupsSortingDialog, OnControlFocusGot, Control*, pControl )
+{
+ if ( m_pFieldExpression && m_pFieldExpression->getExpressionControl() )
+ {
+ Control* pControls[] = { m_pFieldExpression->getExpressionControl(),&m_aHeaderLst,&m_aFooterLst,&m_aGroupOnLst,&m_aGroupIntervalEd,&m_aKeepTogetherLst,&m_aOrderLst};
+ for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+ {
+ if ( pControl == pControls[i] )
+ {
+ ListBox* pListBox = dynamic_cast< ListBox* >( pControl );
+ if ( pListBox )
+ pListBox->SaveValue();
+ NumericField* pNumericField = dynamic_cast< NumericField* >( pControl );
+ if ( pNumericField )
+ pNumericField->SaveValue();
+ showHelpText(static_cast<USHORT>(i+STR_RPT_HELP_FIELD));
+ break;
+ }
+ }
+ }
+ return 0L;
+}
+//------------------------------------------------------------------------------
+IMPL_LINK(OGroupsSortingDialog, OnControlFocusLost, Control*, pControl )
+{
+ if ( m_pFieldExpression && pControl == &m_aGroupIntervalEd )
+ {
+ if ( m_aGroupIntervalEd.IsModified() )
+ SaveData(m_pFieldExpression->GetCurRow());
+ }
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( OGroupsSortingDialog, OnFormatAction, ToolBox*, /*NOTINTERESTEDIN*/ )
+// IMPL_LINK( OGroupsSortingDialog, ClickHdl, ImageButton*, _pButton )
+{
+ DBG_CHKTHIS( rpt_OGroupsSortingDialog,NULL);
+
+ USHORT nCommand = m_aToolBox.GetCurItemId();
+
+ if ( m_pFieldExpression )
+ {
+ long nIndex = m_pFieldExpression->GetCurrRow();
+ sal_Int32 nGroupPos = m_pFieldExpression->getGroupPosition(nIndex);
+ uno::Sequence<uno::Any> aClipboardList;
+ if ( nIndex >= 0 && nGroupPos != NO_GROUP )
+ {
+ aClipboardList.realloc(1);
+ aClipboardList[0] = m_xGroups->getByIndex(nGroupPos);
+ }
+ //BTN if ( _pButton == &m_aPB_Up )
+ if ( nCommand == SID_RPT_GROUPSORT_MOVE_UP )
+ {
+ --nIndex;
+ }
+ //BTN if ( _pButton == &m_aPB_Down )
+ if ( nCommand == SID_RPT_GROUPSORT_MOVE_DOWN )
+ {
+ ++nIndex;
+ }
+ //BTN if ( _pButton == &m_aPB_Delete )
+ if ( nCommand == SID_RPT_GROUPSORT_DELETE )
+ {
+ // m_pFieldExpression->DeleteCurrentRow();
+ Application::PostUserEvent( LINK(m_pFieldExpression, OFieldExpressionControl, DelayedDelete) );
+ // UpdateData( );
+ }
+ else
+ {
+ if ( nIndex >= 0 && aClipboardList.getLength() )
+ {
+ m_pFieldExpression->SetNoSelection();
+ m_pFieldExpression->moveGroups(aClipboardList,nIndex,sal_False);
+ m_pFieldExpression->DeactivateCell();
+ m_pFieldExpression->GoToRow(nIndex);
+ //long nCurRow = m_pFieldExpression->GetCurRow();
+ m_pFieldExpression->ActivateCell(nIndex, m_pFieldExpression->GetCurColumnId());
+ DisplayData(nIndex);
+ }
+ }
+ }
+ return 1L;
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( OGroupsSortingDialog, LBChangeHdl, ListBox*, pListBox )
+{
+ DBG_CHKTHIS( rpt_OGroupsSortingDialog,NULL);
+ if ( pListBox->GetSavedValue() != pListBox->GetSelectEntryPos() )
+ {
+ sal_Int32 nRow = m_pFieldExpression->GetCurRow();
+ sal_Int32 nGroupPos = m_pFieldExpression->getGroupPosition(nRow);
+ if ( pListBox != &m_aHeaderLst && pListBox != &m_aFooterLst)
+ {
+ if ( pListBox && pListBox->GetSavedValue() != pListBox->GetSelectEntryPos() )
+ SaveData(nRow);
+ if ( pListBox == &m_aGroupOnLst )
+ m_aGroupIntervalEd.Enable( pListBox->GetSelectEntryPos() != 0 );
+ }
+ else if ( nGroupPos != NO_GROUP )
+ {
+ uno::Reference< report::XGroup> xGroup = getGroup(nGroupPos);
+ uno::Sequence< beans::PropertyValue > aArgs(2);
+ aArgs[1].Name = PROPERTY_GROUP;
+ aArgs[1].Value <<= xGroup;
+
+ if ( &m_aHeaderLst == pListBox )
+ aArgs[0].Name = PROPERTY_HEADERON;
+ else
+ aArgs[0].Name = PROPERTY_FOOTERON;
+
+ aArgs[0].Value <<= pListBox->GetSelectEntryPos() == 0;
+ m_pController->executeChecked(&m_aHeaderLst == pListBox ? SID_GROUPHEADER : SID_GROUPFOOTER,aArgs);
+ if ( m_pFieldExpression )
+ m_pFieldExpression->InvalidateHandleColumn();
+ }
+ }
+ return 1L;
+}
+// -----------------------------------------------------------------------------
+void OGroupsSortingDialog::showHelpText(USHORT _nResId)
+{
+ m_aHelpWindow.SetText(String(ModuleRes(_nResId)));
+}
+// -----------------------------------------------------------------------------
+void OGroupsSortingDialog::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
+{
+ uno::Reference< report::XGroup > xGroup(_rEvent.Source,uno::UNO_QUERY);
+ if ( xGroup.is() )
+ displayGroup(xGroup);
+ else
+ fillColumns();
+}
+// -----------------------------------------------------------------------------
+void OGroupsSortingDialog::fillColumns()
+{
+ m_xColumns.clear();
+ uno::Reference< report::XReportDefinition> xReport = m_pController->getReportDefinition();
+ if ( xReport->getCommand().getLength() )
+ m_xColumns = dbtools::getFieldsByCommandDescriptor(m_pController->getConnection(),xReport->getCommandType(),xReport->getCommand(),m_xHoldAlive);
+ m_pFieldExpression->fillColumns(m_xColumns);
+}
+// -----------------------------------------------------------------------------
+void OGroupsSortingDialog::displayGroup(const uno::Reference<report::XGroup>& _xGroup)
+{
+ m_aHeaderLst.SelectEntryPos(_xGroup->getHeaderOn() ? 0 : 1 );
+ m_aFooterLst.SelectEntryPos(_xGroup->getFooterOn() ? 0 : 1 );
+ sal_Int32 nDataType = getColumnDataType(_xGroup->getExpression());
+
+ // first clear whole group on list
+ while(m_aGroupOnLst.GetEntryCount() > 1 )
+ {
+ m_aGroupOnLst.RemoveEntry(1);
+ }
+
+ switch(nDataType)
+ {
+ case sdbc::DataType::LONGVARCHAR:
+ case sdbc::DataType::VARCHAR:
+ case sdbc::DataType::CHAR:
+ m_aGroupOnLst.InsertEntry(String(ModuleRes(STR_RPT_PREFIXCHARS)));
+ m_aGroupOnLst.SetEntryData(1,reinterpret_cast<void*>(report::GroupOn::PREFIX_CHARACTERS));
+ break;
+ case sdbc::DataType::DATE:
+ case sdbc::DataType::TIME:
+ case sdbc::DataType::TIMESTAMP:
+ {
+ USHORT nIds[] = { STR_RPT_YEAR, STR_RPT_QUARTER,STR_RPT_MONTH,STR_RPT_WEEK,STR_RPT_DAY,STR_RPT_HOUR,STR_RPT_MINUTE };
+ for (USHORT i = 0; i < sizeof(nIds)/sizeof(nIds[0]); ++i)
+ {
+ m_aGroupOnLst.InsertEntry(String(ModuleRes(nIds[i])));
+ m_aGroupOnLst.SetEntryData(i+1,reinterpret_cast<void*>(i+2));
+ }
+ }
+ break;
+ default:
+ m_aGroupOnLst.InsertEntry(String(ModuleRes(STR_RPT_INTERVAL)));
+ m_aGroupOnLst.SetEntryData(1,reinterpret_cast<void*>(report::GroupOn::INTERVAL));
+ break;
+ } // switch(nDataType)
+ USHORT nPos = 0;
+ switch(_xGroup->getGroupOn())
+ {
+ case report::GroupOn::DEFAULT:
+ nPos = 0;
+ break;
+ case report::GroupOn::PREFIX_CHARACTERS:
+ nPos = 1;
+ break;
+ case report::GroupOn::YEAR:
+ nPos = 1;
+ break;
+ case report::GroupOn::QUARTAL:
+ nPos = 2;
+ break;
+ case report::GroupOn::MONTH:
+ nPos = 3;
+ break;
+ case report::GroupOn::WEEK:
+ nPos = 4;
+ break;
+ case report::GroupOn::DAY:
+ nPos = 5;
+ break;
+ case report::GroupOn::HOUR:
+ nPos = 6;
+ break;
+ case report::GroupOn::MINUTE:
+ nPos = 7;
+ break;
+ case report::GroupOn::INTERVAL:
+ nPos = 1;
+ break;
+ default:
+ nPos = 0;
+ }
+ m_aGroupOnLst.SelectEntryPos(nPos);
+ m_aGroupIntervalEd.SetText(String::CreateFromInt32(_xGroup->getGroupInterval()));
+ m_aGroupIntervalEd.SaveValue();
+ m_aGroupIntervalEd.Enable( nPos != 0 );
+ m_aKeepTogetherLst.SelectEntryPos(_xGroup->getKeepTogether());
+ m_aOrderLst.SelectEntryPos(_xGroup->getSortAscending() ? 0 : 1);
+
+ ListBox* pControls[] = { &m_aHeaderLst,&m_aFooterLst,&m_aGroupOnLst,&m_aKeepTogetherLst,&m_aOrderLst};
+ for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+ pControls[i]->SaveValue();
+
+ ListBox* pControlsLst2[] = { &m_aHeaderLst, &m_aFooterLst, &m_aGroupOnLst, &m_aKeepTogetherLst,&m_aOrderLst};
+ sal_Bool bReadOnly = !m_pController->isEditable();
+ for (size_t i = 0; i < sizeof(pControlsLst2)/sizeof(pControlsLst2[0]); ++i)
+ pControlsLst2[i]->SetReadOnly(bReadOnly);
+ m_aGroupIntervalEd.SetReadOnly(bReadOnly);
+}
+//------------------------------------------------------------------------------
+void OGroupsSortingDialog::Resize()
+{
+ Window::Resize();
+ Size aTotalOutputSize = GetOutputSizePixel();
+ Size aSpace = LogicToPixel( Size( UNRELATED_CONTROLS, UNRELATED_CONTROLS ), MAP_APPFONT );
+ m_pFieldExpression->SetSizePixel(Size(aTotalOutputSize.Width() - 2*aSpace.Width(),m_pFieldExpression->GetSizePixel().Height()));
+
+ Control* pControlsLst[] = { &m_aHeaderLst, &m_aFooterLst, &m_aGroupOnLst, &m_aGroupIntervalEd,&m_aKeepTogetherLst,&m_aOrderLst};
+ Control* pControls[] = { &m_aHeader, &m_aFooter, &m_aGroupOn, &m_aGroupInterval, &m_aKeepTogether, &m_aOrder};
+ sal_Int32 nMaxTextWidth = 0;
+ for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+ {
+ nMaxTextWidth = ::std::max<sal_Int32>(static_cast<sal_Int32>(GetTextWidth(pControls[i]->GetText())),nMaxTextWidth);
+ } // for (int i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+
+ // aTotalOutputSize.Width() - m_aHeaderLst.GetSizePixel().Width() - 3*aSpace.Width()
+ for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+ {
+ pControls[i]->SetSizePixel(Size(nMaxTextWidth,pControls[i]->GetSizePixel().Height()));
+ Point aPos = pControls[i]->GetPosPixel();
+ aPos.X() += nMaxTextWidth + aSpace.Width();
+ aPos.Y() = pControlsLst[i]->GetPosPixel().Y();
+
+ pControlsLst[i]->SetPosSizePixel(aPos,Size(aTotalOutputSize.Width() - aPos.X() - aSpace.Width(),pControlsLst[i]->GetSizePixel().Height()));
+ } // for (int i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i)
+
+ m_aFL.SetSizePixel(Size(aTotalOutputSize.Width() - aSpace.Width(),m_aFL.GetSizePixel().Height()));
+ m_aFL2.SetSizePixel(Size(aTotalOutputSize.Width() - aSpace.Width(),m_aFL2.GetSizePixel().Height()));
+ m_aFL3.SetSizePixel(Size(aTotalOutputSize.Width() - aSpace.Width(),m_aFL3.GetSizePixel().Height()));
+
+//BTN sal_Int32 nPos = aTotalOutputSize.Width() - aSpace.Width() - m_aPB_Up.GetSizePixel().Width();
+//BTN m_aPB_Delete.SetPosPixel(Point(nPos,m_aPB_Delete.GetPosPixel().Y()));
+//BTN
+//BTN nPos -= (m_aPB_Up.GetSizePixel().Width() + LogicToPixel( Size( UNRELATED_CONTROLS, 0 ), MAP_APPFONT ).Width());
+//BTN m_aPB_Down.SetPosPixel(Point(nPos,m_aPB_Down.GetPosPixel().Y()));
+//BTN
+//BTN nPos -= (m_aPB_Up.GetSizePixel().Width() + LogicToPixel( Size( RELATED_CONTROLS, 0 ), MAP_APPFONT ).Width());
+//BTN m_aPB_Up.SetPosPixel(Point(nPos,m_aPB_Up.GetPosPixel().Y()));
+ sal_Int32 nPos = aTotalOutputSize.Width() - aSpace.Width() - m_aToolBox.GetSizePixel().Width();
+ m_aToolBox.SetPosPixel(Point(nPos,m_aToolBox.GetPosPixel().Y()));
+
+ Point aHelpPos = m_aHelpWindow.GetPosPixel();
+ m_aHelpWindow.SetSizePixel(Size(aTotalOutputSize.Width() - aHelpPos.X(),aTotalOutputSize.Height() - aHelpPos.Y()));
+}
+//------------------------------------------------------------------------------
+void OGroupsSortingDialog::checkButtons(sal_Int32 _nRow)
+{
+ sal_Int32 nGroupCount = m_xGroups->getCount();
+ sal_Int32 nRowCount = m_pFieldExpression->GetRowCount();
+ sal_Bool bEnabled = nGroupCount > 1;
+
+ if (bEnabled && _nRow > 0 /* && _nRow < nGroupCount */ )
+ {
+ m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_UP, sal_True);
+ }
+ else
+ {
+ m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_UP, sal_False);
+ }
+ if (bEnabled && _nRow < (nRowCount - 1) /* && _nRow < (nGroupCount - 1) */ )
+ {
+ m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_DOWN, sal_True);
+ }
+ else
+ {
+ m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_DOWN, sal_False);
+ }
+ //BTN m_aPB_Up.Enable(bEnable && _nRow > 0 );
+ //BTN m_aPB_Down.Enable(bEnable && _nRow < (m_pFieldExpression->GetRowCount()-1) );
+ // m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_DOWN, bEnable && _nRow < (-1) );
+
+ sal_Int32 nGroupPos = m_pFieldExpression->getGroupPosition(_nRow);
+ if ( nGroupPos != NO_GROUP )
+ {
+ sal_Bool bEnableDelete = nGroupCount > 0;
+ //BTN m_aPB_Delete.Enable(bEnableDelete );
+ m_aToolBox.EnableItem(SID_RPT_GROUPSORT_DELETE, bEnableDelete);
+ }
+ else
+ {
+ //BTN m_aPB_Delete.Enable( sal_False );
+ m_aToolBox.EnableItem(SID_RPT_GROUPSORT_DELETE, sal_False);
+ }
+}
+
+ImageList OGroupsSortingDialog::getImageList(sal_Int16 _eBitmapSet,sal_Bool _bHiContast) const
+{
+ sal_Int16 nN = IMG_CONDFORMAT_DLG_SC;
+ sal_Int16 nH = IMG_CONDFORMAT_DLG_SCH;
+ if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE )
+ {
+ nN = IMG_CONDFORMAT_DLG_LC;
+ nH = IMG_CONDFORMAT_DLG_LCH;
+ }
+ return ImageList(ModuleRes( _bHiContast ? nH : nN ));
+}
+
+//------------------------------------------------------------------
+void OGroupsSortingDialog::resizeControls(const Size& _rDiff)
+{
+ // we use large images so we must change them
+ if ( _rDiff.Width() || _rDiff.Height() )
+ {
+ Point aPos = LogicToPixel( Point( 2*RELATED_CONTROLS , 0), MAP_APPFONT );
+ Invalidate();
+ }
+}
+
+//------------------------------------------------------------------
+// load the images
+ImageList OGroupsSortingDialog::getImageList(vcl::ImageListType _eType) SAL_THROW (( com::sun::star::lang::IllegalArgumentException ))
+{
+ if (_eType == vcl::HIGHCONTRAST_NO)
+ {
+ return ImageList(ModuleRes(IMGLST_GROUPSORT_DLG_SC));
+ }
+ else if (_eType == vcl::HIGHCONTRAST_YES)
+ {
+ return ImageList(ModuleRes(IMGLST_GROUPSORT_DLG_SCH));
+ }
+ else
+ {
+ throw com::sun::star::lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("High contrast parameter is wrong.")), NULL, 0);
+ }
+}
+
+
+
+// =============================================================================
+} // rptui
+// =============================================================================
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.hrc b/reportdesign/source/ui/dlg/GroupsSorting.hrc
new file mode 100644
index 000000000000..8dfbfd3224a4
--- /dev/null
+++ b/reportdesign/source/ui/dlg/GroupsSorting.hrc
@@ -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.
+ *
+ ************************************************************************/
+#ifndef RPTUI_GROUPSSORTING_HRC
+#define RPTUI_GROUPSSORTING_HRC
+
+#define FT_HEADER (1)
+#define LST_HEADERLST (2)
+#define FT_FOOTER (3)
+#define LST_FOOTERLST (4)
+#define FT_GROUPON (5)
+#define LST_GROUPONLST (6)
+#define FT_GROUPINTERVAL (7)
+#define ED_GROUPINTERVALLST (8)
+#define FT_KEEPTOGETHER (9)
+#define LST_KEEPTOGETHERLST (10)
+#define PB_OK (11)
+#define PB_CANCEL (12)
+#define PB_HELP (13)
+#define WND_CONTROL (14)
+#define HELP_FIELD (15)
+#define FT_ORDER (16)
+#define LST_ORDER (17)
+#define FL_SEPARATOR1 (18)
+#define FT_MOVELABEL (19)
+#define PB_UP (20)
+#define PB_DOWN (21)
+#define FL_SEPARATOR2 (22)
+#define FL_SEPARATOR3 (23)
+//BTN #define IMG_UP_H (24)
+//BTN #define IMG_DOWN_H (25)
+//BTN #define PB_DELETE (26)
+#define TB_TOOLBOX (27)
+
+// #define IMG_GROUPSORT_MOVE_DOWN (28)
+// #define IMG_GROUPSORT_MOVE_UP (29)
+// #define IMG_GROUPSORT_DELETE (30)
+// #define IMG_GROUPSORT_MOVE_DOWN_H (31)
+// #define IMG_GROUPSORT_MOVE_UP_H (32)
+// #define IMG_GROUPSORT_DELETE_H (33)
+
+
+#define CHECKBOX_HEIGHT 8
+#define FIXEDTEXT_HEIGHT 8
+#define FIXEDTEXT_WIDTH 60
+#define RELATED_CONTROLS 4
+#define UNRELATED_CONTROLS 7
+#define EDIT_HEIGHT 12
+#define BUTTON_HEIGHT 14
+#define BUTTON_WIDTH 50
+#define BROWSER_HEIGHT 75
+#define PAGE_WIDTH 120
+#define PAGE_HEIGHT ( 13*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 11*FIXEDTEXT_HEIGHT )
+#define LISTBOX_WIDTH PAGE_WIDTH - 4*UNRELATED_CONTROLS - FIXEDTEXT_WIDTH
+
+#endif // RPTUI_GROUPSSORTING_HRC
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.src b/reportdesign/source/ui/dlg/GroupsSorting.src
new file mode 100644
index 000000000000..2c73fff07de4
--- /dev/null
+++ b/reportdesign/source/ui/dlg/GroupsSorting.src
@@ -0,0 +1,496 @@
+/*************************************************************************
+ *
+ * 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 "GroupsSorting.hrc"
+#include "RptResId.hrc"
+#include "helpids.hrc"
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _SBASLTID_HRC
+#include <svx/svxids.hrc>
+#endif
+
+
+FloatingWindow RID_GROUPS_SORTING
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( PAGE_WIDTH , PAGE_HEIGHT ) ;
+ Text [ en-US ] = "Sorting and Grouping" ;
+ HelpId = HID_RPT_GROUPSSORTING_DLG;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Sizeable = TRUE;
+
+ FixedLine FL_SEPARATOR2
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Groups";
+ };
+
+ Control WND_CONTROL
+ {
+ Pos = MAP_APPFONT( UNRELATED_CONTROLS, 2*UNRELATED_CONTROLS );
+ Size = MAP_APPFONT( PAGE_WIDTH - 2*UNRELATED_CONTROLS, BROWSER_HEIGHT );
+ HelpId = HID_RPT_GROUPSBRW ;
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+
+ FixedText FT_MOVELABEL
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS , 3*UNRELATED_CONTROLS + BROWSER_HEIGHT ) ;
+ Size = MAP_APPFONT ( FIXEDTEXT_WIDTH , FIXEDTEXT_HEIGHT ) ;
+// Text [ en-US ] = "Move group" ;
+ Text [ en-US ] = "Group actions" ;
+ };
+
+// /*
+// | PAGE_WIDTH |
+// | /-----\ {-------\ /---------\ |
+// | unreleated FT_MOVELABEL |PB_UP| unreleated |PB_DOWN| unreleated |PD_DELETE| unreleated |
+// | \_____/ \_______/ \_________/ |
+//
+// Don't set any position here, it will be done in OGroupsSortingDialog::Resize()
+//
+// Find possible IMAGEBUTTON_* in rscicpx.cxx
+// Symbol is vclrsc.hxx
+// */
+// ImageButton PB_UP
+// {
+// Pos = MAP_APPFONT ( PAGE_WIDTH - 3*UNRELATED_CONTROLS - 3*14 - 2*RELATED_CONTROLS, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT -1 ) ;
+// Size = MAP_APPFONT ( 14 , 14 ) ;
+// TabStop = TRUE;
+// // Symbol = IMAGEBUTTON_ARROW_UP ; // arrow up
+// Symbol = IMAGEBUTTON_SPIN_UP ; // triangle up
+// // Symbol = IMAGEBUTTON_FLOAT;
+// };
+//
+// ImageButton PB_DOWN
+// {
+// Pos = MAP_APPFONT ( PAGE_WIDTH - 2*UNRELATED_CONTROLS - 2*14 - 2*RELATED_CONTROLS, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT - 1 ) ;
+// Size = MAP_APPFONT ( 14 , 14 ) ;
+// TabStop = TRUE;
+// // Symbol = IMAGEBUTTON_ARROW_DOWN ; // arrow down
+// // Symbol = IMAGEBUTTON_FIRST ;
+// Symbol = IMAGEBUTTON_SPIN_DOWN;
+//
+// };
+//
+// ImageButton PB_DELETE
+// {
+// Pos = MAP_APPFONT ( PAGE_WIDTH - UNRELATED_CONTROLS - 14, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT - 1 ) ;
+// Size = MAP_APPFONT ( 14 , 14 ) ;
+// TabStop = TRUE;
+// Symbol = IMAGEBUTTON_CLOSE ;
+// };
+
+
+ ToolBox TB_TOOLBOX
+ {
+ Pos = MAP_APPFONT ( PAGE_WIDTH - 4*14 - UNRELATED_CONTROLS, 3*UNRELATED_CONTROLS + BROWSER_HEIGHT - 1 ) ;
+ ButtonType = BUTTON_SYMBOL;
+// Align = BOXALIGN_TOP;
+// HelpId = HID_RPT_CONDFORMAT_TB;
+ Customize = FALSE;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = SID_RPT_GROUPSORT_MOVE_UP ;
+ // Command = ".uno:ReportGroupMoveUp" ; // default_images/res/commandimages/sc_reportgroupmoveup.png
+ HelpID = HID_RPT_GROUPSORT_MOVE_UP ;
+ Text [ en-US ] = "Move up" ;
+ Checkable = TRUE;
+// Disable = TRUE;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_RPT_GROUPSORT_MOVE_DOWN ;
+ // Command = ".uno:ReportGroupMoveDown" ;
+ HelpID = HID_RPT_GROUPSORT_MOVE_DOWN ;
+ Text [ en-US ] = "Move down" ;
+ Checkable = TRUE;
+// Disable = TRUE;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_RPT_GROUPSORT_DELETE ;
+ // Command = ".uno:ReportGroupDelete" ;
+ HelpID = HID_RPT_GROUPSORT_DELETE ;
+ Text [ en-US ] = "~Delete" ;
+ Checkable = TRUE;
+// Disable = TRUE;
+ };
+ };
+ };
+
+ FixedLine FL_SEPARATOR3
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , 3*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Properties";
+ };
+
+ FixedText FT_ORDER
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS , 4*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + FIXEDTEXT_HEIGHT ) ;
+ Size = MAP_APPFONT ( FIXEDTEXT_WIDTH , FIXEDTEXT_HEIGHT ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Sorting" ;
+ };
+ ListBox LST_ORDER
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT(2*UNRELATED_CONTROLS + FIXEDTEXT_WIDTH, 4*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + FIXEDTEXT_HEIGHT - 1 );
+ Size = MAP_APPFONT( LISTBOX_WIDTH, 60 );
+ DropDown = TRUE;
+ TabStop = TRUE;
+ Hide = TRUE;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "Ascending" ; 0 ; > ;
+ < "Descending" ; 1 ; > ;
+ };
+
+ };
+ FixedText FT_HEADER
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS , 5*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 2*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( FIXEDTEXT_WIDTH , FIXEDTEXT_HEIGHT ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Group Header" ;
+
+ };
+ ListBox LST_HEADERLST
+ {
+ Border = TRUE;
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 2*UNRELATED_CONTROLS + FIXEDTEXT_WIDTH, 5*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 2*FIXEDTEXT_HEIGHT -1);
+ Size = MAP_APPFONT( LISTBOX_WIDTH, 60 );
+ DropDown = TRUE;
+ TabStop = TRUE;
+ CurPos = 1 ;
+ StringList [ en-US ] =
+ {
+ < "Present" ; Default ; > ;
+ < "Not present" ; Default ; > ;
+ };
+ };
+ FixedText FT_FOOTER
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS, 6*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 3*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( FIXEDTEXT_WIDTH , FIXEDTEXT_HEIGHT ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Group Footer" ;
+
+ };
+ ListBox LST_FOOTERLST
+ {
+ Border = TRUE;
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 2*UNRELATED_CONTROLS + FIXEDTEXT_WIDTH, 6*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 3*FIXEDTEXT_HEIGHT -1);
+ Size = MAP_APPFONT( LISTBOX_WIDTH, 60 );
+ DropDown = TRUE;
+ TabStop = TRUE;
+ CurPos = 1 ;
+ StringList [ en-US ] =
+ {
+ < "Present" ; Default ; > ;
+ < "Not present" ; Default ; > ;
+ };
+ };
+ FixedText FT_GROUPON
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS, 7*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 4*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( FIXEDTEXT_WIDTH , FIXEDTEXT_HEIGHT ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Group On" ;
+
+ };
+ ListBox LST_GROUPONLST
+ {
+ Border = TRUE;
+ Hide = TRUE;
+ Pos = MAP_APPFONT( 2*UNRELATED_CONTROLS + FIXEDTEXT_WIDTH, 7*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 4*FIXEDTEXT_HEIGHT -1);
+ Size = MAP_APPFONT( LISTBOX_WIDTH, 60 );
+ DropDown = TRUE;
+ TabStop = TRUE;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "Each Value" ; Default ; > ;
+ };
+ };
+ FixedText FT_GROUPINTERVAL
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS , 8*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 5*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( FIXEDTEXT_WIDTH , FIXEDTEXT_HEIGHT ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Group Interval" ;
+ };
+ NumericField ED_GROUPINTERVALLST
+ {
+ Border = TRUE;
+ Hide = TRUE;
+ Pos = MAP_APPFONT(2*UNRELATED_CONTROLS + FIXEDTEXT_WIDTH , 8*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 5*FIXEDTEXT_HEIGHT -1);
+ Size = MAP_APPFONT( LISTBOX_WIDTH, EDIT_HEIGHT );
+ TabStop = TRUE;
+ };
+
+ FixedText FT_KEEPTOGETHER
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS , 9*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 6*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( FIXEDTEXT_WIDTH , FIXEDTEXT_HEIGHT ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Keep Together" ;
+ };
+ ListBox LST_KEEPTOGETHERLST
+ {
+ Border = TRUE;
+ Hide = TRUE;
+ Pos = MAP_APPFONT(2*UNRELATED_CONTROLS + FIXEDTEXT_WIDTH , 9*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 6*FIXEDTEXT_HEIGHT -1);
+ Size = MAP_APPFONT( LISTBOX_WIDTH, 60 );
+ DropDown = TRUE;
+ TabStop = TRUE;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "No" ; 0 ; > ;
+ < "Whole Group" ; 1 ; > ;
+ < "With First Detail" ; 2 ; > ;
+ };
+ };
+
+ FixedLine FL_SEPARATOR1
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , 10*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 7*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Help";
+ };
+
+ FixedText HELP_FIELD
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS , 12*UNRELATED_CONTROLS + BROWSER_HEIGHT + BUTTON_HEIGHT + 7*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT( PAGE_WIDTH - 2*UNRELATED_CONTROLS, 4*FIXEDTEXT_HEIGHT);
+ WordBreak = TRUE;
+ };
+
+//BTN Image IMG_UP_H
+//BTN {
+//BTN ImageBitmap = Bitmap { File = "arrow_move_up_hc" ; };
+//BTN };
+//BTN Image IMG_DOWN_H
+//BTN {
+//BTN ImageBitmap = Bitmap { File = "arrow_move_down_hc" ; };
+//BTN };
+
+
+};
+
+String STR_RPT_EXPRESSION
+{
+ Text [ en-US ] = "Field/Expression" ;
+};
+String STR_RPT_SORTING
+{
+ Text [ en-US ] = "Sort Order" ;
+};
+String STR_RPT_PREFIXCHARS
+{
+ Text [ en-US ] = "Prefix Characters" ;
+};
+String STR_RPT_YEAR
+{
+ Text [ en-US ] = "Year" ;
+};
+String STR_RPT_QUARTER
+{
+ Text [ en-US ] = "Quarter" ;
+};
+String STR_RPT_MONTH
+{
+ Text [ en-US ] = "Month" ;
+};
+String STR_RPT_WEEK
+{
+ Text [ en-US ] = "Week" ;
+};
+String STR_RPT_DAY
+{
+ Text [ en-US ] = "Day" ;
+};
+String STR_RPT_HOUR
+{
+ Text [ en-US ] = "Hour" ;
+};
+String STR_RPT_MINUTE
+{
+ Text [ en-US ] = "Minute" ;
+};
+String STR_RPT_INTERVAL
+{
+ Text [ en-US ] = "Interval" ;
+};
+
+String STR_RPT_HELP_FIELD
+{
+ Text [ en-US ] = "Select a field or type an expression to sort or group on." ;
+};
+
+String STR_RPT_HELP_HEADER
+{
+ Text [ en-US ] = "Display a header for this group?" ;
+};
+
+String STR_RPT_HELP_FOOTER
+{
+ Text [ en-US ] = "Display a footer for this group?" ;
+};
+String STR_RPT_HELP_GROUPON
+{
+ Text [ en-US ] = "Select the value or range of values that starts a new group." ;
+};
+String STR_RPT_HELP_INTERVAL
+{
+ Text [ en-US ] = "Interval or number of characters to group on." ;
+};
+String STR_RPT_HELP_KEEP
+{
+ Text [ en-US ] = "Keep group together on one page?" ;
+};
+String STR_RPT_HELP_SORT
+{
+ Text [ en-US ] = "Select ascending or descending sort order. Ascending means from A to Z or 0 to 9" ;
+};
+
+
+Menu RID_GROUPSROWPOPUPMENU
+{
+ ItemList =
+ {
+/*
+ MenuItem
+ {
+ ITEM_EDIT_CUT
+ };
+ MenuItem
+ {
+ ITEM_EDIT_COPY
+ };
+ MenuItem
+ {
+ ITEM_EDIT_PASTE
+ };
+*/
+ MenuItem
+ {
+ ITEM_EDIT_DELETE
+ };
+ };
+};
+
+
+#define DEF_MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }
+
+#define DEF_IL_GROUPSORT \
+\
+ IdList = {\
+ SID_RPT_GROUPSORT_MOVE_UP;\
+ SID_RPT_GROUPSORT_MOVE_DOWN;\
+ SID_RPT_GROUPSORT_DELETE;\
+ };\
+ IdCount = {\
+ 3;\
+ }
+
+ImageList IMGLST_GROUPSORT_DLG_SC
+{
+ DEF_MASKCOLOR;
+ prefix = "sc";
+ DEF_IL_GROUPSORT ;
+};
+
+ImageList IMGLST_GROUPSORT_DLG_SCH
+{
+ DEF_MASKCOLOR;
+ prefix = "sch";
+ DEF_IL_GROUPSORT ;
+};
+
+
+// Image IMG_GROUPSORT_MOVEUP
+// {
+// ImageBitmap = Bitmap
+// {
+// File = "reportgroupmoveup"; // reportdesign/res/...
+// };
+// DEF_MASKCOLOR;
+// };
+// Image IMG_GROUPSORT_MOVEDOWN
+// {
+// ImageBitmap = Bitmap
+// {
+// File = "reportgroupmovedown";
+// };
+// DEF_MASKCOLOR;
+// };
+// Image IMG_GROUPSORT_DELETE
+// {
+// ImageBitmap = Bitmap
+// {
+// File = "reportgroupdelete";
+// };
+// DEF_MASKCOLOR;
+// };
+//
+// Image IMG_GROUPSORT_MOVEUP_H
+// {
+// ImageBitmap = Bitmap
+// {
+// File = "reportgroupmoveup_h"; // reportdesign/res/...
+// };
+// DEF_MASKCOLOR;
+// };
+// Image IMG_GROUPSORT_MOVEDOWN_H
+// {
+// ImageBitmap = Bitmap
+// {
+// File = "reportgroupmovedown_h";
+// };
+// DEF_MASKCOLOR;
+// };
+// Image IMG_GROUPSORT_DELETE_H
+// {
+// ImageBitmap = Bitmap
+// {
+// File = "reportgroupdelete_h";
+// };
+// DEF_MASKCOLOR;
+// };
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
new file mode 100644
index 000000000000..af61f3b6d514
--- /dev/null
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -0,0 +1,986 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_reportdesign.hxx"
+
+#include "Navigator.hxx"
+
+#include "uistrings.hrc"
+#include "ReportController.hxx"
+#include "UITools.hxx"
+#include "Undo.hxx"
+#include "reportformula.hxx"
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/report/XReportDefinition.hpp>
+#include <com/sun/star/report/XFixedText.hpp>
+#include <com/sun/star/report/XFixedLine.hpp>
+#include <com/sun/star/report/XFormattedField.hpp>
+#include <com/sun/star/report/XImageControl.hpp>
+#include <com/sun/star/report/XShape.hpp>
+#include <svx/globlmn.hrc>
+#include <svx/svxids.hrc>
+#include "helpids.hrc"
+#include "RptResId.hrc"
+#include "rptui_slotid.hrc"
+#include <tools/debug.hxx>
+#include <comphelper/propmultiplex.hxx>
+#include <comphelper/containermultiplexer.hxx>
+#include <comphelper/types.hxx>
+#include "cppuhelper/basemutex.hxx"
+#include "comphelper/SelectionMultiplex.hxx"
+#include <svtools/svtreebx.hxx>
+#include <svl/solar.hrc>
+#include "ReportVisitor.hxx"
+#include "ModuleHelper.hxx"
+#include <rtl/ref.hxx>
+
+#include <boost/bind.hpp>
+#include <memory>
+#include <algorithm>
+
+#define RID_SVXIMG_COLLAPSEDNODE (RID_FORMS_START + 2)
+#define RID_SVXIMG_EXPANDEDNODE (RID_FORMS_START + 3)
+#define DROP_ACTION_TIMER_INITIAL_TICKS 10
+#define DROP_ACTION_TIMER_SCROLL_TICKS 3
+#define DROP_ACTION_TIMER_TICK_BASE 10
+
+namespace rptui
+{
+using namespace ::com::sun::star;
+using namespace utl;
+using namespace ::comphelper;
+
+USHORT lcl_getImageId(const uno::Reference< report::XReportComponent>& _xElement)
+{
+ USHORT nId = 0;
+ uno::Reference< report::XFixedLine> xFixedLine(_xElement,uno::UNO_QUERY);
+ if ( uno::Reference< report::XFixedText>(_xElement,uno::UNO_QUERY).is() )
+ nId = SID_FM_FIXEDTEXT;
+ else if ( xFixedLine.is() )
+ nId = xFixedLine->getOrientation() ? SID_INSERT_VFIXEDLINE : SID_INSERT_HFIXEDLINE;
+ else if ( uno::Reference< report::XFormattedField>(_xElement,uno::UNO_QUERY).is() )
+ nId = SID_FM_EDIT;
+ else if ( uno::Reference< report::XImageControl>(_xElement,uno::UNO_QUERY).is() )
+ nId = SID_FM_IMAGECONTROL;
+ else if ( uno::Reference< report::XShape>(_xElement,uno::UNO_QUERY).is() )
+ nId = SID_DRAWTBX_CS_BASIC;
+ return nId;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString lcl_getName(const uno::Reference< beans::XPropertySet>& _xElement)
+{
+ OSL_ENSURE(_xElement.is(),"Found report element which is NULL!");
+ ::rtl::OUString sTempName;
+ _xElement->getPropertyValue(PROPERTY_NAME) >>= sTempName;
+ ::rtl::OUStringBuffer sName = sTempName;
+ uno::Reference< report::XFixedText> xFixedText(_xElement,uno::UNO_QUERY);
+ uno::Reference< report::XReportControlModel> xReportModel(_xElement,uno::UNO_QUERY);
+ if ( xFixedText.is() )
+ {
+ sName.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : ")));
+ sName.append(xFixedText->getLabel());
+ }
+ else if ( xReportModel.is() && _xElement->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATAFIELD) )
+ {
+ ReportFormula aFormula( xReportModel->getDataField() );
+ if ( aFormula.isValid() )
+ {
+ sName.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : ")));
+ sName.append( aFormula.getUndecoratedContent() );
+ }
+ }
+ return sName.makeStringAndClear();
+}
+// -----------------------------------------------------------------------------
+
+class NavigatorTree : public ::cppu::BaseMutex
+ , public SvTreeListBox
+ , public reportdesign::ITraverseReport
+ , public comphelper::OSelectionChangeListener
+ , public ::comphelper::OPropertyChangeListener
+{
+ class UserData;
+ friend class UserData;
+ class UserData : public ::cppu::BaseMutex
+ ,public ::comphelper::OPropertyChangeListener
+ ,public ::comphelper::OContainerListener
+ {
+ uno::Reference< uno::XInterface > m_xContent;
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pListener;
+ ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener;
+ NavigatorTree* m_pTree;
+ public:
+ UserData(NavigatorTree* _pTree,const uno::Reference<uno::XInterface>& _xContent);
+ ~UserData();
+
+ inline uno::Reference< uno::XInterface > getContent() const { return m_xContent; }
+ inline void setContent(const uno::Reference< uno::XInterface >& _xContent) { m_xContent = _xContent; }
+ protected:
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException);
+
+ // OContainerListener
+ virtual void _elementInserted( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException);
+ virtual void _elementRemoved( const container::ContainerEvent& _Event ) throw(uno::RuntimeException);
+ virtual void _elementReplaced( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException);
+ virtual void _disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException);
+ };
+
+ enum DROP_ACTION { DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE };
+ AutoTimer m_aDropActionTimer;
+ Timer m_aSynchronizeTimer;
+ ImageList m_aNavigatorImages;
+ ImageList m_aNavigatorImagesHC;
+ Point m_aTimerTriggered; // die Position, an der der DropTimer angeschaltet wurde
+ DROP_ACTION m_aDropActionType;
+ OReportController& m_rController;
+ SvLBoxEntry* m_pMasterReport;
+ SvLBoxEntry* m_pDragedEntry;
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
+ ::rtl::Reference< comphelper::OSelectionChangeMultiplexer> m_pSelectionListener;
+ unsigned short m_nTimerCounter;
+
+ SvLBoxEntry* insertEntry(const ::rtl::OUString& _sName,SvLBoxEntry* _pParent,USHORT _nImageId,ULONG _nPosition,UserData* _pData);
+ void traverseSection(const uno::Reference< report::XSection>& _xSection,SvLBoxEntry* _pParent,USHORT _nImageId,ULONG _nPosition = LIST_APPEND);
+ void traverseFunctions(const uno::Reference< report::XFunctions>& _xFunctions,SvLBoxEntry* _pParent);
+
+ NavigatorTree(const NavigatorTree&);
+ void operator =(const NavigatorTree&);
+protected:
+ virtual void Command( const CommandEvent& rEvt );
+ // DragSourceHelper overridables
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+ // DropTargetHelper overridables
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt );
+
+ // OSelectionChangeListener
+ virtual void _disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException);
+
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException);
+
+ // OContainerListener Helper
+ void _elementInserted( const container::ContainerEvent& _rEvent );
+ void _elementRemoved( const container::ContainerEvent& _Event );
+ void _elementReplaced( const container::ContainerEvent& _rEvent );
+
+public:
+ NavigatorTree(Window* pParent,OReportController& _rController );
+ virtual ~NavigatorTree();
+
+ DECL_LINK(OnEntrySelDesel, NavigatorTree*);
+ DECL_LINK( OnDropActionTimer, void* );
+
+ virtual void _selectionChanged( const lang::EventObject& aEvent ) throw (uno::RuntimeException);
+
+ // ITraverseReport
+ virtual void traverseReport(const uno::Reference< report::XReportDefinition>& _xReport);
+ virtual void traverseReportFunctions(const uno::Reference< report::XFunctions>& _xFunctions);
+ virtual void traverseReportHeader(const uno::Reference< report::XSection>& _xSection);
+ virtual void traverseReportFooter(const uno::Reference< report::XSection>& _xSection);
+ virtual void traversePageHeader(const uno::Reference< report::XSection>& _xSection);
+ virtual void traversePageFooter(const uno::Reference< report::XSection>& _xSection);
+
+ virtual void traverseGroups(const uno::Reference< report::XGroups>& _xGroups);
+ virtual void traverseGroup(const uno::Reference< report::XGroup>& _xGroup);
+ virtual void traverseGroupFunctions(const uno::Reference< report::XFunctions>& _xFunctions);
+ virtual void traverseGroupHeader(const uno::Reference< report::XSection>& _xSection);
+ virtual void traverseGroupFooter(const uno::Reference< report::XSection>& _xSection);
+
+ virtual void traverseDetail(const uno::Reference< report::XSection>& _xSection);
+
+ SvLBoxEntry* find(const uno::Reference< uno::XInterface >& _xContent);
+ void removeEntry(SvLBoxEntry* _pEntry,bool _bRemove = true);
+private:
+ using SvTreeListBox::ExecuteDrop;
+};
+DBG_NAME(rpt_NavigatorTree)
+// -----------------------------------------------------------------------------
+NavigatorTree::NavigatorTree( Window* pParent,OReportController& _rController )
+ :SvTreeListBox( pParent, WB_TABSTOP| WB_HASBUTTONS|WB_HASLINES|WB_BORDER|WB_HSCROLL|WB_HASBUTTONSATROOT )
+ ,comphelper::OSelectionChangeListener(m_aMutex)
+ ,OPropertyChangeListener(m_aMutex)
+ ,m_aTimerTriggered(-1,-1)
+ ,m_aDropActionType( DA_SCROLLUP )
+ ,m_rController(_rController)
+ ,m_pMasterReport(NULL)
+ ,m_pDragedEntry(NULL)
+ ,m_nTimerCounter( DROP_ACTION_TIMER_INITIAL_TICKS )
+{
+ DBG_CTOR(rpt_NavigatorTree,NULL);
+ m_pReportListener = new OPropertyChangeMultiplexer(this,m_rController.getReportDefinition().get());
+ m_pReportListener->addProperty(PROPERTY_PAGEHEADERON);
+ m_pReportListener->addProperty(PROPERTY_PAGEFOOTERON);
+ m_pReportListener->addProperty(PROPERTY_REPORTHEADERON);
+ m_pReportListener->addProperty(PROPERTY_REPORTFOOTERON);
+
+ m_pSelectionListener = new OSelectionChangeMultiplexer(this,&m_rController);
+
+ SetHelpId( HID_REPORT_NAVIGATOR_TREE );
+
+ m_aNavigatorImages = ImageList( ModuleRes( RID_SVXIMGLIST_RPTEXPL ) );
+ m_aNavigatorImagesHC = ImageList( ModuleRes( RID_SVXIMGLIST_RPTEXPL_HC ) );
+
+ SetNodeBitmaps(
+ m_aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
+ m_aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ),
+ BMP_COLOR_NORMAL
+ );
+ SetNodeBitmaps(
+ m_aNavigatorImagesHC.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
+ m_aNavigatorImagesHC.GetImage( RID_SVXIMG_EXPANDEDNODE ),
+ BMP_COLOR_HIGHCONTRAST
+ );
+
+ SetDragDropMode(0xFFFF);
+ EnableInplaceEditing( sal_False );
+ SetSelectionMode(MULTIPLE_SELECTION);
+ Clear();
+
+ m_aDropActionTimer.SetTimeoutHdl(LINK(this, NavigatorTree, OnDropActionTimer));
+ SetSelectHdl(LINK(this, NavigatorTree, OnEntrySelDesel));
+ SetDeselectHdl(LINK(this, NavigatorTree, OnEntrySelDesel));
+}
+// -----------------------------------------------------------------------------
+NavigatorTree::~NavigatorTree()
+{
+ SvLBoxEntry* pCurrent = First();
+ while ( pCurrent )
+ {
+ delete static_cast<UserData*>(pCurrent->GetUserData());
+ pCurrent = Next(pCurrent);
+ }
+ m_pReportListener->dispose();
+ m_pSelectionListener->dispose();
+ DBG_DTOR(rpt_NavigatorTree,NULL);
+}
+//------------------------------------------------------------------------------
+void NavigatorTree::Command( const CommandEvent& rEvt )
+{
+ sal_Bool bHandled = sal_False;
+ switch( rEvt.GetCommand() )
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ // die Stelle, an der geklickt wurde
+ SvLBoxEntry* ptClickedOn = NULL;
+ ::Point aWhere;
+ if (rEvt.IsMouseEvent())
+ {
+ aWhere = rEvt.GetMousePosPixel();
+ ptClickedOn = GetEntry(aWhere);
+ if (ptClickedOn == NULL)
+ break;
+ if ( !IsSelected(ptClickedOn) )
+ {
+ SelectAll(sal_False);
+ Select(ptClickedOn, sal_True);
+ SetCurEntry(ptClickedOn);
+ }
+ }
+ else
+ {
+ ptClickedOn = GetCurEntry();
+ if ( !ptClickedOn )
+ break;
+ aWhere = GetEntryPosition(ptClickedOn);
+ }
+ UserData* pData = static_cast<UserData*>(ptClickedOn->GetUserData());
+ uno::Reference< report::XFunctionsSupplier> xSupplier(pData->getContent(),uno::UNO_QUERY);
+ uno::Reference< report::XFunctions> xFunctions(pData->getContent(),uno::UNO_QUERY);
+ uno::Reference< report::XGroup> xGroup(pData->getContent(),uno::UNO_QUERY);
+ sal_Bool bDeleteAllowed = m_rController.isEditable() && (xGroup.is() ||
+ uno::Reference< report::XFunction>(pData->getContent(),uno::UNO_QUERY).is());
+ PopupMenu aContextMenu( ModuleRes( RID_MENU_NAVIGATOR ) );
+
+ USHORT nCount = aContextMenu.GetItemCount();
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ if ( MENUITEM_SEPARATOR != aContextMenu.GetItemType(i))
+ {
+ USHORT nId = aContextMenu.GetItemId(i);
+
+ aContextMenu.CheckItem(nId,m_rController.isCommandChecked(nId));
+ sal_Bool bEnabled = m_rController.isCommandEnabled(nId);
+ if ( nId == SID_RPT_NEW_FUNCTION )
+ aContextMenu.EnableItem(nId,m_rController.isEditable() && (xSupplier.is() || xFunctions.is()) );
+ // special condition, check for function and group
+ else if ( nId == SID_DELETE )
+ aContextMenu.EnableItem(SID_DELETE,bDeleteAllowed);
+ else
+ aContextMenu.EnableItem(nId,bEnabled);
+ }
+ } // for (USHORT i = 0; i < nCount; ++i)
+ USHORT nId = aContextMenu.Execute(this, aWhere);
+ if ( nId )
+ {
+ uno::Sequence< beans::PropertyValue> aArgs;
+ if ( nId == SID_RPT_NEW_FUNCTION )
+ {
+ aArgs.realloc(1);
+ aArgs[0].Value <<= (xFunctions.is() ? xFunctions : xSupplier->getFunctions());
+ }
+ else if ( nId == SID_DELETE )
+ {
+ if ( xGroup.is() )
+ nId = SID_GROUP_REMOVE;
+ aArgs.realloc(1);
+ aArgs[0].Name = PROPERTY_GROUP;
+ aArgs[0].Value <<= pData->getContent();
+ }
+ m_rController.executeUnChecked(nId,aArgs);
+ }
+
+ bHandled = sal_True;
+ } break;
+ }
+
+ if (!bHandled)
+ SvTreeListBox::Command( rEvt );
+}
+// -----------------------------------------------------------------------------
+sal_Int8 NavigatorTree::AcceptDrop( const AcceptDropEvent& _rEvt )
+{
+ sal_Int8 nDropOption = DND_ACTION_NONE;
+ ::Point aDropPos = _rEvt.maPosPixel;
+ if (_rEvt.mbLeaving)
+ {
+ if (m_aDropActionTimer.IsActive())
+ m_aDropActionTimer.Stop();
+ }
+ else
+ {
+ bool bNeedTrigger = false;
+ // auf dem ersten Eintrag ?
+ if ((aDropPos.Y() >= 0) && (aDropPos.Y() < GetEntryHeight()))
+ {
+ m_aDropActionType = DA_SCROLLUP;
+ bNeedTrigger = true;
+ }
+ else if ((aDropPos.Y() < GetSizePixel().Height()) && (aDropPos.Y() >= GetSizePixel().Height() - GetEntryHeight()))
+ {
+ m_aDropActionType = DA_SCROLLDOWN;
+ bNeedTrigger = true;
+ }
+ else
+ {
+ SvLBoxEntry* pDropppedOn = GetEntry(aDropPos);
+ if (pDropppedOn && (GetChildCount(pDropppedOn) > 0) && !IsExpanded(pDropppedOn))
+ {
+ m_aDropActionType = DA_EXPANDNODE;
+ bNeedTrigger = true;
+ }
+ }
+
+ if (bNeedTrigger && (m_aTimerTriggered != aDropPos))
+ {
+ // neu anfangen zu zaehlen
+ m_nTimerCounter = DROP_ACTION_TIMER_INITIAL_TICKS;
+ // die Pos merken, da ich auch AcceptDrops bekomme, wenn sich die Maus gar nicht bewegt hat
+ m_aTimerTriggered = aDropPos;
+ // und den Timer los
+ if (!m_aDropActionTimer.IsActive()) // gibt es den Timer schon ?
+ {
+ m_aDropActionTimer.SetTimeout(DROP_ACTION_TIMER_TICK_BASE);
+ m_aDropActionTimer.Start();
+ }
+ }
+ else if (!bNeedTrigger)
+ m_aDropActionTimer.Stop();
+ }
+
+ return nDropOption;
+}
+// -------------------------------------------------------------------------
+sal_Int8 NavigatorTree::ExecuteDrop( const ExecuteDropEvent& /*_rEvt*/ )
+{
+ // _rEvt.mnAction;
+ return DND_ACTION_NONE;
+}
+// -------------------------------------------------------------------------
+void NavigatorTree::StartDrag( sal_Int8 /*_nAction*/, const Point& _rPosPixel )
+{
+ m_pDragedEntry = GetEntry(_rPosPixel);
+ if ( m_pDragedEntry )
+ {
+ EndSelection();
+ }
+}
+//------------------------------------------------------------------------
+IMPL_LINK( NavigatorTree, OnDropActionTimer, void*, EMPTYARG )
+{
+ if (--m_nTimerCounter > 0)
+ return 0L;
+
+ switch ( m_aDropActionType )
+ {
+ case DA_EXPANDNODE:
+ {
+ SvLBoxEntry* pToExpand = GetEntry(m_aTimerTriggered);
+ if (pToExpand && (GetChildCount(pToExpand) > 0) && !IsExpanded(pToExpand))
+ // tja, eigentlich muesste ich noch testen, ob die Node nicht schon expandiert ist, aber ich
+ // habe dazu weder in den Basisklassen noch im Model eine Methode gefunden ...
+ // aber ich denke, die BK sollte es auch so vertragen
+ Expand(pToExpand);
+
+ // nach dem Expand habe ich im Gegensatz zum Scrollen natuerlich nix mehr zu tun
+ m_aDropActionTimer.Stop();
+ }
+ break;
+
+ case DA_SCROLLUP :
+ ScrollOutputArea( 1 );
+ m_nTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
+ break;
+
+ case DA_SCROLLDOWN :
+ ScrollOutputArea( -1 );
+ m_nTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
+ break;
+
+ }
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK(NavigatorTree, OnEntrySelDesel, NavigatorTree*, /*pThis*/)
+{
+ if ( !m_pSelectionListener->locked() )
+ {
+ m_pSelectionListener->lock();
+ SvLBoxEntry* pEntry = GetCurEntry();
+ uno::Any aSelection;
+ if ( IsSelected(pEntry) )
+ aSelection <<= static_cast<UserData*>(pEntry->GetUserData())->getContent();
+ m_rController.select(aSelection);
+ m_pSelectionListener->unlock();
+ }
+
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::_selectionChanged( const lang::EventObject& aEvent ) throw (uno::RuntimeException)
+{
+ m_pSelectionListener->lock();
+ uno::Reference< view::XSelectionSupplier> xSelectionSupplier(aEvent.Source,uno::UNO_QUERY);
+ uno::Any aSec = xSelectionSupplier->getSelection();
+ uno::Sequence< uno::Reference< report::XReportComponent > > aSelection;
+ aSec >>= aSelection;
+ if ( !aSelection.getLength() )
+ {
+ uno::Reference< uno::XInterface> xSelection(aSec,uno::UNO_QUERY);
+ SvLBoxEntry* pEntry = find(xSelection);
+ if ( pEntry && !IsSelected(pEntry) )
+ {
+ Select(pEntry, sal_True);
+ SetCurEntry(pEntry);
+ }
+ else if ( !pEntry )
+ SelectAll(FALSE,FALSE);
+ }
+ else
+ {
+ const uno::Reference< report::XReportComponent >* pIter = aSelection.getConstArray();
+ const uno::Reference< report::XReportComponent >* pEnd = pIter + aSelection.getLength();
+ for (; pIter != pEnd; ++pIter)
+ {
+ SvLBoxEntry* pEntry = find(*pIter);
+ if ( pEntry && !IsSelected(pEntry) )
+ {
+ Select(pEntry, sal_True);
+ SetCurEntry(pEntry);
+ }
+ }
+ }
+ m_pSelectionListener->unlock();
+}
+// -----------------------------------------------------------------------------
+SvLBoxEntry* NavigatorTree::insertEntry(const ::rtl::OUString& _sName,SvLBoxEntry* _pParent,USHORT _nImageId,ULONG _nPosition,UserData* _pData)
+{
+ SvLBoxEntry* pEntry = NULL;
+ if ( _nImageId )
+ {
+ const Image aImage( m_aNavigatorImages.GetImage( _nImageId ) );
+ pEntry = InsertEntry(_sName,aImage,aImage,_pParent,FALSE,_nPosition,_pData);
+ if ( pEntry )
+ {
+ const Image aImageHC( m_aNavigatorImagesHC.GetImage( _nImageId ) );
+ SetExpandedEntryBmp( pEntry, aImageHC, BMP_COLOR_HIGHCONTRAST );
+ SetCollapsedEntryBmp( pEntry, aImageHC, BMP_COLOR_HIGHCONTRAST );
+ }
+ }
+ else
+ pEntry = InsertEntry(_sName,_pParent,FALSE,_nPosition,_pData);
+ return pEntry;
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseSection(const uno::Reference< report::XSection>& _xSection,SvLBoxEntry* _pParent,USHORT _nImageId,ULONG _nPosition)
+{
+ SvLBoxEntry* pSection = insertEntry(_xSection->getName(),_pParent,_nImageId,_nPosition,new UserData(this,_xSection));
+ const sal_Int32 nCount = _xSection->getCount();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ uno::Reference< report::XReportComponent> xElement(_xSection->getByIndex(i),uno::UNO_QUERY_THROW);
+ OSL_ENSURE(xElement.is(),"Found report element which is NULL!");
+ insertEntry(lcl_getName(xElement.get()),pSection,lcl_getImageId(xElement),LIST_APPEND,new UserData(this,xElement));
+ uno::Reference< report::XReportDefinition> xSubReport(xElement,uno::UNO_QUERY);
+ if ( xSubReport.is() )
+ {
+ m_pMasterReport = find(_xSection->getReportDefinition());
+ reportdesign::OReportVisitor aSubVisitor(this);
+ aSubVisitor.start(xSubReport);
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseFunctions(const uno::Reference< report::XFunctions>& _xFunctions,SvLBoxEntry* _pParent)
+{
+ SvLBoxEntry* pFunctions = insertEntry(String(ModuleRes(RID_STR_FUNCTIONS)),_pParent,SID_RPT_NEW_FUNCTION,LIST_APPEND,new UserData(this,_xFunctions));
+ const sal_Int32 nCount = _xFunctions->getCount();
+ for (sal_Int32 i = 0; i< nCount; ++i)
+ {
+ uno::Reference< report::XFunction> xElement(_xFunctions->getByIndex(i),uno::UNO_QUERY);
+ insertEntry(xElement->getName(),pFunctions,SID_RPT_NEW_FUNCTION,LIST_APPEND,new UserData(this,xElement));
+ }
+}
+// -----------------------------------------------------------------------------
+SvLBoxEntry* NavigatorTree::find(const uno::Reference< uno::XInterface >& _xContent)
+{
+ SvLBoxEntry* pRet = NULL;
+ if ( _xContent.is() )
+ {
+ SvLBoxEntry* pCurrent = First();
+ while ( pCurrent )
+ {
+ UserData* pData = static_cast<UserData*>(pCurrent->GetUserData());
+ OSL_ENSURE(pData,"No UserData set an entry!");
+ if ( pData->getContent() == _xContent )
+ {
+ pRet = pCurrent;
+ break;
+ }
+ pCurrent = Next(pCurrent);
+ }
+ }
+ return pRet;
+}
+// -----------------------------------------------------------------------------
+// ITraverseReport
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseReport(const uno::Reference< report::XReportDefinition>& _xReport)
+{
+ insertEntry(_xReport->getName(),m_pMasterReport,SID_SELECT_REPORT,LIST_APPEND,new UserData(this,_xReport));
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseReportFunctions(const uno::Reference< report::XFunctions>& _xFunctions)
+{
+ SvLBoxEntry* pReport = find(_xFunctions->getParent());
+ traverseFunctions(_xFunctions,pReport);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseReportHeader(const uno::Reference< report::XSection>& _xSection)
+{
+ SvLBoxEntry* pReport = find(_xSection->getReportDefinition());
+ traverseSection(_xSection,pReport,SID_REPORTHEADERFOOTER);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseReportFooter(const uno::Reference< report::XSection>& _xSection)
+{
+ SvLBoxEntry* pReport = find(_xSection->getReportDefinition());
+ traverseSection(_xSection,pReport,SID_REPORTHEADERFOOTER);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traversePageHeader(const uno::Reference< report::XSection>& _xSection)
+{
+ SvLBoxEntry* pReport = find(_xSection->getReportDefinition());
+ traverseSection(_xSection,pReport,SID_PAGEHEADERFOOTER);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traversePageFooter(const uno::Reference< report::XSection>& _xSection)
+{
+ SvLBoxEntry* pReport = find(_xSection->getReportDefinition());
+ traverseSection(_xSection,pReport,SID_PAGEHEADERFOOTER);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseGroups(const uno::Reference< report::XGroups>& _xGroups)
+{
+ SvLBoxEntry* pReport = find(_xGroups->getReportDefinition());
+ insertEntry(String(ModuleRes(RID_STR_GROUPS)),pReport,SID_SORTINGANDGROUPING,LIST_APPEND,new UserData(this,_xGroups));
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseGroup(const uno::Reference< report::XGroup>& _xGroup)
+{
+ uno::Reference< report::XGroups> xGroups(_xGroup->getParent(),uno::UNO_QUERY);
+ SvLBoxEntry* pGroups = find(xGroups);
+ OSL_ENSURE(pGroups,"No Groups inserted so far. Why!");
+ insertEntry(_xGroup->getExpression(),pGroups,SID_GROUP,rptui::getPositionInIndexAccess(xGroups.get(),_xGroup),new UserData(this,_xGroup));
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseGroupFunctions(const uno::Reference< report::XFunctions>& _xFunctions)
+{
+ SvLBoxEntry* pGroup = find(_xFunctions->getParent());
+ traverseFunctions(_xFunctions,pGroup);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseGroupHeader(const uno::Reference< report::XSection>& _xSection)
+{
+ SvLBoxEntry* pGroup = find(_xSection->getGroup());
+ OSL_ENSURE(pGroup,"No group found");
+ traverseSection(_xSection,pGroup,SID_GROUPHEADER,1);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseGroupFooter(const uno::Reference< report::XSection>& _xSection)
+{
+ SvLBoxEntry* pGroup = find(_xSection->getGroup());
+ OSL_ENSURE(pGroup,"No group found");
+ traverseSection(_xSection,pGroup,SID_GROUPFOOTER);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseDetail(const uno::Reference< report::XSection>& _xSection)
+{
+ uno::Reference< report::XReportDefinition> xReport = _xSection->getReportDefinition();
+ SvLBoxEntry* pParent = find(xReport);
+ traverseSection(_xSection,pParent,SID_ICON_DETAIL);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
+{
+ uno::Reference< report::XReportDefinition> xReport(_rEvent.Source,uno::UNO_QUERY);
+ if ( xReport.is() )
+ {
+ sal_Bool bEnabled = sal_False;
+ _rEvent.NewValue >>= bEnabled;
+ if ( bEnabled )
+ {
+ SvLBoxEntry* pParent = find(xReport);
+ if ( _rEvent.PropertyName == PROPERTY_REPORTHEADERON )
+ {
+ ULONG nPos = xReport->getReportHeaderOn() ? 2 : 1;
+ traverseSection(xReport->getReportHeader(),pParent,SID_REPORTHEADERFOOTER,nPos);
+ }
+ else if ( _rEvent.PropertyName == PROPERTY_PAGEHEADERON )
+ {
+ traverseSection(xReport->getPageHeader(),pParent, SID_PAGEHEADERFOOTER,1);
+ }
+ else if ( _rEvent.PropertyName == PROPERTY_PAGEFOOTERON )
+ traverseSection(xReport->getPageFooter(),pParent, SID_PAGEHEADERFOOTER);
+ else if ( _rEvent.PropertyName == PROPERTY_REPORTFOOTERON )
+ {
+ ULONG nPos = xReport->getPageFooterOn() ? (GetLevelChildCount(pParent) - 1) : LIST_APPEND;
+ traverseSection(xReport->getReportFooter(),pParent,SID_REPORTHEADERFOOTER,nPos);
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::_elementInserted( const container::ContainerEvent& _rEvent )
+{
+ SvLBoxEntry* pEntry = find(_rEvent.Source);
+ uno::Reference<beans::XPropertySet> xProp(_rEvent.Element,uno::UNO_QUERY_THROW);
+ ::rtl::OUString sName;
+ uno::Reference< beans::XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
+ if ( xInfo.is() )
+ {
+ if ( xInfo->hasPropertyByName(PROPERTY_NAME) )
+ xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
+ else if ( xInfo->hasPropertyByName(PROPERTY_EXPRESSION) )
+ xProp->getPropertyValue(PROPERTY_EXPRESSION) >>= sName;
+ }
+ uno::Reference< report::XGroup> xGroup(xProp,uno::UNO_QUERY);
+ if ( xGroup.is() )
+ {
+ reportdesign::OReportVisitor aSubVisitor(this);
+ aSubVisitor.start(xGroup);
+ }
+ else
+ {
+ uno::Reference< report::XReportComponent> xElement(xProp,uno::UNO_QUERY);
+ if ( xProp.is() )
+ sName = lcl_getName(xProp);
+ insertEntry(sName,pEntry,(!xElement.is() ? USHORT(SID_RPT_NEW_FUNCTION) : lcl_getImageId(xElement)),LIST_APPEND,new UserData(this,xProp));
+ }
+ if ( !IsExpanded(pEntry) )
+ Expand(pEntry);
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::_elementRemoved( const container::ContainerEvent& _rEvent )
+{
+ uno::Reference<beans::XPropertySet> xProp(_rEvent.Element,uno::UNO_QUERY);
+ SvLBoxEntry* pEntry = find(xProp);
+ OSL_ENSURE(pEntry,"NavigatorTree::_elementRemoved: No Entry found!");
+
+ if ( pEntry )
+ {
+ SvLBoxEntry* pParent = GetParent(pEntry);
+ removeEntry(pEntry);
+ PaintEntry(pParent);
+ }
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::_elementReplaced( const container::ContainerEvent& _rEvent )
+{
+ uno::Reference<beans::XPropertySet> xProp(_rEvent.ReplacedElement,uno::UNO_QUERY);
+ SvLBoxEntry* pEntry = find(xProp);
+ if ( pEntry )
+ {
+ UserData* pData = static_cast<UserData*>(pEntry->GetUserData());
+ xProp.set(_rEvent.Element,uno::UNO_QUERY);
+ pData->setContent(xProp);
+ ::rtl::OUString sName;
+ xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
+ SetEntryText(pEntry,sName);
+ }
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::_disposing(const lang::EventObject& _rSource)throw( uno::RuntimeException)
+{
+ removeEntry(find(_rSource.Source));
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::removeEntry(SvLBoxEntry* _pEntry,bool _bRemove)
+{
+ if ( _pEntry )
+ {
+ SvLBoxEntry* pChild = FirstChild(_pEntry);
+ while( pChild )
+ {
+ removeEntry(pChild,false);
+ pChild = NextSibling(pChild);
+ }
+ delete static_cast<UserData*>(_pEntry->GetUserData());
+ if ( _bRemove )
+ GetModel()->Remove(_pEntry);
+ }
+}
+DBG_NAME(rpt_NavigatorTree_UserData)
+// -----------------------------------------------------------------------------
+NavigatorTree::UserData::UserData(NavigatorTree* _pTree,const uno::Reference<uno::XInterface>& _xContent)
+ : OPropertyChangeListener(m_aMutex)
+ , OContainerListener(m_aMutex)
+ , m_xContent(_xContent)
+ , m_pTree(_pTree)
+{
+ DBG_CTOR(rpt_NavigatorTree_UserData,NULL);
+ uno::Reference<beans::XPropertySet> xProp(m_xContent,uno::UNO_QUERY);
+ if ( xProp.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
+ if ( xInfo.is() )
+ {
+ m_pListener = new ::comphelper::OPropertyChangeMultiplexer(this,xProp);
+ if ( xInfo->hasPropertyByName(PROPERTY_NAME) )
+ m_pListener->addProperty(PROPERTY_NAME);
+ else if ( xInfo->hasPropertyByName(PROPERTY_EXPRESSION) )
+ m_pListener->addProperty(PROPERTY_EXPRESSION);
+ if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
+ m_pListener->addProperty(PROPERTY_DATAFIELD);
+ if ( xInfo->hasPropertyByName(PROPERTY_LABEL) )
+ m_pListener->addProperty(PROPERTY_LABEL);
+ if ( xInfo->hasPropertyByName(PROPERTY_HEADERON) )
+ m_pListener->addProperty(PROPERTY_HEADERON);
+ if ( xInfo->hasPropertyByName(PROPERTY_FOOTERON) )
+ m_pListener->addProperty(PROPERTY_FOOTERON);
+ }
+ }
+ uno::Reference< container::XContainer> xContainer(m_xContent,uno::UNO_QUERY);
+ if ( xContainer.is() )
+ {
+ m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
+ }
+}
+// -----------------------------------------------------------------------------
+NavigatorTree::UserData::~UserData()
+{
+ DBG_DTOR(rpt_NavigatorTree_UserData,NULL);
+ if ( m_pContainerListener.is() )
+ m_pContainerListener->dispose();
+ if ( m_pListener.is() )
+ m_pListener->dispose();
+}
+// -----------------------------------------------------------------------------
+// OPropertyChangeListener
+void NavigatorTree::UserData::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
+{
+ SvLBoxEntry* pEntry = m_pTree->find(_rEvent.Source);
+ OSL_ENSURE(pEntry,"No entry could be found! Why not!");
+ const bool bFooterOn = (PROPERTY_FOOTERON == _rEvent.PropertyName);
+ try
+ {
+ if ( bFooterOn || PROPERTY_HEADERON == _rEvent.PropertyName )
+ {
+ sal_Int32 nPos = 1;
+ uno::Reference< report::XGroup> xGroup(_rEvent.Source,uno::UNO_QUERY);
+ ::std::mem_fun_t< sal_Bool,OGroupHelper> pIsOn = ::std::mem_fun(&OGroupHelper::getHeaderOn);
+ ::std::mem_fun_t< uno::Reference<report::XSection> ,OGroupHelper> pMemFunSection = ::std::mem_fun(&OGroupHelper::getHeader);
+ if ( bFooterOn )
+ {
+ pIsOn = ::std::mem_fun(&OGroupHelper::getFooterOn);
+ pMemFunSection = ::std::mem_fun(&OGroupHelper::getFooter);
+ nPos = m_pTree->GetChildCount(pEntry) - 1;
+ }
+
+ OGroupHelper aGroupHelper(xGroup);
+ if ( pIsOn(&aGroupHelper) )
+ {
+ if ( bFooterOn )
+ ++nPos;
+ m_pTree->traverseSection(pMemFunSection(&aGroupHelper),pEntry,bFooterOn ? SID_GROUPFOOTER : SID_GROUPHEADER,nPos);
+ }
+ //else
+ // m_pTree->removeEntry(m_pTree->GetEntry(pEntry,nPos));
+ }
+ else if ( PROPERTY_EXPRESSION == _rEvent.PropertyName)
+ {
+ ::rtl::OUString sNewName;
+ _rEvent.NewValue >>= sNewName;
+ m_pTree->SetEntryText(pEntry,sNewName);
+ }
+ else if ( PROPERTY_DATAFIELD == _rEvent.PropertyName || PROPERTY_LABEL == _rEvent.PropertyName || PROPERTY_NAME == _rEvent.PropertyName )
+ {
+ uno::Reference<beans::XPropertySet> xProp(_rEvent.Source,uno::UNO_QUERY);
+ m_pTree->SetEntryText(pEntry,lcl_getName(xProp));
+ }
+ }
+ catch(uno::Exception)
+ {}
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::UserData::_elementInserted( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException)
+{
+ m_pTree->_elementInserted( _rEvent );
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::UserData::_elementRemoved( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException)
+{
+ m_pTree->_elementRemoved( _rEvent );
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::UserData::_elementReplaced( const container::ContainerEvent& _rEvent ) throw(uno::RuntimeException)
+{
+ m_pTree->_elementReplaced( _rEvent );
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::UserData::_disposing(const lang::EventObject& _rSource) throw( uno::RuntimeException)
+{
+ m_pTree->_disposing( _rSource );
+}
+// -----------------------------------------------------------------------------
+// class ONavigatorImpl
+// -----------------------------------------------------------------------------
+class ONavigatorImpl
+{
+ ONavigatorImpl(const ONavigatorImpl&);
+ void operator =(const ONavigatorImpl&);
+public:
+ ONavigatorImpl(OReportController& _rController,ONavigator* _pParent);
+ virtual ~ONavigatorImpl();
+
+ uno::Reference< report::XReportDefinition> m_xReport;
+ ::rptui::OReportController& m_rController;
+ ::std::auto_ptr<NavigatorTree> m_pNavigatorTree;
+};
+
+ONavigatorImpl::ONavigatorImpl(OReportController& _rController,ONavigator* _pParent)
+ :m_xReport(_rController.getReportDefinition())
+ ,m_rController(_rController)
+ ,m_pNavigatorTree(new NavigatorTree(_pParent,_rController))
+{
+ reportdesign::OReportVisitor aVisitor(m_pNavigatorTree.get());
+ aVisitor.start(m_xReport);
+ m_pNavigatorTree->Expand(m_pNavigatorTree->find(m_xReport));
+ lang::EventObject aEvent(m_rController);
+ m_pNavigatorTree->_selectionChanged(aEvent);
+}
+//------------------------------------------------------------------------
+ONavigatorImpl::~ONavigatorImpl()
+{
+}
+// -----------------------------------------------------------------------------
+DBG_NAME( rpt_ONavigator )
+const long STD_WIN_SIZE_X = 210;
+const long STD_WIN_SIZE_Y = 280;
+const long LISTBOX_BORDER = 2;
+//========================================================================
+// class ONavigator
+//========================================================================
+ONavigator::ONavigator( Window* _pParent
+ ,OReportController& _rController)
+ : FloatingWindow( _pParent, ModuleRes(RID_NAVIGATOR) )
+{
+ DBG_CTOR( rpt_ONavigator,NULL);
+
+ m_pImpl.reset(new ONavigatorImpl(_rController,this));
+
+ //Size aSpace = LogicToPixel( Size( 7, 120), MAP_APPFONT );
+ //Size aOutSize(nMaxTextWidth + m_aHeader.GetSizePixel().Width() + 3*aSpace.Width(),aSpace.Height());
+ //SetMinOutputSizePixel(aOutSize);
+ //SetOutputSizePixel(aOutSize);
+ FreeResource();
+ m_pImpl->m_pNavigatorTree->Show();
+ m_pImpl->m_pNavigatorTree->GrabFocus();
+ SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
+ Show();
+
+}
+// -----------------------------------------------------------------------------
+
+//------------------------------------------------------------------------
+ONavigator::~ONavigator()
+{
+ DBG_DTOR( rpt_ONavigator,NULL);
+}
+//------------------------------------------------------------------------------
+void ONavigator::Resize()
+{
+ FloatingWindow::Resize();
+
+ Point aPos(GetPosPixel());
+ Size aSize( GetOutputSizePixel() );
+
+ //////////////////////////////////////////////////////////////////////
+
+ // Groesse der form::ListBox anpassen
+ Point aLBPos( LISTBOX_BORDER, LISTBOX_BORDER );
+ Size aLBSize( aSize );
+ aLBSize.Width() -= (2*LISTBOX_BORDER);
+ aLBSize.Height() -= (2*LISTBOX_BORDER);
+
+ m_pImpl->m_pNavigatorTree->SetPosSizePixel( aLBPos, aLBSize );
+}
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+void ONavigator::GetFocus()
+{
+ Window::GetFocus();
+ if ( m_pImpl->m_pNavigatorTree.get() )
+ m_pImpl->m_pNavigatorTree->GrabFocus();
+}
+// =============================================================================
+} // rptui
+// =============================================================================
+
diff --git a/reportdesign/source/ui/dlg/Navigator.src b/reportdesign/source/ui/dlg/Navigator.src
new file mode 100644
index 000000000000..496bae3b0ab7
--- /dev/null
+++ b/reportdesign/source/ui/dlg/Navigator.src
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * 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 "RptResId.hrc"
+#include "helpids.hrc"
+#include "rptui_slotid.hrc"
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _SBASLTID_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <svl/solar.hrc>
+
+#define RID_SVXIMG_COLLAPSEDNODE (RID_FORMS_START + 2)
+#define RID_SVXIMG_EXPANDEDNODE (RID_FORMS_START + 3)
+#define RID_SVXIMG_FORMS (RID_FORMS_START +13)
+
+FloatingWindow RID_NAVIGATOR
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 200 , 250 ) ;
+ Text [ en-US ] = "Report navigator" ;
+ HelpId = HID_RPT_NAVIGATOR_DLG;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Sizeable = TRUE;
+
+ Control 1
+ {
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 200, 250 );
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+};
+#define NAVIGATOR_IMAGEIDS \
+ IdList = \
+ { \
+ SID_SELECT_REPORT;\
+ SID_FM_FIXEDTEXT ; \
+ SID_INSERT_HFIXEDLINE ; \
+ SID_INSERT_VFIXEDLINE;\
+ SID_FM_IMAGECONTROL ; \
+ SID_FM_EDIT ; \
+ SID_RPT_NEW_FUNCTION;\
+ SID_REPORTHEADERFOOTER;\
+ SID_PAGEHEADERFOOTER;\
+ SID_GROUPHEADER;\
+ SID_GROUPFOOTER;\
+ RID_SVXIMG_COLLAPSEDNODE ; \
+ RID_SVXIMG_EXPANDEDNODE ; \
+ SID_SORTINGANDGROUPING;\
+ SID_DRAWTBX_CS_BASIC;\
+ SID_GROUP;\
+ SID_ICON_DETAIL;\
+ }; \
+ IdCount = 17
+
+ImageList RID_SVXIMGLIST_RPTEXPL
+{
+ Prefix = "sx";
+ MaskColor = Color { Red = 0xff00 ; Green = 0x0000 ; Blue = 0xff00 ; };
+ NAVIGATOR_IMAGEIDS;
+};
+
+ImageList RID_SVXIMGLIST_RPTEXPL_HC
+{
+ Prefix = "sxh";
+ MaskColor = Color { Red = 0xff00 ; Green = 0x0000 ; Blue = 0xff00 ; };
+ NAVIGATOR_IMAGEIDS;
+};
+
+String RID_STR_FUNCTIONS
+{
+ Text [ en-US ] = "Functions" ;
+};
+String RID_STR_GROUPS
+{
+ Text [ en-US ] = "Groups" ;
+};
+Menu RID_MENU_NAVIGATOR
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_SORTINGANDGROUPING;
+ HelpId = SID_SORTINGANDGROUPING ;
+ Command = ".uno:DbSortingAndGrouping";
+ Text [ en-US ] = "Sorting and Grouping...";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_PAGEHEADERFOOTER;
+ HelpId = SID_PAGEHEADERFOOTER ;
+ Command = ".uno:PageHeaderFooter";
+ Checkable = TRUE;
+ Text [ en-US ] = "Page Header/Footer...";
+ };
+ MenuItem
+ {
+ Identifier = SID_REPORTHEADERFOOTER;
+ HelpId = SID_REPORTHEADERFOOTER ;
+ Command = ".uno:ReportHeaderFooter";
+ Checkable = TRUE;
+ Text [ en-US ] = "Report Header/Footer...";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_RPT_NEW_FUNCTION;
+ HelpId = SID_RPT_NEW_FUNCTION;
+ Command = ".uno:NewFunction";
+ Text [ en-US ] = "New Function";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_SHOW_PROPERTYBROWSER;
+ HelpId = SID_SHOW_PROPERTYBROWSER ;
+ Command = ".uno:FormProperties";
+ Text [ en-US ] = "Properties...";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ ITEM_EDIT_DELETE
+ };
+/*
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ ITEM_EDIT_CUT
+ };
+ MenuItem
+ {
+ ITEM_EDIT_COPY
+ };
+ MenuItem
+ {
+ ITEM_EDIT_PASTE
+ };
+*/
+ };
+};
+
diff --git a/reportdesign/source/ui/dlg/PageNumber.cxx b/reportdesign/source/ui/dlg/PageNumber.cxx
new file mode 100644
index 000000000000..dba4a7648aaf
--- /dev/null
+++ b/reportdesign/source/ui/dlg/PageNumber.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_reportdesign.hxx"
+#include "PageNumber.hxx"
+#ifndef RPTUI_PAGENUMBER_HRC
+#include "PageNumber.hrc"
+#endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <tools/debug.hxx>
+#ifndef _RPTUI_DLGRESID_HRC
+#include "RptResId.hrc"
+#endif
+#ifndef _RPTUI_SLOTID_HRC_
+#include "rptui_slotid.hrc"
+#endif
+#ifndef _RPTUI_MODULE_HELPER_DBU_HXX_
+#include "ModuleHelper.hxx"
+#endif
+#include "RptDef.hxx"
+#ifndef RTPUI_REPORTDESIGN_HELPID_HRC
+#include "helpids.hrc"
+#endif
+#include <vcl/msgbox.hxx>
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _SBASLTID_HRC
+#include <svx/svxids.hrc>
+#endif
+#ifndef RPTUI_TOOLS_HXX
+#include "UITools.hxx"
+#endif
+#ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
+#include "uistrings.hrc"
+#endif
+#include "ReportController.hxx"
+#include <com/sun/star/report/XFixedText.hpp>
+#include <algorithm>
+
+namespace rptui
+{
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+DBG_NAME( rpt_OPageNumberDialog )
+//========================================================================
+// class OPageNumberDialog
+//========================================================================
+OPageNumberDialog::OPageNumberDialog( Window* _pParent
+ ,const uno::Reference< report::XReportDefinition >& _xHoldAlive
+ ,OReportController* _pController)
+ : ModalDialog( _pParent, ModuleRes(RID_PAGENUMBERS) )
+ ,m_aFormat(this, ModuleRes(FL_FORMAT) )
+ ,m_aPageN(this, ModuleRes(RB_PAGE_N) )
+ ,m_aPageNofM(this, ModuleRes(RB_PAGE_N_OF_M) )
+ ,m_aPosition(this, ModuleRes(FL_POSITION) )
+ ,m_aTopPage(this, ModuleRes(RB_PAGE_TOPPAGE) )
+ ,m_aBottomPage(this, ModuleRes(RB_PAGE_BOTTOMPAGE) )
+ ,m_aMisc(this, ModuleRes(FL_MISC) )
+ ,m_aAlignment(this, ModuleRes(FL_ALIGNMENT) )
+ ,m_aAlignmentLst(this, ModuleRes(LST_ALIGNMENT) )
+ ,m_aShowNumberOnFirstPage(this, ModuleRes(CB_SHOWNUMBERONFIRSTPAGE) )
+ ,m_aFl1(this, ModuleRes(FL_SEPARATOR1))
+ ,m_aPB_OK(this, ModuleRes(PB_OK))
+ ,m_aPB_CANCEL(this, ModuleRes(PB_CANCEL))
+ ,m_aPB_Help(this, ModuleRes(PB_HELP))
+ ,m_pController(_pController)
+ ,m_xHoldAlive(_xHoldAlive)
+{
+ DBG_CTOR( rpt_OPageNumberDialog,NULL);
+
+ m_aShowNumberOnFirstPage.Hide();
+
+ FreeResource();
+}
+
+//------------------------------------------------------------------------
+OPageNumberDialog::~OPageNumberDialog()
+{
+ DBG_DTOR( rpt_OPageNumberDialog,NULL);
+}
+// -----------------------------------------------------------------------------
+short OPageNumberDialog::Execute()
+{
+ short nRet = ModalDialog::Execute();
+ if ( nRet == RET_OK )
+ {
+ try
+ {
+ sal_Int32 nControlMaxSize = 3000;
+ sal_Int32 nPosX = 0;
+ sal_Int32 nPos2X = 0;
+ awt::Size aRptSize = getStyleProperty<awt::Size>(m_xHoldAlive,PROPERTY_PAPERSIZE);
+ switch ( m_aAlignmentLst.GetSelectEntryPos() )
+ {
+ case 0: // left
+ nPosX = getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_LEFTMARGIN);
+ break;
+ case 1: // middle
+ nPosX = getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_LEFTMARGIN) + (aRptSize.Width - getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_LEFTMARGIN) - getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_RIGHTMARGIN) - nControlMaxSize) / 2;
+ break;
+ case 2: // right
+ nPosX = (aRptSize.Width - getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_RIGHTMARGIN) - nControlMaxSize);
+ break;
+ case 3: // inner
+ case 4: // outer
+ nPosX = getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_LEFTMARGIN);
+ nPos2X = (aRptSize.Width - getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_RIGHTMARGIN) - nControlMaxSize);
+ break;
+ default:
+ break;
+ }
+ if ( m_aAlignmentLst.GetSelectEntryPos() > 2 )
+ nPosX = nPos2X;
+
+ sal_Int32 nLength = 0;
+ uno::Sequence<beans::PropertyValue> aValues( 3 );
+ aValues[nLength].Name = PROPERTY_POSITION;
+ aValues[nLength++].Value <<= awt::Point(nPosX,0);
+
+ aValues[nLength].Name = PROPERTY_PAGEHEADERON;
+ aValues[nLength++].Value <<= m_aTopPage.IsChecked();
+
+ aValues[nLength].Name = PROPERTY_STATE;
+ aValues[nLength++].Value <<= m_aPageNofM.IsChecked();
+
+ m_pController->executeChecked(SID_INSERT_FLD_PGNUMBER,aValues);
+ }
+ catch(uno::Exception&)
+ {
+ nRet = RET_NO;
+ }
+ }
+ return nRet;
+}
+// =============================================================================
+} // rptui
+// =============================================================================
diff --git a/reportdesign/source/ui/dlg/PageNumber.hrc b/reportdesign/source/ui/dlg/PageNumber.hrc
new file mode 100644
index 000000000000..a6087c50b00f
--- /dev/null
+++ b/reportdesign/source/ui/dlg/PageNumber.hrc
@@ -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.
+ *
+ ************************************************************************/
+#ifndef RPTUI_PAGENUMBER_HRC
+#define RPTUI_PAGENUMBER_HRC
+
+#define FL_FORMAT (1)
+#define RB_PAGE_N (2)
+#define RB_PAGE_N_OF_M (3)
+#define FL_POSITION (4)
+#define RB_PAGE_TOPPAGE (5)
+#define RB_PAGE_BOTTOMPAGE (6)
+#define FL_ALIGNMENT (7)
+#define LST_ALIGNMENT (8)
+#define CB_SHOWNUMBERONFIRSTPAGE (9)
+#define PB_OK (10)
+#define PB_CANCEL (11)
+#define PB_HELP (12)
+#define FL_SEPARATOR1 (13)
+#define FL_MISC (14)
+
+
+#define CHECKBOX_HEIGHT 8
+#define FIXEDTEXT_HEIGHT 8
+#define FIXEDTEXT_WIDTH 60
+#define RELATED_CONTROLS 4
+#define UNRELATED_CONTROLS 7
+#define EDIT_HEIGHT 12
+#define BUTTON_HEIGHT 14
+#define BUTTON_WIDTH 50
+#define BROWSER_HEIGHT 75
+#define PAGE_WIDTH (RELATED_CONTROLS + 3*UNRELATED_CONTROLS + 3*BUTTON_WIDTH)
+#define PAGE_HEIGHT ( 8*RELATED_CONTROLS + 4*UNRELATED_CONTROLS + 9*FIXEDTEXT_HEIGHT + BUTTON_HEIGHT +1 )
+#define LISTBOX_WIDTH PAGE_WIDTH - 3*UNRELATED_CONTROLS - FIXEDTEXT_WIDTH
+
+#endif // RPTUI_PAGENUMBER_HRC
diff --git a/reportdesign/source/ui/dlg/PageNumber.src b/reportdesign/source/ui/dlg/PageNumber.src
new file mode 100644
index 000000000000..31c5bdb4026c
--- /dev/null
+++ b/reportdesign/source/ui/dlg/PageNumber.src
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * 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 "PageNumber.hrc"
+#include "RptResId.hrc"
+#include "helpids.hrc"
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _SBASLTID_HRC
+#include <svx/svxids.hrc>
+#endif
+
+
+ModalDialog RID_PAGENUMBERS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( PAGE_WIDTH , PAGE_HEIGHT ) ;
+ Text [ en-US ] = "Page Numbers" ;
+ HelpId = HID_RPT_PAGENUMBERS_DLG;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ FixedLine FL_FORMAT
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS ) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS, FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Format";
+ };
+
+ RadioButton RB_PAGE_N
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS + RELATED_CONTROLS, 2*RELATED_CONTROLS + FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Group = TRUE;
+ Check = TRUE;
+ Text [ en-US ] = "Page N";
+ };
+ RadioButton RB_PAGE_N_OF_M
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS + RELATED_CONTROLS, 3*RELATED_CONTROLS + 2*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Page N of M";
+ };
+
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , 3*RELATED_CONTROLS + UNRELATED_CONTROLS + 3*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Position";
+ };
+
+ RadioButton RB_PAGE_TOPPAGE
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS + RELATED_CONTROLS, 4*RELATED_CONTROLS + UNRELATED_CONTROLS + 4*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Group = TRUE;
+ Check = TRUE;
+ Text [ en-US ] = "Top of Page (Header)";
+ };
+ RadioButton RB_PAGE_BOTTOMPAGE
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS + RELATED_CONTROLS, 5*RELATED_CONTROLS + UNRELATED_CONTROLS + 5*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Bottom of Page (Footer)";
+ };
+
+ FixedLine FL_MISC
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , 5*RELATED_CONTROLS + 2*UNRELATED_CONTROLS + 6*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "General";
+ };
+
+ FixedText FL_ALIGNMENT
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS , 6*RELATED_CONTROLS + 2*UNRELATED_CONTROLS + 7*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( FIXEDTEXT_WIDTH, FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Alignment:";
+ };
+ ListBox LST_ALIGNMENT
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 2*UNRELATED_CONTROLS + FIXEDTEXT_WIDTH , 6*RELATED_CONTROLS + 2*UNRELATED_CONTROLS + 7*FIXEDTEXT_HEIGHT -1);
+ Size = MAP_APPFONT( LISTBOX_WIDTH, 60 );
+ DropDown = TRUE;
+ TabStop = TRUE;
+ CurPos = 1 ;
+ StringList [ en-US ] =
+ {
+ < "Left" ; Default ; > ;
+ < "Center" ; Default ; > ;
+ < "Right" ; Default ; > ;
+ //< "Inside" ; Default ; > ;
+ //< "Outside" ; Default ; > ;
+ };
+ };
+ CheckBox CB_SHOWNUMBERONFIRSTPAGE
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS , 6*RELATED_CONTROLS + 3*UNRELATED_CONTROLS + 8*FIXEDTEXT_HEIGHT) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ;
+ Check = TRUE;
+ Text [ en-US ] = "Show Number on First Page";
+ };
+ FixedLine FL_SEPARATOR1
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS , 6*RELATED_CONTROLS + 4*UNRELATED_CONTROLS + 9*FIXEDTEXT_HEIGHT ) ;
+ Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , 1 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( UNRELATED_CONTROLS, 7*RELATED_CONTROLS + 4*UNRELATED_CONTROLS + 9*FIXEDTEXT_HEIGHT +1) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( RELATED_CONTROLS + UNRELATED_CONTROLS + BUTTON_WIDTH , 7*RELATED_CONTROLS + 4*UNRELATED_CONTROLS + 9*FIXEDTEXT_HEIGHT +1) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( RELATED_CONTROLS + 2*UNRELATED_CONTROLS + 2*BUTTON_WIDTH , 7*RELATED_CONTROLS + 4*UNRELATED_CONTROLS + 9*FIXEDTEXT_HEIGHT +1) ;
+ Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ;
+ Text [ en-US ] = "~Help";
+ };
+};
+String STR_RPT_PN_PAGE
+{
+ Text [ en-US ] = "\"Page \" & #PAGENUMBER#" ;
+ Text [ x-comment ] = "The space after the word is no error. #PAGENUMBER# is a replacement and & must not be translated as well as \"";
+};
+String STR_RPT_PN_PAGE_OF
+{
+ Text [ en-US ] = " & \" of \" & #PAGECOUNT#" ;
+ Text [ x-comment ] = "The space before and after the word is no error. #PAGECOUNT# is a replacement and & must not be translated as well as \"";
+};
diff --git a/reportdesign/source/ui/dlg/dlgpage.cxx b/reportdesign/source/ui/dlg/dlgpage.cxx
new file mode 100644
index 000000000000..0f6d328de729
--- /dev/null
+++ b/reportdesign/source/ui/dlg/dlgpage.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_reportdesign.hxx"
+
+
+#include <svx/dialogs.hrc>
+#include <svx/tabarea.hxx>
+#include <svx/flagsdef.hxx>
+#include <svx/svxdlg.hxx>
+#include <editeng/svxenum.hxx>
+#include "dlgpage.hxx"
+#include "ModuleHelper.hxx"
+#include "RptResId.hrc"
+#include <svl/intitem.hxx> //add CHINA001
+#include <svl/cjkoptions.hxx>
+#include <svl/aeitem.hxx>
+
+namespace rptui
+{
+/*************************************************************************
+|*
+|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+|*
+\************************************************************************/
+
+ORptPageDialog::ORptPageDialog( Window* pParent, const SfxItemSet* pAttr,USHORT _nPageId) :
+SfxTabDialog ( pParent, ModuleRes( _nPageId ), pAttr ),
+ rOutAttrs ( *pAttr )
+{
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ switch( _nPageId )
+ {
+ case RID_PAGEDIALOG_BACKGROUND:
+ AddTabPage( RID_SVXPAGE_BACKGROUND,String(ModuleRes(1)));
+ break;
+ case RID_PAGEDIALOG_PAGE:
+ //AddTabPage( RID_SVXPAGE_PAGE,String(ModuleRes(1)));
+ // AddTabPage( RID_SVXPAGE_BACKGROUND,String(ModuleRes(1)));
+ AddTabPage(RID_SVXPAGE_PAGE, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), 0 );
+ AddTabPage(RID_SVXPAGE_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
+ break;
+ case RID_PAGEDIALOG_CHAR:
+ AddTabPage(RID_PAGE_CHAR, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 );
+ AddTabPage(RID_PAGE_EFFECTS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 );
+ AddTabPage(RID_PAGE_POSITION, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), 0 );
+ AddTabPage(RID_PAGE_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), 0 );
+ AddTabPage(RID_PAGE_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
+ AddTabPage(RID_PAGE_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), 0 );
+
+ break;
+ case RID_PAGEDIALOG_LINE:
+ AddTabPage( RID_SVXPAGE_LINE,pFact->GetTabPageCreatorFunc( RID_SVXPAGE_LINE ), 0 );
+ //AddTabPage( RID_SVXPAGE_LINE_DEF,pFact->GetTabPageCreatorFunc( RID_SVXPAGE_LINE_DEF ), 0 );
+ //AddTabPage( RID_SVXPAGE_LINEEND_DEF,pFact->GetTabPageCreatorFunc( RID_SVXPAGE_LINEEND_DEF ), 0 );
+ break;
+ default:
+ OSL_ENSURE(0,"Unknown page id");
+ }
+
+ SvtCJKOptions aCJKOptions;
+ if ( !aCJKOptions.IsDoubleLinesEnabled() )
+ RemoveTabPage(RID_PAGE_TWOLN);
+
+ FreeResource();
+}
+// =============================================================================
+} // namespace rptui
+// =============================================================================
diff --git a/reportdesign/source/ui/dlg/dlgpage.src b/reportdesign/source/ui/dlg/dlgpage.src
new file mode 100644
index 000000000000..b8dfcd377994
--- /dev/null
+++ b/reportdesign/source/ui/dlg/dlgpage.src
@@ -0,0 +1,304 @@
+/*************************************************************************
+ *
+ * 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 <svx/dialogs.hrc>
+#include "RptResId.hrc"
+
+TabDialog RID_PAGEDIALOG_PAGE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Page Setup" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PAGE ;
+ Text [ en-US ] = "Page" ;
+ PageResID = RID_SVXPAGE_PAGE ;
+ Text [ x-comment ] = " ";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = RID_SVXPAGE_BACKGROUND ;
+ Text [ x-comment ] = " ";
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 114 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 169 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zurück : Zur³ck */
+ Text [ en-US ] = "Return" ;
+ TabStop = TRUE ;
+ };
+ Text [ x-comment ] = " ";
+
+ String 1
+ {
+ Text [ en-US ] = "Page" ;
+ };
+ String 2
+ {
+ Text [ en-US ] = "Background" ;
+ };
+};
+
+TabDialog RID_PAGEDIALOG_BACKGROUND
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Section Setup" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 114 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 169 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zurück : Zur³ck */
+ Text [ en-US ] = "Return" ;
+ TabStop = TRUE ;
+ Text [ x-comment ] = " ";
+ };
+ Text [ x-comment ] = " ";
+
+ String 1
+ {
+ Text [ en-US ] = "Background" ;
+ };
+};
+TabDialog RID_PAGEDIALOG_CHAR
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Character Settings" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_PAGE_CHAR ;
+ Text [ en-US ] = "Font" ;
+ PageResID = RID_PAGE_CHAR ;
+ Text [ x-comment ] = " ";
+ };
+ PageItem
+ {
+ Identifier = RID_PAGE_EFFECTS ;
+ Text [ en-US ] = "Font Effects" ;
+ PageResID = RID_PAGE_EFFECTS ;
+ Text [ x-comment ] = " ";
+ };
+ PageItem
+ {
+ Identifier = RID_PAGE_POSITION ;
+ PageResID = RID_PAGE_POSITION ;
+ Text [ en-US ] = "Position";
+ };
+ PageItem
+ {
+ Identifier = RID_PAGE_TWOLN ;
+ PageResID = RID_PAGE_TWOLN;
+ Text [ en-US ] = "Asian Layout";
+ };
+ PageItem
+ {
+ Identifier = RID_PAGE_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = RID_PAGE_BACKGROUND ;
+ Text [ x-comment ] = " ";
+ };
+ PageItem
+ {
+ Identifier = RID_PAGE_ALIGNMENT ;
+ Text [ en-US ] = "Alignment" ;
+ PageResID = RID_PAGE_ALIGNMENT ;
+ Text [ x-comment ] = " ";
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 114 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 169 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zurück : Zur³ck */
+ Text [ en-US ] = "Return" ;
+ TabStop = TRUE ;
+ Text [ x-comment ] = " ";
+ };
+ Text [ x-comment ] = " ";
+
+ String 1
+ {
+ Text [ en-US ] = "Character" ;
+ };
+};
+TabDialog RID_PAGEDIALOG_LINE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Line" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_LINE ;
+ Text [ en-US ] = "Line" ;
+ PageResID = RID_SVXPAGE_LINE ;
+ Text [ x-comment ] = " ";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_LINE_DEF ;
+ Text [ en-US ] = "Line Styles" ;
+ PageResID = RID_SVXPAGE_LINE_DEF ;
+ Text [ x-comment ] = " ";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_LINEEND_DEF ;
+ Text [ en-US ] = "Arrow Styles" ;
+ PageResID = RID_SVXPAGE_LINEEND_DEF ;
+ Text [ x-comment ] = " ";
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 114 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 169 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zurück : Zur³ck */
+ Text [ en-US ] = "Return" ;
+ TabStop = TRUE ;
+ Text [ x-comment ] = " ";
+ };
+ Text [ x-comment ] = " ";
+
+ String 1
+ {
+ Text [ en-US ] = "Line" ;
+ };
+};
diff --git a/reportdesign/source/ui/dlg/makefile.mk b/reportdesign/source/ui/dlg/makefile.mk
new file mode 100644
index 000000000000..a2c7756213fc
--- /dev/null
+++ b/reportdesign/source/ui/dlg/makefile.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJINC=$(PRJ)$/source
+PRJNAME=reportdesign
+TARGET=uidlg
+IMGLST_SRS=$(SRS)$/$(TARGET).srs
+BMP_IN=$(PRJ)$/res
+
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+# .INCLUDE : $(PRJ)$/util$/dll.pmk
+
+# --- Files -------------------------------------
+
+# ... resource files ............................
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ dlgpage.src \
+ PageNumber.src \
+ DateTime.src \
+ CondFormat.src \
+ Navigator.src \
+ GroupsSorting.src
+
+
+# ... object files ............................
+
+EXCEPTIONSFILES= \
+ $(SLO)$/dlgpage.obj \
+ $(SLO)$/Condition.obj \
+ $(SLO)$/CondFormat.obj \
+ $(SLO)$/GroupExchange.obj \
+ $(SLO)$/PageNumber.obj \
+ $(SLO)$/DateTime.obj \
+ $(SLO)$/AddField.obj \
+ $(SLO)$/Navigator.obj \
+ $(SLO)$/GroupsSorting.obj \
+ $(SLO)$/Formula.obj
+
+SLOFILES= \
+ $(EXCEPTIONSFILES) \
+
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+