summaryrefslogtreecommitdiff
path: root/reportdesign/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign/source/ui')
-rw-r--r--reportdesign/source/ui/dlg/AddField.cxx574
-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.src132
-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.cxx1562
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.hrc79
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.src502
-rw-r--r--reportdesign/source/ui/dlg/Navigator.cxx986
-rw-r--r--reportdesign/source/ui/dlg/Navigator.src182
-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.src170
-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
-rw-r--r--reportdesign/source/ui/inc/AddField.hxx143
-rw-r--r--reportdesign/source/ui/inc/ColorChanger.hxx70
-rw-r--r--reportdesign/source/ui/inc/ColorListener.hxx84
-rw-r--r--reportdesign/source/ui/inc/ColumnInfo.hxx57
-rw-r--r--reportdesign/source/ui/inc/CondFormat.hxx186
-rw-r--r--reportdesign/source/ui/inc/DataProviderHandler.hxx129
-rw-r--r--reportdesign/source/ui/inc/DateTime.hxx109
-rw-r--r--reportdesign/source/ui/inc/DefaultInspection.hxx111
-rw-r--r--reportdesign/source/ui/inc/DesignView.hxx298
-rw-r--r--reportdesign/source/ui/inc/EndMarker.hxx53
-rw-r--r--reportdesign/source/ui/inc/FixedTextColor.hxx73
-rw-r--r--reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx70
-rw-r--r--reportdesign/source/ui/inc/Formula.hxx112
-rw-r--r--reportdesign/source/ui/inc/FunctionHelper.hxx112
-rw-r--r--reportdesign/source/ui/inc/GeometryHandler.hxx321
-rw-r--r--reportdesign/source/ui/inc/GroupsSorting.hxx204
-rw-r--r--reportdesign/source/ui/inc/IReportControllerObserver.hxx54
-rw-r--r--reportdesign/source/ui/inc/InsertFunctions.hxx46
-rw-r--r--reportdesign/source/ui/inc/MarkedSection.hxx60
-rw-r--r--reportdesign/source/ui/inc/Navigator.hxx55
-rw-r--r--reportdesign/source/ui/inc/PageNumber.hxx88
-rw-r--r--reportdesign/source/ui/inc/ReportComponentHandler.hxx115
-rw-r--r--reportdesign/source/ui/inc/ReportController.hxx486
-rw-r--r--reportdesign/source/ui/inc/ReportControllerObserver.hxx132
-rw-r--r--reportdesign/source/ui/inc/ReportDefines.hxx39
-rw-r--r--reportdesign/source/ui/inc/ReportRuler.hxx63
-rw-r--r--reportdesign/source/ui/inc/ReportSection.hxx173
-rw-r--r--reportdesign/source/ui/inc/ReportWindow.hxx238
-rw-r--r--reportdesign/source/ui/inc/RptUndo.hxx153
-rw-r--r--reportdesign/source/ui/inc/ScrollHelper.hxx229
-rw-r--r--reportdesign/source/ui/inc/SectionView.hxx77
-rw-r--r--reportdesign/source/ui/inc/SectionWindow.hxx140
-rw-r--r--reportdesign/source/ui/inc/StartMarker.hxx88
-rw-r--r--reportdesign/source/ui/inc/UITools.hxx189
-rw-r--r--reportdesign/source/ui/inc/ViewsWindow.hxx361
-rw-r--r--reportdesign/source/ui/inc/dlgedclip.hxx86
-rw-r--r--reportdesign/source/ui/inc/dlgedfac.hxx50
-rw-r--r--reportdesign/source/ui/inc/dlgedfunc.hxx160
-rw-r--r--reportdesign/source/ui/inc/dlgpage.hxx54
-rw-r--r--reportdesign/source/ui/inc/metadata.hxx162
-rw-r--r--reportdesign/source/ui/inc/propbrw.hxx118
-rw-r--r--reportdesign/source/ui/inc/statusbarcontroller.hxx92
-rw-r--r--reportdesign/source/ui/inc/toolboxcontroller.hxx91
-rw-r--r--reportdesign/source/ui/inspection/DataProviderHandler.cxx565
-rw-r--r--reportdesign/source/ui/inspection/DefaultInspection.cxx284
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx2246
-rw-r--r--reportdesign/source/ui/inspection/ReportComponentHandler.cxx232
-rw-r--r--reportdesign/source/ui/inspection/inspection.src394
-rw-r--r--reportdesign/source/ui/inspection/makefile.mk53
-rw-r--r--reportdesign/source/ui/inspection/metadata.cxx339
-rw-r--r--reportdesign/source/ui/misc/ColorListener.cxx97
-rw-r--r--reportdesign/source/ui/misc/FunctionHelper.cxx257
-rw-r--r--reportdesign/source/ui/misc/RptUndo.cxx411
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx1084
-rw-r--r--reportdesign/source/ui/misc/makefile.mk62
-rw-r--r--reportdesign/source/ui/misc/rptuiservices.cxx82
-rw-r--r--reportdesign/source/ui/misc/statusbarcontroller.cxx230
-rw-r--r--reportdesign/source/ui/misc/toolboxcontroller.cxx360
-rw-r--r--reportdesign/source/ui/report/DesignView.cxx792
-rw-r--r--reportdesign/source/ui/report/EndMarker.cxx104
-rw-r--r--reportdesign/source/ui/report/FixedTextColor.cxx283
-rw-r--r--reportdesign/source/ui/report/FormattedFieldBeautifier.cxx203
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx4421
-rw-r--r--reportdesign/source/ui/report/ReportControllerObserver.cxx462
-rw-r--r--reportdesign/source/ui/report/ReportRuler.cxx63
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx878
-rw-r--r--reportdesign/source/ui/report/ReportWindow.cxx444
-rw-r--r--reportdesign/source/ui/report/ScrollHelper.cxx416
-rw-r--r--reportdesign/source/ui/report/SectionView.cxx274
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx417
-rw-r--r--reportdesign/source/ui/report/StartMarker.cxx324
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx1869
-rw-r--r--reportdesign/source/ui/report/dlgedclip.cxx107
-rw-r--r--reportdesign/source/ui/report/dlgedfac.cxx113
-rw-r--r--reportdesign/source/ui/report/dlgedfunc.cxx1119
-rw-r--r--reportdesign/source/ui/report/makefile.mk72
-rw-r--r--reportdesign/source/ui/report/propbrw.cxx619
-rw-r--r--reportdesign/source/ui/report/report.src682
101 files changed, 33796 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..9a7c1d8086e2
--- /dev/null
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -0,0 +1,574 @@
+/*************************************************************************
+ *
+ * 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 "ColumnInfo.hxx"
+
+#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, sal_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_pListBox.get() )
+ {
+ SvLBoxTreeList* pModel = m_pListBox->GetModel();
+ sal_uLong nCount = pModel->GetEntryCount();
+ for(sal_uLong i = 0; i< nCount;++i)
+ {
+ delete static_cast<ColumnInfo*>(pModel->GetEntry(i)->GetUserData());
+ }
+ }
+ 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,NULL,sal_False,LIST_APPEND,new ColumnInfo(*pEntries) );
+ }
+ void lcl_addToList( OAddFieldWindowListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns )
+ {
+ uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames();
+ const ::rtl::OUString* pEntries = aEntries.getConstArray();
+ sal_Int32 nEntries = aEntries.getLength();
+ for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW);
+ ::rtl::OUString sLabel;
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ if ( sLabel.getLength() )
+ _rListBox.InsertEntry( sLabel,NULL,sal_False,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
+ else
+ _rListBox.InsertEntry( *pEntries,NULL,sal_False,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+void OAddFieldWindow::Update()
+{
+ if ( m_pContainerListener.is() )
+ m_pContainerListener->dispose();
+ m_pContainerListener = NULL;
+ m_xColumns.clear();
+
+ try
+ {
+ // ListBox loeschen
+ m_pListBox->Clear();
+ const sal_uInt16 nItemCount = m_aActions.GetItemCount();
+ for (sal_uInt16 j = 0; j< nItemCount; ++j)
+ {
+ m_aActions.EnableItem(m_aActions.GetItemId(j),sal_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 );
+ 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 (sal_uInt16 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();
+
+ ColumnInfo* pInfo = static_cast<ColumnInfo*>(_pSelected->GetUserData());
+ // ::rtl::OUString sColumnName = m_pListBox->GetEntryText( _pSelected );
+ _rDescriptor[ ::svx::daColumnName ] <<= pInfo->sColumnName;
+ if ( m_xColumns->hasByName( pInfo->sColumnName ) )
+ _rDescriptor[ ::svx::daColumnObject ] <<= m_xColumns->getByName(pInfo->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_xColumns->hasByName(sName) )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(m_xColumns->getByName(sName),UNO_QUERY_THROW);
+ ::rtl::OUString sLabel;
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ if ( sLabel.getLength() )
+ m_pListBox->InsertEntry( sLabel,NULL,sal_False,LIST_APPEND,new ColumnInfo(sName,sLabel) );
+ else
+ m_pListBox->InsertEntry( sName,NULL,sal_False,LIST_APPEND,new ColumnInfo(sName,sLabel) );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+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 );
+ }
+}
+// -----------------------------------------------------------------------------
+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 sal_uInt16 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 sal_uInt16 nItemCount = m_aActions.GetItemCount();
+ for (sal_uInt16 j = 0; j< nItemCount; ++j)
+ {
+ const sal_uInt16 nItemId = m_aActions.GetItemId(j);
+ if ( nCurItem != nItemId )
+ m_aActions.CheckItem(nItemId,sal_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..1e428b081c0d
--- /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( sal_False );
+ }
+ ~UpdateLocker()
+ {
+ m_rWindow.SetUpdateMode( sal_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, sal_uInt16 _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 )
+ {
+ const String sUndoAction( ModuleRes( RID_STR_UNDO_CONDITIONAL_FORMATTING ) );
+ const UndoContext aUndoContext( m_rController.getUndoManager(), 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..0e4d7dbcad82
--- /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( sal_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;
+ sal_uInt16 m_nSlotId;
+public:
+ OColorPopup(Window* _pParent,Condition* _pCondition);
+ ValueSet m_aColorSet;
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void Resize();
+
+ void StartSelection();
+ void SetSlotId(sal_uInt16 _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(sal_uInt16 _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 )
+{
+ sal_uInt16 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*/ )
+{
+ sal_uInt16 nId( m_aActions.GetCurItemId() );
+ if ( !m_pColorFloat )
+ m_pColorFloat = new OColorPopup(&m_aActions,this);
+
+ sal_uInt16 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( sal_uInt16 _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( (sal_uInt16)eType );
+ m_aOperationList.SelectEntryPos( (sal_uInt16)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() )
+ {
+ sal_uInt16 nItemCount = m_aActions.GetItemCount();
+ for (sal_uInt16 j = 0; j< nItemCount; ++j)
+ {
+ sal_uInt16 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..36f0a8ecb697
--- /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(sal_uInt16 _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..09e557007ab4
--- /dev/null
+++ b/reportdesign/source/ui/dlg/DateTime.src
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * 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
+ {
+ HelpID = "reportdesign:CheckBox:RID_DATETIME_DLG: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
+ {
+ HelpID = "reportdesign:ListBox:RID_DATETIME_DLG: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
+ {
+ HelpID = "reportdesign:CheckBox:RID_DATETIME_DLG: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
+ {
+ HelpID = "reportdesign:ListBox:RID_DATETIME_DLG: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..6f741698268c
--- /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::CreateFromAscii( 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(sal_Bool _bOk)
+{
+ EndDialog(_bOk ? RET_OK : RET_CANCEL);
+}
+void FormulaDialog::insertEntryToLRUList(const IFunctionDescription* /*_pDesc*/)
+{
+}
+void FormulaDialog::showReference(const String& /*_sFormula*/)
+{
+}
+void FormulaDialog::dispatch(sal_Bool /*_bOK*/,sal_Bool /*_bMartixChecked*/)
+{
+}
+void FormulaDialog::setDispatcherLock( sal_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( sal_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::CreateFromAscii( 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( sal_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..b5ba9534a9ad
--- /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 )
+ {
+ sal_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..2a93c374ca15
--- /dev/null
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -0,0 +1,1562 @@
+/*************************************************************************
+ *
+ * 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 "ColumnInfo.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;
+
+ void lcl_addToList_throw( ComboBoxControl& _rListBox, ::std::vector<ColumnInfo>& o_aColumnList,const uno::Reference< container::XNameAccess>& i_xColumns )
+ {
+ uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames();
+ const ::rtl::OUString* pEntries = aEntries.getConstArray();
+ sal_Int32 nEntries = aEntries.getLength();
+ for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),uno::UNO_QUERY_THROW);
+ ::rtl::OUString sLabel;
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ o_aColumnList.push_back( ColumnInfo(*pEntries,sLabel) );
+ if ( sLabel.getLength() )
+ _rListBox.InsertEntry( sLabel );
+ else
+ _rListBox.InsertEntry( *pEntries );
+ }
+ }
+
+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;
+ ::std::vector<ColumnInfo> m_aColumnInfo;
+ ::svt::ComboBoxControl* m_pComboCell;
+ sal_Int32 m_nDataPos;
+ sal_Int32 m_nCurrentPos;
+ sal_uLong m_nPasteEvent;
+ sal_uLong m_nDeleteEvent;
+ OGroupsSortingDialog* m_pParent;
+ bool m_bIgnoreEvent;
+
+
+ void fillListBox(const uno::Reference< beans::XPropertySet>& _xDest,long nRow,sal_uInt16 nColumnId);
+ sal_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 sal_Bool CursorMoving(long nNewRow, sal_uInt16 nNewCol);
+ using OFieldExpressionControl_Base::GetRowCount;
+protected:
+ virtual sal_Bool IsTabAllowed(sal_Bool bForward) const;
+
+
+ virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol );
+ virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol );
+ virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId ) const;
+ virtual sal_Bool SeekRow( long nRow );
+ virtual sal_Bool SaveModified();
+ virtual String GetCellText( long nRow, sal_uInt16 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() )
+ {
+ sal_uInt16 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;
+ const String sUndoAction(ModuleRes(RID_STR_UNDO_MOVE_GROUP));
+ const UndoContext aUndoContext( m_pParent->m_pController->getUndoManager(), 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() )
+ lcl_addToList_throw(*m_pComboCell,m_aColumnInfo,_xColumns);
+}
+//------------------------------------------------------------------------------
+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<sal_uInt16>(GetTextWidth('0') * 4)/*, sal_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(), sal_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;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OFieldExpressionControl::IsTabAllowed(sal_Bool /*bForward*/) const
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OFieldExpressionControl::SaveModified()
+{
+ return SaveModified(true);
+}
+//------------------------------------------------------------------------------
+sal_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->getUndoManager().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() )
+ {
+ sal_uInt16 nPos = m_pComboCell->GetSelectEntryPos();
+ ::rtl::OUString sExpression;
+ if ( COMBOBOX_ENTRY_NOTFOUND == nPos )
+ sExpression = m_pComboCell->GetText();
+ else
+ {
+ sExpression = m_aColumnInfo[nPos].sColumnName;
+ }
+ xGroup->setExpression( sExpression );
+
+ ::rptui::adjustSectionName(xGroup,nPos);
+
+ if ( bAppend )
+ m_pParent->m_pController->getUndoManager().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 sal_True;
+}
+//------------------------------------------------------------------------------
+String OFieldExpressionControl::GetCellText( long nRow, sal_uInt16 /*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]);
+ ::rtl::OUString sExpression = xGroup->getExpression();
+
+ for(::std::vector<ColumnInfo>::const_iterator aIter = m_aColumnInfo.begin(); aIter != m_aColumnInfo.end();++aIter)
+ {
+ if ( aIter->sColumnName == sExpression )
+ {
+ if ( aIter->sLabel.getLength() )
+ sExpression = aIter->sLabel;
+ break;
+ }
+ }
+ sText = sExpression;
+ }
+ 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, sal_uInt16 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*/, sal_uInt16 /*nColumnId*/ )
+{
+ DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL);
+ ComboBoxCellController* pCellController = new ComboBoxCellController( m_pComboCell );
+ pCellController->GetComboBox().SetReadOnly(!m_pParent->m_pController->isEditable());
+ return pCellController;
+}
+
+//------------------------------------------------------------------------------
+sal_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 sal_True;
+}
+
+//------------------------------------------------------------------------------
+void OFieldExpressionControl::PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 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;
+ }
+
+ sal_uInt16 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->getUndoManager().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->getUndoManager().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;
+ {
+ const String sUndoAction(ModuleRes(RID_STR_UNDO_APPEND_GROUP));
+ const UndoContext aUndoContext( m_pParent->m_pController->getUndoManager(), 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(sal_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(sal_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<sal_uInt16>(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);
+
+ sal_uInt16 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(sal_uInt16 _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 = m_pController->getColumns();
+ 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:
+ {
+ sal_uInt16 nIds[] = { STR_RPT_YEAR, STR_RPT_QUARTER,STR_RPT_MONTH,STR_RPT_WEEK,STR_RPT_DAY,STR_RPT_HOUR,STR_RPT_MINUTE };
+ for (sal_uInt16 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)
+ sal_uInt16 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..186fb771ad46
--- /dev/null
+++ b/reportdesign/source/ui/dlg/GroupsSorting.src
@@ -0,0 +1,502 @@
+/*************************************************************************
+ *
+ * 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
+ {
+ HelpID = "reportdesign:ListBox:RID_GROUPS_SORTING: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
+ {
+ HelpID = "reportdesign:ListBox:RID_GROUPS_SORTING: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
+ {
+ HelpID = "reportdesign:ListBox:RID_GROUPS_SORTING: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
+ {
+ HelpID = "reportdesign:ListBox:RID_GROUPS_SORTING: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
+ {
+ HelpID = "reportdesign:NumericField:RID_GROUPS_SORTING: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
+ {
+ HelpID = "reportdesign:ListBox:RID_GROUPS_SORTING: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..215e5145889f
--- /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 "RptUndo.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;
+
+sal_uInt16 lcl_getImageId(const uno::Reference< report::XReportComponent>& _xElement)
+{
+ sal_uInt16 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,sal_uInt16 _nImageId,sal_uLong _nPosition,UserData* _pData);
+ void traverseSection(const uno::Reference< report::XSection>& _xSection,SvLBoxEntry* _pParent,sal_uInt16 _nImageId,sal_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 ) );
+
+ sal_uInt16 nCount = aContextMenu.GetItemCount();
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ if ( MENUITEM_SEPARATOR != aContextMenu.GetItemType(i))
+ {
+ sal_uInt16 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 (sal_uInt16 i = 0; i < nCount; ++i)
+ sal_uInt16 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(sal_False,sal_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,sal_uInt16 _nImageId,sal_uLong _nPosition,UserData* _pData)
+{
+ SvLBoxEntry* pEntry = NULL;
+ if ( _nImageId )
+ {
+ const Image aImage( m_aNavigatorImages.GetImage( _nImageId ) );
+ pEntry = InsertEntry(_sName,aImage,aImage,_pParent,sal_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,sal_False,_nPosition,_pData);
+ return pEntry;
+}
+// -----------------------------------------------------------------------------
+void NavigatorTree::traverseSection(const uno::Reference< report::XSection>& _xSection,SvLBoxEntry* _pParent,sal_uInt16 _nImageId,sal_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 )
+ {
+ sal_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 )
+ {
+ sal_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() ? sal_uInt16(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..b9e639dfe646
--- /dev/null
+++ b/reportdesign/source/ui/dlg/Navigator.src
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * 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;
+ Command = ".uno:DbSortingAndGrouping";
+ Text [ en-US ] = "Sorting and Grouping...";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_PAGEHEADERFOOTER;
+ Command = ".uno:PageHeaderFooter";
+ Checkable = TRUE;
+ Text [ en-US ] = "Page Header/Footer...";
+ };
+ MenuItem
+ {
+ Identifier = SID_REPORTHEADERFOOTER;
+ Command = ".uno:ReportHeaderFooter";
+ Checkable = TRUE;
+ Text [ en-US ] = "Report Header/Footer...";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_RPT_NEW_FUNCTION;
+ Command = ".uno:NewFunction";
+ Text [ en-US ] = "New Function";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = 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..c5c760e1755d
--- /dev/null
+++ b/reportdesign/source/ui/dlg/PageNumber.src
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * 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
+ {
+ HelpID = "reportdesign:RadioButton:RID_PAGENUMBERS: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
+ {
+ HelpID = "reportdesign:RadioButton:RID_PAGENUMBERS: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
+ {
+ HelpID = "reportdesign:RadioButton:RID_PAGENUMBERS: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
+ {
+ HelpID = "reportdesign:RadioButton:RID_PAGENUMBERS: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
+ {
+ HelpID = "reportdesign:ListBox:RID_PAGENUMBERS: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
+ {
+ HelpID = "reportdesign:CheckBox:RID_PAGENUMBERS: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..ac373c4c24ae
--- /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,sal_uInt16 _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
+
diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx
new file mode 100644
index 000000000000..fe9cbff6aa6c
--- /dev/null
+++ b/reportdesign/source/ui/inc/AddField.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * 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_ADDFIELDWINDOW_HXX
+#define RPTUI_ADDFIELDWINDOW_HXX
+
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <svtools/transfer.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <svtools/svtreebx.hxx>
+#include <svtools/transfer.hxx>
+#include <vcl/floatwin.hxx>
+#include <comphelper/propmultiplex.hxx>
+#include <comphelper/containermultiplexer.hxx>
+#include <vcl/button.hxx>
+
+#include <svx/dataaccessdescriptor.hxx>
+#include "cppuhelper/basemutex.hxx"
+#include <dbaccess/ToolBoxHelper.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/fixed.hxx>
+
+#include <rtl/ref.hxx>
+
+namespace rptui
+{
+//==================================================================
+class OAddFieldWindow;
+class OAddFieldWindowListBox;
+//========================================================================
+class OAddFieldWindow :public FloatingWindow
+ , public ::cppu::BaseMutex
+ , public ::comphelper::OPropertyChangeListener
+ , public ::comphelper::OContainerListener
+ , public dbaui::OToolBoxHelper
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> m_xHoldAlive;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xRowSet;
+
+ ToolBox m_aActions;
+
+ ::std::auto_ptr<OAddFieldWindowListBox> m_pListBox;
+ FixedLine m_aFixedLine;
+ FixedText m_aHelpText;
+
+ PushButton m_aInsertButton;
+ Link m_aCreateLink;
+ ::rtl::OUString m_aCommandName;
+ ::rtl::OUString m_sFilter;
+ sal_Int32 m_nCommandType;
+ sal_Bool m_bEscapeProcessing;
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pChangeListener;
+ ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener;
+
+ DECL_LINK( OnDoubleClickHdl, void* );
+ DECL_LINK( OnSelectHdl, void* );
+ DECL_LINK( OnSortAction, ToolBox* );
+
+ OAddFieldWindow(const OAddFieldWindow&);
+ void operator =(const OAddFieldWindow&);
+public:
+ OAddFieldWindow(Window* pParent
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xRowSet);
+
+ virtual ~OAddFieldWindow();
+ virtual void Resize();
+ virtual void GetFocus();
+ virtual long PreNotify( NotifyEvent& _rNEvt );
+
+ inline const ::rtl::OUString& GetCommand() const { return m_aCommandName; }
+ inline sal_Int32 GetCommandType() const { return m_nCommandType; }
+ inline sal_Bool GetEscapeProcessing() const { return m_bEscapeProcessing; }
+ inline void SetCreateHdl(const Link& _aCreateLink) { m_aCreateLink = _aCreateLink; }
+
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getColumns() const { return m_xColumns; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors();
+
+ /** 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);
+
+ /// Updates the current field list
+ void Update();
+
+ /** fills the descriptor with the column name, column object, command and command type
+ *
+ * \param _pSelected the currently selected
+ * \param _rDescriptor the descriptor will be filled
+ */
+ void fillDescriptor(SvLBoxEntry* _pSelected,::svx::ODataAccessDescriptor& _rDescriptor);
+
+private:
+ // FmXChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
+ // OContainerListener
+ virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
+};
+//==============================================================================
+} // rptui
+//==============================================================================
+#endif // RPTUI_ADDFIELDWINDOW_HXX
+
diff --git a/reportdesign/source/ui/inc/ColorChanger.hxx b/reportdesign/source/ui/inc/ColorChanger.hxx
new file mode 100644
index 000000000000..a2e01c135007
--- /dev/null
+++ b/reportdesign/source/ui/inc/ColorChanger.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * 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_COLORCHANGER_HXX
+#define RPTUI_COLORCHANGER_HXX
+
+namespace rptui
+{
+ //=====================================================================
+ //= ColorChanger
+ //=====================================================================
+ class ColorChanger
+ {
+ protected:
+ OutputDevice* m_pDev;
+
+ public:
+ ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor)
+ :m_pDev( _pDev )
+ {
+ m_pDev->Push( PUSH_LINECOLOR );
+ m_pDev->SetLineColor( _rNewLineColor );
+ }
+ ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor, const Color& _rNewFillColor )
+ :m_pDev( _pDev )
+ {
+ m_pDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ m_pDev->SetLineColor( _rNewLineColor );
+ m_pDev->SetFillColor( _rNewFillColor );
+ }
+ ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor, const Color& _rNewFillColor, const Color& _rNewTextColor )
+ :m_pDev( _pDev )
+ {
+ m_pDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_TEXTCOLOR);
+ m_pDev->SetLineColor( _rNewLineColor );
+ m_pDev->SetFillColor( _rNewFillColor );
+ m_pDev->SetTextColor( _rNewTextColor );
+ }
+
+ ~ColorChanger()
+ {
+ m_pDev->Pop();
+ }
+ };
+}
+#endif //RPTUI_COLORCHANGER_HXX
+
diff --git a/reportdesign/source/ui/inc/ColorListener.hxx b/reportdesign/source/ui/inc/ColorListener.hxx
new file mode 100644
index 000000000000..4216e39a3652
--- /dev/null
+++ b/reportdesign/source/ui/inc/ColorListener.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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_COLORLISTENER_HXX
+#define RPTUI_COLORLISTENER_HXX
+
+#include <vcl/window.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svtools/extcolorcfg.hxx>
+#include "ModuleHelper.hxx"
+#include <tools/link.hxx>
+
+namespace rptui
+{
+ class OColorListener : public Window, public SfxListener
+ {
+ OColorListener(const OColorListener&);
+ void operator =(const OColorListener&);
+ protected:
+ OModuleClient m_aModuleClient;
+ Link m_aCollapsedLink;
+ svtools::ColorConfig m_aColorConfig;
+ svtools::ExtendedColorConfig m_aExtendedColorConfig;
+ ::rtl::OUString m_sColorEntry;
+ sal_Int32 m_nColor;
+ sal_Int32 m_nTextBoundaries;
+ sal_Bool m_bCollapsed;
+ sal_Bool m_bMarked;
+
+ virtual void ImplInitSettings() = 0;
+ protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ public:
+ OColorListener(Window* _pParent,const ::rtl::OUString& _sColorEntry);
+ virtual ~OColorListener();
+
+ using Window::Notify;
+ // SfxListener
+ virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint);
+
+ /** set the marker as marked or not marked
+ @param _bMark set the new state of the marker
+ */
+ void setMarked(sal_Bool _bMark);
+
+ /** returns if the section is marked
+ */
+ inline sal_Bool isMarked() const { return m_bMarked; }
+
+ inline void setCollapsedHdl(const Link& _aLink ){ m_aCollapsedLink = _aLink; }
+ inline sal_Bool isCollapsed() const { return m_bCollapsed; }
+
+ /** collapse or expand
+ *
+ * \param _bCollapsed
+ */
+ virtual void setCollapsed(sal_Bool _bCollapsed);
+ };
+}
+#endif // RPTUI_COLORLISTENER_HXX
+
diff --git a/reportdesign/source/ui/inc/ColumnInfo.hxx b/reportdesign/source/ui/inc/ColumnInfo.hxx
new file mode 100644
index 000000000000..392a141e6382
--- /dev/null
+++ b/reportdesign/source/ui/inc/ColumnInfo.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AddField.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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_COLUMNINFO_HXX
+#define RPTUI_COLUMNINFO_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace rptui
+{
+ struct ColumnInfo
+ {
+ ::rtl::OUString sColumnName;
+ ::rtl::OUString sLabel;
+ bool bColumn;
+ ColumnInfo(const ::rtl::OUString& i_sColumnName,const ::rtl::OUString& i_sLabel)
+ : sColumnName(i_sColumnName)
+ , sLabel(i_sLabel)
+ , bColumn(true)
+ {
+ }
+ ColumnInfo(const ::rtl::OUString& i_sColumnName)
+ : sColumnName(i_sColumnName)
+ , bColumn(false)
+ {
+ }
+ };
+// =============================================================================
+} // namespace rptui
+// =============================================================================
+#endif // RPTUI_COLUMNINFO_HXX
diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx
new file mode 100644
index 000000000000..e4e56d59e91a
--- /dev/null
+++ b/reportdesign/source/ui/inc/CondFormat.hxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * 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_HXX
+#define RPTUI_CONDFORMAT_HXX
+
+#include "ModuleHelper.hxx"
+
+#include <com/sun/star/report/XReportControlModel.hpp>
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/scrbar.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
+#include <vector>
+
+// .............................................................................
+namespace rptui
+{
+// .............................................................................
+
+ #define MAX_CONDITIONS (size_t)3
+
+ class OReportController;
+ class Condition;
+
+ //=========================================================================
+ //= IConditionalFormatAction
+ //=========================================================================
+ class SAL_NO_VTABLE IConditionalFormatAction
+ {
+ public:
+ virtual void addCondition( size_t _nAddAfterIndex ) = 0;
+ virtual void deleteCondition( size_t _nCondIndex ) = 0;
+ virtual void applyCommand( size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color _aColor ) = 0;
+ virtual void moveConditionUp( size_t _nCondIndex ) = 0;
+ virtual void moveConditionDown( size_t _nCondIndex ) = 0;
+ virtual ::rtl::OUString getDataField() const = 0;
+ };
+
+ /*************************************************************************
+ |*
+ |* Conditional formatting dialog
+ |*
+ \************************************************************************/
+ class ConditionalFormattingDialog :public ModalDialog
+ ,public IConditionalFormatAction
+ ,private ::boost::noncopyable
+ {
+ typedef ::boost::shared_ptr< Condition > ConditionPtr;
+ typedef ::std::vector< ConditionPtr > Conditions;
+
+ OModuleClient m_aModuleClient;
+ Window m_aConditionPlayground;
+ Conditions m_aConditions;
+ FixedLine m_aSeparator;
+ OKButton m_aPB_OK;
+ CancelButton m_aPB_CANCEL;
+ HelpButton m_aPB_Help;
+ ScrollBar m_aCondScroll;
+
+ ::rptui::OReportController& m_rController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel >
+ m_xFormatConditions;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel >
+ m_xCopy;
+
+ bool m_bDeletingCondition;
+
+ public:
+ ConditionalFormattingDialog(
+ Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel>& _xHoldAlive,
+ ::rptui::OReportController& _rController
+ );
+ virtual ~ConditionalFormattingDialog();
+
+ // Dialog overridables
+ virtual short Execute();
+
+ // IConditionalFormatAction overridables
+ virtual void addCondition( size_t _nAddAfterIndex );
+ virtual void deleteCondition( size_t _nCondIndex );
+ virtual void applyCommand( size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color _aColor );
+ virtual void moveConditionUp( size_t _nCondIndex );
+ virtual void moveConditionDown( size_t _nCondIndex );
+ virtual ::rtl::OUString getDataField() const;
+
+ protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+ private:
+ DECL_LINK( OnScroll, ScrollBar* );
+
+ private:
+ /// returns the current number of conditions
+ size_t impl_getConditionCount() const { return m_aConditions.size(); }
+
+ /** adds a condition
+ @param _nNewCondIndex
+ the index of the to-be-inserted condition
+ */
+ void impl_addCondition_nothrow( size_t _nNewCondIndex );
+
+ /// deletes the condition with the given index
+ void impl_deleteCondition_nothrow( size_t _nCondIndex );
+
+ /// moves the condition with the given index one position
+ void impl_moveCondition_nothrow( size_t _nCondIndex, bool _bMoveUp );
+
+ /// does the dialog layouting
+ void impl_layoutAll();
+
+ /// does the layout for the condition windows
+ void impl_layoutConditions( Point& _out_rBelowLastVisible );
+
+ /// called when the number of conditions has changed in any way
+ void impl_conditionCountChanged();
+
+ /// initializes the conditions from m_xCopy
+ void impl_initializeConditions();
+
+ /// tells all our Condition instances their new index
+ void impl_updateConditionIndicies();
+
+ /// returns the number of the condition which has the (child path) focus
+ size_t impl_getFocusedConditionIndex( sal_Int32 _nFallBackIfNone ) const;
+
+ /// returns the index of the first visible condition
+ size_t impl_getFirstVisibleConditionIndex() const;
+
+ /// returns the index of the last visible condition
+ size_t impl_getLastVisibleConditionIndex() const;
+
+ /// determines the width of a Condition
+ long impl_getConditionWidth() const;
+
+ /// focuses the condition with the given index, making it visible if necessary
+ void impl_focusCondition( size_t _nCondIndex );
+
+ /// updates the scrollbar range. (does not update the scrollbar visibility)
+ void impl_updateScrollBarRange();
+
+ /// determines whether we need a scrollbar for the conditions
+ bool impl_needScrollBar() const { return m_aConditions.size() > MAX_CONDITIONS; }
+
+ /// scrolls the condition with the given index to the top position
+ void impl_scrollTo( size_t _nTopCondIndex );
+
+ /// ensures the condition with the given index is visible
+ void impl_ensureConditionVisible( size_t _nCondIndex );
+ };
+
+// .............................................................................
+} // namespace rptui
+// .............................................................................
+
+#endif // RPTUI_CONDFORMAT_HXX
diff --git a/reportdesign/source/ui/inc/DataProviderHandler.hxx b/reportdesign/source/ui/inc/DataProviderHandler.hxx
new file mode 100644
index 000000000000..d5b3221f7745
--- /dev/null
+++ b/reportdesign/source/ui/inc/DataProviderHandler.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef RPT_DATAPROVIDERHANDLER_HXX
+#define RPT_DATAPROVIDERHANDLER_HXX
+
+#include "sal/config.h"
+
+#include "cppuhelper/compbase2.hxx"
+#include "cppuhelper/basemutex.hxx"
+
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/inspection/XPropertyHandler.hpp"
+#include "com/sun/star/chart2/XChartDocument.hpp"
+#include "com/sun/star/chart2/data/XDatabaseDataProvider.hpp"
+#include "com/sun/star/report/XReportComponent.hpp"
+#include "com/sun/star/script/XTypeConverter.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+
+#include <memory>
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+
+ class OPropertyInfoService;
+
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::inspection::XPropertyHandler
+ , ::com::sun::star::lang::XServiceInfo> DataProviderHandler_Base;
+
+ class DataProviderHandler:
+ private ::cppu::BaseMutex,
+ public DataProviderHandler_Base
+ {
+ public:
+ // XServiceInfo - static versions
+ static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
+
+ explicit DataProviderHandler(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context);
+ private:
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent:
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::inspection::XPropertyHandler:
+ virtual void SAL_CALL inspect(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Component) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual void SAL_CALL setPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & Value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& ControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & ControlValue) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & PropertyValue, const ::com::sun::star::uno::Type & ControlValueType) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual void SAL_CALL addPropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & Listener) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
+ virtual void SAL_CALL removePropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & _rxListener) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isComposable(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, ::com::sun::star::uno::Any & out_Data, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException);
+ virtual void SAL_CALL actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const ::com::sun::star::uno::Any & NewValue, const ::com::sun::star::uno::Any & OldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI, ::sal_Bool FirstTimeInit) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
+ virtual ::sal_Bool SAL_CALL suspend(::sal_Bool Suspend) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual ~DataProviderHandler() {}
+ private:
+ DataProviderHandler(DataProviderHandler &); // not defined
+ void operator =(DataProviderHandler &); // not defined
+
+
+ bool impl_dialogLinkedFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
+ bool impl_dialogChartType_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
+ void impl_updateChartTitle_throw(const ::com::sun::star::uno::Any& _aValue);
+
+ // overload WeakComponentImplHelperBase::disposing()
+ // This function is called upon disposing the component,
+ // if your component needs special work when it becomes
+ // disposed, do it here.
+ virtual void SAL_CALL disposing();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > m_xFormComponentHandler; /// delegatee
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDatabaseDataProvider> m_xDataProvider; /// inspectee
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xFormComponent; /// inspectee
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > m_xReportComponent; /// inspectee
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument> m_xChartModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > m_xMasterDetails;
+ /// type converter, needed on various occasions
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter > m_xTypeConverter;
+ ::std::auto_ptr< OPropertyInfoService > m_pInfoService;
+ };
+//........................................................................
+} // namespace rptui
+//........................................................................
+
+#endif // RPT_DATAPROVIDERHANDLER_HXX
diff --git a/reportdesign/source/ui/inc/DateTime.hxx b/reportdesign/source/ui/inc/DateTime.hxx
new file mode 100644
index 000000000000..1526e5978331
--- /dev/null
+++ b/reportdesign/source/ui/inc/DateTime.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * 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_HXX
+#define RPTUI_DATETIME_HXX
+
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <com/sun/star/report/XReportDefinition.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <svtools/dialogcontrolling.hxx>
+
+namespace rptui
+{
+class OReportController;
+/*************************************************************************
+|*
+|* Groups and Sorting dialog
+|*
+\************************************************************************/
+class ODateTimeDialog : public ModalDialog
+{
+ // FixedLine m_aFLDate;
+ CheckBox m_aDate;
+ FixedText m_aFTDateFormat;
+ ListBox m_aDateListBox;
+ FixedLine m_aFL0;
+ CheckBox m_aTime;
+ FixedText m_aFTTimeFormat;
+ ListBox m_aTimeListBox;
+ FixedLine m_aFL1;
+ OKButton m_aPB_OK;
+ CancelButton m_aPB_CANCEL;
+ HelpButton m_aPB_Help;
+
+
+ svt::ControlDependencyManager m_aDateControlling;
+ svt::ControlDependencyManager m_aTimeControlling;
+
+ ::rptui::OReportController* m_pController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>
+ m_xHoldAlive;
+ ::com::sun::star::lang::Locale m_nLocale;
+
+ /** returns the frmat string
+ *
+ * \param _nNumberFormatKey the number format key
+ * \param _xFormats
+ * \param _bTime
+ * \return
+ */
+ ::rtl::OUString getFormatStringByKey(::sal_Int32 _nNumberFormatKey,const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats>& _xFormats,bool _bTime);
+
+ /** returns the number format key
+ @param _nNumberFormatIndex the number format index @see com::sun::star::i18n::NumberFormatIndex
+ */
+ sal_Int32 getFormatKey(sal_Bool _bDate) const;
+
+ DECL_LINK( CBClickHdl, CheckBox* );
+ ODateTimeDialog(const ODateTimeDialog&);
+ void operator =(const ODateTimeDialog&);
+
+ // fill methods
+ void InsertEntry(sal_Int16 _nNumberFormatId);
+public:
+ ODateTimeDialog( Window* pParent
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xHoldAlive
+ ,::rptui::OReportController* _pController);
+ virtual ~ODateTimeDialog();
+ virtual short Execute();
+};
+// =============================================================================
+} // namespace rptui
+// =============================================================================
+#endif // RPTUI_DATETIME_HXX
diff --git a/reportdesign/source/ui/inc/DefaultInspection.hxx b/reportdesign/source/ui/inc/DefaultInspection.hxx
new file mode 100644
index 000000000000..a0382ab0e7f8
--- /dev/null
+++ b/reportdesign/source/ui/inc/DefaultInspection.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * 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 RPT_DEFAULTINSPECTION_HXX
+#define RPT_DEFAULTINSPECTION_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/inspection/XObjectInspectorModel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+/** === end UNO includes === **/
+#include <cppuhelper/implbase3.hxx>
+
+#include <memory>
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+ class OPropertyInfoService;
+ //====================================================================
+ //= DefaultComponentInspectorModel
+ //====================================================================
+ typedef ::cppu::WeakAggImplHelper3 < ::com::sun::star::inspection::XObjectInspectorModel
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XInitialization
+ > DefaultComponentInspectorModel_Base;
+ class DefaultComponentInspectorModel : public DefaultComponentInspectorModel_Base
+ {
+ private:
+ ::osl::Mutex m_aMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel > m_xComponent; /// delegatee
+ bool m_bConstructed;
+ bool m_bHasHelpSection;
+ sal_Bool m_bIsReadOnly;
+ sal_Int32 m_nMinHelpTextLines;
+ sal_Int32 m_nMaxHelpTextLines;
+ /// access to property meta data
+ ::std::auto_ptr< OPropertyInfoService > m_pInfoService;
+
+ DefaultComponentInspectorModel(const DefaultComponentInspectorModel&);
+ DefaultComponentInspectorModel& operator=(const DefaultComponentInspectorModel&);
+ protected:
+ virtual ~DefaultComponentInspectorModel();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XObjectInspectorModel
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getHandlerFactories() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getHasHelpSection() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMinHelpTextLines() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMaxHelpTextLines() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getIsReadOnly() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setIsReadOnly( ::sal_Bool _isreadonly ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::inspection::PropertyCategoryDescriptor > SAL_CALL describeCategories( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getPropertyOrderIndex( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ public:
+ // XServiceInfo - static versions
+ static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
+
+ public:
+ DefaultComponentInspectorModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
+
+ protected:
+ // Service constructors
+ void createDefault();
+ void createWithHelpSection( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines );
+ };
+
+//........................................................................
+} // namespace rptui
+//........................................................................
+
+#endif // RPT_DEFAULTINSPECTION_HXX
+
diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx
new file mode 100644
index 000000000000..52780fdb65ed
--- /dev/null
+++ b/reportdesign/source/ui/inc/DesignView.hxx
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * 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_DESIGNVIEW_HXX
+#define RPTUI_DESIGNVIEW_HXX
+
+#include <dbaccess/dataview.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/report/XSection.hpp>
+#include <com/sun/star/report/XReportComponent.hpp>
+#include <vcl/split.hxx>
+#include <vcl/scrbar.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/datatransfer/DataFlavor.hpp>
+#include <tools/link.hxx>
+#include <tools/gen.hxx>
+#include <vcl/timer.hxx>
+#include <svl/hint.hxx>
+#include <svl/brdcst.hxx>
+#include <comphelper/stl_types.hxx>
+#include "ReportDefines.hxx"
+#include <svtools/colorcfg.hxx>
+#include <boost/shared_ptr.hpp>
+#include <svx/svdedtv.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/splitwin.hxx>
+#include <MarkedSection.hxx>
+#include "ScrollHelper.hxx"
+
+class KeyEvent;
+class MouseEvent;
+class Timer;
+class Window;
+
+namespace rptui
+{
+ class OReportSection;
+ class OUnoObject;
+ class OSectionView;
+ class OReportController;
+ class PropBrw;
+ class OAddFieldWindow;
+ class OReportModel;
+ class ONavigator;
+ //==================================================================
+ //==================================================================
+ class ODesignView : public dbaui::ODataView, public SfxBroadcaster, public IMarkedSection
+ {
+ private:
+ SplitWindow m_aSplitWin;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xReportComponent;
+ OReportController& m_rReportController;
+ OScrollWindowHelper m_aScrollWindow;
+ Window* m_pTaskPane;
+ PropBrw* m_pPropWin;
+ OAddFieldWindow* m_pAddField;
+ OSectionView* m_pCurrentView;
+ ONavigator* m_pReportExplorer;
+ Timer m_aMarkTimer;
+ Point m_aScrollOffset;
+ DlgEdMode m_eMode;
+ sal_uInt16 m_nCurrentPosition;
+ sal_uInt16 m_eActObj;
+ sal_Bool m_bFirstDraw;
+ Size m_aGridSizeCoarse;
+ Size m_aGridSizeFine;
+ sal_Bool m_bGridVisible;
+ sal_Bool m_bGridSnap;
+ sal_Bool m_bDeleted;
+
+
+ DECL_LINK( MarkTimeout, Timer * );
+ DECL_LINK( SplitHdl, void* );
+
+ void ImplInitSettings();
+
+ ODesignView(ODesignView&);
+ void operator =(ODesignView&);
+ protected:
+ // return the Rectangle where I can paint myself
+ virtual void resizeDocumentView(Rectangle& rRect);
+ // return the Rectangle where I can paint myself
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ public:
+ ODesignView(Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&,
+ OReportController& _rController);
+ virtual ~ODesignView();
+
+ // window overloads
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual void GetFocus();
+
+ // set the view readonly or not
+ virtual void setReadOnly(sal_Bool _bReadOnly);
+
+ virtual void initialize();
+
+ inline OReportController& getController() const { return m_rReportController; }
+
+ void SetMode( DlgEdMode m_eMode );
+ void SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString());
+ sal_uInt16 GetInsertObj() const;
+ rtl::OUString GetInsertObjString() const;
+ DlgEdMode GetMode() const { return m_eMode; }
+
+ /** cuts the current selection in this section
+ */
+ void Cut();
+
+ /** copies the current selection in this section
+ */
+ void Copy();
+
+ /** returns if paste is allowed
+ *
+ * \return <TRUE/> if paste is allowed
+ */
+ sal_Bool IsPasteAllowed() const;
+
+ /** paste a new control in this section
+ */
+ void Paste();
+
+ /** Deletes the current selection in this section
+ *
+ */
+ void Delete();
+
+ /** align all marked objects in all sections
+ */
+ void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false);
+
+#if 0
+ /** checks if alignment is possible in the current section
+ */
+ sal_Bool isAlignPossible() const;
+#endif
+
+ /** All objects will be marked.
+ */
+ void SelectAll(const sal_uInt16 _nObjectType);
+
+ /// checks if a selection exists
+ sal_Bool HasSelection() const;
+
+ void UpdatePropertyBrowserDelayed(OSectionView& _rView);
+
+ sal_uInt16 getSectionCount() const;
+
+ /** removes the section at the given position.
+ *
+ * \param _nPosition Zero based.
+ */
+ void removeSection(sal_uInt16 _nPosition);
+
+ /** adds a new section at position _nPosition.
+ If the section is <NULL/> nothing happens.
+ If the position is grater than the current elements, the section will be appended.
+ */
+ void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
+ ,const ::rtl::OUString& _sColorEntry
+ ,sal_uInt16 _nPosition = USHRT_MAX);
+
+ inline Size getGridSizeCoarse() const { return m_aGridSizeCoarse; }
+ inline Size getGridSizeFine() const { return m_aGridSizeFine; }
+ inline sal_Bool isGridSnap() const { return m_bGridSnap; }
+ void setGridSnap(sal_Bool bOn);
+ void setDragStripes(sal_Bool bOn);
+ /** turns the grid on or off
+ *
+ * \param _bGridVisible
+ */
+ void toggleGrid(sal_Bool _bGridVisible);
+
+ void togglePropertyBrowser(sal_Bool _bToogleOn);
+
+ sal_Bool isAddFieldVisible() const;
+ void toggleAddField();
+
+ sal_Bool isReportExplorerVisible() const;
+ void toggleReportExplorer();
+
+ /** shows or hides the ruler.
+ */
+ void showRuler(sal_Bool _bShow);
+
+ /** unmark all objects on the views without the given one.
+ *
+ * @param _pSectionView The view where the objects should not be unmarked.
+ */
+ void unmarkAllObjects(OSectionView* _pSectionView);
+
+ /** triggers the property browser with the section
+ @param _xReportComponent the report component
+ */
+ void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent);
+ ::com::sun::star::uno::Any getCurrentlyShownProperty() const;
+
+ /** returns the current section or the detail section if no section was selected previously
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getCurrentSection() const;
+
+ /** returns the current control report model or <NULL/>
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const;
+
+ // IMarkedSection
+ ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const;
+ ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+ virtual void markSection(const sal_uInt16 _nPos);
+
+ /** fills the positions of all collapsed sections.
+ *
+ * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
+ */
+ void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
+
+ /** collpase all sections given by their position
+ *
+ * \param _aCollpasedSections The position of the sections which should be collapsed.
+ */
+ void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
+
+ ::rtl::OUString getCurrentPage() const;
+ void setCurrentPage(const ::rtl::OUString& _sLastActivePage);
+
+ /** checks if the keycode is known by the child windows
+ @param _rCode the keycode
+ @return <TRUE/> if the keycode is handled otherwise <FALSE/>
+ */
+ sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
+
+ /** set the section as marked or not marked
+ @param _pSectionView the section where to set the marked flag
+ @param _bMark the marked flag
+ */
+ void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark);
+ void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark);
+
+ /** returns if the view handles the event by itself
+ *
+ * \param _nId the command id
+ * \return <FALSE/> is the event is not handled by the view otherwise <TRUE/>
+ */
+ sal_Bool isHandleEvent(sal_uInt16 _nId) const;
+
+ sal_uInt32 getMarkedObjectCount() const;
+
+ /** zoom the ruler and view windows
+ */
+ void zoom(const Fraction& _aZoom);
+
+ /** fills the vector with all selected control models
+ /param _rSelection The vector will be filled and will not be cleared before.
+ */
+ void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
+
+ /** returns the selected field from the add field dialog
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors();
+
+ /** calculates the zoom factor.
+ @param _eType which kind of zoom is needed
+ */
+ sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
+ };
+//==================================================================
+} //rptui
+//==================================================================
+#endif // RPTUI_DESIGNVIEW_HXX
+
diff --git a/reportdesign/source/ui/inc/EndMarker.hxx b/reportdesign/source/ui/inc/EndMarker.hxx
new file mode 100644
index 000000000000..90655077a167
--- /dev/null
+++ b/reportdesign/source/ui/inc/EndMarker.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_ENDMARKER_HXX
+#define RPTUI_ENDMARKER_HXX
+
+#include "ColorListener.hxx"
+
+namespace rptui
+{
+ /** \class OEndMarker
+ * \brief Defines the right side of a graphical section.
+ */
+ class OEndMarker : public OColorListener
+ {
+ OEndMarker(OEndMarker&);
+ void operator =(OEndMarker&);
+ protected:
+ virtual void ImplInitSettings();
+ public:
+ OEndMarker(Window* _pParent,const ::rtl::OUString& _sColorEntry);
+ virtual ~OEndMarker();
+
+ // windows
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ };
+}
+#endif // RPTUI_ENDMARKER_HXX
+
diff --git a/reportdesign/source/ui/inc/FixedTextColor.hxx b/reportdesign/source/ui/inc/FixedTextColor.hxx
new file mode 100644
index 000000000000..cbec4e46a0c9
--- /dev/null
+++ b/reportdesign/source/ui/inc/FixedTextColor.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * 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 INCLUDED_FIXEDTEXTCOLOR_HXX
+#define INCLUDED_FIXEDTEXTCOLOR_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/report/XFixedText.hpp>
+/** === end UNO includes === **/
+
+#include <IReportControllerObserver.hxx>
+
+//#include <boost/noncopyable.hpp>
+#include <vector>
+
+namespace rptui
+{
+ class OReportController;
+
+ class FixedTextColor : public IReportControllerObserver
+ {
+ const OReportController& m_rReportController;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > getVclWindowPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFixedText >& _xComponent) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > getXControl(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFixedText >& _xFixedText) throw(::com::sun::star::uno::RuntimeException);
+
+ void setPropertyTextColor(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _xVclWindowPeer, sal_Int32 _nFormatKey);
+
+ // sal_Int32 getTextColor();
+
+ public:
+ FixedTextColor(const OReportController & _aObserver);
+ virtual ~FixedTextColor();
+
+ void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent );
+ void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
+ void handle( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
+
+ };
+
+} // namespace rptui
+
+
+#endif
diff --git a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx
new file mode 100644
index 000000000000..84119777a160
--- /dev/null
+++ b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * 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 INCLUDED_FORMATTEDFIELDBEAUTIFIER_HXX
+#define INCLUDED_FORMATTEDFIELDBEAUTIFIER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/report/XReportComponent.hpp>
+/** === end UNO includes === **/
+
+//#include <boost/noncopyable.hpp>
+#include <vector>
+#include <IReportControllerObserver.hxx>
+
+namespace rptui
+{
+ class OReportController;
+
+ class FormattedFieldBeautifier : public IReportControllerObserver
+ {
+ const OReportController& m_rReportController;
+ sal_Int32 m_nTextColor;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > getVclWindowPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent >& _xComponent) throw(::com::sun::star::uno::RuntimeException);
+
+ void setPlaceholderText( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
+ void setPlaceholderText( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _xVclWindowPeer, const ::rtl::OUString& _rText );
+
+ sal_Int32 getTextColor();
+
+ public:
+ FormattedFieldBeautifier(const OReportController & _aObserver);
+ virtual ~FormattedFieldBeautifier();
+
+ void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent );
+ void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
+ void handle( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
+ };
+
+} // namespace rptui
+
+
+#endif
diff --git a/reportdesign/source/ui/inc/Formula.hxx b/reportdesign/source/ui/inc/Formula.hxx
new file mode 100644
index 000000000000..b08e14f52b4a
--- /dev/null
+++ b/reportdesign/source/ui/inc/Formula.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * 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_FORMULA_HXX
+#define RPTUI_FORMULA_HXX
+
+#include <formula/formula.hxx>
+#include <formula/IFunctionDescription.hxx>
+#include <formula/IControlReferenceHandler.hxx>
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/report/meta/XFormulaParser.hpp>
+
+class SvLBoxEntry;
+//============================================================================
+namespace rptui
+{
+//============================================================================
+class FunctionManager;
+class OAddFieldWindow;
+
+//============================================================================
+class FormulaDialog : public formula::FormulaModalDialog,
+ public formula::IFormulaEditorHelper,
+ public formula::IControlReferenceHandler
+{
+ ::boost::shared_ptr< formula::IFunctionManager > m_aFunctionManager;
+ formula::FormEditData* m_pFormulaData;
+ OAddFieldWindow* m_pAddField;
+ ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > m_xRowSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFormulaParser> m_xParser;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
+ formula::RefEdit* m_pEdit;
+ String m_sFormula;
+ xub_StrLen m_nStart;
+ xub_StrLen m_nEnd;
+
+ DECL_LINK( OnClickHdl, OAddFieldWindow*);
+public:
+ FormulaDialog( Window* pParent
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xServiceFactory
+ , const ::boost::shared_ptr< formula::IFunctionManager >& _pFunctionMgr
+ , const ::rtl::OUString& _sFormula
+ , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet);
+ virtual ~FormulaDialog();
+
+ // IFormulaEditorHelper
+ virtual void notifyChange();
+ virtual void fill();
+ virtual bool calculateValue(const String& _sExpression,String& _rResult);
+ virtual void doClose(sal_Bool _bOk);
+ virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc);
+ virtual void showReference(const String& _sFormula);
+ virtual void dispatch(sal_Bool _bOK,sal_Bool _bMartixChecked);
+ virtual void setDispatcherLock( sal_Bool bLock );
+ virtual void setReferenceInput(const formula::FormEditData* _pData);
+ virtual void deleteFormData();
+ virtual void clear();
+ virtual void switchBack();
+ virtual formula::FormEditData* getFormEditData() const;
+ virtual void setCurrentFormula(const String& _sReplacement);
+ virtual void setSelection(xub_StrLen _nStart,xub_StrLen _nEnd);
+ virtual void getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const;
+ virtual String getCurrentFormula() const;
+
+ virtual formula::IFunctionManager* getFunctionManager();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const;
+ virtual ::com::sun::star::table::CellAddress getReferencePosition() const;
+
+ virtual ::std::auto_ptr<formula::FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList);
+
+ // IControlReferenceHandler
+ virtual void ShowReference(const String& _sRef);
+ virtual void HideReference( sal_Bool bDoneRefMode = sal_True );
+ virtual void ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
+ virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
+
+protected:
+ void HighlightFunctionParas(const String& aFormula);
+};
+
+// =============================================================================
+} // rptui
+// =============================================================================
+
+#endif // RPTUI_FORMULA_HXX
+
diff --git a/reportdesign/source/ui/inc/FunctionHelper.hxx b/reportdesign/source/ui/inc/FunctionHelper.hxx
new file mode 100644
index 000000000000..13525e8f2e0e
--- /dev/null
+++ b/reportdesign/source/ui/inc/FunctionHelper.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * 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_FUNCTIONHELPER_HXX
+#define RPTUI_FUNCTIONHELPER_HXX
+
+#include <formula/IFunctionDescription.hxx>
+#include <com/sun/star/report/meta/XFunctionManager.hpp>
+#include <com/sun/star/report/meta/XFunctionCategory.hpp>
+#include <com/sun/star/report/meta/XFunctionDescription.hpp>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <tools/string.hxx>
+#include <comphelper/stl_types.hxx>
+
+
+namespace rptui
+{
+//============================================================================
+class FunctionCategory;
+class FunctionDescription;
+//============================================================================
+class FunctionManager : public formula::IFunctionManager
+{
+ DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr< FunctionDescription >, TFunctionsMap);
+ DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr< FunctionCategory > , TCategoriesMap);
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionManager> m_xMgr;
+ mutable TCategoriesMap m_aCategories;
+ mutable ::std::vector< TCategoriesMap::iterator > m_aCategoryIndex;
+ mutable TFunctionsMap m_aFunctions;
+public:
+ FunctionManager(const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionManager>& _xMgr);
+ virtual ~FunctionManager();
+ virtual sal_uInt32 getCount() const;
+ virtual const formula::IFunctionCategory* getCategory(sal_uInt32 nPos) const;
+ virtual void fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const;
+ virtual const formula::IFunctionDescription* getFunctionByName(const ::rtl::OUString& _sFunctionName) const;
+ virtual sal_Unicode getSingleToken(const EToken _eToken) const;
+
+ ::boost::shared_ptr< FunctionDescription > get(const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription>& _xFunctionDescription) const;
+};
+//============================================================================
+class FunctionDescription : public formula::IFunctionDescription
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FunctionArgument > m_aParameter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription> m_xFunctionDescription;
+ const formula::IFunctionCategory* m_pFunctionCategory;
+public:
+ FunctionDescription(const formula::IFunctionCategory* _pFunctionCategory,const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription>& _xFunctionDescription);
+ virtual ~FunctionDescription(){}
+
+ virtual ::rtl::OUString getFunctionName() const ;
+ virtual const formula::IFunctionCategory* getCategory() const ;
+ virtual ::rtl::OUString getDescription() const ;
+ virtual xub_StrLen getSuppressedArgumentCount() const ;
+ virtual ::rtl::OUString getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const ;
+ virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const ;
+ virtual void initArgumentInfo() const;
+ virtual ::rtl::OUString getSignature() const ;
+ virtual rtl::OString getHelpId() const ;
+ virtual sal_uInt32 getParameterCount() const ;
+ virtual ::rtl::OUString getParameterName(sal_uInt32 _nPos) const ;
+ virtual ::rtl::OUString getParameterDescription(sal_uInt32 _nPos) const ;
+ virtual bool isParameterOptional(sal_uInt32 _nPos) const ;
+};
+//============================================================================
+class FunctionCategory : public formula::IFunctionCategory
+{
+ mutable ::std::vector< ::boost::shared_ptr< FunctionDescription > > m_aFunctions;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionCategory> m_xCategory;
+ sal_uInt32 m_nFunctionCount;
+ sal_uInt32 m_nNumber;
+ const FunctionManager* m_pFunctionManager;
+public:
+ FunctionCategory(const FunctionManager* _pFMgr,sal_uInt32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionCategory>& _xCategory);
+ virtual ~FunctionCategory() {}
+
+ virtual sal_uInt32 getCount() const;
+ virtual const formula::IFunctionDescription* getFunction(sal_uInt32 _nPos) const;
+ virtual sal_uInt32 getNumber() const;
+ virtual const formula::IFunctionManager* getFunctionManager() const;
+ virtual ::rtl::OUString getName() const;
+};
+// =============================================================================
+} // rptui
+// =============================================================================
+
+#endif //RPTUI_FUNCTIONHELPER_HXX
diff --git a/reportdesign/source/ui/inc/GeometryHandler.hxx b/reportdesign/source/ui/inc/GeometryHandler.hxx
new file mode 100644
index 000000000000..200b7c29a60a
--- /dev/null
+++ b/reportdesign/source/ui/inc/GeometryHandler.hxx
@@ -0,0 +1,321 @@
+/*************************************************************************
+ *
+ * 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 RPT_GEOMETRYHANDLER_HXX
+#define RPT_GEOMETRYHANDLER_HXX
+
+#include "sal/config.h"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "cppuhelper/compbase3.hxx"
+#include "cppuhelper/basemutex.hxx"
+#include "com/sun/star/inspection/XPropertyHandler.hpp"
+#include "com/sun/star/script/XTypeConverter.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/report/XReportComponent.hpp"
+#include "com/sun/star/report/XFunction.hpp"
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <memory>
+#include <comphelper/stl_types.hxx>
+#include <comphelper/listenernotification.hxx>
+#include "metadata.hxx"
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+
+ struct DefaultFunction
+ {
+ com::sun::star::beans::Optional< ::rtl::OUString> m_sInitialFormula;
+ ::rtl::OUString m_sName;
+ ::rtl::OUString m_sSearchString;
+ ::rtl::OUString m_sFormula;
+ ::sal_Bool m_bPreEvaluated;
+ ::sal_Bool m_bDeepTraversing;
+
+ inline ::rtl::OUString getName() const { return m_sName; }
+ } ;
+
+ class OPropertyInfoService;
+ typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunction>, ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctionsSupplier> > TFunctionPair;
+ typedef ::std::multimap< ::rtl::OUString,TFunctionPair, ::comphelper::UStringMixLess > TFunctions;
+ typedef ::comphelper::OSimpleListenerContainer < ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::beans::PropertyChangeEvent
+ > PropertyChangeListeners;
+ typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::inspection::XPropertyHandler
+ , ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::lang::XServiceInfo> GeometryHandler_Base;
+
+ class GeometryHandler:
+ private ::cppu::BaseMutex,
+ public GeometryHandler_Base
+ {
+ /** sets the counter function at the data field.
+ * If the counter function doesn't exist it will be created.
+ */
+ void impl_setCounterFunction_throw();
+
+ /** executes a dialog for chosing a filter criterion for a database report
+ @param _out_rSelectedClause
+ the filter or order clause as chosen by the user
+ @precond
+ we're really inspecting a database form (well, a RowSet at least)
+ @return
+ <TRUE/> if and only if the user successfully chose a clause
+ */
+ bool impl_dialogFilter_nothrow( ::rtl::OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
+
+ /** returns the data field type depending on the data field of the report control
+ *
+ * \param _sDataField if the data field is not empty it will be used as data field, otherwise the data field will be used.
+ * \return the data field type
+ */
+ sal_uInt32 impl_getDataFieldType_throw(const ::rtl::OUString& _sDataField = ::rtl::OUString()) const;
+
+ ::com::sun::star::uno::Any getConstantValue(sal_Bool bToControlValue,sal_uInt16 nResId,const ::com::sun::star::uno::Any& _aValue,const ::rtl::OUString& _sConstantName,const ::rtl::OUString & PropertyName );
+ ::com::sun::star::beans::Property getProperty(const ::rtl::OUString & PropertyName);
+ void implCreateListLikeControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory
+ ,::com::sun::star::inspection::LineDescriptor & out_Descriptor
+ ,sal_uInt16 _nResId
+ ,sal_Bool _bReadOnlyControl
+ ,sal_Bool _bTrueIfListBoxFalseIfComboBox
+ );
+ void implCreateListLikeControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory
+ ,::com::sun::star::inspection::LineDescriptor & out_Descriptor
+ ,const ::std::vector< ::rtl::OUString>& _aEntries
+ ,sal_Bool _bReadOnlyControl
+ ,sal_Bool _bTrueIfListBoxFalseIfComboBox
+ );
+ void checkPosAndSize( const ::com::sun::star::awt::Point& _aNewPos,
+ const ::com::sun::star::awt::Size& _aSize);
+
+ ::rtl::OUString impl_convertToFormula( const ::com::sun::star::uno::Any& _rControlValue );
+
+ void impl_initFieldList_nothrow( ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rFieldNames ) const;
+
+ /** Creates the function defined by the function template
+ *
+ * \param _sFunctionName the function name
+ * \param _sDataField the data field
+ * \param _aFunction the function template
+ */
+ void impl_createFunction(const ::rtl::OUString& _sFunctionName,const ::rtl::OUString& _sDataField,const DefaultFunction& _aFunction);
+
+ /** check whether the given function name is a countr function.
+ *
+ * \param _sQuotedFunctionName the quoted function name to check
+ * \param _Out_sScope the scope of the function
+ * \return When true it is a counter functions otherwise false.
+ */
+ bool impl_isCounterFunction_throw(const ::rtl::OUString& _sQuotedFunctionName,::rtl::OUString& _Out_sScope) const;
+
+ /** clear the own properties like function and scope and send a notification
+ *
+ * \param _aGuard
+ * \param _sOldFunctionName
+ * \param _sOldScope
+ * \param _nOldDataFieldType
+ */
+ void resetOwnProperties(::osl::ResettableMutexGuard& _aGuard,const ::rtl::OUString& _sOldFunctionName,const ::rtl::OUString& _sOldScope,const sal_uInt32 _nOldDataFieldType);
+
+ /** checks whether the name is a field or a parameter
+ *
+ * \param _sName the name to check
+ * \return true when it is a field or parameter otherwise false
+ */
+ bool impl_isDataField(const ::rtl::OUString& _sName) const;
+
+ /**return all formula in a semicolon seperated list
+ *
+ * \param _rList the localized function names
+ */
+ void impl_fillFormulaList_nothrow(::std::vector< ::rtl::OUString >& _out_rList) const;
+
+ /** return all group names in a semicolon seperated list starting with the group where this control is contained in.
+ *
+ * \param _rList fills the list with all scope names.
+ */
+ void impl_fillScopeList_nothrow(::std::vector< ::rtl::OUString >& _out_rList) const;
+
+ /** return all supported output formats of the report definition
+ *
+ * \param _rList fills the list with all mime types
+ */
+ void impl_fillMimeTypes_nothrow(::std::vector< ::rtl::OUString >& _out_rList) const;
+
+ /** return the one supported output formats of the report definition
+ *
+ * \param _sMimetype the mimetype
+ */
+ ::rtl::OUString impl_ConvertMimeTypeToUI_nothrow(const ::rtl::OUString& _sMimetype) const;
+
+ /** return the MimeType for the given UI Name
+ *
+ * \param _sUIName the doc ui name
+ */
+ ::rtl::OUString impl_ConvertUIToMimeType_nothrow(const ::rtl::OUString& _sUIName) const;
+
+ /** get the functions supplier for the set scope, default is the surrounding group.
+ *
+ * \param _rsNamePostFix the name post fix which canbe used when the scope as name part is needed
+ * \return the function supplier
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctionsSupplier> fillScope_throw(::rtl::OUString& _rsNamePostFix);
+
+ /** checks if the given function is a default function we know.
+ *
+ * \param _sQuotedFunction the quoted function name
+ * \param _Out_rDataField the data field which is used in the function
+ * \param _xFunctionsSupplier teh function supplier to search or empty if not used
+ * \param _bSet If set to sal_True than the m_sDefaultFunction and m_sScope vars will be set if successful.
+ * \return sal_True with known otherwise sal_False
+ */
+ sal_Bool isDefaultFunction(const ::rtl::OUString& _sQuotedFunction
+ ,::rtl::OUString& _Out_rDataField
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctionsSupplier>& _xFunctionsSupplier = ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctionsSupplier>()
+ ,bool _bSet = false) const;
+
+ /** checks if the given function is a default function we know.
+ *
+ * \param _xFunction
+ * \param _rDataField
+ * \param _rsDefaultFunctionName
+ * \return
+ */
+ sal_Bool impl_isDefaultFunction_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunction>& _xFunction
+ ,::rtl::OUString& _rDataField
+ ,::rtl::OUString& _rsDefaultFunctionName) const;
+
+ /** fills the memeber m_aDefaultFunctions
+ *
+ */
+ void loadDefaultFunctions();
+
+ /** creates a default functionof the _sFunction for the data field _sDataField
+ * The new function will only be created if it didn't exist.
+ *
+ * \param _aGuard Will be cleared, when a new function was created.
+ * \param _sFunction The name of the function.
+ * \param _sDataField The name of the data field.
+ */
+ void createDefaultFunction(::osl::ResettableMutexGuard& _aGuard ,const ::rtl::OUString& _sFunction,const ::rtl::OUString& _sDataField);
+
+ void removeFunction();
+
+ class OBlocker
+ {
+ bool& m_bIn;
+ public:
+ OBlocker(bool& _bIn) : m_bIn(_bIn){ m_bIn = true; }
+ ~OBlocker() { m_bIn = false; }
+ };
+
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+
+ public:
+ // XServiceInfo - static versions
+ static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
+
+ public:
+ explicit GeometryHandler(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent:
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::inspection::XPropertyHandler:
+ virtual void SAL_CALL inspect(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Component) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual void SAL_CALL setPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & Value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& ControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & ControlValue) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & PropertyValue, const ::com::sun::star::uno::Type & ControlValueType) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual void SAL_CALL addPropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & Listener) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
+ virtual void SAL_CALL removePropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & _rxListener) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isComposable(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, ::com::sun::star::uno::Any & out_Data, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException);
+ virtual void SAL_CALL actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const ::com::sun::star::uno::Any & NewValue, const ::com::sun::star::uno::Any & OldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI, ::sal_Bool FirstTimeInit) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
+ virtual ::sal_Bool SAL_CALL suspend(::sal_Bool Suspend) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual ~GeometryHandler();
+ private:
+ GeometryHandler(GeometryHandler &); // not defined
+ void operator =(GeometryHandler &); // not defined
+
+ // overload WeakComponentImplHelperBase::disposing()
+ // This function is called upon disposing the component,
+ // if your component needs special work when it becomes
+ // disposed, do it here.
+ virtual void SAL_CALL disposing();
+
+ PropertyChangeListeners m_aPropertyListeners;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aFieldNames;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aParamNames;
+ TFunctions m_aFunctionNames;
+ ::std::vector< DefaultFunction > m_aDefaultFunctions;
+ DefaultFunction m_aCounterFunction;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunction> m_xFunction;
+ ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > m_xFormComponentHandler; /// delegatee
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xReportComponent; /// inspectee
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet;
+ /// type converter, needed on various occasions
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter > m_xTypeConverter;
+ /// access to property meta data
+ ::std::auto_ptr< OPropertyInfoService > m_pInfoService;
+ mutable ::rtl::OUString m_sDefaultFunction;
+ mutable ::rtl::OUString m_sScope;
+ sal_uInt32 m_nDataFieldType;
+ mutable bool m_bNewFunction;
+ bool m_bIn;
+ };
+//........................................................................
+} // namespace rptui
+//........................................................................
+
+#endif // RPT_GeometryHandler_HXX
diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx
new file mode 100644
index 000000000000..239858c605a4
--- /dev/null
+++ b/reportdesign/source/ui/inc/GroupsSorting.hxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * 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_GROUPS_SORTING_HXX
+#define RPTUI_GROUPS_SORTING_HXX
+
+#include <vcl/floatwin.hxx>
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/button.hxx>
+#include <vcl/toolbox.hxx>
+#include <com/sun/star/report/XGroups.hpp>
+#include <com/sun/star/report/XGroup.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include "GroupProperties.hxx"
+#include <comphelper/propmultiplex.hxx>
+#include "cppuhelper/basemutex.hxx"
+#include <svtools/svmedit.hxx>
+#include <rtl/ref.hxx>
+
+#include <vector>
+
+#include <dbaccess/ToolBoxHelper.hxx>
+
+#include <vcl/ImageListProvider.hxx>
+
+namespace comphelper
+{
+ class OPropertyChangeMultiplexer;
+}
+namespace rptui
+{
+class OFieldExpressionControl;
+class OReportController;
+/*************************************************************************
+|*
+|* Groups and Sorting dialog
+|*
+\************************************************************************/
+
+class OGroupsSortingDialog : public FloatingWindow
+ , public ::cppu::BaseMutex
+ , public ::comphelper::OPropertyChangeListener
+ ,public dbaui::OToolBoxHelper
+ ,public vcl::IImageListProvider
+{
+ friend class OFieldExpressionControl;
+
+ FixedLine m_aFL2;
+ FixedText m_aMove;
+//BTN ImageButton m_aPB_Up;
+//BTN ImageButton m_aPB_Down;
+//BTN ImageButton m_aPB_Delete;
+ ToolBox m_aToolBox;
+
+ FixedLine m_aFL3;
+ FixedText m_aOrder;
+ ListBox m_aOrderLst;
+ FixedText m_aHeader;
+ ListBox m_aHeaderLst;
+ FixedText m_aFooter;
+ ListBox m_aFooterLst;
+ FixedText m_aGroupOn;
+ ListBox m_aGroupOnLst;
+ FixedText m_aGroupInterval;
+ NumericField m_aGroupIntervalEd;
+ FixedText m_aKeepTogether;
+ ListBox m_aKeepTogetherLst;
+ FixedLine m_aFL;
+ FixedText m_aHelpWindow;
+
+ OFieldExpressionControl* m_pFieldExpression;
+ ::rptui::OReportController* m_pController;
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pCurrentGroupListener;
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups> m_xGroups;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
+ sal_Bool m_bReadOnly;
+private:
+ DECL_LINK( OnControlFocusLost, Control* );
+ DECL_LINK( OnControlFocusGot, Control* );
+ DECL_LINK( LBChangeHdl, ListBox* );
+//BTN DECL_LINK( ClickHdl, ImageButton* );
+ DECL_LINK( OnFormatAction, ToolBox* );
+
+ /** returns the groups
+ @return the groups which now have to check which one changes
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups>& getGroups() { return m_xGroups; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> getGroup(sal_Int32 _nPos)
+ {
+ OSL_ENSURE(_nPos >= 0 && _nPos < m_xGroups->getCount(),"Invalid count!");
+ return ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>(m_xGroups->getByIndex(_nPos),::com::sun::star::uno::UNO_QUERY);
+ }
+
+ /** updates the listboxes with the new group properties
+ @param _nRow the new group pos
+ */
+ void DisplayData( sal_Int32 _nRow );
+
+ /** saves the values from the listboxes into the group at position _nRow
+ @param _nRow the group pos to store in
+ */
+ void SaveData( sal_Int32 _nRow );
+
+ /** returns <TRUE/> when the dialog should be read only
+ */
+ sal_Bool isReadOnly( ) const;
+
+ /** returns the data type for the given column name
+ @param _sColumnName
+ */
+ sal_Int32 getColumnDataType(const ::rtl::OUString& _sColumnName);
+
+ /** shows the text given by the id in the multiline edit
+ @param _nResId the string id
+ */
+ void showHelpText(sal_uInt16 _nResId);
+ /** display the group props
+ @param _xGroup the group to display
+ */
+ void displayGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup);
+
+ /** enables or diables the up and down button
+ @param _nRow the row which will be active
+ */
+ void checkButtons(sal_Int32 _nRow);
+
+ /** clears the m_xColumns member and reset the fields
+ *
+ */
+ void fillColumns();
+ OGroupsSortingDialog(OGroupsSortingDialog&);
+ void operator =(OGroupsSortingDialog&);
+protected:
+ // window
+ virtual void Resize();
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
+public:
+ OGroupsSortingDialog( Window* pParent
+ ,sal_Bool _bReadOnly
+ ,::rptui::OReportController* _pController);
+ virtual ~OGroupsSortingDialog();
+
+ /** sets the newe columns at the groups dialog.
+ @param _xColumns the new columns
+ */
+ void setColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xColumns);
+
+ /* updates the current view
+ */
+ void UpdateData( );
+
+ /** will be called when the controls need to be resized.
+ @param _rDiff
+ Contains the difference of the old and new toolbox size.
+ */
+ virtual void resizeControls(const Size& _rDiff);
+
+ /** will be called when the image list is needed.
+ @param _eSymbolsSize
+ <svtools/imgdef.hxx>
+ @param _bHiContast
+ <TRUE/> when in high contrast mode.
+ */
+ virtual ImageList getImageList(sal_Int16 _eSymbolsSize,sal_Bool _bHiContast) const;
+
+ // ImageListProvider interface
+ virtual ImageList getImageList(vcl::ImageListType) SAL_THROW ((com::sun::star::lang::IllegalArgumentException ));
+
+};
+// =============================================================================
+} // namespace rptui
+// =============================================================================
+#endif // RPTUI_GROUPS_SORTING_HXX
diff --git a/reportdesign/source/ui/inc/IReportControllerObserver.hxx b/reportdesign/source/ui/inc/IReportControllerObserver.hxx
new file mode 100644
index 000000000000..497fe874b3ef
--- /dev/null
+++ b/reportdesign/source/ui/inc/IReportControllerObserver.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * 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 INCLUDED_BEAUTIFIER_HXX
+#define INCLUDED_BEAUTIFIER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+/** === end UNO includes === **/
+
+namespace rptui
+{
+ /* abstract */ class IReportControllerObserver
+ {
+ protected:
+ // IReportControllerObserver(){}
+ virtual ~IReportControllerObserver() {}
+
+ public:
+
+ virtual void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) = 0;
+ virtual void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ) = 0;
+ virtual void handle( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ) = 0;
+ };
+
+} // namespace rptui
+
+#endif
+
+
diff --git a/reportdesign/source/ui/inc/InsertFunctions.hxx b/reportdesign/source/ui/inc/InsertFunctions.hxx
new file mode 100644
index 000000000000..b177377fd5fd
--- /dev/null
+++ b/reportdesign/source/ui/inc/InsertFunctions.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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 RPT_INSERTFUNCTIONS_HXX_INCLUDED
+#define RPT_INSERTFUNCTIONS_HXX_INCLUDED
+
+#ifndef _EVENT_HXX //autogen
+#include <vcl/event.hxx>
+#endif
+#include <vcl/timer.hxx>
+
+class SdrView;
+class Window;
+class SdrModel;
+class SdrObject;
+namespace rptui
+{
+/************************************************************************/
+// ---------
+} // namespace rptui
+// ---------
+#endif // RPT_INSERTFUNCTIONS_HXX_INCLUDED
+
diff --git a/reportdesign/source/ui/inc/MarkedSection.hxx b/reportdesign/source/ui/inc/MarkedSection.hxx
new file mode 100644
index 000000000000..eb892aee92eb
--- /dev/null
+++ b/reportdesign/source/ui/inc/MarkedSection.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * 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_MARKEDSECTION_HXX
+#define RPTUI_MARKEDSECTION_HXX
+
+#include <boost/shared_ptr.hpp>
+
+namespace rptui
+{
+ class OSectionWindow; // forward declaration
+
+ enum NearSectionAccess
+ {
+ CURRENT = 0,
+ PREVIOUS = -1,
+ POST = 1
+ };
+
+ class IMarkedSection
+ {
+ public:
+ /** returns the section which is currently marked.
+ */
+ virtual ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa) const =0;
+
+ /** mark the section on the given position .
+ *
+ * \param _nPos the position is zero based.
+ */
+ virtual void markSection(const sal_uInt16 _nPos) = 0;
+ };
+
+} // rptui
+
+#endif /* RPTUI_MARKEDSECTION_HXX */
diff --git a/reportdesign/source/ui/inc/Navigator.hxx b/reportdesign/source/ui/inc/Navigator.hxx
new file mode 100644
index 000000000000..a9cf2fd9222e
--- /dev/null
+++ b/reportdesign/source/ui/inc/Navigator.hxx
@@ -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 INCLUDED_RPTUI_NAVIGATOR_HXX
+#define INCLUDED_RPTUI_NAVIGATOR_HXX
+
+#include <vcl/floatwin.hxx>
+#include "ModuleHelper.hxx"
+#include <memory>
+namespace rptui
+{
+ class OReportController;
+ class ONavigatorImpl;
+ class ONavigator : public FloatingWindow
+ {
+ OModuleClient m_aModuleClient;
+ ::std::auto_ptr<ONavigatorImpl> m_pImpl;
+ ONavigator(const ONavigator&);
+ void operator =(const ONavigator&);
+ public:
+ ONavigator( Window* pParent
+ ,OReportController& _rController);
+ virtual ~ONavigator();
+
+ // window
+ virtual void Resize();
+ virtual void GetFocus();
+ };
+// =============================================================================
+} // namespace rptui
+// =============================================================================
+#endif // INCLUDED_RPTUI_NAVIGATOR_HXX
diff --git a/reportdesign/source/ui/inc/PageNumber.hxx b/reportdesign/source/ui/inc/PageNumber.hxx
new file mode 100644
index 000000000000..fd574ff5fa8b
--- /dev/null
+++ b/reportdesign/source/ui/inc/PageNumber.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * 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_HXX
+#define RPTUI_PAGENUMBER_HXX
+
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <com/sun/star/report/XReportDefinition.hpp>
+
+
+namespace rptui
+{
+class OReportController;
+/*************************************************************************
+|*
+|* Groups and Sorting dialog
+|*
+\************************************************************************/
+class OPageNumberDialog : public ModalDialog
+{
+ FixedLine m_aFormat;
+ RadioButton m_aPageN;
+ RadioButton m_aPageNofM;
+
+ FixedLine m_aPosition;
+ RadioButton m_aTopPage;
+ RadioButton m_aBottomPage;
+ FixedLine m_aMisc;
+ FixedText m_aAlignment;
+ ListBox m_aAlignmentLst;
+
+ CheckBox m_aShowNumberOnFirstPage;
+ FixedLine m_aFl1;
+ OKButton m_aPB_OK;
+ CancelButton m_aPB_CANCEL;
+ HelpButton m_aPB_Help;
+
+
+ ::rptui::OReportController* m_pController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>
+ m_xHoldAlive;
+
+ OPageNumberDialog(const OPageNumberDialog&);
+ void operator =(const OPageNumberDialog&);
+public:
+ OPageNumberDialog( Window* pParent
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xHoldAlive
+ ,::rptui::OReportController* _pController);
+ virtual ~OPageNumberDialog();
+ virtual short Execute();
+};
+// =============================================================================
+} // namespace rptui
+// =============================================================================
+#endif // RPTUI_PAGENUMBER_HXX
diff --git a/reportdesign/source/ui/inc/ReportComponentHandler.hxx b/reportdesign/source/ui/inc/ReportComponentHandler.hxx
new file mode 100644
index 000000000000..080d913d59ab
--- /dev/null
+++ b/reportdesign/source/ui/inc/ReportComponentHandler.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * 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 RPT_REPORTCOMPONENTHANDLER_HXX
+#define RPT_REPORTCOMPONENTHANDLER_HXX
+
+#include "sal/config.h"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "cppuhelper/compbase2.hxx"
+#include "cppuhelper/basemutex.hxx"
+#include "com/sun/star/inspection/XPropertyHandler.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+
+#include <memory>
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+
+ class OPropertyInfoService;
+
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::inspection::XPropertyHandler
+ , ::com::sun::star::lang::XServiceInfo> ReportComponentHandler_Base;
+
+ class ReportComponentHandler:
+ private ::cppu::BaseMutex,
+ public ReportComponentHandler_Base
+ {
+ public:
+ // XServiceInfo - static versions
+ static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
+
+ public:
+ explicit ReportComponentHandler(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent:
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::inspection::XPropertyHandler:
+ virtual void SAL_CALL inspect(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Component) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual void SAL_CALL setPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & Value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& ControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & ControlValue) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & PropertyValue, const ::com::sun::star::uno::Type & ControlValueType) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual void SAL_CALL addPropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & Listener) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
+ virtual void SAL_CALL removePropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & _rxListener) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isComposable(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+ virtual ::com::sun::star::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, ::com::sun::star::uno::Any & out_Data, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException);
+ virtual void SAL_CALL actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const ::com::sun::star::uno::Any & NewValue, const ::com::sun::star::uno::Any & OldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI, ::sal_Bool FirstTimeInit) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
+ virtual ::sal_Bool SAL_CALL suspend(::sal_Bool Suspend) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual ~ReportComponentHandler() {}
+ private:
+ ReportComponentHandler(ReportComponentHandler &); // not defined
+ void operator =(ReportComponentHandler &); // not defined
+
+
+
+ // overload WeakComponentImplHelperBase::disposing()
+ // This function is called upon disposing the component,
+ // if your component needs special work when it becomes
+ // disposed, do it here.
+ virtual void SAL_CALL disposing();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > m_xFormComponentHandler; /// delegatee
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xReportComponent; /// inspectee
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xFormComponent; /// inspectee
+ ::std::auto_ptr< OPropertyInfoService > m_pInfoService;
+ };
+//........................................................................
+} // namespace rptui
+//........................................................................
+
+#endif // RPT_REPORTCOMPONENTHANDLER_HXX
diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx
new file mode 100644
index 000000000000..b25f49770f5b
--- /dev/null
+++ b/reportdesign/source/ui/inc/ReportController.hxx
@@ -0,0 +1,486 @@
+/*************************************************************************
+ *
+ * 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_REPORTCONTROLLER_HXX
+#define RPTUI_REPORTCONTROLLER_HXX
+
+#include "DesignView.hxx"
+#include "ModuleHelper.hxx"
+#include "ReportControllerObserver.hxx"
+#include "RptDef.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/report/XReportControlModel.hpp>
+#include <com/sun/star/report/XReportDefinition.hpp>
+#include <com/sun/star/report/XReportEngine.hpp>
+#include <com/sun/star/report/XSection.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XModeSelector.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/implementationreference.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertystatecontainer.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <dbaccess/dbsubcomponentcontroller.hxx>
+#include <svl/lstner.hxx>
+#include <svtools/transfer.hxx>
+#include <svx/svdedtv.hxx>
+#include <svx/zoomitem.hxx>
+
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <functional>
+
+class TransferableHelper;
+class TransferableClipboardListener;
+class VclWindowEvent;
+class SfxUndoManager;
+namespace rptui
+{
+ class OGroupsSortingDialog;
+ class OPropertyMediator;
+ class OReportModel;
+ class OSectionView;
+ class OAddFieldWindow;
+ class OSectionWindow;
+
+ typedef ::dbaui::DBSubComponentController OReportController_BASE;
+ typedef ::cppu::ImplHelper5 < ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::view::XSelectionSupplier
+ , ::com::sun::star::util::XModeSelector
+ , ::com::sun::star::embed::XVisualObject
+ > OReportController_Listener;
+
+ class OReportController : public OReportController_BASE
+ ,public OReportController_Listener
+ ,public SfxListener
+ ,public ::comphelper::OPropertyStateContainer
+ ,public ::comphelper::OPropertyArrayUsageHelper < OReportController_BASE >
+ ,public ::boost::noncopyable
+ {
+ private:
+ OModuleClient m_aModuleClient;
+ ::cppu::OInterfaceContainerHelper
+ m_aSelectionListeners;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>
+ m_aCollapsedSections;
+ TransferableDataHelper m_aSystemClipboard; // content of the clipboard
+ TransferableClipboardListener*
+ m_pClipbordNotifier; /// notifier for changes in the clipboard
+ OGroupsSortingDialog* m_pGroupsFloater;
+
+ OXReportControllerObserver* m_pReportControllerObserver;
+
+ ODesignView* getDesignView() const { return static_cast< ODesignView* >( getView() ); }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportEngine > m_xReportEngine;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XComponentLoader > m_xFrameLoader;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > m_xRowSetMediator;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; // a number formatter working with the report's NumberFormatsSupplier
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xHoldAlive;
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
+ ::com::sun::star::awt::Size m_aVisualAreaSize;
+
+ ::boost::shared_ptr<rptui::OReportModel>
+ m_aReportModel;
+ ::rtl::OUString m_sName; /// name for the report definition
+ ::rtl::OUString m_sLastActivePage; /// last active property browser page
+ ::rtl::OUString m_sMode; /// the current mode of the controller
+ sal_Int32 m_nSplitPos; /// the position of the splitter
+ sal_Int32 m_nPageNum; /// the page number from the restoreView call
+ sal_Int32 m_nSelectionCount;
+ ::sal_Int64 m_nAspect;
+ sal_Int16 m_nZoomValue;
+ SvxZoomType m_eZoomType;
+ sal_Bool m_bShowRuler;
+ sal_Bool m_bGridVisible;
+ sal_Bool m_bGridUse;
+ sal_Bool m_bShowProperties;
+ sal_Bool m_bGroupFloaterWasVisible;
+ sal_Bool m_bHelplinesMove;
+ bool m_bChartEnabled;
+ bool m_bChartEnabledAsked;
+ bool m_bInGeneratePreview;
+
+ /** creates a formatted field in the given section with the given formula as data field
+ *
+ * \param _aArgs
+ * \param _xSection the section where to create the formatted field
+ * \param _sFunction the function which will be set at the data field.
+ */
+ void createControl(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,const ::rtl::OUString& _sFunction ,sal_uInt16 _nObjectId = OBJ_DLG_FORMATTEDFIELD);
+ /** switch the report header/footer sectionon off with undo or without depending on the given id.
+ *
+ * \param _nId Can either be SID_REPORTHEADER_WITHOUT_UNDO or SID_REPORTFOOTER_WITHOUT_UNDO or SID_REPORTHEADERFOOTER.
+ */
+ void switchReportSection(const sal_Int16 _nId);
+
+ /** switch the report header/footer sectionon off with undo or without depending on the given id.
+ *
+ * \param _nId Can either be SID_PAGEHEADER_WITHOUT_UNDO or SID_PAGEFOOTER_WITHOUT_UNDO or SID_PAGEHEADERFOOTER.
+ */
+ void switchPageSection(const sal_Int16 _nId);
+
+ /** append a new group or remove it with undo.
+ *
+ * \param _bAppend
+ * \param _aArgs The args which contains a element named PROPERTY_GROUP of type report::XGroup.
+ */
+ void modifyGroup(const bool _bAppend, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs);
+
+ /** creates a group section.
+ *
+ * \param _bUndo true when undo action should be created
+ * \param _bHeader true when it is a header otherwise it is a footer
+ * \param _aArgs The args which contains a element named PROPERTY_GROUP of type report::XGroup.
+ */
+ void createGroupSection(const bool _bUndo,const bool _bHeader,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&_aArgs);
+
+ /** add or remove me as listener at the report definition
+ *
+ * \param _bAdd
+ */
+ void listen(const bool _bAdd);
+
+ /** opens the common page dialog
+ */
+ void openPageDialog(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection);
+
+ /** opens or hides the sorting and grouping dialog
+ */
+ void openSortingAndGroupingDialog();
+
+ /** opens the zoom dialog
+ */
+ void openZoomDialog();
+
+ /** returns the position of the group inside the groups collection
+ */
+ sal_Int32 getGroupPosition(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup);
+
+ /** calls propertyChanged when the header or footer is really turned on.
+ @param _rEvent the group
+ @param _bShow when <TRUE/> the header and footer will be shown otherwise not
+ */
+ void notifyGroupSections(const ::com::sun::star::container::ContainerEvent& _rEvent
+ ,bool _bShow);
+
+ /** change the sections for a group
+ @param _sPropName the header or footer
+ @param _xGroup the group
+ @param _nGroupPos the position of the group inside the groups collection or the previous index when it was removed
+ @param _bShow when <TRUE/> the header and footer will be shown otherwise not
+ */
+ void groupChange( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup
+ ,const ::rtl::OUString& _sPropName
+ ,sal_Int32 _nGroupPos
+ ,bool _bShow);
+
+ void executeMethodWithUndo(sal_uInt16 _nUndoStrId,const ::std::mem_fun_t<void,ODesignView>& _pMemfun);
+ void alignControlsWithUndo(sal_uInt16 _nUndoStrId,sal_Int32 _nControlModification,bool _bAlignAtSection = false);
+
+ // open the help agent of report designer at start time
+ void doOpenHelpAgent();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getXFrame();
+
+ /** shrink a section
+ @param _nUndoStrId the string id of the string which is shown in undo menu
+ @param _nShrinkId ID of what you would like to shrink.
+ */
+ void shrinkSectionBottom(::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection);
+ void shrinkSectionTop(::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection);
+
+ public:
+ void shrinkSection(sal_uInt16 _nUndoStrId, ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection, sal_Int32 _nShrinkId);
+
+ /** opens the file open dialog to allow the user to select a image which will be
+ * bound to a newly created image button.
+ */
+ void insertGraphic();
+
+ /** resets the floater
+ */
+ void updateFloater();
+
+ /** creates a new function in the given value context
+ *
+ * \param _aValue contains a XNameContainer
+ */
+ void createNewFunction(const ::com::sun::star::uno::Any& _aValue);
+
+ /** inserts a label - field pair into the current selected section
+ *
+ * \param aArgs
+ */
+ void addPairControls(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs);
+
+ /** inserts a label - field combination to show the page number and/or page count
+ *
+ * \param _aArgs
+ */
+ void createPageNumber(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs);
+
+ /** creates a formatted filed with TODAY() function and if set also an NOW() function
+ *
+ * \param _aArgs
+ */
+ void createDateTime(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs);
+
+ /** gets the current section (SdrView)
+ *
+ * \return the currently selected section or <NULL/> if noone is selected
+ */
+ OSectionView* getCurrentSectionView() const;
+
+ /**change the ZOrder of a current select object.
+ *
+ * \param _nId The command ID about what to do.
+ */
+ void changeZOrder(sal_Int32 _nId);
+
+ /** marks the next or previous section, when the first/last section was already selected then the report will be selected.
+ *
+ * \param _bNext
+ */
+ void markSection(const bool _bNext);
+
+ /** collapse or expand the currently selected section.
+ *
+ * \param _bCollapse collapse if sal_True otherwise expand
+ */
+ void collapseSection(const bool _bCollapse);
+
+ /** fills the member that chart is enabled or not
+ *
+ */
+ void checkChartEnabled();
+
+ /** set the zoom factor at the design view
+ */
+ void impl_zoom_nothrow();
+
+ virtual void impl_onModifyChanged();
+
+ virtual void onLoadedMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager );
+ virtual void impl_initialize( );
+ bool isUiVisible() const;
+
+ /** creates a new default control for the currently set type when the modifier KEY_MOD1 was pressed
+ * \param _aArgs must contain a properyvalue with name "KeyModifier" and value KEY_MOD1 when control should be created.
+ */
+ void createDefaultControl(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aArgs);
+
+ /** fills the state for the feture request.
+ @param _sProperty the property which should be filled in the value
+ @param _rState the state to fill
+ */
+ void impl_fillState_nothrow(const ::rtl::OUString& _sProperty,dbaui::FeatureState& _rState) const;
+ void impl_fillCustomShapeState_nothrow(const char* _pCustomShapeType,dbaui::FeatureState& _rState) const;
+
+ /** set the property at all selected controls.
+ @return <TRUE/> when the selection is not empty
+ */
+ bool impl_setPropertyAtControls_throw(const sal_uInt16 _nUndoResId
+ ,const ::rtl::OUString& _sProperty
+ ,const ::com::sun::star::uno::Any& _aValue
+ ,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs);
+
+ DECL_LINK( OnInvalidateClipboard, void* );
+ DECL_LINK( OnClipboardChanged, void* );
+ DECL_LINK( OnExecuteReport, void* );
+ DECL_LINK( OnOpenHelpAgent, void* );
+ short saveModified();
+ // all the features which should be handled by this class
+ virtual void describeSupportedFeatures();
+ // state of a feature. 'feature' may be the handle of a ::com::sun::star::util::URL somebody requested a dispatch interface for OR a toolbar slot.
+ virtual dbaui::FeatureState GetState(sal_uInt16 nId) const;
+ // execute a feature
+ virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
+
+ virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
+
+ private:
+ virtual ~OReportController();
+
+ public:
+ OReportController(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context);
+
+ DECL_LINK( EventLstHdl, VclWindowEvent* );
+ DECL_LINK( OnCreateHdl, OAddFieldWindow*);
+
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // SfxListener
+ virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint);
+
+ /** returns <TRUE/> when the command is enbaled
+ @param _nCommand the command id
+ @param _xControlFormat the report control format
+ */
+ sal_Bool isFormatCommandEnabled(sal_uInt16 _nCommand
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat>& _xControlFormat) const;
+
+ virtual sal_Bool Construct(Window* pParent);
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::frame::XController
+ virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL disposing();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ // need by registration
+ static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
+
+ // ::com::sun::star::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XSelectionSupplier
+ virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::frame::XController
+ virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getViewData(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL restoreViewData(const ::com::sun::star::uno::Any& Data) throw( ::com::sun::star::uno::RuntimeException );
+
+ /** gives access to the report definition
+ * \return the report definition object, may be <NULL/>
+ */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition> getReportDefinition() const { return m_xReportDefinition; }
+
+ // ::com::sun::star::frame::XController
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XTitle
+ virtual ::rtl::OUString SAL_CALL getTitle( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModeSelector
+ virtual void SAL_CALL setMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException) ;
+ virtual ::rtl::OUString SAL_CALL getMode( ) throw (::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes( ) throw (::com::sun::star::uno::RuntimeException) ;
+ virtual ::sal_Bool SAL_CALL supportsMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::uno::RuntimeException) ;
+
+ // XVisualObject
+ virtual void SAL_CALL setVisualAreaSize( ::sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMapUnit( ::sal_Int64 nAspect ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+
+ /** returns the current position of the splitter
+ *
+ * \return
+ */
+ inline sal_Int32 getSplitPos() const { return m_nSplitPos;}
+ inline void setSplitPos(sal_Int32 _nSplitPos) { m_nSplitPos = _nSplitPos;}
+
+ /** creates a new report from the report definition.
+ *
+ * \return The model or <NULL/> if the model could not be created.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> executeReport();
+
+ /** returns the RowSet which reflects the current settings of the report definition
+
+ The caller is allowed to hold a reference to the RowSet - it is kept alive as long
+ as the controller lives, and it's settings will follow the report definition's settings.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > getRowSet();
+
+ /** returns the number formatter
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > getReportNumberFormatter() const;
+
+ /** return the SdrModel of the real model
+ *
+ * \return
+ */
+ ::boost::shared_ptr<rptui::OReportModel> getSdrModel() const;
+
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; }
+ inline sal_Int16 getZoomValue() const { return m_nZoomValue; }
+ inline void resetZoomType() { m_eZoomType = SVX_ZOOM_PERCENT; }
+
+ // com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
+ }
+ // comphelper::OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ // cppu::OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const;
+ ::rtl::OUString getColumnLabel_throw(const ::rtl::OUString& i_sColumnName) const;
+
+ SfxUndoManager& getUndoManager() const;
+ void clearUndoManager() const;
+ void addUndoAction( SfxUndoAction* i_pAction );
+ };
+}
+#endif // RPTUI_REPORTCONTROLLER_HXX
+
diff --git a/reportdesign/source/ui/inc/ReportControllerObserver.hxx b/reportdesign/source/ui/inc/ReportControllerObserver.hxx
new file mode 100644
index 000000000000..5f7868c9fa14
--- /dev/null
+++ b/reportdesign/source/ui/inc/ReportControllerObserver.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * 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 INCLUDED_REPORTCONTROLLEROBSERVER_HXX
+#define INCLUDED_REPORTCONTROLLEROBSERVER_HXX
+
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/report/XReportDefinition.hpp>
+#include <cppuhelper/implbase3.hxx>
+
+#include <memory>
+#include <dllapi.h>
+#include <vector>
+
+// #include <svl/lstner.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/link.hxx>
+
+#include <FormattedFieldBeautifier.hxx>
+#include <FixedTextColor.hxx>
+
+namespace rptui
+{
+ class OReportController;
+ class OXReportControllerObserverImpl;
+
+ //========================================================================
+ class /* REPORTDESIGN_DLLPUBLIC */ OXReportControllerObserver
+ : public ::cppu::WeakImplHelper3< ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::util::XModifyListener
+ >
+ /*,public SfxListener*/
+ {
+
+ const ::std::auto_ptr<OXReportControllerObserverImpl> m_pImpl;
+
+ FormattedFieldBeautifier m_aFormattedFieldBeautifier;
+ FixedTextColor m_aFixedTextColor;
+
+ // do not allow copy
+ OXReportControllerObserver(const OXReportControllerObserver&);
+ OXReportControllerObserver& operator=(const OXReportControllerObserver&);
+ virtual ~OXReportControllerObserver(); // UNO Object must have private destructor!
+ public:
+ OXReportControllerObserver(const OReportController& _rController);
+
+// protected:
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+
+ // 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);
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+
+ void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+ void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+
+ void AddSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection);
+ void RemoveSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection );
+
+ // SfxListener
+ // virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ /**
+ Create an object ob OUndoEnvLock locks the undo possibility
+ As long as in the OUndoEnvLock scope, no undo is possible for manipulated object.
+ */
+ class OEnvLock
+ {
+ OXReportControllerObserver& m_rObserver;
+ public:
+ OEnvLock(OXReportControllerObserver& _rObserver): m_rObserver(_rObserver){m_rObserver.Lock();}
+ ~OEnvLock(){ m_rObserver.UnLock(); }
+ };
+
+ void Lock();
+ void UnLock();
+ sal_Bool IsLocked() const;
+
+ void Clear();
+ private:
+
+ void TogglePropertyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+ void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(());
+ void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(());
+
+ // void ModeChanged(); // will be called from 'Notify'
+ DECL_LINK(SettingsChanged, VclWindowEvent* );
+ private:
+
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild> >::const_iterator getSection(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild>& _xContainer) const;
+
+ };
+
+} // namespace rptui
+
+#endif /* INCLUDED_REPORTCONTROLLEROBSERVER_HXX */
+
+
diff --git a/reportdesign/source/ui/inc/ReportDefines.hxx b/reportdesign/source/ui/inc/ReportDefines.hxx
new file mode 100644
index 000000000000..9d207c9c9142
--- /dev/null
+++ b/reportdesign/source/ui/inc/ReportDefines.hxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * 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_REPORT_DEFINES_HXX
+#define RPTUI_REPORT_DEFINES_HXX
+
+namespace rptui
+{
+ enum DlgEdMode { RPTUI_INSERT, RPTUI_SELECT, RPTUI_TEST, RPTUI_READONLY };
+
+#define REPORT_STARTMARKER_WIDTH 120
+#define REPORT_ENDMARKER_WIDTH 10
+#define REPORT_EXTRA_SPACE 10
+
+}
+#endif //RPTUI_REPORT_DEFINES_HXX
diff --git a/reportdesign/source/ui/inc/ReportRuler.hxx b/reportdesign/source/ui/inc/ReportRuler.hxx
new file mode 100644
index 000000000000..a14e3a2dffdb
--- /dev/null
+++ b/reportdesign/source/ui/inc/ReportRuler.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * 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_RULER_HXX
+#define RPTUI_RULER_HXX
+
+#include <vcl/window.hxx>
+#include <com/sun/star/report/XSection.hpp>
+
+namespace rptui
+{
+ class OReportSection;
+ class OReportWindow;
+ class OReportRuler : public Window
+ {
+ OReportSection* m_pSection;
+ OReportWindow* m_pParent;
+ sal_Bool m_bShow;
+ OReportRuler(OReportRuler&);
+ void operator =(OReportRuler&);
+ public:
+ OReportRuler(Window* _pParent,OReportWindow* _pReportWindowt,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
+ virtual ~OReportRuler();
+
+ // windows overloads
+ virtual void Resize();
+
+ inline OReportSection* getSection() const { return m_pSection; }
+ inline OReportWindow* getView() const { return m_pParent; }
+
+ /** makes the grid visible
+ *
+ * \param _bVisible when <TRUE/> the grid is made visible
+ */
+ void SetGridVisible(sal_Bool _bVisible);
+ };
+//==============================================================================
+} // rptui
+//==============================================================================
+#endif // RPTUI_RULER_HXX
diff --git a/reportdesign/source/ui/inc/ReportSection.hxx b/reportdesign/source/ui/inc/ReportSection.hxx
new file mode 100644
index 000000000000..1a6cc07b4169
--- /dev/null
+++ b/reportdesign/source/ui/inc/ReportSection.hxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * 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 REPORT_REPORTSECTION_HXX
+#define REPORT_REPORTSECTION_HXX
+
+#include <vcl/window.hxx>
+#include "RptPage.hxx"
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <comphelper/propmultiplex.hxx>
+#include "cppuhelper/basemutex.hxx"
+#include "ReportDefines.hxx"
+#include "dlgedfunc.hxx"
+#include <svtools/transfer.hxx>
+#include <rtl/ref.hxx>
+#include <boost/shared_ptr.hpp>
+#include <memory>
+
+namespace rptui
+{
+ class OReportModel;
+ class OReportPage;
+ class OSectionView;
+ class OSectionWindow;
+
+ class OReportSection : public Window
+ , public ::cppu::BaseMutex
+ , public ::comphelper::OPropertyChangeListener
+ , public DropTargetHelper
+ {
+ OReportPage* m_pPage;
+ OSectionView* m_pView;
+ OSectionWindow* m_pParent;
+ ::std::auto_ptr<DlgEdFunc> m_pFunc;
+ ::boost::shared_ptr<OReportModel> m_pModel;
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pMulti;
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > m_xSection;
+
+ DlgEdMode m_eMode;
+ sal_Bool m_bDialogModelChanged;
+ sal_Bool m_bInDrag;
+
+ /** fills the section with all control from the report section
+ */
+ void fill();
+
+ OReportSection(OReportSection&);
+ void operator =(OReportSection&);
+ protected:
+ // DropTargetHelper overridables
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt );
+
+ // window overrides
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Resize();
+
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
+ public:
+ OReportSection(OSectionWindow* _pParent,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
+ virtual ~OReportSection();
+
+ // window overrides
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+
+ /** copies the current selection in this section
+ @param _rAllreadyCopiedObjects This is an out/in put param which contains all already copied objects.
+ */
+ void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rAllreadyCopiedObjects);
+
+ void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rAllreadyCopiedObjects,bool _bEraseAnddNoClone);
+
+ /** paste a new control in this section
+ @param _aAllreadyCopiedObjects objects to paste into the section. Only objects are pasted where the name is equal to the section name.
+ @param _bForce If set to <TRUE/> than the objects will be copied into this section. The name is not compared in this case.
+ */
+ void Paste(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _aAllreadyCopiedObjects,bool _bForce = false);
+
+ /** Deletes the current selection in this section
+ *
+ */
+ void Delete();
+
+ /** All objects will be marked.
+ */
+ void SelectAll(const sal_uInt16 _nObjectType);
+
+ /** makes the grid visible
+ *
+ * \param _bVisible when <TRUE/> the grid is made visible
+ */
+ void SetGridVisible(sal_Bool _bVisible);
+
+ inline OSectionWindow* getSectionWindow() const { return m_pParent; }
+ inline OSectionView& getSectionView() const { return *m_pView; }
+ inline OReportPage* getPage() const { return m_pPage; }
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getSection() const { return m_xSection; }
+
+ void SetDialogModelChanged( sal_Bool bChanged = sal_True ) { m_bDialogModelChanged = bChanged; }
+ sal_Bool IsDialogModelChanged() const { return m_bDialogModelChanged; }
+ DlgEdMode GetMode() const { return m_eMode; }
+ void SetMode( DlgEdMode m_eMode );
+
+ /** checks if the keycode is known by the child windows
+ @param _rCode the keycode
+ @return <TRUE/> if the keycode is handled otherwise <FALSE/>
+ */
+ sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
+
+ /** returns the current control report model or <NULL/>
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const;
+
+ /** fills the vector with all selected control models
+ /param _rSelection The vector will be filled and will not be cleared before.
+ */
+ void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
+
+ /** creates a default object (custom shape)
+ *
+ * @param _sType
+ */
+ void createDefault(const ::rtl::OUString& _sType);
+
+ /** creates a new default custom shape
+ *
+ * \param _sType
+ * \param _pObj
+ */
+ void createDefault(const ::rtl::OUString& _sType,SdrObject* _pObj);
+ void stopScrollTimer();
+
+ /** deactivate the currect active ole object if any
+ */
+ void deactivateOle();
+
+ /** returns true when an ole object is currently active
+ */
+ bool isUiActive() const;
+ };
+//==================================================================
+} //rptui
+//==================================================================
+#endif // REPORT_REPORTSECTION_HXX
+
diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx
new file mode 100644
index 000000000000..da1dd620a15f
--- /dev/null
+++ b/reportdesign/source/ui/inc/ReportWindow.hxx
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * 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_REPORT_WINDOW_HXX
+#define RPTUI_REPORT_WINDOW_HXX
+
+#include <com/sun/star/report/XSection.hpp>
+#include "ReportDefines.hxx"
+#include "StartMarker.hxx"
+#include <svtools/ruler.hxx>
+#include <svx/svdedtv.hxx>
+#include <svx/zoomitem.hxx>
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+#include <MarkedSection.hxx>
+#include "ViewsWindow.hxx"
+
+class Splitter;
+
+namespace rptui
+{
+ class ODesignView;
+ class OReportSection;
+ class OScrollWindowHelper;
+ class OSectionView;
+ class OReportModel;
+ class OEndMarker;
+ class OReportPage;
+ class DlgEdFunc;
+ class DlgEdFactory;
+
+ class OReportWindow : public Window, public IMarkedSection
+ {
+ Ruler m_aHRuler;
+ ODesignView* m_pView;
+ OScrollWindowHelper* m_pParent;
+ OViewsWindow m_aViewsWindow;
+ ::std::auto_ptr<DlgEdFactory>
+ m_pObjFac;
+
+ void ImplInitSettings();
+
+ sal_Int32 GetTotalHeight() const;
+ sal_Int32 impl_getRealPixelWidth() const;
+
+ OReportWindow(OReportWindow&);
+ void operator =(OReportWindow&);
+ protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ public:
+ OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView);
+ virtual ~OReportWindow();
+
+ /** late ctor
+ */
+ void initialize();
+ // WINDOW overloads
+ virtual void Resize();
+
+ inline ODesignView* getReportView() const { return m_pView; }
+ inline OScrollWindowHelper* getScrollWindow() const { return m_pParent; }
+
+ void SetMode( DlgEdMode m_eMode );
+ void SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString());
+ rtl::OUString GetInsertObjString() const;
+ void setGridSnap(sal_Bool bOn);
+ void setDragStripes(sal_Bool bOn);
+
+ /** copies the current selection in this section
+ */
+ void Copy();
+
+ /** returns if paste is allowed
+ *
+ * \return <TRUE/> if paste is allowed
+ */
+ sal_Bool IsPasteAllowed() const;
+
+ /** paste a new control in this section
+ */
+ void Paste();
+
+ /** Deletes the current selection in this section
+ *
+ */
+ void Delete();
+
+ /** All objects will be marked.
+ */
+ void SelectAll(const sal_uInt16 _nObjectType);
+
+ /** returns <TRUE/> when a object is marked
+ */
+ sal_Bool HasSelection() const;
+
+ Point getThumbPos() const;
+
+ /** removes the section at the given position.
+ *
+ * \param _nPosition Zero based.
+ */
+ void removeSection(sal_uInt16 _nPosition);
+
+ /** adds a new section at position _nPosition.
+ If the section is <NULL/> nothing happens.
+ If the position is grater than the current elements, the section will be appended.
+ */
+ void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
+ ,const ::rtl::OUString& _sColorEntry
+ ,sal_uInt16 _nPosition = USHRT_MAX);
+
+ sal_uInt16 getSectionCount() const;
+
+ /** turns the grid on or off
+ *
+ * \param _bVisible
+ */
+ void toggleGrid(sal_Bool _bVisible);
+
+
+ /** shows the ruler
+ */
+ void showRuler(sal_Bool _bShow);
+
+ inline sal_Int32 getRulerHeight() const { return m_aHRuler.GetSizePixel().Height(); }
+
+ /** returns the total width of the first section
+ */
+ sal_Int32 GetTotalWidth() const;
+
+ /** calculate the max width of the markers
+ *
+ * @param _bWithEnd if <TRUE/> the end marker will be used for calculation as well otherwise not.
+ * \return the max width
+ */
+ sal_Int32 getMaxMarkerWidth(sal_Bool _bWithEnd) const;
+
+ void ScrollChildren(const Point& _aThumbPos);
+
+ void notifySizeChanged();
+
+ /** unmark all objects on the views without the given one.
+ *
+ * @param _pSectionView The view where the objects should not be unmarked.
+ */
+ void unmarkAllObjects(OSectionView* _pSectionView);
+
+ /** triggers the property browser with the report component or section
+ @param _xReportComponent
+ */
+ void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xReportComponent);
+
+ /** checks if the keycode is known by the child windows
+ @param _rCode the keycode
+ @return <TRUE/> if the keycode is handled otherwise <FALSE/>
+ */
+ sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
+
+ /** the the section as marked or not marked
+ @param _pSectionView the section where to set the marked flag
+ @param _bMark the marked flag
+ */
+ void setMarked(OSectionView* _pSectionView,sal_Bool _bMark);
+ void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark);
+ void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark);
+
+ // IMarkedSection
+ ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const;
+ ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+ virtual void markSection(const sal_uInt16 _nPos);
+
+
+ /** fills the positions of all collapsed sections.
+ *
+ * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
+ */
+ void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
+
+ /** collpase all sections given by their position
+ *
+ * \param _aCollpasedSections The position of the sections which should be collapsed.
+ */
+ void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
+
+ /** align all marked objects in all sections
+ *
+ * \param eHor
+ * \param eVert
+ * \param bBoundRects
+ */
+ void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false);
+
+ sal_uInt32 getMarkedObjectCount() const;
+
+ /** zoom the ruler and view windows
+ */
+ void zoom(const Fraction& _aZoom);
+
+ /** fills the vector with all selected control models
+ /param _rSelection The vector will be filled and will not be cleared before.
+ */
+ void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
+
+ /** calculates the zoom factor.
+ @param _eType which kind of zoom is needed
+ */
+ sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
+ };
+//==================================================================
+} //rptui
+//==================================================================
+#endif // RPTUI_REPORT_WINDOW_HXX
+
diff --git a/reportdesign/source/ui/inc/RptUndo.hxx b/reportdesign/source/ui/inc/RptUndo.hxx
new file mode 100644
index 000000000000..bd3b9606a8e3
--- /dev/null
+++ b/reportdesign/source/ui/inc/RptUndo.hxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * 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_UNDO_HXX
+#define RPTUI_UNDO_HXX
+
+#include "UndoActions.hxx"
+#include <functional>
+
+FORWARD_DECLARE_INTERFACE(awt,XControl)
+FORWARD_DECLARE_INTERFACE(awt,XControlContainer)
+FORWARD_DECLARE_INTERFACE(drawing,XShape)
+namespace dbaui
+{
+ class IController;
+}
+namespace rptui
+{
+ class OObjectBase;
+
+
+ /** \class OSectionUndo
+ * Undo class for section add and remove.
+ */
+ class OSectionUndo : public OCommentUndoAction
+ {
+ OSectionUndo(const OSectionUndo&);
+ void operator =(const OSectionUndo&);
+ protected:
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> >
+ m_aControls;
+ ::std::vector< ::std::pair< ::rtl::OUString ,::com::sun::star::uno::Any> >
+ m_aValues;
+ Action m_eAction;
+ sal_uInt16 m_nSlot;
+ bool m_bInserted;
+
+ virtual void implReInsert( ) = 0;
+ virtual void implReRemove( ) = 0;
+
+ void collectControls(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
+ public:
+ TYPEINFO();
+ OSectionUndo( OReportModel& rMod
+ ,sal_uInt16 _nSlot
+ ,Action _eAction
+ ,sal_uInt16 nCommentID);
+ virtual ~OSectionUndo();
+
+ virtual void Undo();
+ virtual void Redo();
+ };
+
+ /** Undo action for the group header, footer, page header, footer
+ */
+ class OReportSectionUndo : public OSectionUndo
+ {
+ OReportHelper m_aReportHelper;
+ ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
+ ,OReportHelper> m_pMemberFunction;
+
+ void implReInsert( );
+ void implReRemove( );
+ OReportSectionUndo(const OReportSectionUndo&);
+ void operator =(const OReportSectionUndo&);
+ public:
+ TYPEINFO();
+ //OReportSectionUndo( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
+ OReportSectionUndo( OReportModel& rMod
+ ,sal_uInt16 _nSlot
+ ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
+ ,OReportHelper> _pMemberFunction
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReport
+ ,Action _eAction
+ ,sal_uInt16 nCommentID);
+ virtual ~OReportSectionUndo();
+ };
+
+ /** Undo action for the group header, footer
+ */
+ class OGroupSectionUndo : public OSectionUndo
+ {
+ OGroupHelper m_aGroupHelper;
+ ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
+ ,OGroupHelper> m_pMemberFunction;
+
+ mutable ::rtl::OUString m_sName;
+
+ void implReInsert( );
+ void implReRemove( );
+ OGroupSectionUndo(const OGroupSectionUndo&);
+ void operator =(const OGroupSectionUndo&);
+ public:
+ TYPEINFO();
+ //OGroupSectionUndo( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
+ OGroupSectionUndo( OReportModel& rMod
+ ,sal_uInt16 _nSlot
+ ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
+ ,OGroupHelper> _pMemberFunction
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup
+ ,Action _eAction
+ ,sal_uInt16 nCommentID);
+
+ virtual String GetComment() const;
+ };
+
+ /** /class OGroupUndo
+ * \brief Undo action for removing a group object.
+ */
+ class OGroupUndo : public OCommentUndoAction
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> m_xGroup; ///<! the group for the undo redo action
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition; ///<! the parent report definition
+ Action m_eAction; ///<! the current action
+ sal_Int32 m_nLastPosition; ///<! the last position of the group
+
+ void implReInsert( );
+ void implReRemove( );
+ public:
+ TYPEINFO();
+ OGroupUndo(OReportModel& rMod
+ ,sal_uInt16 nCommentID
+ ,Action _eAction
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReportDefinition);
+ virtual void Undo();
+ virtual void Redo();
+ };
+}
+#endif // RPTUI_UNDO_HXX
diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx
new file mode 100644
index 000000000000..1f9f73533340
--- /dev/null
+++ b/reportdesign/source/ui/inc/ScrollHelper.hxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * 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_SCROLLHELPER_HXX
+#define RPTUI_SCROLLHELPER_HXX
+
+#include <vcl/scrbar.hxx>
+#include <com/sun/star/report/XSection.hpp>
+#include <comphelper/propmultiplex.hxx>
+#include "ReportDefines.hxx"
+#include <svtools/colorcfg.hxx>
+#include <svx/svdedtv.hxx>
+#include "cppuhelper/basemutex.hxx"
+#include <rtl/ref.hxx>
+#include <boost/shared_ptr.hpp>
+#include <vcl/dockwin.hxx>
+#include <MarkedSection.hxx>
+#include "ReportWindow.hxx"
+
+class SdrView;
+namespace rptui
+{
+ class ODesignView;
+ class OReportWindow;
+ class OSectionView;
+ class OReportSection;
+ class OReportModel;
+
+ /** This class defines the scrollable area of the report design. It includes
+ the h-ruler and the sections, and end marker. Not the start marker.
+ */
+ typedef Window OScrollWindowHelper_BASE;
+ class OScrollWindowHelper : public ::cppu::BaseMutex
+ , public OScrollWindowHelper_BASE/*TabPage*/
+ , public ::comphelper::OPropertyChangeListener
+ , public IMarkedSection
+ {
+ private:
+ ScrollBar m_aHScroll;
+ ScrollBar m_aVScroll;
+ ScrollBarBox m_aCornerWin; // window in the bottom right corner
+ Size m_aTotalPixelSize;
+ ODesignView* m_pParent;
+ OReportWindow m_aReportWindow;
+ ::rtl::Reference<comphelper::OPropertyChangeMultiplexer >
+ m_pReportDefintionMultiPlexer; // listener for property changes
+
+ DECL_LINK( ScrollHdl, ScrollBar*);
+ Size ResizeScrollBars();
+ void ImplInitSettings();
+ void impl_initScrollBar( ScrollBar& _rScrollBar ) const;
+
+ OScrollWindowHelper(OScrollWindowHelper&);
+ void operator =(OScrollWindowHelper&);
+ protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ // window
+ virtual void Resize();
+ virtual long Notify( NotifyEvent& rNEvt );
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
+ public:
+ OScrollWindowHelper( ODesignView* _pReportDesignView);
+ virtual ~OScrollWindowHelper();
+
+ /** late ctor
+ */
+ void initialize();
+
+ inline Point getThumbPos() const { return Point(m_aHScroll.GetThumbPos(),m_aVScroll.GetThumbPos())/*m_aScrollOffset*/; }
+ inline const OReportWindow& getReportWindow() const { return m_aReportWindow; }
+ void setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight);
+ inline Size getTotalSize() const { return m_aTotalPixelSize; }
+ inline ScrollBar* GetHScroll() { return &m_aHScroll; }
+ inline ScrollBar* GetVScroll() { return &m_aVScroll; }
+
+ // forwards
+ void SetMode( DlgEdMode _eMode );
+ void SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString());
+ rtl::OUString GetInsertObjString() const;
+ void setGridSnap(sal_Bool bOn);
+ void setDragStripes(sal_Bool bOn);
+ /** copies the current selection in this section
+ */
+ void Copy();
+
+ /** returns if paste is allowed
+ *
+ * \return <TRUE/> if paste is allowed
+ */
+ sal_Bool IsPasteAllowed() const;
+
+ /** paste a new control in this section
+ */
+ void Paste();
+
+ /** Deletes the current selection in this section
+ *
+ */
+ void Delete();
+
+ /** All objects will be marked.
+ */
+ void SelectAll(const sal_uInt16 _nObjectType);
+
+ /** returns <TRUE/> when a object is marked
+ */
+ sal_Bool HasSelection() const;
+
+ /** removes the section at the given position.
+ *
+ * \param _nPosition Zero based.
+ */
+ void removeSection(sal_uInt16 _nPosition);
+
+ /** adds a new section at position _nPosition.
+ If the section is <NULL/> nothing happens.
+ If the position is grater than the current elements, the section will be appended.
+ */
+ void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
+ ,const ::rtl::OUString& _sColorEntry
+ ,sal_uInt16 _nPosition = USHRT_MAX);
+
+ sal_uInt16 getSectionCount() const;
+
+ /** turns the grid on or off
+ *
+ * \param _bVisible
+ */
+ void toggleGrid(sal_Bool _bVisible);
+
+ /** unmark all objects on the views without the given one.
+ *
+ * @param _pSectionView The view where the objects should not be unmarked.
+ */
+ void unmarkAllObjects(OSectionView* _pSectionView);
+
+ /** shows or hides the ruler.
+ */
+ void showRuler(sal_Bool _bShow);
+
+ /** calculate the max width of the markers
+ *
+ * @param _bWithEnd if <TRUE/> the end marker will be used for calculation as well otherwise not.
+ * \return the max width
+ */
+ sal_Int32 getMaxMarkerWidth(sal_Bool _bWithEnd) const;
+
+ /** checks if the keycode is known by the child windows
+ @param _rCode the keycode
+ @return <TRUE/> if the keycode is handled otherwise <FALSE/>
+ */
+ sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
+
+ /** the the section as marked or not marked
+ @param _pSectionView the section where to set the marked flag
+ @param _bMark the marked flag
+ */
+ void setMarked(OSectionView* _pSectionView,sal_Bool _bMark);
+ void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark);
+ void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark);
+
+ // IMarkedSection
+ ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const;
+ ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+ virtual void markSection(const sal_uInt16 _nPos);
+
+
+ /** fills the positions of all collapsed sections.
+ *
+ * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
+ */
+ void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
+
+ /** collpase all sections given by their position
+ *
+ * \param _aCollpasedSections The position of the sections which should be collapsed.
+ */
+ void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
+
+ /** align all marked objects in all sections
+ *
+ * \param eHor
+ * \param eVert
+ * \param bBoundRects
+ */
+ void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false);
+
+ sal_uInt32 getMarkedObjectCount() const;
+
+ /** zoom the ruler and view windows
+ */
+ void zoom(const Fraction& _aZoom);
+
+ /** fills the vector with all selected control models
+ /param _rSelection The vector will be filled and will not be cleared before.
+ */
+ void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
+
+ /** calculates the zoom factor.
+ @param _eType which kind of zoom is needed
+ */
+ sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
+ };
+}
+#endif // RPTUI_SCROLLHELPER_HXX
diff --git a/reportdesign/source/ui/inc/SectionView.hxx b/reportdesign/source/ui/inc/SectionView.hxx
new file mode 100644
index 000000000000..71d07db7b7a2
--- /dev/null
+++ b/reportdesign/source/ui/inc/SectionView.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _REPORT_SECTIONVIEW_HXX
+#define _REPORT_SECTIONVIEW_HXX
+
+
+#include <svx/svdview.hxx>
+namespace rptui
+{
+class OReportWindow;
+class OReportSection;
+
+//============================================================================
+// OSectionView
+//============================================================================
+
+class OSectionView : public SdrView
+{
+private:
+ OReportWindow* m_pReportWindow;
+ OReportSection* m_pSectionWindow;
+
+ void ObjectRemovedInAliveMode( const SdrObject* pObject );
+ OSectionView(const OSectionView&);
+ void operator =(const OSectionView&);
+public:
+ TYPEINFO();
+
+ OSectionView( SdrModel* pModel, OReportSection* _pSectionWindow, OReportWindow* pEditor );
+ virtual ~OSectionView();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ virtual void MarkListHasChanged();
+ virtual void MakeVisible( const Rectangle& rRect, Window& rWin );
+
+ inline OReportSection* getReportSection() const { return m_pSectionWindow; }
+
+ // switch the marked objects to the given layer.
+ void SetMarkedToLayer( SdrLayerID nLayerNo );
+
+ // return true when only shapes are marked, otherwise false.
+ bool OnlyShapesMarked() const;
+
+ /* returns the common layer id of the marked objects, otherwise -1 will be returned.
+ */
+ short GetLayerIdOfMarkedObjects() const;
+
+ // returns true if objects at Drag & Drop is resize not move
+ bool IsDragResize() const;
+};
+}
+#endif //_REPORT_SECTIONVIEW_HXX
diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx
new file mode 100644
index 000000000000..8afd59ee2de8
--- /dev/null
+++ b/reportdesign/source/ui/inc/SectionWindow.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * 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_SECTIONWINDOW_HXX
+#define RPTUI_SECTIONWINDOW_HXX
+
+#include <com/sun/star/report/XSection.hpp>
+#include <vcl/window.hxx>
+#include <vcl/split.hxx>
+#include <svtools/colorcfg.hxx>
+#include <comphelper/propmultiplex.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include "UITools.hxx"
+#include "UndoActions.hxx"
+#include "StartMarker.hxx"
+#include "EndMarker.hxx"
+#include "ReportSection.hxx"
+
+#include <list>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+namespace comphelper
+{
+ class OPropertyChangeMultiplexer;
+}
+namespace rptui
+{
+ class OReportWindow;
+ class ODesignView;
+ class OViewsWindow;
+ class OSectionWindow : public Window
+ , public ::cppu::BaseMutex
+ , public ::comphelper::OPropertyChangeListener
+ {
+ OViewsWindow* m_pParent;
+ OStartMarker m_aStartMarker;
+ OReportSection m_aReportSection;
+ Splitter m_aSplitter;
+ OEndMarker m_aEndMarker;
+
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pSectionMulti;
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pGroupMulti;
+
+ OSectionWindow(OSectionWindow&);
+ void operator =(OSectionWindow&);
+
+ /** set the title of the group header or footer
+ *
+ * \param _xGroup
+ * \param _nResId
+ * \param _pGetSection
+ * \param _pIsSectionOn
+ * @return sal_True when title was set otherwise FALSE
+ */
+ bool setGroupSectionTitle(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup,sal_uInt16 _nResId,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> , OGroupHelper> _pGetSection,::std::mem_fun_t<sal_Bool, OGroupHelper> _pIsSectionOn);
+
+ /** set the title of the (report/page) header or footer
+ *
+ * \param _xGroup
+ * \param _nResId
+ * \param _pGetSection
+ * \param _pIsSectionOn
+ * @return sal_True when title was set otherwise FALSE
+ */
+ bool setReportSectionTitle(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,sal_uInt16 _nResId,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> , OReportHelper> _pGetSection,::std::mem_fun_t<sal_Bool, OReportHelper> _pIsSectionOn);
+ void ImplInitSettings();
+
+ DECL_LINK(Collapsed,OColorListener*);
+ DECL_LINK(StartSplitHdl, Splitter*);
+ DECL_LINK(SplitHdl, Splitter*);
+ DECL_LINK(EndSplitHdl, Splitter*);
+
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ // windows overload
+ virtual void Resize();
+
+ protected:
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
+ public:
+ OSectionWindow( OViewsWindow* _pParent
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
+ ,const ::rtl::OUString& _sColorEntry);
+ virtual ~OSectionWindow();
+
+ inline OStartMarker& getStartMarker() { return m_aStartMarker; }
+ inline OReportSection& getReportSection() { return m_aReportSection; }
+ inline OEndMarker& getEndMarker() { return m_aEndMarker; }
+ inline OViewsWindow* getViewsWindow() { return m_pParent; }
+
+ void setCollapsed(sal_Bool _bCollapsed);
+
+ /** triggers the property browser with the section
+ @param _pStartMarker
+ */
+ void showProperties();
+
+ /** set the marker as marked or not marked
+ @param _bMark set the new state of the marker
+ */
+ void setMarked(sal_Bool _bMark);
+
+ OViewsWindow* getViewsWindow() const { return m_pParent; }
+
+ /** zoom the ruler and view windows
+ */
+ void zoom(const Fraction& _aZoom);
+
+ void scrollChildren(long _nThumbPosX);
+ };
+//==============================================================================
+} // rptui
+//==============================================================================
+#endif // RPTUI_SECTIONWINDOW_HXX
+
diff --git a/reportdesign/source/ui/inc/StartMarker.hxx b/reportdesign/source/ui/inc/StartMarker.hxx
new file mode 100644
index 000000000000..d1746cc46b11
--- /dev/null
+++ b/reportdesign/source/ui/inc/StartMarker.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * 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_STARTMARKER_HXX
+#define RPTUI_STARTMARKER_HXX
+
+#include <osl/interlck.h>
+#include <svtools/ruler.hxx>
+#include "ColorListener.hxx"
+#include <vcl/fixed.hxx>
+
+
+namespace rptui
+{
+ class OSectionWindow;
+ class OStartMarker : public OColorListener
+ {
+
+ Ruler m_aVRuler;
+ FixedText m_aText;
+ FixedImage m_aImage;
+ OSectionWindow* m_pParent;
+ static Image* s_pDefCollapsed;
+ static Image* s_pDefExpanded;
+ static Image* s_pDefCollapsedHC;
+ static Image* s_pDefExpandedHC;
+ static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed
+
+ sal_Bool m_bShowRuler;
+
+ void changeImage();
+ void initDefaultNodeImages();
+ void setColor();
+ virtual void ImplInitSettings();
+ OStartMarker(OStartMarker&);
+ void operator =(OStartMarker&);
+ public:
+ OStartMarker(OSectionWindow* _pParent,const ::rtl::OUString& _sColorEntry);
+ virtual ~OStartMarker();
+
+ // SfxListener
+ virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint);
+ // window overloads
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Resize();
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ using Window::Notify;
+
+ void setTitle(const String& _sTitle);
+ sal_Int32 getMinHeight() const;
+
+ /** shows or hides the ruler.
+ */
+ void showRuler(sal_Bool _bShow);
+
+ virtual void setCollapsed(sal_Bool _bCollapsed);
+
+ /** zoom the ruler and view windows
+ */
+ void zoom(const Fraction& _aZoom);
+ };
+}
+#endif // RPTUI_STARTMARKER_HXX
+
diff --git a/reportdesign/source/ui/inc/UITools.hxx b/reportdesign/source/ui/inc/UITools.hxx
new file mode 100644
index 000000000000..2b5ab62bcb11
--- /dev/null
+++ b/reportdesign/source/ui/inc/UITools.hxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * 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_UITOOLS_HXX
+#define RPTUI_UITOOLS_HXX
+
+#include <com/sun/star/report/XGroup.hpp>
+#include <com/sun/star/report/XReportControlFormat.hpp>
+#include <com/sun/star/report/XShape.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include "ReportSection.hxx"
+#include <rtl/ref.hxx>
+#include <vcl/taskpanelist.hxx>
+#include <comphelper/stl_types.hxx>
+#include <functional>
+
+class SdrPage;
+class SdrObject;
+class SdrUnoObj;
+class SdrView;
+class Rectangle;
+namespace comphelper
+{
+ class OPropertyChangeMultiplexer;
+ class OPropertyChangeListener;
+}
+namespace rptui
+{
+ /** returns the position of the object inside the index container
+ @param _xReportDefinition the report definition to get the groups
+ @param _xGroup the group to search
+ @return returns the position of the group in the list, otherwise -1
+ */
+ template<typename T> sal_Int32 getPositionInIndexAccess(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _xCollection
+ ,const ::com::sun::star::uno::Reference< T >& _xSearch)
+ {
+ sal_Int32 nCount = _xCollection->getCount();
+ sal_Int32 i = (nCount == 0) ? -1 : 0;
+ for (;i<nCount ; ++i)
+ {
+ ::com::sun::star::uno::Reference< T > xObject(_xCollection->getByIndex(i),::com::sun::star::uno::UNO_QUERY);
+ if ( xObject == _xSearch )
+ break;
+ } // for (;i<nCount ; ++i)
+ return i;
+ }
+
+ /** set the name of the header and footer of the group by the expression appended by the localized name of the section
+ @param _xGroup the group where the header/footer name is set by the expression of the group
+ */
+ void adjustSectionName(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup,sal_Int32 _nPos);
+
+ /** add a listener for the properties size, left margin, right margin to the page style
+ *
+ * \param _xReportDefinition
+ * \param _pListener
+ * \return
+ */
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> addStyleListener( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReportDefinition
+ ,::comphelper::OPropertyChangeListener* _pListener);
+
+ /** opens the common character font dialog
+ */
+ bool openCharDialog(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat>& _xReportControlFormat,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _out_rNewValues
+ );
+
+ /** opens the area dialog for shapes
+ */
+ bool openAreaDialog(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::report::XShape >& _xShape
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow
+ );
+
+ /** opens the formula dialog
+ @param _out_rFormula
+ the formula chosen by the user
+ @precond
+ we're really inspecting a database report (well, a RowSet at least)
+ @return
+ <TRUE/> if and only if the user successfully chose a clause
+ */
+ bool openDialogFormula_nothrow( ::rtl::OUString& _in_out_rFormula
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow
+ , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet
+ );
+
+ /** applies the character settings previously obtained via openCharDialog
+ */
+ void applyCharacterSettings(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat >& _rxReportControlFormat,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rSettings
+ );
+
+ /** notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search _pWindow.
+ @param _pWindow
+ The window which is used to search for the SystemWindow.
+ @param _pToRegister
+ The window which should be added or removed on the TaskPaneList.
+ @param _rMemFunc
+ The member function which should be called at the SystemWindow when found.
+ Possible values are:
+ ::comphelper::mem_fun(&TaskPaneList::AddWindow)
+ ::comphelper::mem_fun(&TaskPaneList::RemoveWindow)
+ */
+ void notifySystemWindow(Window* _pWindow,Window* _pToRegister, ::comphelper::mem_fun1_t<TaskPaneList,Window*> _rMemFunc);
+
+
+ const sal_Int16 ISOVER_IGNORE_CUSTOMSHAPES = 1;
+
+ /** checks whether the given rectangle overlapps another OUnoObject object in that view.
+ *
+ * \param _rRect
+ * \param _rPage
+ * \param _bAllObjects if <TRUE/> all objects are taken into account, otherwise only not marked ones
+ * \return the object which is overlapped, otherwise <NULL/>
+ */
+ SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false,SdrObject* _pIgnore = NULL, sal_Int16 _nIgnoreType=0);
+
+ SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj* _pIgnoreList[], int _nIgnoreListLength);
+
+ /** checks whether the given OUnoObject object rectangle overlapps another object in that view.
+ *
+ * \param _pObj
+ * \param _rPage
+ * \param _rView
+ * \param _bAllObjects if <TRUE/> all objects are taken into account, otherwise only not marked ones
+ * \return the object which is overlapped, otherwise <NULL/>. If the given object is not of type OUnoObject <NULL/> will be returned.
+ */
+ SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false);
+
+ /** retrieves the names of the parameters of the command which the given RowSet is bound to
+ */
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ getParameterNames( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet );
+
+ /** ensures that no control overlaps the given one.
+ *
+ * \param pControl the control which should place in the section without overlapping
+ * \param _pReportSection the section
+ * \param _bInsert sal_True whe the control should be inserted, otherwise not.
+ */
+ void correctOverlapping(SdrObject* pControl,OReportSection& _aReportSection,bool _bInsert = true);
+
+ /** returns a Rectangle of a given SdrObject
+ *
+ * \param pControl the SdrObject
+ */
+
+ Rectangle getRectangleFromControl(SdrObject* pControl);
+
+ /** sets the map mode at the window
+ @param _aZoom the zoom scale
+ @param _rWindow where to set the map mode
+ */
+ void setZoomFactor(const Fraction& _aZoom,Window& _rWindow);
+}
+#endif //RPTUI_UITOOLS_HXX
+
diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx
new file mode 100644
index 000000000000..9bee09a0b335
--- /dev/null
+++ b/reportdesign/source/ui/inc/ViewsWindow.hxx
@@ -0,0 +1,361 @@
+/*************************************************************************
+ *
+ * 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_VIEWSWINDOW_HXX
+#define RPTUI_VIEWSWINDOW_HXX
+
+#include <com/sun/star/report/XSection.hpp>
+#include <vcl/window.hxx>
+#include <svtools/colorcfg.hxx>
+#include "ReportDefines.hxx"
+#include "ReportSection.hxx"
+#include <comphelper/propmultiplex.hxx>
+#include "cppuhelper/basemutex.hxx"
+#include <svtools/colorcfg.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <svx/svdedtv.hxx>
+#include <SectionView.hxx>
+#include <unotools/options.hxx>
+#include <list>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+#include <MarkedSection.hxx>
+#include <SectionWindow.hxx>
+
+class SdrHdl;
+namespace rptui
+{
+ class OReportWindow;
+ class ODesignView;
+ class OEndMarker;
+ class OReportSection;
+ class OSectionView;
+
+
+ // -----------------------------------------------------------------------------
+ struct RectangleLess : public ::std::binary_function< Rectangle, Rectangle, bool>
+ {
+ enum CompareMode { POS_LEFT,POS_RIGHT,POS_UPPER,POS_DOWN,POS_CENTER_HORIZONTAL,POS_CENTER_VERTICAL };
+ CompareMode m_eCompareMode;
+ Point m_aRefPoint;
+ RectangleLess(CompareMode _eCompareMode,const Point& _rRefPoint ) : m_eCompareMode(_eCompareMode),m_aRefPoint(_rRefPoint){}
+ bool operator() (const Rectangle& lhs, const Rectangle& rhs) const
+ {
+ switch(m_eCompareMode)
+ {
+ case POS_LEFT:
+ return lhs.Left() < rhs.Left();
+ case POS_RIGHT:
+ return lhs.Right() >= rhs.Right();
+ case POS_UPPER:
+ return lhs.Top() < rhs.Top();
+ case POS_DOWN:
+ return lhs.Bottom() >= rhs.Bottom();
+ case POS_CENTER_HORIZONTAL:
+ return abs(m_aRefPoint.X() - lhs.Center().X()) < abs(m_aRefPoint.X() - rhs.Center().X());
+ case POS_CENTER_VERTICAL:
+ return abs(lhs.Center().Y() - m_aRefPoint.Y()) < abs(rhs.Center().Y() - m_aRefPoint.Y());
+ }
+ return false;
+ }
+ };
+
+ class OWindowPositionCorrector
+ {
+ ::std::vector< ::std::pair<Window*,Point> > m_aChildren;
+ long m_nDeltaX;
+ long m_nDeltaY;
+ public:
+ OWindowPositionCorrector(Window* _pWindow,long _nDeltaX, long _nDeltaY) :m_nDeltaX(_nDeltaX), m_nDeltaY(_nDeltaY)
+ {
+ sal_uInt16 nCount = _pWindow->GetChildCount();
+ m_aChildren.reserve(nCount);
+ while( nCount )
+ {
+ Window* pChild = _pWindow->GetChild(--nCount);
+ m_aChildren.push_back(::std::pair<Window*,Point>(pChild,pChild->GetPosPixel()));
+ }
+ }
+ ~OWindowPositionCorrector()
+ {
+ ::std::vector< ::std::pair<Window*,Point> >::iterator aIter = m_aChildren.begin();
+ ::std::vector< ::std::pair<Window*,Point> >::iterator aEnd = m_aChildren.end();
+ for (; aIter != aEnd; ++aIter)
+ {
+ const Point aPos = aIter->first->GetPosPixel();
+ if ( aPos == aIter->second )
+ aIter->first->SetPosPixel(Point(m_nDeltaX,m_nDeltaY) + aPos);
+ }
+ }
+ };
+
+ class OViewsWindow : public Window
+ , public utl::ConfigurationListener
+ , public IMarkedSection
+ {
+ typedef ::std::multimap<Rectangle,::std::pair<SdrObject*,OSectionView*>,RectangleLess> TRectangleMap;
+ public:
+ typedef ::std::vector< ::boost::shared_ptr<OSectionWindow> > TSectionsMap;
+
+ struct TReportPairHelper : public ::std::unary_function< TSectionsMap::value_type, OReportSection >
+ {
+ OReportSection& operator() (const TSectionsMap::value_type& lhs) const
+ {
+ return lhs->getReportSection();
+ }
+ };
+ struct TStartMarkerHelper : public ::std::unary_function< TSectionsMap::value_type, OStartMarker >
+ {
+ OStartMarker& operator() (const TSectionsMap::value_type& lhs) const
+ {
+ return lhs->getStartMarker();
+ }
+ };
+ private:
+ TSectionsMap m_aSections;
+ svtools::ColorConfig m_aColorConfig;
+ OReportWindow* m_pParent;
+ ::rtl::OUString m_sShapeType;
+ sal_Bool m_bInSplitHandler;
+ sal_Bool m_bInUnmark;
+
+ void ImplInitSettings();
+ /** returns the iterator at pos _nPos or the end()
+ */
+ TSectionsMap::iterator getIteratorAtPos(sal_uInt16 _nPos);
+ void collectRectangles(TRectangleMap& _rMap,bool _bBoundRects);
+ void collectBoundResizeRect(const TRectangleMap& _rSortRectangles,sal_Int32 _nControlModification,bool _bAlignAtSection,bool _bBoundRects,Rectangle& _rBound,Rectangle& _rResize);
+ void impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet);
+
+ OViewsWindow(OViewsWindow&);
+ void operator =(OViewsWindow&);
+ protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ // windows overload
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
+ public:
+ OViewsWindow(
+ OReportWindow* _pReportWindow);
+ virtual ~OViewsWindow();
+
+ // windows overload
+ virtual void Resize();
+
+ void resize(const OSectionWindow& _rSectionWindow);
+
+ /** late ctor
+ */
+ void initialize();
+
+ inline OReportWindow* getView() const { return m_pParent; }
+
+ /** removes the section at the given position.
+ *
+ * \param _nPosition Zero based.
+ */
+ void removeSection(sal_uInt16 _nPosition);
+
+ /** adds a new section at position _nPosition.
+ If the section is <NULL/> nothing happens.
+ If the position is grater than the current elements, the section will be appended.
+ */
+ void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
+ ,const ::rtl::OUString& _sColorEntry
+ ,sal_uInt16 _nPosition = USHRT_MAX);
+
+ sal_uInt16 getSectionCount() const;
+ /** return the section at the given position
+ *
+ * \param _nPos
+ * \return the section at this pos or an empty section
+ */
+ ::boost::shared_ptr<OSectionWindow> getSectionWindow(const sal_uInt16 _nPos) const;
+
+ /** turns the grid on or off
+ *
+ * \param _bVisible
+ */
+ void toggleGrid(sal_Bool _bVisible);
+ void setGridSnap(sal_Bool bOn);
+ void setDragStripes(sal_Bool bOn);
+
+ /** returns the total accumulated height of all sections until _pSection is reached
+ */
+ sal_Int32 getTotalHeight() const;
+
+ inline bool empty() const { return m_aSections.empty(); }
+ void SetMode( DlgEdMode m_eMode );
+ void SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString());
+ rtl::OUString GetInsertObjString() const;
+ /** copies the current selection in this section
+ */
+ void Copy();
+
+ /** returns if paste is allowed
+ *
+ * \return <TRUE/> if paste is allowed
+ */
+ sal_Bool IsPasteAllowed() const;
+
+ /** paste a new control in this section
+ */
+ void Paste();
+
+ /** Deletes the current selection in this section
+ *
+ */
+ void Delete();
+
+ /** All objects will be marked.
+ */
+ void SelectAll(const sal_uInt16 _nObjectType);
+
+ /** returns <TRUE/> when a object is marked
+ */
+ sal_Bool HasSelection() const;
+
+ /** unmark all objects on the views without the given one.
+ *
+ * @param _pSectionView The view where the objects should not be unmarked.
+ */
+ void unmarkAllObjects(OSectionView* _pSectionView);
+
+ /** returns the report section window for the given xsection
+ @param _xSection the section
+ */
+ // ::boost::shared_ptr<OSectionWindow> getReportSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
+ ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+
+ /** checks if the keycode is known by the child windows
+ @param _rCode the keycode
+ @return <TRUE/> if the keycode is handled otherwise <FALSE/>
+ */
+ sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
+
+ /** the the section as marked or not marked
+ @param _pSectionView the section where to set the marked flag
+ @param _bMark the marked flag
+ */
+ void setMarked(OSectionView* _pSectionView,sal_Bool _bMark);
+ void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark);
+ void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark);
+
+ // IMarkedSection
+ ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const;
+ virtual void markSection(const sal_uInt16 _nPos);
+
+ /** align all marked objects in all sections
+ */
+ void alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects = false);
+
+ /** creates a default object
+ *
+ */
+ void createDefault();
+
+ /** shows or hides the ruler.
+ */
+ void showRuler(sal_Bool _bShow);
+
+ /** returns the currently set shape type.
+ *
+ * \return \member m_sShapeType
+ */
+ inline ::rtl::OUString getShapeType() const { return m_sShapeType; }
+
+ /** returns the current position in the list
+ */
+ sal_uInt16 getPosition(const OSectionWindow* _pSectionWindow = NULL) const;
+
+ /** calls on every section BrkAction
+ *
+ */
+ void BrkAction();
+ void BegMarkObj(const Point& _aPnt,const OSectionView* _pSection);
+
+ private:
+ void BegDragObj_createInvisibleObjectAtPosition(const Rectangle& _aRect, const OSectionView& _rSection);
+ void EndDragObj_removeInvisibleObjects();
+ Point m_aDragDelta;
+ ::std::vector<SdrObject*> m_aBegDragTempList;
+ bool isObjectInMyTempList(SdrObject *);
+ public:
+ void BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionView* _pSection);
+ void EndDragObj(sal_Bool _bDragIntoNewSection,const OSectionView* _pSection,const Point& _aPnt);
+
+ void EndAction();
+ void ForceMarkedToAnotherPage();
+ sal_Bool IsAction() const;
+ sal_Bool IsDragObj() const;
+ void handleKey(const KeyCode& _rCode);
+ void stopScrollTimer();
+
+ /** return the section at the given point which is relative to the given section
+ *
+ * \param _pSection the section which is used as reference point
+ * \param _rPnt the point, it will be changed that it is inside the section which will be returned
+ * \return the section
+ */
+ OSectionView* getSectionRelativeToPosition(const OSectionView* _pSection,Point& _rPnt);
+
+ void MovAction(const Point& rPnt,const OSectionView* _pSection,bool _bMove /*= true */, bool _bControlKeySet);
+ // void MovAction2(const Point& rPnt,const OSectionView* _pSection);
+
+ sal_uInt32 getMarkedObjectCount() const;
+
+ /** fills the positions of all collapsed sections.
+ *
+ * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
+ */
+ void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
+
+ /** collpase all sections given by their position
+ *
+ * \param _aCollpasedSections The position of the sections which should be collapsed.
+ */
+ void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
+
+ /** zoom the ruler and view windows
+ */
+ void zoom(const Fraction& _aZoom);
+
+ void scrollChildren(const Point& _aThumbPos);
+
+ /** fills the vector with all selected control models
+ /param _rSelection The vector will be filled and will not be cleared before.
+ */
+ void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
+ };
+//==============================================================================
+} // rptui
+//==============================================================================
+#endif // RPTUI_VIEWSWINDOW_HXX
+
diff --git a/reportdesign/source/ui/inc/dlgedclip.hxx b/reportdesign/source/ui/inc/dlgedclip.hxx
new file mode 100644
index 000000000000..bc57a83dc45c
--- /dev/null
+++ b/reportdesign/source/ui/inc/dlgedclip.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * 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 _REPORT_RPTUICLIP_HXX
+#define _REPORT_RPTUICLIP_HXX
+
+#include <svtools/transfer.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+namespace rptui
+{
+//============================================================================
+// OReportExchange
+//============================================================================
+/** \class OReportExchange
+ * \brief defines a clipboard fromat for copying selection elements.
+ * \ingroup reportdesign_source_ui_report
+ *
+ *
+ */
+class OReportExchange : public TransferableHelper
+{
+public:
+ typedef ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > TSectionElements;
+
+ /** Constructs a new exchange object with section elements
+ *
+ * \param _rCopyElements the elements to copy. Each section is one entry. The value must be a sequence of elements.
+ * \return
+ */
+ OReportExchange( const TSectionElements& _rCopyElements);
+
+ /** checks whether or not a descriptor can be extracted from the data flavor vector given
+ *
+ * \param _rFlavors
+ available flavors
+ * \return
+ */
+ static sal_Bool canExtract(const DataFlavorExVector& _rFlavors);
+
+ /** extract the section elements
+ *
+ * \param _rData the clipboard data
+ * \return the copied elements
+ */
+ static TSectionElements extractCopies(const TransferableDataHelper& _rData);
+
+ /** returns the format id.
+ *
+ * \return the registered format id
+ */
+ static sal_uInt32 getDescriptorFormatId();
+
+protected:
+ // TransferableHelper overridables
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+private:
+ TSectionElements m_aCopyElements;
+};
+}
+#endif // _REPORT_RPTUICLIP_HXX
diff --git a/reportdesign/source/ui/inc/dlgedfac.hxx b/reportdesign/source/ui/inc/dlgedfac.hxx
new file mode 100644
index 000000000000..fd5738447cd6
--- /dev/null
+++ b/reportdesign/source/ui/inc/dlgedfac.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * 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 _REPORT_RPTUIFAC_HXX
+#define _REPORT_RPTUIFAC_HXX
+
+
+#include <svx/svdobj.hxx>
+
+namespace rptui
+{
+ class OReportSection;
+//============================================================================
+// DlgEdFactory
+//============================================================================
+class DlgEdFactory
+{
+public:
+ DlgEdFactory();
+ ~DlgEdFactory();
+
+ DECL_LINK( MakeObject, SdrObjFactory * );
+};
+}
+#endif // _REPORT_RPTUIFAC_HXX
+
diff --git a/reportdesign/source/ui/inc/dlgedfunc.hxx b/reportdesign/source/ui/inc/dlgedfunc.hxx
new file mode 100644
index 000000000000..f7eb0cb6d00e
--- /dev/null
+++ b/reportdesign/source/ui/inc/dlgedfunc.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * 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 _REPORT_RPTUIFUNC_HXX
+#define _REPORT_RPTUIFUNC_HXX
+
+#include <vcl/timer.hxx>
+
+class Timer;
+class MouseEvent;
+class Point;
+class SdrTextObj;
+class SdrObject;
+namespace rptui
+{
+
+class OReportSection;
+class OSectionView;
+
+//============================================================================
+// DlgEdFunc
+//============================================================================
+
+class DlgEdFunc /* : public LinkHdl */
+{
+ DlgEdFunc(const DlgEdFunc&);
+ void operator =(const DlgEdFunc&);
+protected:
+ OReportSection* m_pParent;
+ OSectionView& m_rView;
+ Timer aScrollTimer;
+ Point m_aMDPos;
+ com::sun::star::uno::Reference<com::sun::star::uno::XInterface> m_xOverlappingObj;
+ SdrObject * m_pOverlappingObj;
+ sal_Int32 m_nOverlappedControlColor;
+ sal_Int32 m_nOldColor;
+ bool m_bSelectionMode;
+ bool m_bUiActive;
+ bool m_bShowPropertyBrowser;
+
+ DECL_LINK( ScrollTimeout, Timer * );
+ void ForceScroll( const Point& rPos );
+ /** checks that no other object is overlapped.
+ *
+ * \param rMEvt
+ */
+ void checkMovementAllowed(const MouseEvent& rMEvt);
+
+ /** sets the correct mouse pointer when moving a object
+ *
+ * \param rMEvt
+ * \return <TRUE/> when the pointer was already set.
+ */
+ bool setMovementPointer(const MouseEvent& rMEvt);
+
+ bool isRectangleHit(const MouseEvent& rMEvt);
+ /**
+ returns true, as long as only customshapes in the marked list,
+ custom shapes can drop every where
+ */
+ bool isOnlyCustomShapeMarked();
+
+ /** activate object if it is of type OBJ_OLE2
+ */
+ void activateOle(SdrObject* _pObj);
+
+ void checkTwoCklicks(const MouseEvent& rMEvt);
+
+public:
+ DlgEdFunc( OReportSection* pParent );
+ virtual ~DlgEdFunc();
+
+ virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
+ virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt );
+ virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
+
+ /** checks if the keycode is known by the child windows
+ @param _rCode the keycode
+ @return <TRUE/> if the keycode is handled otherwise <FALSE/>
+ */
+ virtual sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
+
+ /** returns <TRUE/> if the mouse event is over an existing object
+ *
+ * \param rMEvt
+ * \return <TRUE/> if overlapping, otherwise <FALSE/>
+ */
+ bool isOverlapping(const MouseEvent& rMEvt);
+ void setOverlappedControlColor(sal_Int32 _nColor);
+ void stopScrollTimer();
+
+ /** deactivate all ole object
+ */
+ void deactivateOle(bool _bSelect = false);
+
+ inline bool isUiActive() const { return m_bUiActive; }
+protected:
+ void colorizeOverlappedObject(SdrObject* _pOverlappedObj);
+ void unColorizeOverlappedObj();
+
+
+};
+
+//============================================================================
+// DlgEdFuncInsert
+//============================================================================
+
+class DlgEdFuncInsert : public DlgEdFunc
+{
+public:
+ DlgEdFuncInsert( OReportSection* pParent );
+ ~DlgEdFuncInsert();
+
+ virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
+ virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt );
+ virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
+};
+
+//============================================================================
+// DlgEdFuncSelect
+//============================================================================
+
+class DlgEdFuncSelect : public DlgEdFunc
+{
+public:
+ DlgEdFuncSelect( OReportSection* pParent );
+ ~DlgEdFuncSelect();
+
+ virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
+ virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt );
+ virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
+
+ void SetInEditMode(SdrTextObj* _pTextObj,const MouseEvent& rMEvt, sal_Bool bQuickDrag);
+};
+
+}
+#endif //_REPORT_RPTUIFUNC_HXX
diff --git a/reportdesign/source/ui/inc/dlgpage.hxx b/reportdesign/source/ui/inc/dlgpage.hxx
new file mode 100644
index 000000000000..aec98e42cdd6
--- /dev/null
+++ b/reportdesign/source/ui/inc/dlgpage.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * 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_DLGPAGE_HXX
+#define RPTUI_DLGPAGE_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+namespace rptui
+{
+/*************************************************************************
+|*
+|* Seite einrichten-Tab-Dialog
+|*
+\************************************************************************/
+class ORptPageDialog : public SfxTabDialog
+{
+private:
+ const SfxItemSet& rOutAttrs;
+
+ ORptPageDialog(const ORptPageDialog&);
+ void operator =(const ORptPageDialog&);
+public:
+
+ ORptPageDialog( Window* pParent, const SfxItemSet* pAttr,sal_uInt16 _nPageId);
+ virtual ~ORptPageDialog() {}
+};
+// =============================================================================
+} // namespace rptui
+// =============================================================================
+#endif // RPTUI_DLGPAGE_HXX
diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx
new file mode 100644
index 000000000000..3cc2a20cc465
--- /dev/null
+++ b/reportdesign/source/ui/inc/metadata.hxx
@@ -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.
+ *
+ ************************************************************************/
+#ifndef RPTUI_METADATA_HXX_
+#define RPTUI_METADATA_HXX_
+
+#include "ModuleHelper.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/inspection/XPropertyHandler.hpp>
+/** === end UNO includes === **/
+
+//............................................................................
+namespace rptui
+{
+//............................................................................
+
+ struct OPropertyInfoImpl;
+
+ //========================================================================
+ //= OPropertyInfoService
+ //========================================================================
+ class OPropertyInfoService
+ :public OModuleClient
+ {
+ OPropertyInfoService(const OPropertyInfoService&);
+ void operator =(const OPropertyInfoService&);
+ protected:
+ static sal_uInt16 s_nCount;
+ static OPropertyInfoImpl* s_pPropertyInfos;
+ // TODO: a real structure which allows quick access by name as well as by id
+
+ public:
+ OPropertyInfoService(){}
+ virtual ~OPropertyInfoService(){}
+ // IPropertyInfoService
+ sal_Int32 getPropertyId(const String& _rName) const;
+ String getPropertyTranslation(sal_Int32 _nId) const;
+ rtl::OString getPropertyHelpId(sal_Int32 _nId) const;
+ sal_uInt32 getPropertyUIFlags(sal_Int32 _nId) const;
+ static void getExcludeProperties(::std::vector< com::sun::star::beans::Property >& _rExcludeProperties,const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _xFormComponentHandler);
+
+ bool isComposable(
+ const ::rtl::OUString& _rPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _xFormComponentHandler
+ );
+
+ protected:
+ static const OPropertyInfoImpl* getPropertyInfo();
+
+ static const OPropertyInfoImpl* getPropertyInfo(const String& _rName);
+ static const OPropertyInfoImpl* getPropertyInfo(sal_Int32 _nId);
+ };
+
+ //========================================================================
+ //= HelpIdUrl
+ //========================================================================
+ /// small helper to translate help ids into help urls
+ class HelpIdUrl
+ {
+ public:
+ static ::rtl::OUString getHelpURL( const rtl::OString& _sHelpId );
+ };
+
+ //========================================================================
+ //= UI flags (for all browseable properties)
+ //========================================================================
+
+#define PROP_FLAG_NONE 0x00000001 // no special flag
+#define PROP_FLAG_ENUM 0x00000002 // the property is some kind of enum property, i.e. its
+ // value is chosen from a fixed list of possible values
+#define PROP_FLAG_ENUM_ONE 0x00000004 // the property is an enum property starting with 1
+ // (note that this includes PROP_FLAG_ENUM)
+#define PROP_FLAG_COMPOSEABLE 0x00000008 // the property is "composeable", i.e. an intersection of property
+ // sets should expose it, if all elements do
+#define PROP_FLAG_EXPERIMENTAL 0x00000010 // the property is experimental, i.e. should not appear in the
+ // UI, unless experimental properties are enabled by a configuraiton
+ // option
+#define PROP_FLAG_DATA_PROPERTY 0x00000020 // the property is to appear on the "Data" page
+
+ //========================================================================
+ //= property ids (for all browseable properties)
+ //= The ID is used for the view order in the property browser.
+ //========================================================================
+
+ #define PROPERTY_ID_FORCENEWPAGE 1
+ #define PROPERTY_ID_NEWROWORCOL 2
+ #define PROPERTY_ID_KEEPTOGETHER 3
+ #define PROPERTY_ID_CANGROW 4
+ #define PROPERTY_ID_CANSHRINK 5
+ #define PROPERTY_ID_REPEATSECTION 6
+ #define PROPERTY_ID_PRESERVEIRI 7
+ #define PROPERTY_ID_VISIBLE 8
+ #define PROPERTY_ID_GROUPKEEPTOGETHER 9
+ #define PROPERTY_ID_PAGEHEADEROPTION 10
+ #define PROPERTY_ID_PAGEFOOTEROPTION 11
+ #define PROPERTY_ID_POSITIONX 12
+ #define PROPERTY_ID_POSITIONY 13
+ #define PROPERTY_ID_WIDTH 14
+ #define PROPERTY_ID_HEIGHT 15
+ #define PROPERTY_ID_FORMULA 16
+ #define PROPERTY_ID_PRINTREPEATEDVALUES 17
+ #define PROPERTY_ID_CONDITIONALPRINTEXPRESSION 18
+ #define PROPERTY_ID_INITIALFORMULA 19
+ #define PROPERTY_ID_STARTNEWCOLUMN 20
+ #define PROPERTY_ID_TYPE 21
+ #define PROPERTY_ID_DATAFIELD 22
+ #define PROPERTY_ID_CHARFONTNAME 23
+ #define PROPERTY_ID_PRINTWHENGROUPCHANGE 24
+ #define PROPERTY_ID_DEEPTRAVERSING 25
+ #define PROPERTY_ID_PREEVALUATED 26
+
+ #define PROPERTY_ID_BACKTRANSPARENT 27
+ #define PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT 28
+ #define PROPERTY_ID_BACKCOLOR 29
+ #define PROPERTY_ID_CONTROLBACKGROUND 30
+
+ #define PROPERTY_ID_FORMULALIST 31
+ #define PROPERTY_ID_SCOPE 32
+ #define PROPERTY_ID_RESETPAGENUMBER 33
+ #define PROPERTY_ID_CHARTTYPE 34
+ #define PROPERTY_ID_MASTERFIELDS 35
+ #define PROPERTY_ID_DETAILFIELDS 36
+ #define PROPERTY_ID_PREVIEW_COUNT 37
+ #define PROPERTY_ID_AREA 38
+ #define PROPERTY_ID_MIMETYPE 39
+
+ #define PROPERTY_ID_FONT 40
+ #define PROPERTY_ID_PARAADJUST 41
+ #define PROPERTY_ID_VERTICALALIGN 42
+
+
+//............................................................................
+} // namespace rptui
+//............................................................................
+
+#endif // RPTUI_METADATA_HXX_
+
diff --git a/reportdesign/source/ui/inc/propbrw.hxx b/reportdesign/source/ui/inc/propbrw.hxx
new file mode 100644
index 000000000000..bf64f7687046
--- /dev/null
+++ b/reportdesign/source/ui/inc/propbrw.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _REPORT_PROPBRW_HXX
+#define _REPORT_PROPBRW_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/inspection/XObjectInspector.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+#include <vcl/dockwin.hxx>
+#include <svx/svdmark.hxx>
+#include "ModuleHelper.hxx"
+
+namespace rptui
+{
+
+class OSectionView;
+class ODesignView;
+class OObjectBase;
+//============================================================================
+// PropBrw
+//============================================================================
+
+class PropBrw : public DockingWindow , public SfxListener, public SfxBroadcaster
+{
+private:
+ OModuleClient m_aModuleClient;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xInspectorContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
+ m_xMeAsFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspector >
+ m_xBrowserController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
+ m_xBrowserComponentWindow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
+ m_xLastSection; /// is the previously displayed section
+ ::rtl::OUString m_sLastActivePage;
+ ODesignView* m_pDesignView;
+ OSectionView* m_pView;
+ sal_Bool m_bInitialStateChange;
+
+ PropBrw(PropBrw&);
+ void operator =(PropBrw&);
+protected:
+
+ virtual void Resize();
+ virtual sal_Bool Close();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> >
+ CreateCompPropSet(const SdrMarkList& rMarkList);
+
+ void implSetNewObject(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> >& _aObjects = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> >());
+
+ ::rtl::OUString GetHeadlineName(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> >& _aObjects);
+
+ void implDetachController();
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> CreateComponentPair(OObjectBase* _pObj);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> CreateComponentPair(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xFormComponent
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent);
+ DECL_LINK( OnAsyncGetFocus, void* );
+
+public:
+ PropBrw(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB
+ ,Window* pParent
+ ,ODesignView* _pDesignView);
+ virtual ~PropBrw();
+
+ virtual void LoseFocus();
+
+ void Update( OSectionView* m_pView );
+ void Update( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent);
+ inline OSectionView* GetCurView() const { return m_pView; }
+ ::rtl::OUString getCurrentPage() const;
+ void setCurrentPage(const ::rtl::OUString& _sLastActivePage);
+
+ ::Size getMinimumSize() const;
+private:
+ using Window::Update;
+};
+//==============================================================================
+} // rptui
+//==============================================================================
+#endif // _REPORT_PROPBRW_HXX
diff --git a/reportdesign/source/ui/inc/statusbarcontroller.hxx b/reportdesign/source/ui/inc/statusbarcontroller.hxx
new file mode 100644
index 000000000000..6fffd36cc4df
--- /dev/null
+++ b/reportdesign/source/ui/inc/statusbarcontroller.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * 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_STATUSBARCONTROLLER_HXX
+#define RPTUI_STATUSBARCONTROLLER_HXX
+
+#include <svtools/statusbarcontroller.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/implementationreference.hxx>
+
+class SfxStatusBarControl;
+namespace rptui
+{
+ typedef ::comphelper::ImplementationReference<SfxStatusBarControl,::com::sun::star::frame::XStatusbarController> TStatusbarHelper;
+
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> OStatusbarController_BASE;
+ class OStatusbarController : public ::svt::StatusbarController,
+ public OStatusbarController_BASE
+ {
+ TStatusbarHelper m_pController;
+ sal_uInt16 m_nSlotId;
+ sal_uInt16 m_nId;
+ public:
+ OStatusbarController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
+
+ static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
+
+ private:
+ void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+ // XInterface
+ DECLARE_XINTERFACE( )
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ // need by registration
+
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XUpdatable
+ virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XStatusbarController
+ virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos,
+ ::sal_Int32 nCommand,
+ ::sal_Bool bMouseEvent,
+ const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
+ const ::com::sun::star::awt::Rectangle& rOutputRectangle,
+ ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif // DBAUI_STATUSBARCONTROLLER_HXX
+
diff --git a/reportdesign/source/ui/inc/toolboxcontroller.hxx b/reportdesign/source/ui/inc/toolboxcontroller.hxx
new file mode 100644
index 000000000000..447db93fe667
--- /dev/null
+++ b/reportdesign/source/ui/inc/toolboxcontroller.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * 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_TOOLBOXCONTROLLER_HXX
+#define RPTUI_TOOLBOXCONTROLLER_HXX
+
+#include <svtools/toolboxcontroller.hxx>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XSubToolbarController.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/implementationreference.hxx>
+
+class SfxToolBoxControl;
+namespace rptui
+{
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::frame::XSubToolbarController> TToolboxController_BASE;
+ typedef ::comphelper::ImplementationReference<SfxToolBoxControl,::com::sun::star::frame::XToolbarController> TToolbarHelper;
+
+ class OToolboxController : public ::svt::ToolboxController
+ ,public TToolboxController_BASE
+ {
+ DECLARE_STL_USTRINGACCESS_MAP(sal_Bool,TCommandState);
+ TCommandState m_aStates;
+ TToolbarHelper m_pToolbarController;
+ sal_uInt16 m_nToolBoxId;
+ sal_uInt16 m_nSlotId;
+ OToolboxController(const OToolboxController&);
+ void operator =(const OToolboxController&);
+ public:
+ OToolboxController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
+ virtual ~OToolboxController();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ // need by registration
+ static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+ // XToolbarController
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
+
+ // XSubToolbarController
+ virtual ::sal_Bool SAL_CALL opensSubToolbar( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSubToolbarName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL functionSelected( const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateImage( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+ };
+//..........................................................................
+} // rptui
+//..........................................................................
+#endif //RPTUI_TOOLBOXCONTROLLER_HXX
+
diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
new file mode 100644
index 000000000000..dcc327060806
--- /dev/null
+++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
@@ -0,0 +1,565 @@
+/*************************************************************************
+ *
+ * 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 "DataProviderHandler.hxx"
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/types.hxx>
+#include "uistrings.hrc"
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/syslocale.hxx>
+#include <com/sun/star/inspection/PropertyControlType.hpp>
+#include <com/sun/star/inspection/PropertyLineElement.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XFormattedString.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/report/XReportDefinition.hpp>
+#include <com/sun/star/report/XSection.hpp>
+#include <com/sun/star/inspection/XNumericControl.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/util/MeasureUnit.hpp>
+#include <tools/fldunit.hxx>
+#include "metadata.hxx"
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include "helpids.hrc"
+#include "uistrings.hrc"
+#include "RptResId.hrc"
+#include "PropertyForward.hxx"
+//........................................................................
+namespace rptui
+{
+//........................................................................
+using namespace ::com::sun::star;
+
+DataProviderHandler::DataProviderHandler(uno::Reference< uno::XComponentContext > const & context)
+ :DataProviderHandler_Base(m_aMutex)
+ ,m_xContext(context)
+ ,m_pInfoService( new OPropertyInfoService() )
+{
+ try
+ {
+ m_xFormComponentHandler.set(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.FormComponentPropertyHandler")),m_xContext),uno::UNO_QUERY_THROW);
+ m_xTypeConverter.set(m_xContext->getServiceManager()->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter" )),m_xContext),uno::UNO_QUERY_THROW);
+
+ }catch(uno::Exception)
+ {
+ }
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString SAL_CALL DataProviderHandler::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return getImplementationName_Static();
+}
+
+//------------------------------------------------------------------------
+sal_Bool SAL_CALL DataProviderHandler::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_static());
+}
+
+//------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL DataProviderHandler::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ return getSupportedServiceNames_static();
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString DataProviderHandler::getImplementationName_Static( ) throw(uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.DataProviderHandler"));
+}
+
+//------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > DataProviderHandler::getSupportedServiceNames_static( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSupported(1);
+ aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.inspection.DataProviderHandler"));
+ return aSupported;
+}
+
+//------------------------------------------------------------------------
+uno::Reference< uno::XInterface > SAL_CALL DataProviderHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
+{
+ return *(new DataProviderHandler( _rxContext ));
+}
+// overload WeakComponentImplHelperBase::disposing()
+// This function is called upon disposing the component,
+// if your component needs special work when it becomes
+// disposed, do it here.
+void SAL_CALL DataProviderHandler::disposing()
+{
+ ::comphelper::disposeComponent(m_xFormComponentHandler);
+ ::comphelper::disposeComponent( m_xMasterDetails );
+ ::comphelper::disposeComponent(m_xTypeConverter);
+}
+void SAL_CALL DataProviderHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener) throw (uno::RuntimeException)
+{
+ m_xFormComponentHandler->addEventListener(xListener);
+}
+
+void SAL_CALL DataProviderHandler::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw (uno::RuntimeException)
+{
+ m_xFormComponentHandler->removeEventListener(aListener);
+}
+
+// inspection::XPropertyHandler:
+
+/********************************************************************************/
+void SAL_CALL DataProviderHandler::inspect(const uno::Reference< uno::XInterface > & Component) throw (uno::RuntimeException, lang::NullPointerException)
+{
+ try
+ {
+ uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY);
+ const ::rtl::OUString sFormComponent(RTL_CONSTASCII_USTRINGPARAM("FormComponent"));
+ if ( xNameCont->hasByName(sFormComponent) )
+ {
+ uno::Reference<beans::XPropertySet> xProp(xNameCont->getByName(sFormComponent),uno::UNO_QUERY);
+ const ::rtl::OUString sModel(RTL_CONSTASCII_USTRINGPARAM("Model"));
+ if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(sModel) )
+ {
+ m_xChartModel.set(xProp->getPropertyValue(sModel),uno::UNO_QUERY);
+ if ( m_xChartModel.is() )
+ m_xFormComponent = m_xChartModel->getDataProvider();
+ }
+ }
+ m_xDataProvider.set(m_xFormComponent,uno::UNO_QUERY);
+ m_xReportComponent.set( xNameCont->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReportComponent" ) ) ), uno::UNO_QUERY );
+ if ( m_xDataProvider.is() )
+ {
+ ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
+ TPropertyNamePair aPropertyMediation;
+ aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_MASTERFIELDS, TPropertyConverter(PROPERTY_MASTERFIELDS,aNoConverter) ) );
+ aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_DETAILFIELDS, TPropertyConverter(PROPERTY_DETAILFIELDS,aNoConverter) ) );
+
+ m_xMasterDetails = new OPropertyMediator( m_xDataProvider.get(), m_xReportComponent.get(), aPropertyMediation,sal_True );
+ }
+
+ //const ::rtl::OUString sRowSet(RTL_CONSTASCII_USTRINGPARAM("RowSet"));
+ //if ( xNameCont->hasByName(sRowSet) )
+ //{
+ // uno::Reference<beans::XPropertySet> xProp(m_xFormComponentHandler,uno::UNO_QUERY);
+ // xProp->setPropertyValue(sRowSet,xNameCont->getByName(sRowSet));
+ //}
+ }
+ catch(uno::Exception)
+ {
+ throw lang::NullPointerException();
+ }
+ if ( m_xFormComponent.is() )
+ {
+ m_xFormComponentHandler->inspect(m_xFormComponent);
+ }
+}
+
+uno::Any SAL_CALL DataProviderHandler::getPropertyValue(const ::rtl::OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ uno::Any aPropertyValue;
+ const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_CHARTTYPE:
+ // TODO: We need a possiblity to get the UI of the selected chart type
+ //if( m_xChartModel.is() )
+ //{
+ // uno::Reference< chart2::XDiagram > xDiagram( m_xChartModel->getFirstDiagram() );
+ // if( xDiagram.is() )
+ // {
+ // ::rtl::OUString sChartTypes;
+ // uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+ // const uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ // const uno::Reference< chart2::XCoordinateSystem >* pIter = aCooSysSeq.getConstArray();
+ // const uno::Reference< chart2::XCoordinateSystem >* pEnd = pIter + aCooSysSeq.getLength();
+ // for(;pIter != pEnd;++pIter)
+ // {
+ // const uno::Reference< chart2::XChartTypeContainer > xCTCnt( *pIter, uno::UNO_QUERY_THROW );
+ // const uno::Sequence< uno::Reference< chart2::XChartType > > aCTSeq( xCTCnt->getChartTypes());
+ // const uno::Reference< chart2::XChartType >* pChartTypeIter = aCTSeq.getConstArray();
+ // const uno::Reference< chart2::XChartType >* pChartTypeEnd = pChartTypeIter + aCTSeq.getLength();
+ // for(;pChartTypeIter != pChartTypeEnd;++pChartTypeIter)
+ // {
+ // sChartTypes += (*pChartTypeIter)->getChartType();
+ // sChartTypes += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";"));
+ // }
+ // }
+ // aPropertyValue;// <<= sChartTypes;
+ // }
+ //}
+ break;
+ case PROPERTY_ID_PREVIEW_COUNT:
+ aPropertyValue <<= m_xDataProvider->getRowLimit();
+ break;
+ default:
+ aPropertyValue = m_xFormComponentHandler->getPropertyValue( PropertyName );
+ break;
+ }
+ return aPropertyValue;
+}
+
+void SAL_CALL DataProviderHandler::setPropertyValue(const ::rtl::OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ uno::Any aPropertyValue;
+ const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_CHARTTYPE:
+ break;
+ case PROPERTY_ID_PREVIEW_COUNT:
+ m_xDataProvider->setPropertyValue(PropertyName,Value);
+ break;
+ default:
+ m_xFormComponentHandler->setPropertyValue(PropertyName, Value);
+ break;
+ }
+}
+// -----------------------------------------------------------------------------
+void DataProviderHandler::impl_updateChartTitle_throw(const uno::Any& _aValue)
+{
+ uno::Reference<chart2::XTitled> xTitled(m_xChartModel,uno::UNO_QUERY);
+ if ( xTitled.is() )
+ {
+ uno::Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
+ if ( !xTitle.is() )
+ {
+ xTitle.set(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.Title")),m_xContext),uno::UNO_QUERY);
+ xTitled->setTitleObject(xTitle);
+ }
+ if ( xTitle.is() )
+ {
+ uno::Reference< chart2::XFormattedString> xFormatted(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.FormattedString")),m_xContext),uno::UNO_QUERY);
+ ::rtl::OUString sStr;
+ _aValue>>= sStr;
+ xFormatted->setString(sStr);
+ uno::Sequence< uno::Reference< chart2::XFormattedString> > aArgs(1);
+ aArgs[0] = xFormatted;
+ xTitle->setText(aArgs);
+ }
+ } // if ( xTitled.is() )
+}
+
+beans::PropertyState SAL_CALL DataProviderHandler::getPropertyState(const ::rtl::OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ return m_xFormComponentHandler->getPropertyState(PropertyName);
+}
+
+inspection::LineDescriptor SAL_CALL DataProviderHandler::describePropertyLine(const ::rtl::OUString & PropertyName, const uno::Reference< inspection::XPropertyControlFactory > & _xControlFactory) throw (beans::UnknownPropertyException, lang::NullPointerException,uno::RuntimeException)
+{
+ inspection::LineDescriptor aOut;
+ const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_CHARTTYPE:
+ aOut.PrimaryButtonId = rtl::OUString::createFromAscii(UID_RPT_PROP_CHARTTYPE_DLG);
+ aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::TextField , sal_True);
+ aOut.HasPrimaryButton = sal_True;
+ break;
+ case PROPERTY_ID_PREVIEW_COUNT:
+ aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::NumericField , sal_False);
+ break;
+ case PROPERTY_ID_MASTERFIELDS:
+ case PROPERTY_ID_DETAILFIELDS:
+ aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::StringListField , sal_False);
+ aOut.PrimaryButtonId = rtl::OUString::createFromAscii(UID_RPT_PROP_DLG_LINKFIELDS);
+ aOut.HasPrimaryButton = sal_True;
+ break;
+ default:
+ aOut = m_xFormComponentHandler->describePropertyLine(PropertyName, _xControlFactory);
+ }
+ if ( nId != -1 )
+ {
+ aOut.Category = ((m_pInfoService->getPropertyUIFlags(nId ) & PROP_FLAG_DATA_PROPERTY) != 0) ?
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data"))
+ :
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("General"));
+ aOut.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nId ) );
+ aOut.DisplayName = m_pInfoService->getPropertyTranslation(nId);
+ }
+ return aOut;
+}
+
+uno::Any SAL_CALL DataProviderHandler::convertToPropertyValue(const ::rtl::OUString & _rPropertyValue, const uno::Any & _rControlValue) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ uno::Any aPropertyValue( _rControlValue );
+ const sal_Int32 nId = m_pInfoService->getPropertyId(_rPropertyValue);
+ switch(nId)
+ {
+ case PROPERTY_ID_CHARTTYPE:
+ break;
+ case PROPERTY_ID_PREVIEW_COUNT:
+ try
+ {
+ aPropertyValue = m_xTypeConverter->convertTo( _rControlValue, ::getCppuType((const sal_Int32*)0));
+ }
+ catch( const uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "DataProviderHandler::convertToPropertyValue: caught an exception while converting via TypeConverter!" );
+ }
+ break;
+ case PROPERTY_ID_MASTERFIELDS:
+ case PROPERTY_ID_DETAILFIELDS:
+ break;
+ default:
+ aPropertyValue = m_xFormComponentHandler->convertToPropertyValue(_rPropertyValue, _rControlValue);
+ }
+ return aPropertyValue;
+}
+
+uno::Any SAL_CALL DataProviderHandler::convertToControlValue(const ::rtl::OUString & _rPropertyName, const uno::Any & _rPropertyValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ uno::Any aControlValue( _rPropertyValue );
+ if ( !aControlValue.hasValue() )
+ // NULL is converted to NULL
+ return aControlValue;
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ const sal_Int32 nId = m_pInfoService->getPropertyId(_rPropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_CHARTTYPE:
+ break;
+ case PROPERTY_ID_MASTERFIELDS:
+ case PROPERTY_ID_DETAILFIELDS:
+ case PROPERTY_ID_PREVIEW_COUNT:
+ try
+ {
+ aControlValue = m_xTypeConverter->convertTo( _rPropertyValue, ControlValueType);
+ }
+ catch( const uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "GeometryHandler::convertToPropertyValue: caught an exception while converting via TypeConverter!" );
+ }
+ break;
+ default:
+ aControlValue = m_xFormComponentHandler->convertToControlValue(_rPropertyName, _rPropertyValue, ControlValueType);
+ }
+ return aControlValue;
+}
+
+void SAL_CALL DataProviderHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & Listener) throw (uno::RuntimeException, lang::NullPointerException)
+{
+ m_xFormComponentHandler->addPropertyChangeListener(Listener);
+}
+
+void SAL_CALL DataProviderHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener) throw (uno::RuntimeException)
+{
+ m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
+}
+
+uno::Sequence< beans::Property > SAL_CALL DataProviderHandler::getSupportedProperties() throw (uno::RuntimeException)
+{
+ ::std::vector< beans::Property > aNewProps;
+ if( m_xChartModel.is() )
+ {
+ m_pInfoService->getExcludeProperties( aNewProps, m_xFormComponentHandler );
+ beans::Property aValue;
+ static const ::rtl::OUString s_pProperties[] =
+ {
+ PROPERTY_CHARTTYPE
+ ,PROPERTY_MASTERFIELDS
+ ,PROPERTY_DETAILFIELDS
+ ,PROPERTY_PREVIEW_COUNT
+ //,PROPERTY_TITLE
+ };
+
+ for (size_t nPos = 0; nPos < sizeof(s_pProperties)/sizeof(s_pProperties[0]) ;++nPos )
+ {
+ aValue.Name = s_pProperties[nPos];
+ aNewProps.push_back(aValue);
+ }
+ }
+ return aNewProps.empty() ? uno::Sequence< beans::Property > () : uno::Sequence< beans::Property > (&(*aNewProps.begin()),aNewProps.size());
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL DataProviderHandler::getSupersededProperties() throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = PROPERTY_TITLE; // have a look at OPropertyInfoService::getExcludeProperties
+ return aRet;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL DataProviderHandler::getActuatingProperties() throw (uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ uno::Sequence< ::rtl::OUString > aSeq(1);
+ aSeq[0] = PROPERTY_TITLE;
+ return ::comphelper::concatSequences(m_xFormComponentHandler->getActuatingProperties(),aSeq);
+}
+
+::sal_Bool SAL_CALL DataProviderHandler::isComposable( const ::rtl::OUString& _rPropertyName ) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ return m_pInfoService->isComposable( _rPropertyName, m_xFormComponentHandler );
+}
+
+inspection::InteractiveSelectionResult SAL_CALL DataProviderHandler::onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, uno::Any & out_Data, const uno::Reference< inspection::XObjectInspectorUI > & _rxInspectorUI) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::NullPointerException)
+{
+ if ( !_rxInspectorUI.is() )
+ throw lang::NullPointerException();
+
+ inspection::InteractiveSelectionResult eResult = inspection::InteractiveSelectionResult_Cancelled;
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_CHARTTYPE:
+ if ( impl_dialogChartType_nothrow(aGuard) )
+ eResult = inspection::InteractiveSelectionResult_ObtainedValue;
+ break;
+ case PROPERTY_ID_MASTERFIELDS:
+ case PROPERTY_ID_DETAILFIELDS:
+ if ( impl_dialogLinkedFields_nothrow( aGuard ) )
+ eResult = inspection::InteractiveSelectionResult_Success;
+ break;
+ default:
+ eResult = m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, out_Data, _rxInspectorUI);
+ }
+
+ return eResult;
+}
+
+void SAL_CALL DataProviderHandler::actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const uno::Any & NewValue, const uno::Any & OldValue, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI, ::sal_Bool FirstTimeInit) throw (uno::RuntimeException, lang::NullPointerException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ if ( ActuatingPropertyName == PROPERTY_COMMAND )
+ {
+ if ( NewValue != OldValue )
+ {
+ uno::Reference< report::XReportDefinition> xReport = m_xReportComponent->getSection()->getReportDefinition();
+ bool bDoEnableMasterDetailFields = xReport.is() && xReport->getCommand().getLength() && m_xDataProvider->getCommand().getLength();
+ InspectorUI->enablePropertyUIElements( PROPERTY_DETAILFIELDS, inspection::PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
+ InspectorUI->enablePropertyUIElements( PROPERTY_MASTERFIELDS, inspection::PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields );
+
+ sal_Bool bModified = xReport->isModified();
+ // this fills the chart again
+ ::comphelper::NamedValueCollection aArgs;
+ aArgs.put( "CellRangeRepresentation", uno::makeAny( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "all" ) ) ) );
+ aArgs.put( "HasCategories", uno::makeAny( sal_True ) );
+ aArgs.put( "FirstCellAsLabel", uno::makeAny( sal_True ) );
+ aArgs.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
+ uno::Reference< chart2::data::XDataReceiver > xReceiver(m_xChartModel,uno::UNO_QUERY_THROW);
+ xReceiver->setArguments( aArgs.getPropertyValues() );
+ if ( !bModified )
+ xReport->setModified(sal_False);
+ } // if ( NewValue != OldValue )
+ m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
+ } // if ( ActuatingPropertyName == PROPERTY_COMMAND )
+ else if ( ActuatingPropertyName == PROPERTY_TITLE )
+ {
+ if ( NewValue != OldValue )
+ impl_updateChartTitle_throw(NewValue);
+ }
+ else
+ {
+ const sal_Int32 nId = m_pInfoService->getPropertyId(ActuatingPropertyName);
+ switch(nId)
+ {
+
+ case PROPERTY_ID_MASTERFIELDS:
+ break;
+ case PROPERTY_ID_DETAILFIELDS:
+ break;
+ default:
+ m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
+ }
+ }
+}
+
+::sal_Bool SAL_CALL DataProviderHandler::suspend(::sal_Bool Suspend) throw (uno::RuntimeException)
+{
+ return m_xFormComponentHandler->suspend(Suspend);
+}
+bool DataProviderHandler::impl_dialogLinkedFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
+{
+ uno::Sequence<uno::Any> aSeq(6);
+ beans::PropertyValue aParam;
+ aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow"));
+ aParam.Value <<= m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow")));
+ aSeq[0] <<= aParam;
+ aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Detail"));
+ aParam.Value <<= m_xDataProvider;
+ aSeq[1] <<= aParam;
+ aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Master"));
+ aParam.Value <<= m_xReportComponent->getSection()->getReportDefinition();
+ aSeq[2] <<= aParam;
+
+ aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Explanation"));
+ aParam.Value <<= ::rtl::OUString(String(ModuleRes(RID_STR_EXPLANATION)));
+ aSeq[3] <<= aParam;
+ aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DetailLabel"));
+ aParam.Value <<= ::rtl::OUString(String(ModuleRes(RID_STR_DETAILLABEL)));
+ aSeq[4] <<= aParam;
+ aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MasterLabel"));
+ aParam.Value <<= ::rtl::OUString(String(ModuleRes(RID_STR_MASTERLABEL)));
+ aSeq[5] <<= aParam;
+
+ uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
+ m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.form.ui.MasterDetailLinkDialog")),aSeq
+ , m_xContext), uno::UNO_QUERY);
+
+ _rClearBeforeDialog.clear();
+ return ( xDialog->execute() != 0 );
+}
+// -----------------------------------------------------------------------------
+bool DataProviderHandler::impl_dialogChartType_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
+{
+ uno::Sequence<uno::Any> aSeq(2);
+ beans::PropertyValue aParam;
+ aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow"));
+ aParam.Value <<= m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow")));
+ aSeq[0] <<= aParam;
+ aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ChartModel"));
+ aParam.Value <<= m_xChartModel;
+ aSeq[1] <<= aParam;
+
+ uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
+ m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.chart2.ChartTypeDialog")),aSeq
+ , m_xContext), uno::UNO_QUERY);
+
+ _rClearBeforeDialog.clear();
+ return ( xDialog->execute() != 0 );
+}
+//........................................................................
+} // namespace rptui
+//........................................................................
+
diff --git a/reportdesign/source/ui/inspection/DefaultInspection.cxx b/reportdesign/source/ui/inspection/DefaultInspection.cxx
new file mode 100644
index 000000000000..c5b2df1d3589
--- /dev/null
+++ b/reportdesign/source/ui/inspection/DefaultInspection.cxx
@@ -0,0 +1,284 @@
+/*************************************************************************
+ *
+ * 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 "DefaultInspection.hxx"
+#include <comphelper/sequence.hxx>
+#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#ifndef _REPORT_DLGRESID_HRC
+#include <RptResId.hrc>
+#endif
+#include "ModuleHelper.hxx"
+#ifndef RTPUI_REPORTDESIGN_HELPID_HRC
+#include "helpids.hrc"
+#endif
+#include <cppuhelper/implbase1.hxx>
+#include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+#include "metadata.hxx"
+#include <tools/urlobj.hxx>
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+ //------------------------------------------------------------------------
+ ::rtl::OUString HelpIdUrl::getHelpURL( const rtl::OString& sHelpId )
+ {
+ ::rtl::OUStringBuffer aBuffer;
+ ::rtl::OUString aTmp( sHelpId, sHelpId.getLength(), RTL_TEXTENCODING_UTF8 );
+ DBG_ASSERT( INetURLObject( aTmp ).GetProtocol() == INET_PROT_NOT_VALID, "Wrong HelpId!" );
+ aBuffer.appendAscii( INET_HID_SCHEME );
+ aBuffer.append( aTmp.getStr() );
+ return aBuffer.makeStringAndClear();
+ }
+
+ /** === begin UNO using === **/
+ using namespace com::sun::star::uno;
+ using namespace com::sun::star;
+ using com::sun::star::inspection::PropertyCategoryDescriptor;
+ /** === end UNO using === **/
+
+ //====================================================================
+ //= DefaultComponentInspectorModel
+ //====================================================================
+ DBG_NAME(DefaultComponentInspectorModel)
+ //--------------------------------------------------------------------
+ DefaultComponentInspectorModel::DefaultComponentInspectorModel( const Reference< XComponentContext >& _rxContext)
+ :m_xContext( _rxContext )
+ ,m_bConstructed( false )
+ ,m_bHasHelpSection( false )
+ ,m_bIsReadOnly(sal_False)
+ ,m_nMinHelpTextLines( 3 )
+ ,m_nMaxHelpTextLines( 8 )
+ ,m_pInfoService(new OPropertyInfoService())
+ {
+ DBG_CTOR(DefaultComponentInspectorModel,NULL);
+ }
+
+ //------------------------------------------------------------------------
+ DefaultComponentInspectorModel::~DefaultComponentInspectorModel()
+ {
+ DBG_DTOR(DefaultComponentInspectorModel,NULL);
+ }
+
+ //------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL DefaultComponentInspectorModel::getImplementationName( ) throw(RuntimeException)
+ {
+ return getImplementationName_Static();
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool SAL_CALL DefaultComponentInspectorModel::supportsService( const ::rtl::OUString& ServiceName ) throw(RuntimeException)
+ {
+ return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_static());
+ }
+
+ //------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL DefaultComponentInspectorModel::getSupportedServiceNames( ) throw(RuntimeException)
+ {
+ return getSupportedServiceNames_static();
+ }
+
+ //------------------------------------------------------------------------
+ ::rtl::OUString DefaultComponentInspectorModel::getImplementationName_Static( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.DefaultComponentInspectorModel"));
+ }
+
+ //------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > DefaultComponentInspectorModel::getSupportedServiceNames_static( ) throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aSupported(1);
+ aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.inspection.DefaultComponentInspectorModel"));
+ return aSupported;
+ }
+
+ //------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL DefaultComponentInspectorModel::create( const Reference< XComponentContext >& _rxContext )
+ {
+ return *(new DefaultComponentInspectorModel( _rxContext ));
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< Any > SAL_CALL DefaultComponentInspectorModel::getHandlerFactories() throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+
+ // service names for all our handlers
+ const struct
+ {
+ const sal_Char* serviceName;
+ } aFactories[] = {
+
+ { "com.sun.star.report.inspection.ReportComponentHandler"},
+ { "com.sun.star.form.inspection.EditPropertyHandler"},
+ { "com.sun.star.report.inspection.DataProviderHandler"},
+ { "com.sun.star.report.inspection.GeometryHandler"}
+
+ // generic virtual edit properties
+
+ };
+
+ const size_t nFactories = sizeof( aFactories ) / sizeof( aFactories[ 0 ] );
+ Sequence< Any > aReturn( nFactories );
+ Any* pReturn = aReturn.getArray();
+ for ( size_t i = 0; i < nFactories; ++i )
+ {
+ *pReturn++ <<= ::rtl::OUString::createFromAscii( aFactories[i].serviceName );
+ }
+
+ return aReturn;
+ }
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL DefaultComponentInspectorModel::getHasHelpSection() throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_bHasHelpSection;
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultComponentInspectorModel::getMinHelpTextLines() throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_nMinHelpTextLines;
+ }
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL DefaultComponentInspectorModel::getIsReadOnly() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_bIsReadOnly;
+ }
+ //--------------------------------------------------------------------
+ void SAL_CALL DefaultComponentInspectorModel::setIsReadOnly( ::sal_Bool _isreadonly ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_bIsReadOnly = _isreadonly;
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultComponentInspectorModel::getMaxHelpTextLines() throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_nMaxHelpTextLines;
+ }
+ //--------------------------------------------------------------------
+ void SAL_CALL DefaultComponentInspectorModel::initialize( const Sequence< Any >& _arguments ) throw (Exception, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_bConstructed )
+ throw ucb::AlreadyInitializedException();
+
+ if ( !_arguments.hasElements() )
+ { // constructor: "createDefault()"
+ createDefault();
+ return;
+ }
+
+ sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 );
+ if ( _arguments.getLength() == 2 )
+ { // constructor: "createWithHelpSection( long, long )"
+ if ( !( _arguments[0] >>= nMinHelpTextLines ) || !( _arguments[1] >>= nMaxHelpTextLines ) )
+ throw lang::IllegalArgumentException( ::rtl::OUString(), *this, 0 );
+ createWithHelpSection( nMinHelpTextLines, nMaxHelpTextLines );
+ return;
+ }
+
+ throw lang::IllegalArgumentException( ::rtl::OUString(), *this, 0 );
+ }
+
+ //--------------------------------------------------------------------
+ void DefaultComponentInspectorModel::createDefault()
+ {
+ m_bConstructed = true;
+ }
+ //--------------------------------------------------------------------
+ void DefaultComponentInspectorModel::createWithHelpSection( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines )
+ {
+ if ( ( _nMinHelpTextLines <= 0 ) || ( _nMaxHelpTextLines <= 0 ) || ( _nMinHelpTextLines > _nMaxHelpTextLines ) )
+ throw lang::IllegalArgumentException( ::rtl::OUString(), *this, 0 );
+
+ m_bHasHelpSection = true;
+ m_nMinHelpTextLines = _nMinHelpTextLines;
+ m_nMaxHelpTextLines = _nMaxHelpTextLines;
+ m_bConstructed = true;
+ }
+ //--------------------------------------------------------------------
+ Sequence< PropertyCategoryDescriptor > SAL_CALL DefaultComponentInspectorModel::describeCategories( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ const struct
+ {
+ const sal_Char* programmaticName;
+ sal_uInt16 uiNameResId;
+ rtl::OString helpId;
+ } aCategories[] = {
+ { "General", RID_STR_PROPPAGE_DEFAULT, HID_RPT_PROPDLG_TAB_GENERAL },
+ { "Data", RID_STR_PROPPAGE_DATA, HID_RPT_PROPDLG_TAB_DATA },
+ };
+
+ const size_t nCategories = sizeof( aCategories ) / sizeof( aCategories[0] );
+ Sequence< PropertyCategoryDescriptor > aReturn( nCategories );
+ PropertyCategoryDescriptor* pReturn = aReturn.getArray();
+ for ( size_t i=0; i<nCategories; ++i, ++pReturn )
+ {
+ pReturn->ProgrammaticName = ::rtl::OUString::createFromAscii( aCategories[i].programmaticName );
+ pReturn->UIName = String( ModuleRes( aCategories[i].uiNameResId ) );
+ pReturn->HelpURL = HelpIdUrl::getHelpURL( aCategories[i].helpId );
+ }
+
+ return aReturn;
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultComponentInspectorModel::getPropertyOrderIndex( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ const sal_Int32 nPropertyId( m_pInfoService->getPropertyId( _rPropertyName ) );
+ if ( nPropertyId != -1 )
+ return nPropertyId;
+
+ if ( !m_xComponent.is() )
+ try
+ {
+ m_xComponent.set(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.DefaultFormComponentInspectorModel")),m_xContext),UNO_QUERY_THROW);
+ }
+ catch(Exception)
+ {
+ return 0;
+ }
+
+ return m_xComponent->getPropertyOrderIndex(_rPropertyName);
+ }
+
+//........................................................................
+} // namespace rptui
+//........................................................................
+
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
new file mode 100644
index 000000000000..c02683a97452
--- /dev/null
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -0,0 +1,2246 @@
+/*************************************************************************
+ *
+ * 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 "GeometryHandler.hxx"
+
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/mimeconfighelper.hxx>
+
+#include "uistrings.hrc"
+#include "reportformula.hxx"
+
+#include <unotools/textsearch.hxx>
+#include <unotools/configmgr.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/syslocale.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/StringListResource.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include "com/sun/star/inspection/StringRepresentation.hpp"
+#include <com/sun/star/inspection/PropertyLineElement.hpp>
+#include <com/sun/star/inspection/PropertyControlType.hpp>
+#include <com/sun/star/inspection/XStringListControl.hpp>
+#include <com/sun/star/report/Function.hpp>
+#include <com/sun/star/report/XReportDefinition.hpp>
+#include <com/sun/star/report/XShape.hpp>
+#include <com/sun/star/report/XSection.hpp>
+#include <com/sun/star/report/XFormattedField.hpp>
+#include <com/sun/star/report/XFixedLine.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/MeasureUnit.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/inspection/XNumericControl.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+
+#include <vcl/msgbox.hxx>
+#include <vcl/waitobj.hxx>
+#include <tools/fldunit.hxx>
+#include <vcl/stdtext.hxx>
+
+#include "ModuleHelper.hxx"
+#include "RptResId.hrc"
+#include "RptDef.hxx"
+#include "UITools.hxx"
+
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbconversion.hxx>
+#include <connectivity/dbtools.hxx>
+
+#include <boost/bind.hpp>
+#include <tools/string.hxx>
+#include "metadata.hxx"
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+
+#define ITEMID_COLOR_TABLE SID_COLOR_TABLE
+#define ITEMID_DASH_LIST SID_DASH_LIST
+#define ITEMID_LINEEND_LIST SID_LINEEND_LIST
+#include <svx/xdef.hxx>
+#include <svx/xpool.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnstcit.hxx>
+#include <svx/xlnedcit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/svxids.hrc>
+
+#define ITEMID_COLOR_TABLE SID_COLOR_TABLE
+#define ITEMID_DASH_LIST SID_DASH_LIST
+#define ITEMID_LINEEND_LIST SID_LINEEND_LIST
+#include <svx/drawitem.hxx>
+#define ITEMID_BRUSH SID_ATTR_BRUSH
+#include <editeng/brshitem.hxx>
+#include <sfx2/docfilt.hxx>
+
+#include "dlgpage.hxx"
+#include "helpids.hrc"
+#include <toolkit/helper/convert.hxx>
+
+#define DATA_OR_FORMULA 0
+#define FUNCTION 1
+#define COUNTER 2
+#define USER_DEF_FUNCTION 3
+#define UNDEF_DATA 4
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+using namespace ::com::sun::star;
+//using namespace formula;
+
+// comparing two property instances
+struct PropertyCompare : public ::std::binary_function< beans::Property, ::rtl::OUString , bool >
+{
+ bool operator() (const beans::Property& x, const ::rtl::OUString& y) const
+ {
+ return x.Name.equals(y);// ? true : false;
+ }
+ bool operator() (const ::rtl::OUString& x,const beans::Property& y) const
+ {
+ return x.equals(y.Name);// ? true : false;
+ }
+};
+
+// -----------------------------------------------------------------------------
+::rtl::OUString lcl_getQuotedFunctionName(const ::rtl::OUString& _sFunction)
+{
+ ::rtl::OUString sQuotedFunctionName(RTL_CONSTASCII_USTRINGPARAM("["));
+ sQuotedFunctionName += _sFunction + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("]"));
+ return sQuotedFunctionName;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString lcl_getQuotedFunctionName(const uno::Reference< report::XFunction>& _xFunction)
+{
+ return lcl_getQuotedFunctionName(_xFunction->getName());
+}
+// -----------------------------------------------------------------------------
+void lcl_collectFunctionNames(const uno::Reference< report::XFunctions>& _xFunctions,TFunctions& _rFunctionNames)
+{
+ uno::Reference< report::XFunctionsSupplier> xParent(_xFunctions->getParent(),uno::UNO_QUERY_THROW);
+ const sal_Int32 nCount = _xFunctions->getCount();
+ for (sal_Int32 i = 0; i < nCount ; ++i)
+ {
+ uno::Reference< report::XFunction > xFunction(_xFunctions->getByIndex(i),uno::UNO_QUERY_THROW);
+ _rFunctionNames.insert(TFunctions::value_type(lcl_getQuotedFunctionName(xFunction),TFunctionPair(xFunction,xParent)));
+ }
+}
+// -----------------------------------------------------------------------------
+void lcl_collectFunctionNames(const uno::Reference< report::XSection>& _xSection,TFunctions& _rFunctionNames)
+{
+ const uno::Reference< report::XReportDefinition> xReportDefinition = _xSection->getReportDefinition();
+ const uno::Reference< report::XGroups> xGroups = xReportDefinition->getGroups();
+ sal_Int32 nPos = -1;
+ uno::Reference< report::XGroup> xGroup = _xSection->getGroup();
+ if ( xGroup.is() )
+ nPos = getPositionInIndexAccess(xGroups.get(),xGroup);
+ else if ( _xSection == xReportDefinition->getDetail() )
+ nPos = xGroups->getCount()-1;
+
+ for (sal_Int32 i = 0 ; i <= nPos ; ++i)
+ {
+ xGroup.set(xGroups->getByIndex(i),uno::UNO_QUERY_THROW);
+ lcl_collectFunctionNames(xGroup->getFunctions(),_rFunctionNames);
+ }
+ lcl_collectFunctionNames(xReportDefinition->getFunctions(),_rFunctionNames);
+}
+// -----------------------------------------------------------------------------
+void lcl_convertFormulaTo(const uno::Any& _aPropertyValue,uno::Any& _rControlValue)
+{
+ ::rtl::OUString sName;
+ _aPropertyValue >>= sName;
+ const sal_Int32 nLen = sName.getLength();
+ if ( nLen )
+ {
+ ReportFormula aFormula( sName );
+ _rControlValue <<= aFormula.getUndecoratedContent();
+ }
+}
+// -----------------------------------------------------------------------------
+bool GeometryHandler::impl_isDataField(const ::rtl::OUString& _sName) const
+{
+ const ::rtl::OUString* pEnd = m_aFieldNames.getConstArray() + m_aFieldNames.getLength();
+ bool bIsField = ( ::std::find( m_aFieldNames.getConstArray(), pEnd, _sName ) != pEnd );
+
+ if ( !bIsField )
+ {
+ pEnd = m_aParamNames.getConstArray() + m_aParamNames.getLength();
+ bIsField = ( ::std::find( m_aParamNames.getConstArray(), pEnd, _sName ) != pEnd );
+ }
+ return bIsField;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString GeometryHandler::impl_convertToFormula( const uno::Any& _rControlValue )
+{
+ ::rtl::OUString sName;
+ _rControlValue >>= sName;
+
+ if ( !sName.getLength() )
+ return sName;
+
+ ReportFormula aParser( sName );
+ if ( aParser.isValid() )
+ return sName;
+
+ aParser = ReportFormula( impl_isDataField(sName) ? ReportFormula::Field : ReportFormula::Expression, sName );
+ return aParser.getCompleteFormula();
+}
+DBG_NAME(rpt_GeometryHandler)
+GeometryHandler::GeometryHandler(uno::Reference< uno::XComponentContext > const & context) :
+ GeometryHandler_Base(m_aMutex)
+ ,m_aPropertyListeners( m_aMutex )
+ ,m_xContext(context)
+ ,m_pInfoService(new OPropertyInfoService())
+ ,m_nDataFieldType(0)
+ ,m_bIn(false)
+{
+ DBG_CTOR(rpt_GeometryHandler,NULL);
+ try
+ {
+ const uno::Reference< lang::XMultiComponentFactory > xFac = m_xContext->getServiceManager();
+ m_xFormComponentHandler.set(xFac->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.FormComponentPropertyHandler")),m_xContext),uno::UNO_QUERY_THROW);
+ m_xTypeConverter.set(xFac->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter" )),m_xContext),uno::UNO_QUERY_THROW);
+ loadDefaultFunctions();
+ }
+ catch(const uno::Exception&)
+ {
+ }
+}
+// -----------------------------------------------------------------------------
+GeometryHandler::~GeometryHandler()
+{
+ DBG_DTOR(rpt_GeometryHandler,NULL);
+}
+//------------------------------------------------------------------------
+::rtl::OUString SAL_CALL GeometryHandler::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return getImplementationName_Static();
+}
+
+//------------------------------------------------------------------------
+sal_Bool SAL_CALL GeometryHandler::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_static());
+}
+
+//------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL GeometryHandler::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ return getSupportedServiceNames_static();
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString GeometryHandler::getImplementationName_Static( ) throw(uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.GeometryHandler"));
+}
+
+//------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > GeometryHandler::getSupportedServiceNames_static( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSupported(1);
+ aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.inspection.GeometryHandler"));
+ return aSupported;
+}
+
+//------------------------------------------------------------------------
+uno::Reference< uno::XInterface > SAL_CALL GeometryHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
+{
+ return *(new GeometryHandler( _rxContext ));
+}
+// overload WeakComponentImplHelperBase::disposing()
+// This function is called upon disposing the component,
+// if your component needs special work when it becomes
+// disposed, do it here.
+void SAL_CALL GeometryHandler::disposing()
+{
+ try
+ {
+ ::comphelper::disposeComponent(m_xFormComponentHandler);
+ ::comphelper::disposeComponent(m_xTypeConverter);
+ if ( m_xReportComponent.is() && m_xReportComponent->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATAFIELD) )
+ m_xReportComponent->removePropertyChangeListener(PROPERTY_DATAFIELD,static_cast< beans::XPropertyChangeListener* >( this ));
+
+ m_xReportComponent.clear();
+ m_xRowSet.clear();
+ m_aPropertyListeners.clear();
+ }
+ catch(uno::Exception&)
+ {}
+}
+void SAL_CALL GeometryHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener) throw (uno::RuntimeException)
+{
+ m_xFormComponentHandler->addEventListener(xListener);
+}
+
+void SAL_CALL GeometryHandler::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw (uno::RuntimeException)
+{
+ m_xFormComponentHandler->removeEventListener(aListener);
+}
+
+// inspection::XPropertyHandler:
+
+/********************************************************************************/
+void SAL_CALL GeometryHandler::inspect( const uno::Reference< uno::XInterface > & _rxInspectee ) throw (uno::RuntimeException, lang::NullPointerException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_sScope = m_sDefaultFunction = ::rtl::OUString();
+ m_bNewFunction = false;
+ m_nDataFieldType = 0;
+ m_xFunction.clear();
+ m_aFunctionNames.clear();
+ try
+ {
+ if ( m_xReportComponent.is() && m_xReportComponent->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATAFIELD) )
+ m_xReportComponent->removePropertyChangeListener(PROPERTY_DATAFIELD,static_cast< beans::XPropertyChangeListener* >( this ));
+
+ const uno::Reference< container::XNameContainer > xObjectAsContainer( _rxInspectee, uno::UNO_QUERY );
+ m_xReportComponent.set( xObjectAsContainer->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReportComponent" ) ) ), uno::UNO_QUERY );
+
+ const ::rtl::OUString sRowSet(RTL_CONSTASCII_USTRINGPARAM("RowSet"));
+ if ( xObjectAsContainer->hasByName( sRowSet ) )
+ {
+ const uno::Any aRowSet( xObjectAsContainer->getByName(sRowSet) );
+ aRowSet >>= m_xRowSet;
+ // forward the rowset to our delegator handler
+ uno::Reference< beans::XPropertySet > xProp( m_xFormComponentHandler,uno::UNO_QUERY );
+ xProp->setPropertyValue( sRowSet, aRowSet );
+
+ m_aParamNames = getParameterNames( m_xRowSet );
+ impl_initFieldList_nothrow(m_aFieldNames);
+ if ( m_xReportComponent->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATAFIELD) )
+ m_xReportComponent->addPropertyChangeListener(PROPERTY_DATAFIELD,static_cast< beans::XPropertyChangeListener* >( this ));
+ }
+
+ const uno::Reference< report::XReportComponent> xReportComponent( m_xReportComponent, uno::UNO_QUERY);
+ uno::Reference< report::XSection> xSection( m_xReportComponent, uno::UNO_QUERY );
+ if ( !xSection.is() && xReportComponent.is() )
+ xSection = xReportComponent->getSection();
+ if ( xSection.is() )
+ lcl_collectFunctionNames( xSection, m_aFunctionNames );
+ }
+ catch(uno::Exception)
+ {
+ throw lang::NullPointerException();
+ }
+ m_xFormComponentHandler->inspect(m_xReportComponent);
+}
+
+uno::Any SAL_CALL GeometryHandler::getPropertyValue(const ::rtl::OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ uno::Any aPropertyValue;
+ const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_CONDITIONALPRINTEXPRESSION:
+ case PROPERTY_ID_INITIALFORMULA:
+ case PROPERTY_ID_FORMULA:
+ case PROPERTY_ID_DATAFIELD:
+ aPropertyValue = m_xReportComponent->getPropertyValue( PropertyName );
+ lcl_convertFormulaTo(aPropertyValue,aPropertyValue);
+ if ( PROPERTY_ID_DATAFIELD == nId )
+ {
+ ::rtl::OUString sDataField;
+ aPropertyValue >>= sDataField;
+ switch(m_nDataFieldType)
+ {
+ case DATA_OR_FORMULA:
+ break;
+ case FUNCTION:
+ if ( isDefaultFunction(sDataField,sDataField) )
+ aPropertyValue <<= sDataField;
+ else if ( !sDataField.getLength() )
+ aPropertyValue = uno::Any();
+ break;
+ case COUNTER:
+ case USER_DEF_FUNCTION:
+ aPropertyValue = uno::Any();
+ break;
+ }
+
+ }
+ break;
+ case PROPERTY_ID_TYPE:
+ {
+ const sal_uInt32 nOldDataFieldType = m_nDataFieldType;
+ m_nDataFieldType = impl_getDataFieldType_throw();
+ if ( UNDEF_DATA == m_nDataFieldType )
+ m_nDataFieldType = nOldDataFieldType;
+ aPropertyValue <<= m_nDataFieldType;
+ }
+ break;
+ case PROPERTY_ID_FORMULALIST:
+ case PROPERTY_ID_SCOPE:
+ {
+ uno::Any aDataField = m_xReportComponent->getPropertyValue( PROPERTY_DATAFIELD );
+ lcl_convertFormulaTo(aDataField,aDataField);
+ ::rtl::OUString sDataField;
+ aDataField >>= sDataField;
+ switch(m_nDataFieldType)
+ {
+ case DATA_OR_FORMULA:
+ break;
+ case FUNCTION:
+ if ( isDefaultFunction(sDataField,sDataField,uno::Reference< report::XFunctionsSupplier>(),true) )
+ aPropertyValue <<= (PROPERTY_ID_FORMULALIST == nId ? m_sDefaultFunction : m_sScope);
+ break;
+ case USER_DEF_FUNCTION:
+ if ( sDataField.getLength() && PROPERTY_ID_FORMULALIST == nId )
+ aPropertyValue = aDataField;
+ break;
+ case COUNTER:
+ if ( PROPERTY_ID_SCOPE == nId && impl_isCounterFunction_throw(sDataField,m_sScope) )
+ aPropertyValue <<= m_sScope;
+ break;
+ }
+
+ }
+ break;
+ case PROPERTY_ID_BACKCOLOR:
+ case PROPERTY_ID_CONTROLBACKGROUND:
+ {
+ aPropertyValue = m_xReportComponent->getPropertyValue( PropertyName );
+ sal_Int32 nColor = COL_TRANSPARENT;
+ if ( (aPropertyValue >>= nColor) && static_cast<sal_Int32>(COL_TRANSPARENT) == nColor )
+ aPropertyValue.clear();
+ }
+ break;
+ case PROPERTY_ID_MIMETYPE:
+ {
+ ::rtl::OUString sValue;
+ m_xReportComponent->getPropertyValue( PropertyName ) >>= sValue;
+ aPropertyValue <<= impl_ConvertMimeTypeToUI_nothrow(sValue);
+ }
+ break;
+ default:
+ aPropertyValue = m_xReportComponent->getPropertyValue( PropertyName );
+ break;
+ }
+ return aPropertyValue;
+}
+
+void SAL_CALL GeometryHandler::setPropertyValue(const ::rtl::OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ ::osl::ResettableMutexGuard aGuard( m_aMutex );
+ uno::Any aNewValue = Value;
+ const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
+ bool bHandled = false;
+ switch(nId)
+ {
+ case PROPERTY_ID_INITIALFORMULA:
+ case PROPERTY_ID_FORMULA:
+ break;
+ case PROPERTY_ID_DATAFIELD:
+ {
+ OBlocker aBlocker(m_bIn);
+ m_xReportComponent->setPropertyValue(PropertyName, aNewValue);
+ bHandled = true;
+ const ::rtl::OUString sOldFunctionName = m_sDefaultFunction;
+ const ::rtl::OUString sOldScope = m_sScope;
+
+ uno::Any aPropertyValue;
+ lcl_convertFormulaTo(Value,aPropertyValue);
+ ::rtl::OUString sDataField;
+ aPropertyValue >>= sDataField;
+
+ m_sScope = m_sDefaultFunction = ::rtl::OUString();
+ m_xFunction.clear();
+ const sal_uInt32 nOldDataFieldType = m_nDataFieldType;
+ if ( sDataField.getLength() )
+ {
+ if ( isDefaultFunction(sDataField,sDataField,uno::Reference< report::XFunctionsSupplier>(),true) )
+ m_nDataFieldType = FUNCTION;
+ else if ( m_aFunctionNames.find(sDataField) != m_aFunctionNames.end() )
+ m_nDataFieldType = USER_DEF_FUNCTION;
+ }
+
+ resetOwnProperties(aGuard,sOldFunctionName,sOldScope,nOldDataFieldType);
+ }
+ break;
+ case PROPERTY_ID_TYPE:
+ {
+ bHandled = true;
+ Value >>= m_nDataFieldType;
+
+ const ::rtl::OUString sOldFunctionName = m_sDefaultFunction;
+ const ::rtl::OUString sOldScope = m_sScope;
+ m_sDefaultFunction = m_sScope = ::rtl::OUString();
+
+ if ( m_nDataFieldType == COUNTER )
+ {
+ impl_setCounterFunction_throw();
+ }
+ else
+ {
+ if ( m_bNewFunction )
+ removeFunction();
+ m_xFunction.clear();
+ OBlocker aBlocker(m_bIn);
+ m_xReportComponent->setPropertyValue(PROPERTY_DATAFIELD,uno::makeAny(::rtl::OUString()));
+ }
+ resetOwnProperties(aGuard,sOldFunctionName,sOldScope,m_nDataFieldType);
+ }
+ break;
+ case PROPERTY_ID_FORMULALIST:
+ {
+ bHandled = true;
+ ::rtl::OUString sFunction;
+ if ( !(Value >>= sFunction) || !sFunction.getLength() )
+ {
+ if ( m_nDataFieldType == FUNCTION )
+ {
+ m_sDefaultFunction = ::rtl::OUString();
+ if ( m_bNewFunction )
+ removeFunction();
+ m_xFunction.clear();
+
+ beans::PropertyChangeEvent aEvent;
+ aEvent.PropertyName = PROPERTY_SCOPE;
+ aEvent.OldValue <<= m_sScope;
+ m_sScope = ::rtl::OUString();
+ aEvent.NewValue <<= m_sScope;
+ aGuard.clear();
+ m_aPropertyListeners.notify( aEvent, &beans::XPropertyChangeListener::propertyChange );
+ }
+ else if ( m_nDataFieldType == USER_DEF_FUNCTION )
+ {
+ OBlocker aBlocker(m_bIn);
+ m_xReportComponent->setPropertyValue(PROPERTY_DATAFIELD,uno::makeAny(::rtl::OUString()));
+ }
+ }
+ else if ( m_nDataFieldType == USER_DEF_FUNCTION )
+ {
+ ::rtl::OUString sDataField;
+ OBlocker aBlocker(m_bIn);
+ const sal_uInt32 nNewDataType = impl_getDataFieldType_throw(sFunction);
+ if ( nNewDataType != UNDEF_DATA && nNewDataType != m_nDataFieldType )
+ {
+ const ::rtl::OUString sOldFunctionName = m_sDefaultFunction;
+ const ::rtl::OUString sOldScope = m_sScope;
+ m_sScope = m_sDefaultFunction = ::rtl::OUString();
+ m_xFunction.clear();
+ if ( nNewDataType == COUNTER )
+ impl_isCounterFunction_throw(sFunction,m_sScope);
+ else
+ {
+ ::rtl::OUString sNamePostFix;
+ const uno::Reference< report::XFunctionsSupplier> xFunctionsSupplier = fillScope_throw(sNamePostFix);
+ isDefaultFunction(sFunction,sDataField,xFunctionsSupplier,true);
+ }
+ const sal_uInt32 nOldDataFieldType = m_nDataFieldType;
+ m_nDataFieldType = nNewDataType;
+ m_xReportComponent->setPropertyValue(PROPERTY_DATAFIELD,uno::makeAny(impl_convertToFormula( uno::makeAny(sFunction))));
+ resetOwnProperties(aGuard,sOldFunctionName,sOldScope,nOldDataFieldType);
+ }
+ else
+ m_xReportComponent->setPropertyValue(PROPERTY_DATAFIELD,uno::makeAny(impl_convertToFormula( uno::makeAny(sFunction))));
+ }
+ else if ( m_nDataFieldType == FUNCTION )
+ {
+ uno::Any aPropertyValue = m_xReportComponent->getPropertyValue(PROPERTY_DATAFIELD);
+ lcl_convertFormulaTo(aPropertyValue,aPropertyValue);
+ ::rtl::OUString sDataField;
+ aPropertyValue >>= sDataField;
+ if ( m_nDataFieldType == FUNCTION && (!isDefaultFunction(sDataField,sDataField) || m_sDefaultFunction != sFunction) )
+ {
+ if ( m_bNewFunction )
+ removeFunction();
+ // function currently does not exist
+ createDefaultFunction(aGuard,sFunction,sDataField);
+ m_sDefaultFunction = sFunction;
+ }
+ }
+ }
+
+ break;
+ case PROPERTY_ID_SCOPE:
+ if ( !(Value >>= m_sScope) )
+ m_sScope = ::rtl::OUString();
+ else
+ {
+ if ( m_bNewFunction )
+ removeFunction();
+ if ( m_nDataFieldType == COUNTER )
+ impl_setCounterFunction_throw();
+ else
+ {
+ OSL_ENSURE(m_xFunction.is(),"Where is my function gone!");
+
+ ::rtl::OUString sNamePostFix;
+ const uno::Reference< report::XFunctionsSupplier> xFunctionsSupplier = fillScope_throw(sNamePostFix);
+
+ ::rtl::OUString sQuotedFunctionName(lcl_getQuotedFunctionName(m_xFunction));
+ if ( isDefaultFunction(sQuotedFunctionName,sQuotedFunctionName,xFunctionsSupplier,true) )
+ m_bNewFunction = false;
+ else
+ {
+ ::rtl::OUString sDefaultFunctionName;
+ ::rtl::OUString sDataField;
+ OSL_VERIFY( impl_isDefaultFunction_nothrow(m_xFunction,sDataField,sDefaultFunctionName) );
+ m_sDefaultFunction = sDefaultFunctionName;
+ createDefaultFunction(aGuard,m_sDefaultFunction,sDataField);
+ }
+ }
+ }
+ bHandled = true;
+ break;
+ case PROPERTY_ID_POSITIONX:
+ case PROPERTY_ID_POSITIONY:
+ case PROPERTY_ID_HEIGHT:
+ case PROPERTY_ID_WIDTH:
+ {
+ const uno::Reference< report::XReportComponent> xSourceReportComponent(m_xReportComponent,uno::UNO_QUERY);
+ if ( xSourceReportComponent.is() ) // check only report components
+ {
+ sal_Int32 nNewValue = 0;
+ Value >>= nNewValue;
+ awt::Point aAwtPoint = xSourceReportComponent->getPosition();
+ awt::Size aAwtSize = xSourceReportComponent->getSize();
+ if ( nId == PROPERTY_ID_POSITIONX )
+ aAwtPoint.X = nNewValue;
+ else if ( nId == PROPERTY_ID_POSITIONY )
+ aAwtPoint.Y = nNewValue;
+ else if ( nId == PROPERTY_ID_HEIGHT )
+ aAwtSize.Height = nNewValue;
+ else if ( nId == PROPERTY_ID_WIDTH )
+ aAwtSize.Width = nNewValue;
+
+ checkPosAndSize(aAwtPoint,aAwtSize);
+ }
+ }
+ break;
+ case PROPERTY_ID_FONT:
+ {
+ const uno::Reference< report::XReportControlFormat > xReportControlFormat( m_xReportComponent,uno::UNO_QUERY_THROW );
+ uno::Sequence< beans::NamedValue > aFontSettings;
+ OSL_VERIFY( Value >>= aFontSettings );
+ applyCharacterSettings( xReportControlFormat, aFontSettings );
+ bHandled = true;
+ }
+ break;
+ case PROPERTY_ID_MIMETYPE:
+ {
+ ::rtl::OUString sValue;
+ Value >>= sValue;
+ aNewValue <<= impl_ConvertUIToMimeType_nothrow(sValue);
+ }
+ default:
+ break;
+ }
+
+ if ( !bHandled )
+ m_xReportComponent->setPropertyValue(PropertyName, aNewValue);
+}
+
+// -----------------------------------------------------------------------------
+beans::PropertyState SAL_CALL GeometryHandler::getPropertyState(const ::rtl::OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return m_xFormComponentHandler->getPropertyState(PropertyName);
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::implCreateListLikeControl(
+ const uno::Reference< inspection::XPropertyControlFactory >& _rxControlFactory
+ ,inspection::LineDescriptor & out_Descriptor
+ ,sal_uInt16 _nResId
+ ,sal_Bool _bReadOnlyControl
+ ,sal_Bool _bTrueIfListBoxFalseIfComboBox
+ )
+{
+ ::std::vector< ::rtl::OUString > aList;
+ tools::StringListResource aRes(ModuleRes(_nResId),aList);
+
+ implCreateListLikeControl(_rxControlFactory,out_Descriptor,aList,_bReadOnlyControl,_bTrueIfListBoxFalseIfComboBox);
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::implCreateListLikeControl(
+ const uno::Reference< inspection::XPropertyControlFactory >& _rxControlFactory
+ ,inspection::LineDescriptor & out_Descriptor
+ ,const ::std::vector< ::rtl::OUString>& _aEntries
+ ,sal_Bool _bReadOnlyControl
+ ,sal_Bool _bTrueIfListBoxFalseIfComboBox
+ )
+{
+ const uno::Reference< inspection::XStringListControl > xListControl(
+ _rxControlFactory->createPropertyControl(
+ _bTrueIfListBoxFalseIfComboBox ? inspection::PropertyControlType::ListBox : inspection::PropertyControlType::ComboBox, _bReadOnlyControl
+ ),
+ uno::UNO_QUERY_THROW
+ );
+
+ out_Descriptor.Control = xListControl.get();
+ ::std::for_each( _aEntries.begin(), _aEntries.end(),::boost::bind( &inspection::XStringListControl::appendListEntry, xListControl,_1 ));
+}
+// -----------------------------------------------------------------------------
+
+inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const ::rtl::OUString & PropertyName, const uno::Reference< inspection::XPropertyControlFactory > & _xControlFactory) throw (beans::UnknownPropertyException, lang::NullPointerException,uno::RuntimeException)
+{
+ inspection::LineDescriptor aOut;
+ const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_FORCENEWPAGE:
+ case PROPERTY_ID_NEWROWORCOL:
+ implCreateListLikeControl(_xControlFactory,aOut,RID_STR_FORCENEWPAGE_CONST,sal_False,sal_True);
+ break;
+ case PROPERTY_ID_GROUPKEEPTOGETHER:
+ implCreateListLikeControl(_xControlFactory,aOut,RID_STR_GROUPKEEPTOGETHER_CONST,sal_False,sal_True);
+ break;
+ case PROPERTY_ID_PAGEHEADEROPTION:
+ case PROPERTY_ID_PAGEFOOTEROPTION:
+ implCreateListLikeControl(_xControlFactory,aOut,RID_STR_REPORTPRINTOPTION_CONST,sal_False,sal_True);
+ break;
+ case PROPERTY_ID_FORMULALIST:
+ {
+ ::std::vector< ::rtl::OUString > aList;
+ impl_fillFormulaList_nothrow(aList);
+ implCreateListLikeControl(_xControlFactory,aOut,aList,sal_False,sal_True);
+ }
+ break;
+ case PROPERTY_ID_SCOPE:
+ {
+ ::std::vector< ::rtl::OUString > aList;
+ impl_fillScopeList_nothrow(aList);
+ implCreateListLikeControl(_xControlFactory,aOut,aList,sal_False,sal_True);
+ }
+ break;
+ case PROPERTY_ID_MIMETYPE:
+ {
+ ::std::vector< ::rtl::OUString > aList;
+ impl_fillMimeTypes_nothrow(aList);
+ implCreateListLikeControl(_xControlFactory,aOut,aList,sal_False,sal_True);
+ }
+ break;
+ case PROPERTY_ID_TYPE:
+ implCreateListLikeControl(_xControlFactory,aOut,RID_STR_TYPE_CONST,sal_False,sal_True);
+ break;
+ case PROPERTY_ID_VISIBLE:
+ case PROPERTY_ID_CANGROW:
+ case PROPERTY_ID_CANSHRINK:
+ case PROPERTY_ID_REPEATSECTION:
+ case PROPERTY_ID_PRINTREPEATEDVALUES:
+ case PROPERTY_ID_STARTNEWCOLUMN:
+ case PROPERTY_ID_RESETPAGENUMBER:
+ case PROPERTY_ID_PRINTWHENGROUPCHANGE:
+ case PROPERTY_ID_KEEPTOGETHER:
+ case PROPERTY_ID_DEEPTRAVERSING:
+ case PROPERTY_ID_PREEVALUATED:
+ case PROPERTY_ID_PRESERVEIRI:
+ case PROPERTY_ID_BACKTRANSPARENT:
+ case PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT:
+ {
+ sal_uInt16 nResId = RID_STR_BOOL;
+ if ( PROPERTY_ID_KEEPTOGETHER == nId && uno::Reference< report::XGroup>(m_xReportComponent,uno::UNO_QUERY).is())
+ nResId = RID_STR_KEEPTOGETHER_CONST;
+ implCreateListLikeControl(_xControlFactory,aOut,nResId,sal_False,sal_True);
+ }
+ break;
+ case PROPERTY_ID_INITIALFORMULA:
+ case PROPERTY_ID_FORMULA:
+ aOut.PrimaryButtonId = rtl::OUString::createFromAscii(UID_RPT_PROP_FORMULA);
+ aOut.HasPrimaryButton = sal_True;
+ aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::MultiLineTextField , sal_False);
+ break;
+ case PROPERTY_ID_CONDITIONALPRINTEXPRESSION:
+ aOut.PrimaryButtonId = rtl::OUString::createFromAscii(UID_RPT_PROP_FORMULA);
+ aOut.HasPrimaryButton = sal_True;
+ aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::MultiLineTextField , sal_False);
+ break;
+ case PROPERTY_ID_DATAFIELD:
+ {
+ uno::Reference< inspection::XStringListControl > xListControl(
+ _xControlFactory->createPropertyControl(
+ m_nDataFieldType == DATA_OR_FORMULA ? inspection::PropertyControlType::ComboBox : inspection::PropertyControlType::ListBox, sal_False
+ ),
+ uno::UNO_QUERY_THROW
+ );
+
+ if ( m_nDataFieldType == DATA_OR_FORMULA )
+ {
+ aOut.PrimaryButtonId = rtl::OUString::createFromAscii(UID_RPT_PROP_FORMULA);
+ aOut.HasPrimaryButton = sal_True;
+ }
+
+ aOut.Control = xListControl.get();
+ if ( m_nDataFieldType == USER_DEF_FUNCTION )
+ {
+ // add function names
+ ::std::for_each( m_aFunctionNames.begin(), m_aFunctionNames.end(),
+ ::std::compose1(
+ ::boost::bind( &inspection::XStringListControl::appendListEntry, xListControl,_1 ),
+ ::std::select1st<TFunctions::value_type>()));
+ }
+ else
+ {
+ ::std::for_each( m_aFieldNames.getConstArray(), m_aFieldNames.getConstArray() + m_aFieldNames.getLength(),
+ ::boost::bind( &inspection::XStringListControl::appendListEntry, xListControl, _1 ) );
+ ::std::for_each( m_aParamNames.getConstArray(), m_aParamNames.getConstArray() + m_aParamNames.getLength(),
+ ::boost::bind( &inspection::XStringListControl::appendListEntry, xListControl, _1 ) );
+ }
+ }
+ break;
+ case PROPERTY_ID_BACKCOLOR:
+ case PROPERTY_ID_CONTROLBACKGROUND:
+ aOut.Control = _xControlFactory->createPropertyControl( inspection::PropertyControlType::ColorListBox, sal_False );
+ break;
+ case PROPERTY_ID_FONT:
+ aOut.PrimaryButtonId = rtl::OUString::createFromAscii(UID_RPT_RPT_PROP_DLG_FONT_TYPE);
+ aOut.Control = _xControlFactory->createPropertyControl( inspection::PropertyControlType::TextField, sal_True );
+ aOut.HasPrimaryButton = sal_True;
+ break;
+ case PROPERTY_ID_AREA:
+ aOut.PrimaryButtonId = rtl::OUString::createFromAscii(UID_RPT_RPT_PROP_DLG_AREA);
+ aOut.Control = _xControlFactory->createPropertyControl( inspection::PropertyControlType::TextField, sal_True );
+ aOut.HasPrimaryButton = sal_True;
+ break;
+ case PROPERTY_ID_VERTICALALIGN:
+ implCreateListLikeControl(_xControlFactory,aOut,RID_STR_VERTICAL_ALIGN_CONST,sal_False,sal_True);
+ break;
+ case PROPERTY_ID_PARAADJUST:
+ implCreateListLikeControl(_xControlFactory,aOut,RID_STR_PARAADJUST_CONST,sal_False,sal_True);
+ break;
+ default:
+ {
+ aOut = m_xFormComponentHandler->describePropertyLine(PropertyName, _xControlFactory);
+ }
+ }
+
+ if ( nId != -1 )
+ {
+ aOut.Category = ((m_pInfoService->getPropertyUIFlags(nId ) & PROP_FLAG_DATA_PROPERTY) != 0) ?
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data"))
+ :
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("General"));
+ aOut.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nId ) );
+ aOut.DisplayName = m_pInfoService->getPropertyTranslation(nId);
+ }
+
+ if ( ( nId == PROPERTY_ID_POSITIONX )
+ || ( nId == PROPERTY_ID_POSITIONY )
+ || ( nId == PROPERTY_ID_WIDTH )
+ || ( nId == PROPERTY_ID_HEIGHT )
+ )
+ {
+ const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
+ const sal_Int16 nDisplayUnit = VCLUnoHelper::ConvertToMeasurementUnit( MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH, 1 );
+ uno::Reference< inspection::XNumericControl > xNumericControl(aOut.Control,uno::UNO_QUERY);
+ xNumericControl->setDecimalDigits( 2 );
+ xNumericControl->setValueUnit( util::MeasureUnit::MM_100TH );
+ xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
+ if ( nDisplayUnit != -1 )
+ xNumericControl->setDisplayUnit( nDisplayUnit );
+ uno::Reference< report::XReportComponent> xComp(m_xReportComponent,uno::UNO_QUERY);
+ if ( xComp.is() && xComp->getSection().is() )
+ {
+ uno::Reference< report::XReportDefinition > xReport = xComp->getSection()->getReportDefinition();
+ OSL_ENSURE(xReport.is(),"Why is the report definition NULL!");
+ if ( xReport.is() )
+ {
+ const awt::Size aSize = getStyleProperty<awt::Size>(xReport,PROPERTY_PAPERSIZE);
+ const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReport,PROPERTY_LEFTMARGIN);
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReport,PROPERTY_RIGHTMARGIN);
+ switch(nId)
+ {
+ case PROPERTY_ID_POSITIONX:
+ case PROPERTY_ID_POSITIONY:
+ case PROPERTY_ID_WIDTH:
+ xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
+ xNumericControl->setMaxValue(beans::Optional<double>(sal_True,double(aSize.Width - nLeftMargin - nRightMargin)));
+ if ( PROPERTY_ID_WIDTH == nId )
+ {
+ uno::Reference<report::XFixedLine> xFixedLine(m_xReportComponent,uno::UNO_QUERY);
+ if ( xFixedLine.is() && xFixedLine->getOrientation() == 1 ) // vertical
+ xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.08 ));
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else if ( PROPERTY_ID_HEIGHT == nId )
+ {
+ const uno::Reference< report::XSection> xSection(m_xReportComponent,uno::UNO_QUERY);
+ if ( xSection.is() )
+ {
+ sal_Int32 nHeight = 0;
+ const sal_Int32 nCount = xSection->getCount();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ uno::Reference<drawing::XShape> xShape(xSection->getByIndex(i),uno::UNO_QUERY);
+ nHeight = ::std::max<sal_Int32>(nHeight,xShape->getPosition().Y + xShape->getSize().Height);
+ }
+ xNumericControl->setMinValue(beans::Optional<double>(sal_True,nHeight ));
+ }
+ }
+ }
+ return aOut;
+}
+// -----------------------------------------------------------------------------
+beans::Property GeometryHandler::getProperty(const ::rtl::OUString & PropertyName)
+{
+ uno::Sequence< beans::Property > aProps = getSupportedProperties();
+ const beans::Property* pIter = aProps.getConstArray();
+ const beans::Property* pEnd = pIter + aProps.getLength();
+ const beans::Property* pFind = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyCompare(),boost::cref(PropertyName)));
+ if ( pFind == pEnd )
+ return beans::Property();
+ return *pFind;
+}
+uno::Any GeometryHandler::getConstantValue(sal_Bool _bToControlValue,sal_uInt16 _nResId,const uno::Any& _aValue,const ::rtl::OUString& _sConstantName,const ::rtl::OUString & PropertyName )
+{
+ ::std::vector< ::rtl::OUString > aList;
+ tools::StringListResource aRes(ModuleRes(_nResId),aList);
+ uno::Sequence< ::rtl::OUString > aSeq(aList.size());
+ ::std::copy( aList.begin(), aList.end(), aSeq.getArray() );
+
+ uno::Reference< inspection::XStringRepresentation > xConversionHelper = inspection::StringRepresentation::createConstant( m_xContext,m_xTypeConverter,_sConstantName,aSeq);
+ if ( _bToControlValue )
+ {
+ return uno::makeAny( xConversionHelper->convertToControlValue( _aValue ) );
+ }
+ else
+ {
+ ::rtl::OUString sControlValue;
+ _aValue >>= sControlValue;
+ const beans::Property aProp = getProperty(PropertyName);
+ return xConversionHelper->convertToPropertyValue( sControlValue, aProp.Type );
+ }
+}
+
+uno::Any SAL_CALL GeometryHandler::convertToPropertyValue(const ::rtl::OUString & PropertyName, const uno::Any & _rControlValue) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ uno::Any aPropertyValue( _rControlValue );
+ const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_FORCENEWPAGE:
+ case PROPERTY_ID_NEWROWORCOL:
+ aPropertyValue = getConstantValue(sal_False,RID_STR_FORCENEWPAGE_CONST,_rControlValue,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ForceNewPage")),PropertyName);
+ break;
+ case PROPERTY_ID_GROUPKEEPTOGETHER:
+ aPropertyValue = getConstantValue(sal_False,RID_STR_GROUPKEEPTOGETHER_CONST,_rControlValue,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.GroupKeepTogether")),PropertyName);
+ break;
+ case PROPERTY_ID_PAGEHEADEROPTION:
+ case PROPERTY_ID_PAGEFOOTEROPTION:
+ aPropertyValue = getConstantValue(sal_False,RID_STR_REPORTPRINTOPTION_CONST,_rControlValue,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ReportPrintOption")),PropertyName);
+ break;
+ case PROPERTY_ID_BACKCOLOR:
+ case PROPERTY_ID_CONTROLBACKGROUND:
+ if ( !_rControlValue.hasValue() )
+ {
+ aPropertyValue <<= static_cast<sal_Int32>(COL_TRANSPARENT);
+ break;
+ }
+ // run through
+
+ case PROPERTY_ID_KEEPTOGETHER:
+ if ( uno::Reference< report::XGroup>(m_xReportComponent,uno::UNO_QUERY).is())
+ {
+ aPropertyValue = getConstantValue(sal_False,RID_STR_KEEPTOGETHER_CONST,_rControlValue,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.KeepTogether")),PropertyName);
+ break;
+ }
+ // run through
+
+ case PROPERTY_ID_VISIBLE:
+ case PROPERTY_ID_CANGROW:
+ case PROPERTY_ID_CANSHRINK:
+ case PROPERTY_ID_REPEATSECTION:
+ case PROPERTY_ID_PRINTREPEATEDVALUES:
+ case PROPERTY_ID_STARTNEWCOLUMN:
+ case PROPERTY_ID_RESETPAGENUMBER:
+ case PROPERTY_ID_PRINTWHENGROUPCHANGE:
+ case PROPERTY_ID_DEEPTRAVERSING:
+ case PROPERTY_ID_PREEVALUATED:
+ case PROPERTY_ID_PRESERVEIRI:
+ case PROPERTY_ID_BACKTRANSPARENT:
+ case PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT:
+ {
+ if ( aPropertyValue.hasValue() )
+ {
+ const beans::Property aProp = getProperty(PropertyName);
+ if ( aPropertyValue.getValueType().equals( aProp.Type ) )
+ // nothing to do, type is already as desired
+ return aPropertyValue;
+
+ if ( _rControlValue.getValueType().getTypeClass() == uno::TypeClass_STRING )
+ {
+ ::rtl::OUString sControlValue;
+ _rControlValue >>= sControlValue;
+
+ const uno::Reference< inspection::XStringRepresentation > xConversionHelper = inspection::StringRepresentation::create( m_xContext,m_xTypeConverter );
+ aPropertyValue = xConversionHelper->convertToPropertyValue( sControlValue, aProp.Type );
+ }
+ else
+ {
+ try
+ {
+ aPropertyValue = m_xTypeConverter->convertTo( _rControlValue, aProp.Type );
+ }
+ catch( const uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "GeometryHandler::convertToPropertyValue: caught an exception while converting via TypeConverter!" );
+ }
+ }
+ }
+
+ break;
+ }
+ case PROPERTY_ID_CONDITIONALPRINTEXPRESSION:
+ case PROPERTY_ID_INITIALFORMULA:
+ case PROPERTY_ID_FORMULA:
+ return uno::makeAny( impl_convertToFormula( _rControlValue ) );
+ case PROPERTY_ID_DATAFIELD:
+ {
+ ::rtl::OUString sDataField;
+ _rControlValue >>= sDataField;
+ if ( isDefaultFunction(sDataField,sDataField) )
+ {
+ OSL_ENSURE(m_xFunction.is(),"No function set!");
+ aPropertyValue <<= impl_convertToFormula( uno::makeAny(lcl_getQuotedFunctionName(m_xFunction)) );
+ }
+ else
+ aPropertyValue <<= impl_convertToFormula( _rControlValue );
+ }
+ break;
+ case PROPERTY_ID_POSITIONX:
+ {
+ aPropertyValue = m_xFormComponentHandler->convertToPropertyValue(PropertyName, _rControlValue);
+ sal_Int32 nPosX = 0;
+ aPropertyValue >>= nPosX;
+ const uno::Reference< report::XReportComponent> xSourceReportComponent(m_xReportComponent,uno::UNO_QUERY);
+ if ( xSourceReportComponent->getSection().is() )
+ nPosX += getStyleProperty<sal_Int32>(xSourceReportComponent->getSection()->getReportDefinition(),PROPERTY_LEFTMARGIN);
+ aPropertyValue <<= nPosX;
+ }
+ break;
+ case PROPERTY_ID_FONT:
+ aPropertyValue = m_xFormComponentHandler->convertToPropertyValue(PROPERTY_FONT, _rControlValue);
+ break;
+ case PROPERTY_ID_SCOPE:
+ case PROPERTY_ID_FORMULALIST:
+ case PROPERTY_ID_AREA:
+ aPropertyValue = _rControlValue;
+ break;
+ case PROPERTY_ID_TYPE:
+ {
+ ::rtl::OUString sValue;
+ _rControlValue >>= sValue;
+ ::std::vector< ::rtl::OUString > aList;
+ tools::StringListResource aRes(ModuleRes(RID_STR_TYPE_CONST),aList);
+ ::std::vector< ::rtl::OUString >::iterator aFind = ::std::find(aList.begin(),aList.end(),sValue);
+ if ( aFind != aList.end() )
+ aPropertyValue <<= static_cast<sal_uInt32>(aFind - aList.begin());
+ }
+ break;
+ case PROPERTY_ID_MIMETYPE:
+ aPropertyValue = _rControlValue;
+ break;
+ case PROPERTY_ID_VERTICALALIGN:
+ {
+ ::rtl::OUString sValue;
+ _rControlValue >>= sValue;
+ ::std::vector< ::rtl::OUString > aList;
+ tools::StringListResource aRes(ModuleRes(RID_STR_VERTICAL_ALIGN_CONST),aList);
+ ::std::vector< ::rtl::OUString >::iterator aFind = ::std::find(aList.begin(),aList.end(),sValue);
+ if ( aFind != aList.end() )
+ aPropertyValue <<= static_cast<style::VerticalAlignment>(aFind - aList.begin());
+ }
+ break;
+ case PROPERTY_ID_PARAADJUST:
+ {
+ ::rtl::OUString sValue;
+ _rControlValue >>= sValue;
+ ::std::vector< ::rtl::OUString > aList;
+ tools::StringListResource aRes(ModuleRes(RID_STR_PARAADJUST_CONST),aList);
+ ::std::vector< ::rtl::OUString >::iterator aFind = ::std::find(aList.begin(),aList.end(),sValue);
+ if ( aFind != aList.end() )
+ aPropertyValue <<= static_cast<sal_Int16>(aFind - aList.begin());
+ }
+ break;
+ default:
+ return m_xFormComponentHandler->convertToPropertyValue(PropertyName, _rControlValue);
+ }
+ return aPropertyValue;
+}
+
+uno::Any SAL_CALL GeometryHandler::convertToControlValue(const ::rtl::OUString & PropertyName, const uno::Any & _rPropertyValue, const uno::Type & _rControlValueType) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ uno::Any aControlValue( _rPropertyValue );
+ if ( !aControlValue.hasValue() )
+ // NULL is converted to NULL
+ return aControlValue;
+
+ uno::Any aPropertyValue(_rPropertyValue);
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ const sal_Int32 nId = m_pInfoService->getPropertyId(PropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_AREA:
+ break;
+ case PROPERTY_ID_FORCENEWPAGE:
+ case PROPERTY_ID_NEWROWORCOL:
+ aControlValue = getConstantValue(sal_True,RID_STR_FORCENEWPAGE_CONST,aPropertyValue,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ForceNewPage")),PropertyName);
+ break;
+ case PROPERTY_ID_GROUPKEEPTOGETHER:
+ aControlValue = getConstantValue(sal_True,RID_STR_GROUPKEEPTOGETHER_CONST,aPropertyValue,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.GroupKeepTogether")),PropertyName);
+ break;
+ case PROPERTY_ID_PAGEHEADEROPTION:
+ case PROPERTY_ID_PAGEFOOTEROPTION:
+ aControlValue = getConstantValue(sal_True,RID_STR_REPORTPRINTOPTION_CONST,aPropertyValue,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ReportPrintOption")),PropertyName);
+ break;
+ case PROPERTY_ID_KEEPTOGETHER:
+ if ( uno::Reference< report::XGroup>(m_xReportComponent,uno::UNO_QUERY).is())
+ {
+ aControlValue = getConstantValue(sal_True,RID_STR_KEEPTOGETHER_CONST,aPropertyValue,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.KeepTogether")),PropertyName);
+ break;
+ }
+ // run through
+ case PROPERTY_ID_VISIBLE:
+ case PROPERTY_ID_CANGROW:
+ case PROPERTY_ID_CANSHRINK:
+ case PROPERTY_ID_REPEATSECTION:
+ case PROPERTY_ID_PRINTREPEATEDVALUES:
+ case PROPERTY_ID_STARTNEWCOLUMN:
+ case PROPERTY_ID_RESETPAGENUMBER:
+ case PROPERTY_ID_PRINTWHENGROUPCHANGE:
+ case PROPERTY_ID_DEEPTRAVERSING:
+ case PROPERTY_ID_PREEVALUATED:
+ case PROPERTY_ID_PRESERVEIRI:
+ case PROPERTY_ID_BACKTRANSPARENT:
+ case PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT:
+ {
+ if ( _rControlValueType.getTypeClass() == uno::TypeClass_STRING )
+ {
+ const uno::Reference< inspection::XStringRepresentation > xConversionHelper = inspection::StringRepresentation::create( m_xContext,m_xTypeConverter );
+ aControlValue <<= xConversionHelper->convertToControlValue( aPropertyValue );
+ }
+ else
+ {
+ try
+ {
+ aControlValue = m_xTypeConverter->convertTo( aPropertyValue, _rControlValueType );
+ }
+ catch( const uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "GeometryHandler::convertToControlValue: caught an exception while converting via TypeConverter!" );
+ }
+ }
+ break;
+ }
+ case PROPERTY_ID_CONDITIONALPRINTEXPRESSION:
+ case PROPERTY_ID_INITIALFORMULA:
+ case PROPERTY_ID_FORMULA:
+ lcl_convertFormulaTo(aPropertyValue,aControlValue);
+ break;
+ case PROPERTY_ID_DATAFIELD:
+ {
+ ::rtl::OUString sValue;
+ aControlValue >>= sValue;
+ if ( isDefaultFunction(sValue,sValue) )
+ aControlValue <<= sValue;
+ else
+ lcl_convertFormulaTo(aPropertyValue,aControlValue);
+ }
+ break;
+ case PROPERTY_ID_FONT:
+ aControlValue = m_xFormComponentHandler->convertToControlValue(PROPERTY_FONT, aPropertyValue, _rControlValueType);
+ break;
+ case PROPERTY_ID_POSITIONX:
+ {
+ sal_Int32 nPosX = 0;
+ aPropertyValue >>= nPosX;
+ const uno::Reference< report::XReportComponent> xSourceReportComponent(m_xReportComponent,uno::UNO_QUERY);
+ if ( xSourceReportComponent->getSection().is() )
+ nPosX -= getStyleProperty<sal_Int32>(xSourceReportComponent->getSection()->getReportDefinition(),PROPERTY_LEFTMARGIN);
+ aPropertyValue <<= nPosX;
+ aControlValue = m_xFormComponentHandler->convertToControlValue(PropertyName, aPropertyValue, _rControlValueType);
+ }
+ break;
+ case PROPERTY_ID_FORMULALIST:
+ aControlValue <<= m_sDefaultFunction;
+ break;
+ case PROPERTY_ID_SCOPE:
+ aControlValue <<= m_sScope;
+ break;
+ case PROPERTY_ID_MIMETYPE:
+ aControlValue = aPropertyValue;
+ break;
+ case PROPERTY_ID_TYPE:
+ {
+ ::std::vector< ::rtl::OUString > aList;
+ tools::StringListResource aRes(ModuleRes(RID_STR_TYPE_CONST),aList);
+ if ( m_nDataFieldType < aList.size() )
+ aControlValue <<= aList[m_nDataFieldType];
+ }
+ break;
+ case PROPERTY_ID_VERTICALALIGN:
+ {
+ style::VerticalAlignment nParagraphVertAlign = style::VerticalAlignment_TOP;
+ aPropertyValue >>= nParagraphVertAlign;
+ ::std::vector< ::rtl::OUString > aList;
+ tools::StringListResource aRes(ModuleRes(RID_STR_VERTICAL_ALIGN_CONST),aList);
+ if ( static_cast<sal_Int16>(nParagraphVertAlign) < static_cast<sal_Int16>(aList.size()) )
+ aControlValue <<= aList[nParagraphVertAlign];
+ }
+ break;
+ case PROPERTY_ID_PARAADJUST:
+ {
+ sal_Int16 nParagraphAdjust = style::ParagraphAdjust_LEFT;
+ aPropertyValue >>= nParagraphAdjust;
+ ::std::vector< ::rtl::OUString > aList;
+ tools::StringListResource aRes(ModuleRes(RID_STR_PARAADJUST_CONST),aList);
+ if ( nParagraphAdjust < static_cast<sal_Int16>(aList.size()) )
+ aControlValue <<= aList[nParagraphAdjust];
+ }
+ break;
+ case PROPERTY_ID_BACKCOLOR:
+ case PROPERTY_ID_CONTROLBACKGROUND:
+ {
+ sal_Int32 nColor = COL_TRANSPARENT;
+ if ( (aPropertyValue >>= nColor) && static_cast<sal_Int32>(COL_TRANSPARENT) == nColor )
+ aPropertyValue.clear();
+ }
+ // run through
+ default:
+ aControlValue = m_xFormComponentHandler->convertToControlValue(PropertyName, aPropertyValue, _rControlValueType);
+ }
+ return aControlValue;
+}
+void SAL_CALL GeometryHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener) throw (uno::RuntimeException, lang::NullPointerException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_aPropertyListeners.addListener( _rxListener );
+ m_xFormComponentHandler->addPropertyChangeListener(_rxListener);
+}
+
+void SAL_CALL GeometryHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener) throw (uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_aPropertyListeners.removeListener( _rxListener );
+ m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
+}
+// -----------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+uno::Sequence< beans::Property > SAL_CALL GeometryHandler::getSupportedProperties() throw (uno::RuntimeException)
+{
+ ::std::vector< beans::Property > aNewProps;
+ aNewProps.reserve(20); // only a guess
+ m_pInfoService->getExcludeProperties( aNewProps, m_xFormComponentHandler );
+
+ const ::rtl::OUString pIncludeProperties[] =
+ {
+ PROPERTY_FORCENEWPAGE
+ ,PROPERTY_KEEPTOGETHER
+ ,PROPERTY_CANGROW
+ ,PROPERTY_CANSHRINK
+ ,PROPERTY_REPEATSECTION
+ ,PROPERTY_PRINTREPEATEDVALUES
+ ,PROPERTY_CONDITIONALPRINTEXPRESSION
+ ,PROPERTY_STARTNEWCOLUMN
+ ,PROPERTY_RESETPAGENUMBER
+ ,PROPERTY_PRINTWHENGROUPCHANGE
+ ,PROPERTY_VISIBLE
+ ,PROPERTY_PAGEHEADEROPTION
+ ,PROPERTY_PAGEFOOTEROPTION
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlLabel"))
+ ,PROPERTY_POSITIONX
+ ,PROPERTY_POSITIONY
+ ,PROPERTY_WIDTH
+ ,PROPERTY_HEIGHT
+ ,PROPERTY_PREEVALUATED
+ ,PROPERTY_DEEPTRAVERSING
+ ,PROPERTY_FORMULA
+ ,PROPERTY_INITIALFORMULA
+ ,PROPERTY_PRESERVEIRI
+ ,PROPERTY_DATAFIELD
+ ,PROPERTY_FONT
+ ,PROPERTY_BACKCOLOR
+ ,PROPERTY_BACKTRANSPARENT
+ ,PROPERTY_CONTROLBACKGROUND
+ ,PROPERTY_CONTROLBACKGROUNDTRANSPARENT
+ ,PROPERTY_LABEL
+ ,PROPERTY_MIMETYPE
+ ,PROPERTY_VERTICALALIGN
+ ,PROPERTY_PARAADJUST
+ };
+ const uno::Reference < beans::XPropertySetInfo > xInfo = m_xReportComponent->getPropertySetInfo();
+ const uno::Sequence< beans::Property> aSeq = xInfo->getProperties();
+ for (size_t i = 0; i < sizeof(pIncludeProperties)/sizeof(pIncludeProperties[0]) ;++i )
+ {
+ const beans::Property* pIter = aSeq.getConstArray();
+ const beans::Property* pEnd = pIter + aSeq.getLength();
+ const beans::Property* pFind = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyCompare(),boost::cref(pIncludeProperties[i])));
+ if ( pFind != pEnd )
+ {
+ // special case for controls which contain a data field
+ if ( PROPERTY_DATAFIELD == pIncludeProperties[i] )
+ {
+ beans::Property aValue;
+ aValue.Name = PROPERTY_FORMULALIST;
+ aNewProps.push_back(aValue);
+ aValue.Name = PROPERTY_SCOPE;
+ aNewProps.push_back(aValue);
+ aValue.Name = PROPERTY_TYPE;
+ aNewProps.push_back(aValue);
+ }
+ aNewProps.push_back(*pFind);
+ }
+ } // for (size_t i = 0; i < sizeof(pIncludeProperties)/sizeof(pIncludeProperties[0]) ;++i )
+
+ // special property for shapes
+// if ( uno::Reference< report::XShape>(m_xReportComponent,uno::UNO_QUERY).is() )
+// {
+// beans::Property aValue;
+// aValue.Name = PROPERTY_AREA;
+// aNewProps.push_back(aValue);
+// }
+ // re-enable when the remaining issues of #i88727# are fixed
+
+ return uno::Sequence< beans::Property > (&(*aNewProps.begin()),aNewProps.size());
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL GeometryHandler::getSupersededProperties() throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet;
+ const uno::Reference<report::XReportDefinition> xReport(m_xReportComponent,uno::UNO_QUERY);
+ if ( xReport.is() && !uno::Reference< report::XSection>(xReport->getParent(),uno::UNO_QUERY).is() )
+ {
+ aRet.realloc(5);
+ ::rtl::OUString* pIter = aRet.getArray();
+ *pIter++ = PROPERTY_POSITIONX;
+ *pIter++ = PROPERTY_POSITIONY;
+ *pIter++ = PROPERTY_WIDTH;
+ *pIter++ = PROPERTY_HEIGHT;
+ *pIter++ = PROPERTY_DATAFIELD;
+ }
+ return aRet;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL GeometryHandler::getActuatingProperties() throw (uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ uno::Sequence< ::rtl::OUString > aSeq(5);
+ aSeq[0] = PROPERTY_BACKTRANSPARENT;
+ aSeq[1] = PROPERTY_CONTROLBACKGROUNDTRANSPARENT;
+ aSeq[2] = PROPERTY_FORMULALIST;
+ aSeq[3] = PROPERTY_TYPE;
+ aSeq[4] = PROPERTY_DATAFIELD;
+
+ return ::comphelper::concatSequences(m_xFormComponentHandler->getActuatingProperties(),aSeq);
+}
+
+::sal_Bool SAL_CALL GeometryHandler::isComposable(const ::rtl::OUString & _rPropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ return m_pInfoService->isComposable( _rPropertyName, m_xFormComponentHandler );
+}
+
+inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, uno::Any & _rData, const uno::Reference< inspection::XObjectInspectorUI > & _rxInspectorUI) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::NullPointerException)
+{
+ if ( !_rxInspectorUI.is() )
+ throw lang::NullPointerException();
+ if ( PropertyName.equalsAscii(PROPERTY_FILTER) )
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ inspection::InteractiveSelectionResult eResult = inspection::InteractiveSelectionResult_Cancelled;
+ ::rtl::OUString sClause;
+ if ( impl_dialogFilter_nothrow( sClause, aGuard ) )
+ {
+ _rData <<= sClause;
+ eResult = inspection::InteractiveSelectionResult_ObtainedValue;
+ }
+ return eResult;
+ }
+ else if ( PropertyName.equalsAscii(PROPERTY_FONT) )
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ inspection::InteractiveSelectionResult eResult = inspection::InteractiveSelectionResult_Cancelled;
+ const uno::Reference< awt::XWindow> xInspectorWindow(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY);
+ const uno::Reference< report::XReportControlFormat> xReportControlFormat(m_xReportComponent,uno::UNO_QUERY);
+ aGuard.clear();
+
+ uno::Sequence< beans::NamedValue > aFontSettings;
+ if ( rptui::openCharDialog( xReportControlFormat, xInspectorWindow, aFontSettings ) )
+ {
+ _rData <<= aFontSettings;
+ eResult = inspection::InteractiveSelectionResult_ObtainedValue;
+ }
+ return eResult;
+ }
+ else if ( PropertyName.equalsAscii(PROPERTY_FORMULA)
+ || PropertyName.equalsAscii(PROPERTY_INITIALFORMULA)
+ || PropertyName.equalsAscii(PROPERTY_DATAFIELD)
+ || PropertyName.equalsAscii(PROPERTY_CONDITIONALPRINTEXPRESSION))
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+
+ ::rtl::OUString sFormula;
+ m_xReportComponent->getPropertyValue(PropertyName) >>= sFormula;
+ const uno::Reference< awt::XWindow> xInspectorWindow(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY);
+ uno::Reference< uno::XComponentContext > xContext = m_xContext;
+ uno::Reference< beans::XPropertySet > xRowSet( m_xRowSet,uno::UNO_QUERY);
+ aGuard.clear();
+
+ inspection::InteractiveSelectionResult eResult = inspection::InteractiveSelectionResult_Cancelled;
+ if ( rptui::openDialogFormula_nothrow( sFormula, xContext,xInspectorWindow,xRowSet ) )
+ {
+ _rData <<= sFormula;
+ eResult = inspection::InteractiveSelectionResult_ObtainedValue;
+ }
+ return eResult;
+ }
+ else if ( PropertyName.equalsAscii(PROPERTY_AREA) )
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ inspection::InteractiveSelectionResult eResult = inspection::InteractiveSelectionResult_Cancelled;
+ const uno::Reference< awt::XWindow> xInspectorWindow(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY);
+ const uno::Reference< report::XShape> xShape(m_xReportComponent,uno::UNO_QUERY);
+ aGuard.clear();
+
+ if ( rptui::openAreaDialog( xShape, xInspectorWindow) )
+ {
+ eResult = inspection::InteractiveSelectionResult_ObtainedValue;
+ beans::PropertyChangeEvent aScopeEvent;
+ aScopeEvent.PropertyName = PROPERTY_FILLCOLOR;
+ // aScopeEvent.OldValue <<= _nOldDataFieldType;
+ aScopeEvent.NewValue <<= xShape->getPropertyValue(PROPERTY_FILLCOLOR);
+ m_aPropertyListeners.notify( aScopeEvent, &beans::XPropertyChangeListener::propertyChange );
+ }
+ return eResult;
+ }
+
+
+ return m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, _rData, _rxInspectorUI);
+}
+
+void SAL_CALL GeometryHandler::actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const uno::Any & NewValue, const uno::Any & OldValue, const uno::Reference< inspection::XObjectInspectorUI > & _rxInspectorUI, ::sal_Bool _bFirstTimeInit) throw (uno::RuntimeException, lang::NullPointerException)
+{
+ if ( !_rxInspectorUI.is() )
+ throw lang::NullPointerException();
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ const sal_Int32 nId = m_pInfoService->getPropertyId(ActuatingPropertyName);
+ switch(nId)
+ {
+ case PROPERTY_ID_TYPE:
+ {
+ sal_uInt32 nNewVal = 0;
+ NewValue >>= nNewVal;
+ switch(nNewVal)
+ {
+ case DATA_OR_FORMULA:
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_DATAFIELD);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_True);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,sal_False);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,sal_False);
+ OSL_ENSURE(m_sDefaultFunction.getLength() == 0,"Why is the m_sDefaultFunction set?");
+ OSL_ENSURE(m_sScope.getLength() == 0,"Why is the m_sScope set?");
+ break;
+ case FUNCTION:
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_DATAFIELD);
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_FORMULALIST);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_True);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,m_sDefaultFunction.getLength() != 0);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,m_sScope.getLength() != 0);
+ break;
+ case USER_DEF_FUNCTION:
+ _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_False);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,sal_True);
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_FORMULALIST);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,sal_False);
+ break;
+ case COUNTER:
+ _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_False);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,sal_False);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,sal_True);
+ break;
+ }
+ }
+ break;
+ case PROPERTY_ID_DATAFIELD:
+ {
+ sal_Bool bEnable = (m_nDataFieldType != DATA_OR_FORMULA && m_nDataFieldType != COUNTER );
+ if ( bEnable )
+ {
+ ::rtl::OUString sValue;
+ m_xReportComponent->getPropertyValue( PROPERTY_DATAFIELD ) >>= sValue;
+ bEnable = sValue.getLength() != 0;
+ }
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,bEnable);
+ if ( bEnable )
+ {
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_DATAFIELD);
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_FORMULALIST);
+ } // if ( bEnable )
+ m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, _rxInspectorUI, _bFirstTimeInit);
+ }
+ break;
+ case PROPERTY_ID_FORMULALIST:
+ {
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,m_nDataFieldType == FUNCTION || m_nDataFieldType == COUNTER);
+ }
+ break;
+ case PROPERTY_ID_BACKTRANSPARENT:
+ case PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT:
+ {
+ sal_Bool bValue = sal_False;
+ NewValue >>= bValue;
+ bValue = !bValue;
+ _rxInspectorUI->enablePropertyUI(PROPERTY_BACKCOLOR,bValue);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_CONTROLBACKGROUND,bValue);
+ }
+ break;
+ default:
+ m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, _rxInspectorUI, _bFirstTimeInit);
+ break;
+ }
+}
+
+::sal_Bool SAL_CALL GeometryHandler::suspend(::sal_Bool Suspend) throw (uno::RuntimeException)
+{
+ return m_xFormComponentHandler->suspend(Suspend);
+}
+// -----------------------------------------------------------------------------
+bool GeometryHandler::impl_dialogFilter_nothrow( ::rtl::OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
+{
+ _out_rSelectedClause = ::rtl::OUString();
+ bool bSuccess = false;
+ ::dbtools::SQLExceptionInfo aErrorInfo;
+ uno::Reference< awt::XWindow > xInspectorWindow;
+ uno::Reference< lang::XMultiComponentFactory > xFactory;
+ uno::Reference<lang::XMultiServiceFactory> xServiceFactory;
+ try
+ {
+ xFactory = m_xContext->getServiceManager();
+ xServiceFactory.set(xFactory,uno::UNO_QUERY);
+ xInspectorWindow.set(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY);
+ uno::Reference<sdbc::XConnection> xCon(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection"))) ,uno::UNO_QUERY);
+ if ( !xCon.is() )
+ return false;
+
+ uno::Reference< beans::XPropertySet> xRowSetProp(m_xRowSet,uno::UNO_QUERY);
+ if ( !m_xRowSet.is() )
+ {
+ m_xRowSet.set(xFactory->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.RowSet")),m_xContext),uno::UNO_QUERY);
+ xRowSetProp.set(m_xRowSet,uno::UNO_QUERY);
+ xRowSetProp->setPropertyValue(PROPERTY_ACTIVECONNECTION,uno::makeAny(xCon));
+ ::comphelper::copyProperties(m_xReportComponent,xRowSetProp);
+ }
+
+ // get a composer for the statement which the form is currently based on
+ uno::Reference< sdb::XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( xRowSetProp, xServiceFactory ) );
+ OSL_ENSURE( xComposer.is(), "GeometryHandler::impl_dialogFilter_nothrow: could not obtain a composer!" );
+ if ( !xComposer.is() )
+ return false;
+
+ // create the dialog
+ uno::Reference< ui::dialogs::XExecutableDialog > xDialog(xFactory->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.FilterDialog")),m_xContext),uno::UNO_QUERY);
+ if ( !xDialog.is() )
+ {
+ Window* pInspectorWindow = VCLUnoHelper::GetWindow( xInspectorWindow );
+ ShowServiceNotAvailableError( pInspectorWindow, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.FilterDialog")), sal_True );
+ return false;
+ }
+
+ const String aGcc3WorkaroundTemporary( ModuleRes(RID_STR_FILTER));
+ const ::rtl::OUString sPropertyUIName( aGcc3WorkaroundTemporary );
+ // initialize the dialog
+ uno::Reference< beans::XPropertySet > xDialogProps( xDialog, uno::UNO_QUERY_THROW );
+ xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" ) ), uno::makeAny( xComposer ) );
+ xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowSet" ) ), uno::makeAny( m_xRowSet ) );
+ xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ) ), uno::makeAny( xInspectorWindow ) );
+ xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), uno::makeAny( sPropertyUIName ) );
+
+ _rClearBeforeDialog.clear();
+ bSuccess = ( xDialog->execute() != 0 );
+ if ( bSuccess )
+ _out_rSelectedClause = xComposer->getFilter();
+ }
+ catch (sdb::SQLContext& e) { aErrorInfo = e; }
+ catch (sdbc::SQLWarning& e) { aErrorInfo = e; }
+ catch (sdbc::SQLException& e) { aErrorInfo = e; }
+ catch( const uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "GeometryHandler::impl_dialogFilter_nothrow: caught an exception!" );
+ }
+
+ if ( aErrorInfo.isValid() )
+ ::dbtools::showError( aErrorInfo, xInspectorWindow, xServiceFactory );
+
+ return bSuccess;
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::checkPosAndSize( const awt::Point& _aNewPos,
+ const awt::Size& _aSize)
+{
+ const uno::Reference< report::XReportComponent> xSourceReportComponent(m_xReportComponent,uno::UNO_QUERY);
+ const uno::Reference< report::XSection> xSection(xSourceReportComponent->getParent(),uno::UNO_QUERY);
+ if ( !xSection.is() || uno::Reference< report::XShape>(xSourceReportComponent,uno::UNO_QUERY).is() ) // shapes can overlap.
+ return;
+
+ ::Point aPos(VCLPoint(_aNewPos));
+ if ( aPos.X() < 0 || aPos.Y() < 0 ) // TODO: have to check size with pos aka || (aPos.X() + aAwtSize.Width) > m_xSection->getReportDefinition()->
+ throw beans::PropertyVetoException(String(ModuleRes(RID_STR_ILLEGAL_POSITION)),xSourceReportComponent);
+
+ ::Rectangle aSourceRect(aPos,VCLSize(_aSize));
+
+ const sal_Int32 nCount = xSection->getCount();
+ for (sal_Int32 i = 0; i < nCount ; ++i)
+ {
+ const uno::Reference< report::XReportComponent> xReportComponent(xSection->getByIndex(i),uno::UNO_QUERY);
+ if ( xReportComponent.is() && xReportComponent != xSourceReportComponent )
+ {
+ const ::Rectangle aBoundRect(VCLPoint(xReportComponent->getPosition()),VCLSize(xReportComponent->getSize()));
+ const ::Rectangle aRect = aSourceRect.GetIntersection(aBoundRect);
+ if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
+ throw beans::PropertyVetoException(String(ModuleRes( RID_STR_OVERLAP_OTHER_CONTROL)),xSourceReportComponent);
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::impl_fillFormulaList_nothrow(::std::vector< ::rtl::OUString >& _out_rList) const
+{
+ if ( m_nDataFieldType == FUNCTION )
+ ::std::transform(m_aDefaultFunctions.begin(),m_aDefaultFunctions.end(),::std::back_inserter(_out_rList),::boost::bind( &DefaultFunction::getName, _1 ));
+ else if ( m_nDataFieldType == USER_DEF_FUNCTION )
+ ::std::transform(m_aFunctionNames.begin(),m_aFunctionNames.end(),::std::back_inserter(_out_rList),::std::select1st<TFunctions::value_type>());
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString GeometryHandler::impl_ConvertUIToMimeType_nothrow(const ::rtl::OUString& _sUIName) const
+{
+ ::std::vector< ::rtl::OUString > aList;
+ impl_fillMimeTypes_nothrow(aList);
+ ::rtl::OUString sRet;
+ ::std::vector< ::rtl::OUString >::const_iterator aFind = ::std::find(aList.begin(),aList.end(),_sUIName);
+ if ( aFind != aList.end() )
+ {
+ const sal_Size nPos = aFind - aList.begin();
+ const uno::Reference< report::XReportDefinition> xReportDefinition(m_xReportComponent,uno::UNO_QUERY);
+ if ( xReportDefinition.is() )
+ {
+ const uno::Sequence< ::rtl::OUString > aMimeTypes( xReportDefinition->getAvailableMimeTypes() );
+ sRet = aMimeTypes[nPos];
+ }
+ } // if ( aFind != aList.end() )
+ return sRet;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString GeometryHandler::impl_ConvertMimeTypeToUI_nothrow(const ::rtl::OUString& _sMimetype) const
+{
+ uno::Reference<lang::XMultiServiceFactory> xServiceFactory(m_xContext->getServiceManager(),uno::UNO_QUERY_THROW);
+ ::comphelper::MimeConfigurationHelper aMimeHelper(xServiceFactory);
+ ::rtl::OUString sRet;
+ const SfxFilter* pFilter = SfxFilter::GetDefaultFilter( aMimeHelper.GetDocServiceNameFromMediaType(_sMimetype) );
+ if ( pFilter )
+ sRet = pFilter->GetUIName();
+ if ( !sRet.getLength() )
+ sRet = _sMimetype;
+ return sRet;
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::impl_fillMimeTypes_nothrow(::std::vector< ::rtl::OUString >& _out_rList) const
+{
+ try
+ {
+ const uno::Reference< report::XReportDefinition> xReportDefinition(m_xReportComponent,uno::UNO_QUERY);
+ if ( xReportDefinition.is() )
+ {
+ uno::Sequence< ::rtl::OUString > aMimeTypes( xReportDefinition->getAvailableMimeTypes() );
+ const ::rtl::OUString* pIter = aMimeTypes.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aMimeTypes.getLength();
+ for(;pIter != pEnd; ++pIter)
+ {
+ const ::rtl::OUString sDocName( impl_ConvertMimeTypeToUI_nothrow(*pIter) );
+ if ( sDocName.getLength() )
+ _out_rList.push_back(sDocName);
+ }
+ }
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught!");
+ }
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::impl_fillScopeList_nothrow(::std::vector< ::rtl::OUString >& _out_rList) const
+{
+ try
+ {
+ const uno::Reference< report::XReportComponent> xSourceReportComponent(m_xReportComponent,uno::UNO_QUERY_THROW);
+ const uno::Reference< report::XSection> xSection(xSourceReportComponent->getParent(),uno::UNO_QUERY_THROW);
+
+ const uno::Reference< report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
+ const uno::Reference< report::XGroups> xGroups = xReportDefinition->getGroups();
+ sal_Int32 nPos = -1;
+ uno::Reference< report::XGroup> xGroup = xSection->getGroup();
+ if ( xGroup.is() )
+ nPos = getPositionInIndexAccess(xGroups.get(),xGroup);
+ else if ( xSection == xReportDefinition->getDetail() )
+ nPos = xGroups->getCount()-1;
+
+ const String sGroup = String(ModuleRes(RID_STR_SCOPE_GROUP));
+ for (sal_Int32 i = 0 ; i <= nPos ; ++i)
+ {
+ xGroup.set(xGroups->getByIndex(i),uno::UNO_QUERY_THROW);
+ String sGroupName = sGroup;
+ sGroupName.SearchAndReplaceAscii("%1",xGroup->getExpression());
+ _out_rList.push_back(sGroupName);
+ }
+ _out_rList.push_back(xReportDefinition->getName());
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught!");
+ }
+}
+// -----------------------------------------------------------------------------
+uno::Reference< report::XFunctionsSupplier> GeometryHandler::fillScope_throw(::rtl::OUString& _rsNamePostFix)
+{
+ uno::Reference< report::XFunctionsSupplier> xReturn;
+
+ const uno::Reference< report::XReportComponent> xSourceReportComponent(m_xReportComponent,uno::UNO_QUERY_THROW);
+ const uno::Reference< report::XSection> xSection(xSourceReportComponent->getParent(),uno::UNO_QUERY_THROW);
+ const uno::Reference< report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
+ if ( !m_sScope.getLength() )
+ {
+ const uno::Reference< report::XGroup> xGroup(xSection->getGroup(),uno::UNO_QUERY);
+ if ( xGroup.is() )
+ {
+ String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+ _rsNamePostFix = xGroup->getExpression();
+ sGroupName.SearchAndReplaceAscii("%1",_rsNamePostFix);
+ m_sScope = sGroupName;
+ xReturn = xGroup.get();
+ }
+ else if ( xSection == xReportDefinition->getDetail() )
+ {
+ const uno::Reference< report::XGroups> xGroups = xReportDefinition->getGroups();
+ const sal_Int32 nCount = xGroups->getCount();
+ if ( nCount )
+ {
+ const uno::Reference< report::XGroup> xGroup2(xGroups->getByIndex(nCount - 1),uno::UNO_QUERY_THROW);
+ String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+ _rsNamePostFix = xGroup2->getExpression();
+ sGroupName.SearchAndReplaceAscii("%1",_rsNamePostFix);
+ m_sScope = sGroupName;
+ xReturn = xGroup2.get();
+ }
+ }
+ if ( !m_sScope.getLength() )
+ {
+ xReturn = xReportDefinition.get();
+ _rsNamePostFix = m_sScope = xReportDefinition->getName();
+ }
+ }
+ else if ( m_sScope == xReportDefinition->getName() )
+ {
+ xReturn = xReportDefinition.get();
+ _rsNamePostFix = m_sScope;
+ }
+ else
+ {
+ uno::Reference< report::XGroups> xGroups = xReportDefinition->getGroups();
+ const sal_Int32 nCount = xGroups->getCount();
+
+ for (sal_Int32 i = 0 ; i < nCount; ++i)
+ {
+ const uno::Reference< report::XGroup> xGroup(xGroups->getByIndex(i),uno::UNO_QUERY_THROW);
+ String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+ sGroupName.SearchAndReplaceAscii("%1",xGroup->getExpression());
+ if ( m_sScope == ::rtl::OUString(sGroupName) )
+ {
+ _rsNamePostFix = xGroup->getExpression();
+ xReturn = xGroup.get();
+ break;
+ }
+ }
+
+ }
+ OSL_ENSURE(xReturn.is(),"Why don't we have a functionssupplier here!");
+
+ return xReturn;
+}
+// -----------------------------------------------------------------------------
+sal_Bool GeometryHandler::isDefaultFunction( const ::rtl::OUString& _sQuotedFunction
+ ,::rtl::OUString& _rDataField
+ ,const uno::Reference< report::XFunctionsSupplier>& _xFunctionsSupplier
+ ,bool _bSet) const
+{
+ sal_Bool bDefaultFunction = sal_False;
+ try
+ {
+ const uno::Reference< report::XReportComponent> xSourceReportComponent(m_xReportComponent,uno::UNO_QUERY_THROW);
+ const uno::Reference< report::XSection> xSection(xSourceReportComponent->getParent(),uno::UNO_QUERY_THROW);
+ const uno::Reference< report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
+
+ ::std::pair<TFunctions::const_iterator,TFunctions::const_iterator> aFind = m_aFunctionNames.equal_range(_sQuotedFunction);
+ while ( aFind.first != aFind.second )
+ {
+ if ( !_xFunctionsSupplier.is() || _xFunctionsSupplier == aFind.first->second.second )
+ {
+ const beans::Optional< ::rtl::OUString> aInitalFormula = aFind.first->second.first->getInitialFormula();
+ if ( aInitalFormula.IsPresent )
+ {
+ ::rtl::OUString sDefaultFunctionName;
+ bDefaultFunction = impl_isDefaultFunction_nothrow(aFind.first->second.first,_rDataField,sDefaultFunctionName);
+ if ( bDefaultFunction )
+ {
+ m_xFunction = aFind.first->second.first;
+ if ( _bSet )
+ {
+ m_sDefaultFunction = sDefaultFunctionName;
+ uno::Reference< report::XGroup> xGroup(aFind.first->second.second,uno::UNO_QUERY);
+ if ( xGroup.is() )
+ {
+ String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+ sGroupName.SearchAndReplaceAscii("%1",xGroup->getExpression());
+ m_sScope = sGroupName;
+ }
+ else
+ m_sScope = xReportDefinition->getName();
+ }
+ }
+ break;
+ }
+ }
+ ++(aFind.first);
+ }
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught!");
+ }
+ return bDefaultFunction;
+}
+// -----------------------------------------------------------------------------
+sal_Bool GeometryHandler::impl_isDefaultFunction_nothrow( const uno::Reference< report::XFunction>& _xFunction
+ ,::rtl::OUString& _rDataField
+ ,::rtl::OUString& _rsDefaultFunctionName) const
+{
+ sal_Bool bDefaultFunction = sal_False;
+ try
+ {
+ const String sFormula( _xFunction->getFormula() );
+ util::SearchOptions aSearchOptions;
+ aSearchOptions.algorithmType = util::SearchAlgorithms_REGEXP;
+ aSearchOptions.searchFlag = 0x00000100;
+ ::std::vector< DefaultFunction >::const_iterator aIter = m_aDefaultFunctions.begin();
+ ::std::vector< DefaultFunction >::const_iterator aDeEnd = m_aDefaultFunctions.end();
+ for (; aIter != aDeEnd; ++aIter)
+ {
+ aSearchOptions.searchString = aIter->m_sSearchString;
+ utl::TextSearch aTextSearch(aSearchOptions);
+ xub_StrLen start = 0;
+ xub_StrLen end = sFormula.Len();
+ if ( aTextSearch.SearchFrwrd(sFormula,&start,&end) && start == 0 && end == sFormula.Len()) // default function found
+ {
+ aSearchOptions.searchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]"));
+ utl::TextSearch aDataSearch(aSearchOptions);
+ aDataSearch.SearchFrwrd(sFormula,&start,&end );
+ ++start;
+ _rDataField = sFormula.Copy(start,end-start-1);
+ _rsDefaultFunctionName = aIter->m_sName;
+ break;
+ }
+ }
+
+ bDefaultFunction = aIter != aDeEnd;
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught!");
+ }
+ return bDefaultFunction;
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::loadDefaultFunctions()
+{
+ if ( m_aDefaultFunctions.empty() )
+ {
+ m_aCounterFunction.m_bPreEvaluated = sal_False;
+ m_aCounterFunction.m_bDeepTraversing = sal_False;
+ m_aCounterFunction.m_sName = String(ModuleRes(RID_STR_F_COUNTER));
+ m_aCounterFunction.m_sFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%FunctionName] + 1"));
+ m_aCounterFunction.m_sSearchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:\\[[:alpha:]+([:space:]*[:alnum:]*)*\\][:space:]*\\+[:space:]*[:digit:]*"));
+ m_aCounterFunction.m_sInitialFormula.IsPresent = sal_True;
+ m_aCounterFunction.m_sInitialFormula.Value = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:1"));
+
+ DefaultFunction aDefault;
+ aDefault.m_bDeepTraversing = sal_False;
+
+ //aDefault.m_sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Counter"));
+ //aDefault.m_sFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%FunctionName] + 1"));
+ //aDefault.m_sSearchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:\\[[:alpha:]+[:alnum:]*\\][:space:]*\\+[:space:]*1"));
+ //aDefault.m_sInitialFormula.IsPresent = sal_True;
+ //aDefault.m_sInitialFormula.Value = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:1"));
+ //m_aDefaultFunctions.push_back(aDefault);
+
+ aDefault.m_bPreEvaluated = sal_True;
+
+ aDefault.m_sName = String(ModuleRes(RID_STR_F_ACCUMULATION));
+ aDefault.m_sFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%Column] + [%FunctionName]"));
+ aDefault.m_sSearchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:\\[[:alpha:]+([:space:]*[:alnum:]*)*\\][:space:]*\\+[:space:]*\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]"));
+ aDefault.m_sInitialFormula.IsPresent = sal_True;
+ aDefault.m_sInitialFormula.Value = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%Column]"));
+ m_aDefaultFunctions.push_back(aDefault);
+
+ aDefault.m_sName = String(ModuleRes(RID_STR_F_MINIMUM));
+ aDefault.m_sFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:IF([%Column] < [%FunctionName];[%Column];[%FunctionName])"));
+ aDefault.m_sSearchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:IF\\((\\[[:alpha:]+([:space:]*[:alnum:]*)*\\])[:space:]*<[:space:]*(\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]);[:space:]*\\1[:space:]*;[:space:]*\\3[:space:]*\\)"));
+ aDefault.m_sInitialFormula.IsPresent = sal_True;
+ aDefault.m_sInitialFormula.Value = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%Column]"));
+ m_aDefaultFunctions.push_back(aDefault);
+
+ aDefault.m_sName = String(ModuleRes(RID_STR_F_MAXIMUM));
+ aDefault.m_sFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:IF([%Column] > [%FunctionName];[%Column];[%FunctionName])"));
+ aDefault.m_sSearchString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:IF\\((\\[[:alpha:]+([:space:]*[:alnum:]*)*\\])[:space:]*>[:space:]*(\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]);[:space:]*\\1[:space:]*;[:space:]*\\3[:space:]*\\)"));
+ aDefault.m_sInitialFormula.IsPresent = sal_True;
+ aDefault.m_sInitialFormula.Value = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:[%Column]"));
+ m_aDefaultFunctions.push_back(aDefault);
+ }
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::createDefaultFunction(::osl::ResettableMutexGuard& _aGuard ,const ::rtl::OUString& _sFunction,const ::rtl::OUString& _sDataField)
+{
+ try
+ {
+ ::rtl::OUString sNamePostFix;
+ const uno::Reference< report::XFunctionsSupplier> xFunctionsSupplier = fillScope_throw(sNamePostFix);
+
+ ::std::vector< DefaultFunction >::const_iterator aIter = m_aDefaultFunctions.begin();
+ ::std::vector< DefaultFunction >::const_iterator aDeEnd = m_aDefaultFunctions.end();
+ for (; aIter != aDeEnd; ++aIter)
+ {
+ if ( aIter->m_sName == _sFunction )
+ {
+ const ::rtl::OUString sFunctionName( _sFunction + _sDataField + sNamePostFix);
+ const ::rtl::OUString sQuotedFunctionName(lcl_getQuotedFunctionName(sFunctionName));
+
+ beans::PropertyChangeEvent aEvent;
+ aEvent.PropertyName = PROPERTY_SCOPE;
+ aEvent.OldValue <<= m_sScope;
+
+ ::std::pair<TFunctions::const_iterator,TFunctions::const_iterator> aFind = m_aFunctionNames.equal_range(sQuotedFunctionName);
+ while ( aFind.first != aFind.second )
+ {
+ if ( xFunctionsSupplier == aFind.first->second.second )
+ {
+ m_xFunction = aFind.first->second.first;
+ ::rtl::OUString sTemp;
+ isDefaultFunction(sQuotedFunctionName,sTemp,uno::Reference< report::XFunctionsSupplier>(),true); // implicitly sets the m_sScope
+ break;
+ }
+ ++(aFind.first);
+ }
+ if ( aFind.first == aFind.second )
+ impl_createFunction(sFunctionName,_sDataField,*aIter);
+
+ OBlocker aBlocker(m_bIn);
+ m_xReportComponent->setPropertyValue(PROPERTY_DATAFIELD,uno::makeAny( impl_convertToFormula( uno::makeAny(sQuotedFunctionName) )));
+ aEvent.NewValue <<= m_sScope;
+ _aGuard.clear();
+ m_aPropertyListeners.notify( aEvent, &beans::XPropertyChangeListener::propertyChange );
+ break;
+ }
+ }
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught!");
+ }
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::removeFunction()
+{
+ if ( m_xFunction.is() )
+ {
+ const ::rtl::OUString sQuotedFunctionName(lcl_getQuotedFunctionName(m_xFunction));
+ ::std::pair<TFunctions::iterator,TFunctions::iterator> aFind = m_aFunctionNames.equal_range(sQuotedFunctionName);
+ while ( aFind.first != aFind.second )
+ {
+ if ( aFind.first->second.first == m_xFunction )
+ {
+ uno::Reference< report::XFunctions> xFunctions = aFind.first->second.second->getFunctions();
+ xFunctions->removeByIndex(xFunctions->getCount() - 1 ); /// TODO: insert new method in XFunctions: removeFunction(xfunction)
+ m_aFunctionNames.erase(aFind.first);
+ m_bNewFunction = false;
+ break;
+ }
+ ++(aFind.first);
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::resetOwnProperties(::osl::ResettableMutexGuard& _aGuard,const ::rtl::OUString& _sOldFunctionName,const ::rtl::OUString& _sOldScope,const sal_uInt32 _nOldDataFieldType)
+{
+ const ::rtl::OUString sNewFunction = m_sDefaultFunction;
+ const ::rtl::OUString sNewScope = m_sScope;
+ const sal_uInt32 nNewDataFieldType = m_nDataFieldType;
+ _aGuard.clear();
+ if ( _nOldDataFieldType != nNewDataFieldType )
+ {
+ beans::PropertyChangeEvent aScopeEvent;
+ aScopeEvent.PropertyName = PROPERTY_TYPE;
+ aScopeEvent.OldValue <<= _nOldDataFieldType;
+ aScopeEvent.NewValue <<= nNewDataFieldType;
+ m_aPropertyListeners.notify( aScopeEvent, &beans::XPropertyChangeListener::propertyChange );
+ }
+ if ( _sOldFunctionName != sNewFunction )
+ {
+ beans::PropertyChangeEvent aFormulaEvent;
+ aFormulaEvent.PropertyName = PROPERTY_FORMULALIST;
+ aFormulaEvent.OldValue <<= _sOldFunctionName;
+ aFormulaEvent.NewValue <<= sNewFunction;
+
+ m_aPropertyListeners.notify( aFormulaEvent, &beans::XPropertyChangeListener::propertyChange );
+ }
+ if ( _sOldScope != sNewScope )
+ {
+ beans::PropertyChangeEvent aScopeEvent;
+ aScopeEvent.PropertyName = PROPERTY_SCOPE;
+ aScopeEvent.OldValue <<= _sOldScope;
+ aScopeEvent.NewValue <<= sNewScope;
+ m_aPropertyListeners.notify( aScopeEvent, &beans::XPropertyChangeListener::propertyChange );
+ }
+
+ _aGuard.reset();
+}
+//------------------------------------------------------------------------
+void GeometryHandler::impl_initFieldList_nothrow( uno::Sequence< ::rtl::OUString >& _rFieldNames ) const
+{
+ _rFieldNames.realloc(0);
+ try
+ {
+ uno::Reference< awt::XWindow> xInspectorWindow(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY);
+ Window* pInspectorWindow = VCLUnoHelper::GetWindow( xInspectorWindow );
+ WaitObject aWaitCursor( pInspectorWindow );
+
+ uno::Reference< sdbc::XPreparedStatement > xStatement;
+
+ // get the form of the control we're inspecting
+ uno::Reference< beans::XPropertySet > xFormSet( m_xRowSet, uno::UNO_QUERY );
+ if ( !xFormSet.is() )
+ return;
+
+ ::rtl::OUString sObjectName;
+ OSL_VERIFY( xFormSet->getPropertyValue( PROPERTY_COMMAND ) >>= sObjectName );
+ // when there is no command we don't need to ask for columns
+ uno::Reference<sdbc::XConnection> xCon(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection"))) ,uno::UNO_QUERY);
+ if ( sObjectName.getLength() && xCon.is() )
+ {
+ sal_Int32 nObjectType = sdb::CommandType::COMMAND;
+ OSL_VERIFY( xFormSet->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nObjectType );
+
+ _rFieldNames = ::dbtools::getFieldNamesByCommandDescriptor( xCon, nObjectType, sObjectName );
+ }
+ }
+ catch (uno::Exception&)
+ {
+ DBG_ERROR( "GeometryHandler::impl_initFieldList_nothrow: caught an exception!" );
+ }
+}
+// -----------------------------------------------------------------------------
+bool GeometryHandler::impl_isCounterFunction_throw(const ::rtl::OUString& _sQuotedFunctionName,::rtl::OUString& _Out_sScope) const
+{
+ ::std::pair<TFunctions::const_iterator,TFunctions::const_iterator> aFind = m_aFunctionNames.equal_range(_sQuotedFunctionName);
+ while ( aFind.first != aFind.second )
+ {
+ const beans::Optional< ::rtl::OUString> aInitalFormula = aFind.first->second.first->getInitialFormula();
+ if ( aInitalFormula.IsPresent )
+ {
+ const String sFormula( aFind.first->second.first->getFormula() );
+ util::SearchOptions aSearchOptions;
+ aSearchOptions.algorithmType = util::SearchAlgorithms_REGEXP;
+ aSearchOptions.searchFlag = 0x00000100;
+ aSearchOptions.searchString = m_aCounterFunction.m_sSearchString;
+ utl::TextSearch aTextSearch(aSearchOptions);
+ xub_StrLen start = 0;
+ xub_StrLen end = sFormula.Len();
+ if ( aTextSearch.SearchFrwrd(sFormula,&start,&end) && start == 0 && end == sFormula.Len()) // counter function found
+ {
+ const uno::Reference< report::XGroup > xGroup(aFind.first->second.second,uno::UNO_QUERY);
+ if ( xGroup.is() )
+ {
+ String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+ sGroupName.SearchAndReplaceAscii("%1",xGroup->getExpression());
+ _Out_sScope = sGroupName;
+ }
+ else
+ _Out_sScope = uno::Reference< report::XReportDefinition >(aFind.first->second.second,uno::UNO_QUERY_THROW)->getName();
+ break;
+ }
+ }
+ ++(aFind.first);
+ }
+ return aFind.first != aFind.second;
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::impl_createFunction(const ::rtl::OUString& _sFunctionName,const ::rtl::OUString& _sDataField,const DefaultFunction& _aFunction)
+{
+ if ( m_bNewFunction )
+ removeFunction();
+
+ const ::rtl::OUString sQuotedFunctionName(lcl_getQuotedFunctionName(_sFunctionName));
+ m_xFunction.set(report::Function::create(m_xContext));
+ m_xFunction->setName( _sFunctionName );
+
+ const String sPlaceHolder1(RTL_CONSTASCII_USTRINGPARAM("%Column"));
+ const String sPlaceHolder2(RTL_CONSTASCII_USTRINGPARAM("%FunctionName"));
+ String sFormula(_aFunction.m_sFormula);
+ sFormula.SearchAndReplaceAll(sPlaceHolder1,_sDataField);
+ sFormula.SearchAndReplaceAll(sPlaceHolder2,_sFunctionName);
+
+ m_xFunction->setFormula(sFormula);
+ m_xFunction->setPreEvaluated(_aFunction.m_bPreEvaluated);
+ m_xFunction->setDeepTraversing(_aFunction.m_bDeepTraversing);
+ if ( _aFunction.m_sInitialFormula.IsPresent )
+ {
+ beans::Optional< ::rtl::OUString> aInitialFormula = _aFunction.m_sInitialFormula;
+ String sInitialFormula = aInitialFormula.Value;
+ sInitialFormula.SearchAndReplaceAll(sPlaceHolder1,_sDataField);
+ sInitialFormula.SearchAndReplaceAll(sPlaceHolder2,_sFunctionName);
+ aInitialFormula.Value = sInitialFormula;
+ m_xFunction->setInitialFormula( aInitialFormula );
+ }
+ ::rtl::OUString sNamePostFix;
+ const uno::Reference< report::XFunctionsSupplier> xFunctionsSupplier = fillScope_throw(sNamePostFix);
+ const uno::Reference< container::XIndexContainer> xFunctions(xFunctionsSupplier->getFunctions(),uno::UNO_QUERY_THROW);
+ xFunctions->insertByIndex(xFunctions->getCount(),uno::makeAny(m_xFunction));
+ m_aFunctionNames.insert(TFunctions::value_type(sQuotedFunctionName,TFunctionPair(m_xFunction,xFunctionsSupplier)));
+ m_bNewFunction = true;
+}
+// -----------------------------------------------------------------------------
+void GeometryHandler::impl_setCounterFunction_throw()
+{
+ ::rtl::OUString sNamePostFix;
+ fillScope_throw(sNamePostFix);
+ ::rtl::OUString sFunctionName = m_aCounterFunction.m_sName;
+ sFunctionName += sNamePostFix;
+ const ::rtl::OUString sQuotedFunctionName = lcl_getQuotedFunctionName(sFunctionName);
+ ::rtl::OUString sScope;
+ if ( !(sFunctionName.getLength() && m_aFunctionNames.find(sQuotedFunctionName) != m_aFunctionNames.end() && impl_isCounterFunction_throw(sQuotedFunctionName,sScope)) )
+ impl_createFunction(sFunctionName,::rtl::OUString(),m_aCounterFunction);
+
+ OBlocker aBlocker(m_bIn);
+ m_xReportComponent->setPropertyValue(PROPERTY_DATAFIELD,uno::makeAny(impl_convertToFormula( uno::makeAny(sQuotedFunctionName))));
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 GeometryHandler::impl_getDataFieldType_throw(const ::rtl::OUString& _sDataField) const
+{
+ sal_uInt32 nDataFieldType = UNDEF_DATA;
+ ::rtl::OUString sDataField;
+ if ( _sDataField.getLength() )
+ sDataField = _sDataField;
+ else
+ {
+ uno::Any aDataField( m_xReportComponent->getPropertyValue( PROPERTY_DATAFIELD ) );
+ lcl_convertFormulaTo(aDataField,aDataField);
+ aDataField >>= sDataField;
+ }
+
+ if ( sDataField.getLength() )
+ {
+ if ( impl_isDataField(sDataField) )
+ nDataFieldType = DATA_OR_FORMULA;
+ else if ( isDefaultFunction(sDataField,sDataField) )
+ nDataFieldType = FUNCTION;
+ else if ( m_aFunctionNames.find(sDataField) != m_aFunctionNames.end() )
+ {
+ nDataFieldType = USER_DEF_FUNCTION;
+ ::rtl::OUString sScope;
+ if ( impl_isCounterFunction_throw(sDataField,sScope) )
+ nDataFieldType = COUNTER;
+ }
+ else
+ nDataFieldType = DATA_OR_FORMULA;
+ }
+ return nDataFieldType;
+}
+// -----------------------------------------------------------------------------
+// XEventListener
+void SAL_CALL GeometryHandler::disposing(const lang::EventObject& ) throw( uno::RuntimeException )
+{
+}
+// XPropertyChangeListener
+void SAL_CALL GeometryHandler::propertyChange(const beans::PropertyChangeEvent& /*evt*/) throw(uno::RuntimeException)
+{
+ ::osl::ResettableMutexGuard aGuard( m_aMutex );
+ if ( !m_bIn )
+ {
+ const sal_uInt32 nOldDataFieldType = m_nDataFieldType;
+ const ::rtl::OUString sOldFunctionName = m_sDefaultFunction;
+ const ::rtl::OUString sOldScope = m_sScope;
+ m_sDefaultFunction = m_sScope = ::rtl::OUString();
+ m_nDataFieldType = impl_getDataFieldType_throw();
+ if ( UNDEF_DATA == m_nDataFieldType )
+ m_nDataFieldType = nOldDataFieldType;
+ uno::Any aDataField = m_xReportComponent->getPropertyValue( PROPERTY_DATAFIELD );
+ lcl_convertFormulaTo(aDataField,aDataField);
+ ::rtl::OUString sDataField;
+ aDataField >>= sDataField;
+ switch(m_nDataFieldType)
+ {
+ case FUNCTION:
+ isDefaultFunction(sDataField,sDataField,uno::Reference< report::XFunctionsSupplier>(),true);
+ break;
+ case COUNTER:
+ impl_isCounterFunction_throw(sDataField,m_sScope);
+ break;
+ default:
+ ;
+ }
+
+ resetOwnProperties(aGuard,sOldFunctionName,sOldScope,nOldDataFieldType);
+ }
+}
+//........................................................................
+} // namespace rptui
+//........................................................................
+
diff --git a/reportdesign/source/ui/inspection/ReportComponentHandler.cxx b/reportdesign/source/ui/inspection/ReportComponentHandler.cxx
new file mode 100644
index 000000000000..d992206b6f54
--- /dev/null
+++ b/reportdesign/source/ui/inspection/ReportComponentHandler.cxx
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * 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 "ReportComponentHandler.hxx"
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/sequence.hxx>
+#ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
+#include "uistrings.hrc"
+#endif
+#include <comphelper/types.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/syslocale.hxx>
+#include <com/sun/star/inspection/PropertyControlType.hpp>
+#include <com/sun/star/report/XReportDefinition.hpp>
+#include <com/sun/star/report/XSection.hpp>
+#include <com/sun/star/inspection/XNumericControl.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/util/MeasureUnit.hpp>
+#include <tools/fldunit.hxx>
+#include "metadata.hxx"
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+using namespace ::com::sun::star;
+// using namespace comphelper;
+
+ReportComponentHandler::ReportComponentHandler(uno::Reference< uno::XComponentContext > const & context)
+ :ReportComponentHandler_Base(m_aMutex)
+ ,m_xContext(context)
+ ,m_pInfoService( new OPropertyInfoService() )
+{
+ try
+ {
+ m_xFormComponentHandler.set(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.FormComponentPropertyHandler")),m_xContext),uno::UNO_QUERY_THROW);
+
+ }catch(uno::Exception)
+ {
+ }
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ReportComponentHandler::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return getImplementationName_Static();
+}
+
+//------------------------------------------------------------------------
+sal_Bool SAL_CALL ReportComponentHandler::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_static());
+}
+
+//------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL ReportComponentHandler::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ return getSupportedServiceNames_static();
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString ReportComponentHandler::getImplementationName_Static( ) throw(uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.ReportComponentHandler"));
+}
+
+//------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > ReportComponentHandler::getSupportedServiceNames_static( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSupported(1);
+ aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.inspection.ReportComponentHandler"));
+ return aSupported;
+}
+
+//------------------------------------------------------------------------
+uno::Reference< uno::XInterface > SAL_CALL ReportComponentHandler::create( const uno::Reference< uno::XComponentContext >& _rxContext )
+{
+ return *(new ReportComponentHandler( _rxContext ));
+}
+// overload WeakComponentImplHelperBase::disposing()
+// This function is called upon disposing the component,
+// if your component needs special work when it becomes
+// disposed, do it here.
+void SAL_CALL ReportComponentHandler::disposing()
+{
+ ::comphelper::disposeComponent(m_xFormComponentHandler);
+}
+void SAL_CALL ReportComponentHandler::addEventListener(const uno::Reference< lang::XEventListener > & xListener) throw (uno::RuntimeException)
+{
+ m_xFormComponentHandler->addEventListener(xListener);
+}
+
+void SAL_CALL ReportComponentHandler::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw (uno::RuntimeException)
+{
+ m_xFormComponentHandler->removeEventListener(aListener);
+}
+
+// inspection::XPropertyHandler:
+
+/********************************************************************************/
+void SAL_CALL ReportComponentHandler::inspect(const uno::Reference< uno::XInterface > & Component) throw (uno::RuntimeException, lang::NullPointerException)
+{
+ try
+ {
+ uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY);
+ const ::rtl::OUString sFormComponent(RTL_CONSTASCII_USTRINGPARAM("FormComponent"));
+ if ( xNameCont->hasByName(sFormComponent) )
+ xNameCont->getByName(sFormComponent) >>= m_xFormComponent;
+ const ::rtl::OUString sRowSet(RTL_CONSTASCII_USTRINGPARAM("RowSet"));
+ if ( xNameCont->hasByName(sRowSet) )
+ {
+ uno::Reference<beans::XPropertySet> xProp(m_xFormComponentHandler,uno::UNO_QUERY);
+ xProp->setPropertyValue(sRowSet,xNameCont->getByName(sRowSet));
+ }
+ }
+ catch(uno::Exception)
+ {
+ throw lang::NullPointerException();
+ }
+ if ( m_xFormComponent.is() )
+ {
+ m_xFormComponentHandler->inspect(m_xFormComponent);
+ }
+}
+
+uno::Any SAL_CALL ReportComponentHandler::getPropertyValue(const ::rtl::OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ return m_xFormComponentHandler->getPropertyValue(PropertyName);
+}
+
+void SAL_CALL ReportComponentHandler::setPropertyValue(const ::rtl::OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ m_xFormComponentHandler->setPropertyValue(PropertyName, Value);
+}
+
+beans::PropertyState SAL_CALL ReportComponentHandler::getPropertyState(const ::rtl::OUString & PropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ return m_xFormComponentHandler->getPropertyState(PropertyName);
+}
+
+inspection::LineDescriptor SAL_CALL ReportComponentHandler::describePropertyLine(const ::rtl::OUString & PropertyName, const uno::Reference< inspection::XPropertyControlFactory > & ControlFactory) throw (beans::UnknownPropertyException, lang::NullPointerException,uno::RuntimeException)
+{
+ return m_xFormComponentHandler->describePropertyLine(PropertyName, ControlFactory);
+}
+
+uno::Any SAL_CALL ReportComponentHandler::convertToPropertyValue(const ::rtl::OUString & PropertyName, const uno::Any & ControlValue) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ return m_xFormComponentHandler->convertToPropertyValue(PropertyName, ControlValue);
+}
+
+uno::Any SAL_CALL ReportComponentHandler::convertToControlValue(const ::rtl::OUString & PropertyName, const uno::Any & PropertyValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ return m_xFormComponentHandler->convertToControlValue(PropertyName, PropertyValue, ControlValueType);
+}
+
+void SAL_CALL ReportComponentHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & Listener) throw (uno::RuntimeException, lang::NullPointerException)
+{
+ m_xFormComponentHandler->addPropertyChangeListener(Listener);
+}
+
+void SAL_CALL ReportComponentHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener) throw (uno::RuntimeException)
+{
+ m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
+}
+
+uno::Sequence< beans::Property > SAL_CALL ReportComponentHandler::getSupportedProperties() throw (uno::RuntimeException)
+{
+ ::std::vector< beans::Property > aNewProps;
+ m_pInfoService->getExcludeProperties( aNewProps, m_xFormComponentHandler );
+
+ return aNewProps.empty() ? uno::Sequence< beans::Property > () : uno::Sequence< beans::Property > (&(*aNewProps.begin()),aNewProps.size());
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ReportComponentHandler::getSupersededProperties() throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet;
+ return aRet;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ReportComponentHandler::getActuatingProperties() throw (uno::RuntimeException)
+{
+ return m_xFormComponentHandler->getActuatingProperties();
+}
+
+::sal_Bool SAL_CALL ReportComponentHandler::isComposable( const ::rtl::OUString& _rPropertyName ) throw (uno::RuntimeException, beans::UnknownPropertyException)
+{
+ return m_pInfoService->isComposable( _rPropertyName, m_xFormComponentHandler );
+}
+
+inspection::InteractiveSelectionResult SAL_CALL ReportComponentHandler::onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, uno::Any & out_Data, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::NullPointerException)
+{
+ return m_xFormComponentHandler->onInteractivePropertySelection(PropertyName, Primary, out_Data, InspectorUI);
+}
+
+void SAL_CALL ReportComponentHandler::actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const uno::Any & NewValue, const uno::Any & OldValue, const uno::Reference< inspection::XObjectInspectorUI > & InspectorUI, ::sal_Bool FirstTimeInit) throw (uno::RuntimeException, lang::NullPointerException)
+{
+ m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, InspectorUI, FirstTimeInit);
+}
+
+::sal_Bool SAL_CALL ReportComponentHandler::suspend(::sal_Bool Suspend) throw (uno::RuntimeException)
+{
+ return m_xFormComponentHandler->suspend(Suspend);
+}
+
+//........................................................................
+} // namespace rptui
+//........................................................................
+
diff --git a/reportdesign/source/ui/inspection/inspection.src b/reportdesign/source/ui/inspection/inspection.src
new file mode 100644
index 000000000000..5d496ee26d83
--- /dev/null
+++ b/reportdesign/source/ui/inspection/inspection.src
@@ -0,0 +1,394 @@
+/*************************************************************************
+ *
+ * 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 "rptui_slotid.hrc"
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _SBASLTID_HRC
+#include <svx/svxids.hrc>
+#endif
+
+String RID_STR_PROPPAGE_DEFAULT
+{
+ Text [ en-US ] = "General" ;
+ Text [ x-comment ] = " ";
+};
+String RID_STR_PROPPAGE_DATA
+{
+ Text [ en-US ] = "Data" ;
+ Text [ x-comment ] = " ";
+};
+Resource RID_STR_BOOL
+{
+ String 1
+ {
+ Text [ en-US ] = "No" ;
+ };
+ String 2
+ {
+ Text [ en-US ] = "Yes" ;
+ };
+};
+String RID_STR_FORCENEWPAGE
+{
+ Text [ en-US ] = "Force New Page" ;
+};
+Resource RID_STR_FORCENEWPAGE_CONST
+{
+ String 1
+ {
+ Text [ en-US ] = "None" ;
+ };
+ String 2
+ {
+ Text [ en-US ] = "Before Section" ;
+ };
+ String 3
+ {
+ Text [ en-US ] = "After Section" ;
+ };
+ String 4
+ {
+ Text [ en-US ] = "Before & After Section" ;
+ };
+};
+String RID_STR_NEWROWORCOL
+{
+ Text [ en-US ] = "New Row Or Column" ;
+};
+String RID_STR_KEEPTOGETHER
+{
+ Text [ en-US ] = "Keep Together" ;
+};
+Resource RID_STR_KEEPTOGETHER_CONST
+{
+ String 1
+ {
+ Text [ en-US ] = "No" ;
+ };
+ String 2
+ {
+ Text [ en-US ] = "Whole Group" ;
+ };
+ String 3
+ {
+ Text [ en-US ] = "With First Detail" ;
+ };
+};
+String RID_STR_CANGROW
+{
+ Text [ en-US ] = "Can Grow" ;
+};
+String RID_STR_CANSHRINK
+{
+ Text [ en-US ] = "Can Shrink" ;
+};
+String RID_STR_REPEATSECTION
+{
+ Text [ en-US ] = "Repeat Section" ;
+};
+String RID_STR_PRINTREPEATEDVALUES
+{
+ Text [ en-US ] = "Print repeated values" ;
+};
+String RID_STR_CONDITIONALPRINTEXPRESSION
+{
+ Text [ en-US ] = "Conditional Print Expression" ;
+};
+String RID_STR_STARTNEWCOLUMN
+{
+ Text [ en-US ] = "Start new column" ;
+};
+String RID_STR_STARTNEWPAGE
+{
+ Text [ en-US ] = "Start new page" ;
+};
+String RID_STR_RESETPAGENUMBER
+{
+ Text [ en-US ] = "Reset page number" ;
+};
+String RID_STR_CHARTTYPE
+{
+ Text [ en-US ] = "Chart type" ;
+};
+String RID_STR_PRINTWHENGROUPCHANGE
+{
+ Text [ en-US ] = "Print When Group Change" ;
+};
+String RID_STR_VISIBLE
+{
+ Text [ en-US ] = "Visible" ;
+};
+String RID_STR_GROUPKEEPTOGETHER
+{
+ Text [ en-US ] = "Group keep together" ;
+};
+Resource RID_STR_GROUPKEEPTOGETHER_CONST
+{
+ String 1
+ {
+ Text [ en-US ] = "Per Page" ;
+ };
+ String 2
+ {
+ Text [ en-US ] = "Per Column" ;
+ };
+};
+Resource RID_STR_SECTIONPAGEBREAK_CONST
+{
+ String 1
+ {
+ Text [ en-US ] = "None" ;
+ };
+ String 2
+ {
+ Text [ en-US ] = "Section" ;
+ };
+ String 3
+ {
+ Text [ en-US ] = "Automatic" ;
+ };
+};
+String RID_STR_PAGEHEADEROPTION
+{
+ Text [ en-US ] = "Page header" ;
+};
+String RID_STR_PAGEFOOTEROPTION
+{
+ Text [ en-US ] = "Page footer" ;
+};
+Resource RID_STR_REPORTPRINTOPTION_CONST
+{
+ String 1
+ {
+ Text [ en-US ] = "All Pages" ;
+ };
+ String 2
+ {
+ Text [ en-US ] = "Not With Report Header" ;
+ };
+ String 3
+ {
+ Text [ en-US ] = "Not With Report Footer" ;
+ };
+ String 4
+ {
+ Text [ en-US ] = "Not With Report Header/Footer" ;
+ };
+};
+String RID_STR_DEEPTRAVERSING
+{
+ Text [ en-US ] = "Deep traversing" ;
+};
+String RID_STR_PREEVALUATED
+{
+ Text [ en-US ] = "Pre evaluation" ;
+};
+String RID_STR_POSITIONX
+{
+ Text [ en-US ] = "Position X";
+};
+String RID_STR_POSITIONY
+{
+ Text [ en-US ] = "Position Y";
+};
+String RID_STR_WIDTH
+{
+ Text [ en-US ] = "Width";
+};
+String RID_STR_HEIGHT
+{
+ Text [ en-US ] = "Height";
+};
+String RID_STR_INITIALFORMULA
+{
+ Text [ en-US ] = "Initial value" ;
+};
+String RID_STR_PRESERVEIRI
+{
+ Text [ en-US ] = "Preserve as Link" ;
+};
+String RID_STR_FORMULA
+{
+ Text [ en-US ] = "Formula" ;
+};
+String RID_STR_DATAFIELD
+{
+ Text [ en-US ] = "Data field" ;
+};
+String RID_STR_FONT
+{
+ Text [ en-US ] = "Font" ;
+};
+String RID_STR_BACKCOLOR
+{
+ Text [ en-US ] = "Background color";
+};
+String RID_STR_BACKTRANSPARENT
+{
+ Text [ en-US ] = "Background Transparent";
+};
+String RID_STR_CONTROLBACKGROUNDTRANSPARENT
+{
+ Text [ en-US ] = "Background Transparent";
+};
+String RID_STR_OVERLAP_OTHER_CONTROL
+{
+ Text [ en-US ] = "This operation is not allowed. The control overlaps with another one.";
+};
+String RID_STR_ILLEGAL_POSITION
+{
+ Text [ en-US ] = "This position can not be set. It is invalid.";
+};
+String RID_STR_SCOPE_GROUP
+{
+ Text [ en-US ] = "Group: %1";
+};
+String RID_STR_FORMULALIST
+{
+ Text [ en-US ] = "Function";
+};
+String RID_STR_SCOPE
+{
+ Text [ en-US ] = "Scope";
+};
+String RID_STR_TYPE
+{
+ Text [ en-US ] = "Data Field Type";
+};
+Resource RID_STR_TYPE_CONST
+{
+ String 1
+ {
+ Text [ en-US ] = "Field or Formula";
+ };
+ String 2
+ {
+ Text [ en-US ] = "Function";
+ };
+ String 3
+ {
+ Text [ en-US ] = "Counter";
+ };
+ String 4
+ {
+ Text [ en-US ] = "User defined Function";
+ };
+};
+String RID_STR_MASTERFIELDS
+{
+ Text [ en-US ] = "Link master fields" ;
+};
+String RID_STR_DETAILFIELDS
+{
+ Text [ en-US ] = "Link slave fields" ;
+};
+String RID_STR_EXPLANATION
+{
+ Text [ en-US ] = "Charts can be used to display detailed data about the current record of the report. To do this, you can specify which columns in the chart match which columns in the report.";
+};
+String RID_STR_DETAILLABEL
+{
+ Text [ en-US ] = "Chart" ;
+};
+String RID_STR_MASTERLABEL
+{
+ Text [ en-US ] = "Report" ;
+};
+
+String RID_STR_PREVIEW_COUNT
+{
+ Text [ en-US ] = "Preview Row(s)" ;
+};
+String RID_STR_AREA
+{
+ Text [ en-US ] = "Area" ;
+};
+String RID_STR_MIMETYPE
+{
+ Text [ en-US ] = "Report Output Format" ;
+};
+String RID_STR_VERTICALALIGN
+{
+ Text [ en-US ] = "Vert. Alignment" ;
+};
+Resource RID_STR_VERTICAL_ALIGN_CONST
+{
+ String 1
+ {
+ Text [ en-US ] = "Top";
+ };
+ String 2
+ {
+ Text [ en-US ] = "Middle";
+ };
+ String 3
+ {
+ Text [ en-US ] = "Bottom";
+ };
+};
+String RID_STR_PARAADJUST
+{
+ Text [ en-US ] = "Horz. Alignment" ;
+};
+Resource RID_STR_PARAADJUST_CONST
+{
+ String 1
+ {
+ Text [ en-US ] = "Left";
+ };
+ String 2
+ {
+ Text [ en-US ] = "Right";
+ };
+ String 3
+ {
+ Text [ en-US ] = "Block";
+ };
+ String 4
+ {
+ Text [ en-US ] = "Center";
+ };
+};
+String RID_STR_F_COUNTER
+{
+ Text [ en-US ] = "Counter" ;
+};
+String RID_STR_F_ACCUMULATION
+{
+ Text [ en-US ] = "Accumulation" ;
+};
+String RID_STR_F_MINIMUM
+{
+ Text [ en-US ] = "Minimum" ;
+};
+String RID_STR_F_MAXIMUM
+{
+ Text [ en-US ] = "Maximum" ;
+};
+
diff --git a/reportdesign/source/ui/inspection/makefile.mk b/reportdesign/source/ui/inspection/makefile.mk
new file mode 100644
index 000000000000..cd2c6e9e52cd
--- /dev/null
+++ b/reportdesign/source/ui/inspection/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJINC=$(PRJ)$/source
+PRJNAME=reportdesign
+TARGET=ui_inspection
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES=\
+ $(SLO)$/DefaultInspection.obj \
+ $(SLO)$/ReportComponentHandler.obj \
+ $(SLO)$/GeometryHandler.obj \
+ $(SLO)$/DataProviderHandler.obj \
+ $(SLO)$/metadata.obj
+
+
+SRS1NAME=$(TARGET)
+SRC1FILES = inspection.src
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx
new file mode 100644
index 000000000000..419a161741d2
--- /dev/null
+++ b/reportdesign/source/ui/inspection/metadata.cxx
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * 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 "metadata.hxx"
+#include <svtools/localresaccess.hxx>
+#include "com/sun/star/inspection/XPropertyHandler.hpp"
+#include <tools/debug.hxx>
+#include <comphelper/extract.hxx>
+#ifndef RTPUI_REPORTDESIGN_HELPID_HRC
+#include "helpids.hrc"
+#endif
+#ifndef _RPTUI_DLGRESID_HRC
+#include "RptResId.hrc"
+#endif
+#ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
+#include "uistrings.hrc"
+#endif
+
+#include <functional>
+#include <algorithm>
+
+//............................................................................
+namespace rptui
+{
+//............................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star;
+
+ //========================================================================
+ //= OPropertyInfoImpl
+ //========================================================================
+ struct OPropertyInfoImpl
+ {
+ String sName;
+ String sTranslation;
+ rtl::OString sHelpId;
+ sal_Int32 nId;
+ sal_uInt16 nPos;
+ sal_uInt32 nUIFlags;
+
+ OPropertyInfoImpl(
+ const ::rtl::OUString& rName,
+ sal_Int32 _nId,
+ const String& aTranslation,
+ sal_uInt16 nPosId,
+ const rtl::OString& _sHelpId,
+ sal_uInt32 _nUIFlags);
+ };
+
+ //------------------------------------------------------------------------
+ OPropertyInfoImpl::OPropertyInfoImpl(const ::rtl::OUString& _rName, sal_Int32 _nId,
+ const String& aString, sal_uInt16 nP, const rtl::OString& sHid, sal_uInt32 _nUIFlags)
+ :sName(_rName)
+ ,sTranslation(aString)
+ ,sHelpId(sHid)
+ ,nId(_nId)
+ ,nPos(nP)
+ ,nUIFlags(_nUIFlags)
+ {
+ }
+
+ //------------------------------------------------------------------------
+ // Vergleichen von PropertyInfo
+ struct PropertyInfoLessByName : public ::std::binary_function< OPropertyInfoImpl, OPropertyInfoImpl, bool >
+ {
+ bool operator()( const OPropertyInfoImpl& _lhs, const OPropertyInfoImpl& _rhs )
+ {
+ return _lhs.sName < _rhs.sName;
+ }
+ };
+
+ //========================================================================
+ //= OPropertyInfoService
+ //========================================================================
+#define DEF_INFO( ident, uinameres, helpid, flags ) \
+ OPropertyInfoImpl( PROPERTY_##ident, PROPERTY_ID_##ident, \
+ String( ModuleRes( RID_STR_##uinameres ) ), nPos++, HID_RPT_PROP_##helpid, flags )
+
+#define DEF_INFO_1( ident, uinameres, helpid, flag1 ) \
+ DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 )
+
+#define DEF_INFO_2( ident, uinameres, helpid, flag1, flag2 ) \
+ DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 )
+
+#define DEF_INFO_3( ident, uinameres, helpid, flag1, flag2, flag3 ) \
+ DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 )
+
+#define DEF_INFO_4( ident, uinameres, helpid, flag1, flag2, flag3, flag4 ) \
+ DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 )
+
+#define DEF_INFO_5( ident, uinameres, helpid, flag1, flag2, flag3, flag4, flag5 ) \
+ DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 | PROP_FLAG_##flag5 )
+
+ sal_uInt16 OPropertyInfoService::s_nCount = 0;
+ OPropertyInfoImpl* OPropertyInfoService::s_pPropertyInfos = NULL;
+ //------------------------------------------------------------------------
+ const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo()
+ {
+ if ( s_pPropertyInfos )
+ return s_pPropertyInfos;
+
+ OModuleClient aResourceAccess;
+ // this ensures that we have our resource file loaded
+
+ sal_uInt16 nPos = 1;
+ static OPropertyInfoImpl aPropertyInfos[] =
+ {
+ /*
+ DEF_INFO_?( propname and id, resoure id, help id, flags ),
+ */
+ DEF_INFO_1( FORCENEWPAGE, FORCENEWPAGE, FORCENEWPAGE, COMPOSEABLE )
+ ,DEF_INFO_1( NEWROWORCOL, NEWROWORCOL, NEWROWORCOL, COMPOSEABLE )
+ ,DEF_INFO_1( KEEPTOGETHER, KEEPTOGETHER, KEEPTOGETHER, COMPOSEABLE )
+ ,DEF_INFO_1( CANGROW, CANGROW, CANGROW, COMPOSEABLE )
+ ,DEF_INFO_1( CANSHRINK, CANSHRINK, CANSHRINK, COMPOSEABLE )
+ ,DEF_INFO_1( REPEATSECTION, REPEATSECTION, REPEATSECTION, COMPOSEABLE )
+ ,DEF_INFO_1( PRINTREPEATEDVALUES, PRINTREPEATEDVALUES, PRINTREPEATEDVALUES, COMPOSEABLE )
+ ,DEF_INFO_1( CONDITIONALPRINTEXPRESSION, CONDITIONALPRINTEXPRESSION, CONDITIONALPRINTEXPRESSION, COMPOSEABLE )
+ ,DEF_INFO_1( STARTNEWCOLUMN, STARTNEWCOLUMN, STARTNEWCOLUMN, COMPOSEABLE )
+ ,DEF_INFO_1( RESETPAGENUMBER, RESETPAGENUMBER, RESETPAGENUMBER, COMPOSEABLE )
+ ,DEF_INFO_1( PRINTWHENGROUPCHANGE, PRINTWHENGROUPCHANGE, PRINTWHENGROUPCHANGE, COMPOSEABLE )
+ ,DEF_INFO_1( VISIBLE, VISIBLE, VISIBLE, COMPOSEABLE )
+ ,DEF_INFO_1( GROUPKEEPTOGETHER, GROUPKEEPTOGETHER, GROUPKEEPTOGETHER, COMPOSEABLE )
+ ,DEF_INFO_1( PAGEHEADEROPTION, PAGEHEADEROPTION, PAGEHEADEROPTION, COMPOSEABLE )
+ ,DEF_INFO_1( PAGEFOOTEROPTION, PAGEFOOTEROPTION, PAGEFOOTEROPTION, COMPOSEABLE )
+ ,DEF_INFO_1( POSITIONX, POSITIONX, RPT_POSITIONX, COMPOSEABLE )
+ ,DEF_INFO_1( POSITIONY, POSITIONY, RPT_POSITIONY, COMPOSEABLE )
+ ,DEF_INFO_1( WIDTH, WIDTH, RPT_WIDTH, COMPOSEABLE )
+ ,DEF_INFO_1( HEIGHT, HEIGHT, RPT_HEIGHT, COMPOSEABLE )
+ ,DEF_INFO_1( FONT, FONT, RPT_FONT, COMPOSEABLE )
+ ,DEF_INFO_1( PREEVALUATED, PREEVALUATED, PREEVALUATED, COMPOSEABLE )
+ ,DEF_INFO_1( DEEPTRAVERSING, DEEPTRAVERSING, DEEPTRAVERSING, COMPOSEABLE )
+ ,DEF_INFO_1( FORMULA, FORMULA, FORMULA, COMPOSEABLE )
+ ,DEF_INFO_1( INITIALFORMULA, INITIALFORMULA, INITIALFORMULA, COMPOSEABLE )
+ ,DEF_INFO_2( TYPE, TYPE, TYPE, COMPOSEABLE,DATA_PROPERTY )
+ ,DEF_INFO_2( DATAFIELD, DATAFIELD, DATAFIELD, COMPOSEABLE,DATA_PROPERTY )
+ ,DEF_INFO_2( FORMULALIST, FORMULALIST, FORMULALIST, COMPOSEABLE,DATA_PROPERTY )
+ ,DEF_INFO_2( SCOPE, SCOPE, SCOPE, COMPOSEABLE,DATA_PROPERTY )
+ ,DEF_INFO_1( PRESERVEIRI, PRESERVEIRI, PRESERVEIRI, COMPOSEABLE )
+ ,DEF_INFO_1( BACKCOLOR, BACKCOLOR, BACKCOLOR, COMPOSEABLE )
+ ,DEF_INFO_1( CONTROLBACKGROUND, BACKCOLOR, BACKCOLOR, COMPOSEABLE )
+ ,DEF_INFO_1( BACKTRANSPARENT, BACKTRANSPARENT, BACKTRANSPARENT, COMPOSEABLE )
+ ,DEF_INFO_1( CONTROLBACKGROUNDTRANSPARENT, CONTROLBACKGROUNDTRANSPARENT
+ ,CONTROLBACKGROUNDTRANSPARENT, COMPOSEABLE )
+ ,DEF_INFO_1( CHARTTYPE, CHARTTYPE, CHARTTYPE, COMPOSEABLE )
+ ,DEF_INFO_1( PREVIEW_COUNT, PREVIEW_COUNT, PREVIEW_COUNT, COMPOSEABLE )
+ ,DEF_INFO_2( MASTERFIELDS, MASTERFIELDS, MASTERFIELDS, COMPOSEABLE,DATA_PROPERTY )
+ ,DEF_INFO_2( DETAILFIELDS, DETAILFIELDS, DETAILFIELDS, COMPOSEABLE,DATA_PROPERTY)
+ ,DEF_INFO_1( AREA, AREA, AREA, COMPOSEABLE )
+ ,DEF_INFO_2( MIMETYPE, MIMETYPE, MIMETYPE, COMPOSEABLE,DATA_PROPERTY )
+ ,DEF_INFO_1( PARAADJUST, PARAADJUST, PARAADJUST, COMPOSEABLE )
+ ,DEF_INFO_1( VERTICALALIGN, VERTICALALIGN, VERTICALALIGN, COMPOSEABLE )
+ };
+
+ s_pPropertyInfos = aPropertyInfos;
+ s_nCount = sizeof(aPropertyInfos) / sizeof(OPropertyInfoImpl);
+
+ ::std::sort( aPropertyInfos, aPropertyInfos + s_nCount, PropertyInfoLessByName() );
+
+ return s_pPropertyInfos;
+ }
+
+ //------------------------------------------------------------------------
+ sal_Int32 OPropertyInfoService::getPropertyId(const String& _rName) const
+ {
+ const OPropertyInfoImpl* pInfo = getPropertyInfo(_rName);
+ return pInfo ? pInfo->nId : -1;
+ }
+
+ //------------------------------------------------------------------------
+ String OPropertyInfoService::getPropertyTranslation(sal_Int32 _nId) const
+ {
+ const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
+ return (pInfo) ? pInfo->sTranslation : String();
+ }
+
+ //------------------------------------------------------------------------
+ rtl::OString OPropertyInfoService::getPropertyHelpId(sal_Int32 _nId) const
+ {
+ const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
+ return (pInfo) ? pInfo->sHelpId : rtl::OString();
+ }
+
+ //------------------------------------------------------------------------
+ sal_uInt32 OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) const
+ {
+ const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId);
+ return (pInfo) ? pInfo->nUIFlags : 0;
+ }
+
+ //------------------------------------------------------------------------
+ const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(const String& _rName)
+ {
+ // intialisierung
+ if(!s_pPropertyInfos)
+ getPropertyInfo();
+ OPropertyInfoImpl aSearch(_rName, 0L, String(), 0, "", 0);
+
+ const OPropertyInfoImpl* pPropInfo = ::std::lower_bound(
+ s_pPropertyInfos, s_pPropertyInfos + s_nCount, aSearch, PropertyInfoLessByName() );
+
+ if ( ( pPropInfo < s_pPropertyInfos + s_nCount ) && pPropInfo->sName == _rName )
+ return pPropInfo;
+
+ return NULL;
+ }
+
+
+ //------------------------------------------------------------------------
+ const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(sal_Int32 _nId)
+ {
+ // intialisierung
+ if(!s_pPropertyInfos)
+ getPropertyInfo();
+
+ // TODO: a real structure which allows quick access by name as well as by id
+ for (sal_uInt16 i = 0; i < s_nCount; i++)
+ if (s_pPropertyInfos[i].nId == _nId)
+ return &s_pPropertyInfos[i];
+
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------
+ bool OPropertyInfoService::isComposable( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _rxFormComponentHandler )
+ {
+ sal_Int32 nId = getPropertyId( _rPropertyName );
+ if ( nId != -1 )
+ {
+ sal_uInt32 nFlags = getPropertyUIFlags( nId );
+ return ( nFlags & PROP_FLAG_COMPOSEABLE ) != 0;
+ }
+
+ return _rxFormComponentHandler->isComposable( _rPropertyName );
+ }
+
+ //------------------------------------------------------------------------
+ void OPropertyInfoService::getExcludeProperties(::std::vector< beans::Property >& _rExcludeProperties,const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _xFormComponentHandler)
+ {
+ uno::Sequence< beans::Property > aProps = _xFormComponentHandler->getSupportedProperties();
+ static const ::rtl::OUString pExcludeProperties[] =
+ {
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Enabled")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Printable")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WordBreak")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MultiLine")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Tag")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HelpText")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HelpURL")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxTextLen")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Tabstop")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TabIndex")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ValueMin")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ValueMax")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Spin")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SpinValue")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SpinValueMin")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SpinValueMax")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultSpinValue")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SpinIncrement")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Repeat")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RepeatDelay")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlLabel")), /// TODO: has to be checked
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LabelControl")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), // comment this out if you want to have title feature for charts
+ PROPERTY_MAXTEXTLEN,
+ PROPERTY_EFFECTIVEDEFAULT,
+ PROPERTY_EFFECTIVEMAX,
+ PROPERTY_EFFECTIVEMIN,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HideInactiveSelection")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SubmitAction")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputRequired")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VerticalAlign")),
+ PROPERTY_ALIGN,
+ PROPERTY_EMPTY_IS_NULL,
+ PROPERTY_FILTERPROPOSAL
+ ,PROPERTY_POSITIONX
+ ,PROPERTY_POSITIONY
+ ,PROPERTY_WIDTH
+ ,PROPERTY_HEIGHT
+ ,PROPERTY_FONT
+ ,PROPERTY_LABEL
+ ,PROPERTY_LINECOLOR
+ ,PROPERTY_BORDER
+ ,PROPERTY_BORDERCOLOR
+ ,PROPERTY_BACKTRANSPARENT
+ ,PROPERTY_CONTROLBACKGROUND
+ ,PROPERTY_BACKGROUNDCOLOR
+ ,PROPERTY_CONTROLBACKGROUNDTRANSPARENT
+ ,PROPERTY_FORMULALIST
+ ,PROPERTY_SCOPE
+ ,PROPERTY_TYPE
+ ,PROPERTY_DATASOURCENAME
+ ,PROPERTY_VERTICALALIGN
+ };
+
+ beans::Property* pPropsIter = aProps.getArray();
+ beans::Property* pPropsEnd = pPropsIter + aProps.getLength();
+ for (; pPropsIter != pPropsEnd; ++pPropsIter)
+ {
+ size_t nPos = 0;
+ for (; nPos < sizeof(pExcludeProperties)/sizeof(pExcludeProperties[0]) && pExcludeProperties[nPos] != pPropsIter->Name;++nPos )
+ ;
+ if ( nPos == sizeof(pExcludeProperties)/sizeof(pExcludeProperties[0]) )
+ _rExcludeProperties.push_back(*pPropsIter);
+ }
+ }
+
+
+//............................................................................
+} // namespace pcr
+//............................................................................
+
diff --git a/reportdesign/source/ui/misc/ColorListener.cxx b/reportdesign/source/ui/misc/ColorListener.cxx
new file mode 100644
index 000000000000..2a53a5937095
--- /dev/null
+++ b/reportdesign/source/ui/misc/ColorListener.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * 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 "ColorListener.hxx"
+#include <svl/smplhint.hxx>
+#ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
+#include "uistrings.hrc"
+#endif
+
+#define BORDERCOLORCHANGE 191
+//=====================================================================
+namespace rptui
+{
+//=====================================================================
+ DBG_NAME( rpt_OColorListener )
+OColorListener::OColorListener(Window* _pParent ,const ::rtl::OUString& _sColorEntry)
+: Window(_pParent)
+,m_sColorEntry(_sColorEntry)
+,m_nColor(COL_LIGHTBLUE)
+,m_bCollapsed(sal_False)
+,m_bMarked(sal_False)
+{
+ DBG_CTOR( rpt_OColorListener,NULL);
+ StartListening(m_aExtendedColorConfig);
+ m_nColor = m_aExtendedColorConfig.GetColorValue(CFG_REPORTDESIGNER,m_sColorEntry).getColor();
+ m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor;
+}
+// -----------------------------------------------------------------------------
+OColorListener::~OColorListener()
+{
+ DBG_DTOR( rpt_OColorListener,NULL);
+ EndListening(m_aExtendedColorConfig);
+}
+// -----------------------------------------------------------------------
+void OColorListener::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint)
+{
+ if (rHint.ISA(SfxSimpleHint)
+ && (static_cast< SfxSimpleHint const & >(rHint).GetId()
+ == SFX_HINT_COLORS_CHANGED))
+ {
+ m_nColor = m_aExtendedColorConfig.GetColorValue(CFG_REPORTDESIGNER,m_sColorEntry).getColor();
+ m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor;
+ Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE);
+ }
+}
+//-----------------------------------------------------------------------------
+void OColorListener::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+// -----------------------------------------------------------------------------
+void OColorListener::setCollapsed(sal_Bool _bCollapsed)
+{
+ m_bCollapsed = _bCollapsed;
+ if ( m_aCollapsedLink.IsSet() )
+ m_aCollapsedLink.Call(this);
+}
+// -----------------------------------------------------------------------------
+void OColorListener::setMarked(sal_Bool _bMark)
+{
+ m_bMarked = _bMark;
+ Invalidate();
+}
+// =======================================================================
+}
+// =======================================================================
diff --git a/reportdesign/source/ui/misc/FunctionHelper.cxx b/reportdesign/source/ui/misc/FunctionHelper.cxx
new file mode 100644
index 000000000000..e6c92f0cbb0d
--- /dev/null
+++ b/reportdesign/source/ui/misc/FunctionHelper.cxx
@@ -0,0 +1,257 @@
+/*************************************************************************
+ *
+ * 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 "FunctionHelper.hxx"
+#include <tools/debug.hxx>
+
+// =============================================================================
+namespace rptui
+{
+// =============================================================================
+ using namespace ::com::sun::star;
+
+FunctionManager::FunctionManager(const uno::Reference< report::meta::XFunctionManager>& _xMgr)
+: m_xMgr(_xMgr)
+{
+}
+FunctionManager::~FunctionManager()
+{
+}
+sal_Unicode FunctionManager::getSingleToken(const formula::IFunctionManager::EToken _eToken) const
+{
+ switch(_eToken)
+ {
+ case eOk:
+ return sal_Unicode('(');
+ case eClose:
+ return sal_Unicode(')');
+ case eSep:
+ return sal_Unicode(';');
+ case eArrayOpen:
+ return sal_Unicode('{');
+ case eArrayClose:
+ return sal_Unicode('}');
+ } // switch(_eToken)
+ return 0;
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 FunctionManager::getCount() const
+{
+ return m_xMgr->getCount();
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionCategory* FunctionManager::getCategory(sal_uInt32 _nPos) const
+{
+ if ( _nPos >= m_aCategoryIndex.size() )
+ {
+ uno::Reference< report::meta::XFunctionCategory> xCategory = m_xMgr->getCategory(_nPos);
+ ::boost::shared_ptr< FunctionCategory > pCategory(new FunctionCategory(this,_nPos + 1,xCategory));
+ m_aCategoryIndex.push_back( m_aCategories.insert(TCategoriesMap::value_type(xCategory->getName(),pCategory)).first );
+ }
+ return m_aCategoryIndex[_nPos]->second.get();
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionDescription* FunctionManager::getFunctionByName(const ::rtl::OUString& _sFunctionName) const
+{
+ const formula::IFunctionDescription* pDesc = NULL;
+ try
+ {
+ pDesc = get(m_xMgr->getFunctionByName(_sFunctionName)).get();
+ }
+ catch(uno::Exception&)
+ {
+ }
+ return pDesc;
+}
+// -----------------------------------------------------------------------------
+void FunctionManager::fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& /*_rLastRUFunctions*/) const
+{
+ //const sal_uInt32 nCount = getCount();
+ //for(sal_uInt32 i = 0 ; i < nCount ; ++i)
+ //{
+ // const formula::IFunctionCategory* pCategory = getCategory(
+ //}
+}
+// -----------------------------------------------------------------------------
+::boost::shared_ptr< FunctionDescription > FunctionManager::get(const uno::Reference< report::meta::XFunctionDescription>& _xFunctionDescription) const
+{
+ ::boost::shared_ptr< FunctionDescription > pDesc;
+ if ( _xFunctionDescription.is() )
+ {
+ const ::rtl::OUString sFunctionName = _xFunctionDescription->getName();
+ TFunctionsMap::const_iterator aFunctionFind = m_aFunctions.find(sFunctionName);
+ if ( aFunctionFind == m_aFunctions.end() )
+ {
+ const uno::Reference< report::meta::XFunctionCategory> xCategory = _xFunctionDescription->getCategory();
+ const ::rtl::OUString sCategoryName = xCategory->getName();
+ TCategoriesMap::iterator aCategoryFind = m_aCategories.find(sCategoryName);
+ if ( aCategoryFind == m_aCategories.end() )
+ {
+ aCategoryFind = m_aCategories.insert(TCategoriesMap::value_type(sCategoryName,::boost::shared_ptr< FunctionCategory > (new FunctionCategory(this,xCategory->getNumber() + 1,xCategory)))).first;
+ m_aCategoryIndex.push_back( aCategoryFind );
+ }
+ aFunctionFind = m_aFunctions.insert(TFunctionsMap::value_type(sFunctionName,::boost::shared_ptr<FunctionDescription>(new FunctionDescription(aCategoryFind->second.get(),_xFunctionDescription)))).first;
+ } // if ( aFind == m_aFunctions.end() )
+ pDesc = aFunctionFind->second;
+ } // if ( _xFunctionDescription.is() )
+ return pDesc;
+}
+// -----------------------------------------------------------------------------
+FunctionCategory::FunctionCategory(const FunctionManager* _pFMgr,sal_uInt32 _nPos,const uno::Reference< report::meta::XFunctionCategory>& _xCategory)
+: m_xCategory(_xCategory)
+,m_nFunctionCount(_xCategory->getCount())
+, m_nNumber(_nPos)
+,m_pFunctionManager(_pFMgr)
+{
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 FunctionCategory::getCount() const
+{
+ return m_nFunctionCount;
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionDescription* FunctionCategory::getFunction(sal_uInt32 _nPos) const
+{
+ if ( _nPos >= m_aFunctions.size() && _nPos < m_nFunctionCount )
+ {
+ uno::Reference< report::meta::XFunctionDescription> xFunctionDescription = m_xCategory->getFunction(_nPos);
+ ::boost::shared_ptr< FunctionDescription > pFunction = m_pFunctionManager->get(xFunctionDescription);
+ m_aFunctions.push_back( pFunction );
+ }
+ return m_aFunctions[_nPos].get();
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 FunctionCategory::getNumber() const
+{
+ return m_nNumber;
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionManager* FunctionCategory::getFunctionManager() const
+{
+ return m_pFunctionManager;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionCategory::getName() const
+{
+ return m_xCategory->getName();
+}
+// -----------------------------------------------------------------------------
+FunctionDescription::FunctionDescription(const formula::IFunctionCategory* _pFunctionCategory,const uno::Reference< report::meta::XFunctionDescription>& _xFunctionDescription)
+: m_xFunctionDescription(_xFunctionDescription)
+, m_pFunctionCategory(_pFunctionCategory)
+{
+ m_aParameter = m_xFunctionDescription->getArguments();
+}
+::rtl::OUString FunctionDescription::getFunctionName() const
+{
+ return m_xFunctionDescription->getName();
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionCategory* FunctionDescription::getCategory() const
+{
+ return m_pFunctionCategory;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getDescription() const
+{
+ return m_xFunctionDescription->getDescription();
+}
+// -----------------------------------------------------------------------------
+xub_StrLen FunctionDescription::getSuppressedArgumentCount() const
+{
+ return static_cast<xub_StrLen>(m_aParameter.getLength());
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const
+{
+ ::rtl::OUString sFormula;
+ try
+ {
+ const ::rtl::OUString *pArguments = _aArguments.empty() ? 0 : &_aArguments[0];
+ sFormula = m_xFunctionDescription->createFormula(uno::Sequence< ::rtl::OUString >(pArguments, _aArguments.size()));
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_ERROR("Exception caught!");
+ }
+ return sFormula;
+}
+// -----------------------------------------------------------------------------
+void FunctionDescription::fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const
+{
+ const sal_Int32 nCount = m_aParameter.getLength();
+ for(sal_uInt16 i = 0;i < nCount; ++i)
+ {
+ _rArguments.push_back(i);
+ }
+}
+// -----------------------------------------------------------------------------
+void FunctionDescription::initArgumentInfo() const
+{
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getSignature() const
+{
+ return m_xFunctionDescription->getSignature();
+}
+// -----------------------------------------------------------------------------
+rtl::OString FunctionDescription::getHelpId() const
+{
+ return rtl::OString();
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 FunctionDescription::getParameterCount() const
+{
+ return m_aParameter.getLength();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getParameterName(sal_uInt32 _nPos) const
+{
+ if ( _nPos < static_cast<sal_uInt32>(m_aParameter.getLength()) )
+ return m_aParameter[_nPos].Name;
+ return ::rtl::OUString();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getParameterDescription(sal_uInt32 _nPos) const
+{
+ if ( _nPos < static_cast<sal_uInt32>(m_aParameter.getLength()) )
+ return m_aParameter[_nPos].Description;
+ return ::rtl::OUString();
+}
+// -----------------------------------------------------------------------------
+bool FunctionDescription::isParameterOptional(sal_uInt32 _nPos) const
+{
+ if ( _nPos < static_cast<sal_uInt32>(m_aParameter.getLength()) )
+ return m_aParameter[_nPos].IsOptional;
+ return false;
+}
+// -----------------------------------------------------------------------------
+// =============================================================================
+} // rptui
+// =============================================================================
diff --git a/reportdesign/source/ui/misc/RptUndo.cxx b/reportdesign/source/ui/misc/RptUndo.cxx
new file mode 100644
index 000000000000..4244987b717a
--- /dev/null
+++ b/reportdesign/source/ui/misc/RptUndo.cxx
@@ -0,0 +1,411 @@
+/*************************************************************************
+ *
+ * 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 "RptUndo.hxx"
+#include "uistrings.hrc"
+#include "rptui_slotid.hrc"
+#include "UITools.hxx"
+#include "UndoEnv.hxx"
+
+#include <dbaccess/IController.hxx>
+#include <com/sun/star/report/XSection.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <svx/unoshape.hxx>
+#include <boost/bind.hpp>
+#include <functional>
+
+namespace rptui
+{
+ using namespace ::com::sun::star;
+ using namespace uno;
+ using namespace lang;
+ using namespace script;
+ using namespace beans;
+ using namespace awt;
+ using namespace util;
+ using namespace container;
+ using namespace report;
+
+//----------------------------------------------------------------------------
+namespace
+{
+ void lcl_collectElements(const uno::Reference< report::XSection >& _xSection,::std::vector< uno::Reference< drawing::XShape> >& _rControls)
+ {
+ if ( _xSection.is() )
+ {
+ sal_Int32 nCount = _xSection->getCount();
+ _rControls.reserve(nCount);
+ while ( nCount )
+ {
+ uno::Reference< drawing::XShape> xShape(_xSection->getByIndex(nCount-1),uno::UNO_QUERY);
+ _rControls.push_back(xShape);
+ _xSection->remove(xShape);
+ --nCount;
+ }
+ } // if ( _xSection.is() )
+ }
+ //----------------------------------------------------------------------------
+ void lcl_insertElements(const uno::Reference< report::XSection >& _xSection,const ::std::vector< uno::Reference< drawing::XShape> >& _aControls)
+ {
+ if ( _xSection.is() )
+ {
+ ::std::vector< uno::Reference< drawing::XShape> >::const_reverse_iterator aIter = _aControls.rbegin();
+ ::std::vector< uno::Reference< drawing::XShape> >::const_reverse_iterator aEnd = _aControls.rend();
+ for (; aIter != aEnd; ++aIter)
+ {
+ try
+ {
+ const awt::Point aPos = (*aIter)->getPosition();
+ const awt::Size aSize = (*aIter)->getSize();
+ _xSection->add(*aIter);
+ (*aIter)->setPosition( aPos );
+ (*aIter)->setSize( aSize );
+ }
+ catch(const uno::Exception&)
+ {
+ OSL_ENSURE(0,"lcl_insertElements:Exception caught!");
+ }
+ }
+ }
+ }
+ //----------------------------------------------------------------------------
+ void lcl_setValues(const uno::Reference< report::XSection >& _xSection,const ::std::vector< ::std::pair< ::rtl::OUString ,uno::Any> >& _aValues)
+ {
+ if ( _xSection.is() )
+ {
+ ::std::vector< ::std::pair< ::rtl::OUString ,uno::Any> >::const_iterator aIter = _aValues.begin();
+ ::std::vector< ::std::pair< ::rtl::OUString ,uno::Any> >::const_iterator aEnd = _aValues.end();
+ for (; aIter != aEnd; ++aIter)
+ {
+ try
+ {
+ _xSection->setPropertyValue(aIter->first,aIter->second);
+ }
+ catch(const uno::Exception&)
+ {
+ OSL_ENSURE(0,"lcl_setValues:Exception caught!");
+ }
+ }
+ }
+ }
+}
+//----------------------------------------------------------------------------
+TYPEINIT1( OSectionUndo, OCommentUndoAction );
+DBG_NAME(rpt_OSectionUndo)
+//----------------------------------------------------------------------------
+OSectionUndo::OSectionUndo(OReportModel& _rMod
+ ,sal_uInt16 _nSlot
+ ,Action _eAction
+ ,sal_uInt16 nCommentID)
+: OCommentUndoAction(_rMod,nCommentID)
+,m_eAction(_eAction)
+,m_nSlot(_nSlot)
+,m_bInserted(false)
+{
+ DBG_CTOR(rpt_OSectionUndo,NULL);
+}
+// -----------------------------------------------------------------------------
+OSectionUndo::~OSectionUndo()
+{
+ if ( !m_bInserted )
+ {
+ OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv();
+ ::std::vector< uno::Reference< drawing::XShape> >::iterator aEnd = m_aControls.end();
+ for (::std::vector< uno::Reference< drawing::XShape> >::iterator aIter = m_aControls.begin(); aIter != aEnd; ++aIter)
+ {
+ uno::Reference< drawing::XShape> xShape = *aIter;
+ rEnv.RemoveElement(xShape);
+
+#if OSL_DEBUG_LEVEL > 0
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL;
+ OSL_ENSURE( pShape && pShape->HasSdrObjectOwnership() && pObject && !pObject->IsInserted(),
+ "OSectionUndo::~OSectionUndo: inconsistency in the shape/object ownership!" );
+#endif
+ try
+ {
+ comphelper::disposeComponent(xShape);
+ }
+ catch(uno::Exception)
+ {
+ OSL_ENSURE(0,"Exception caught!");
+ }
+ }
+ }
+ DBG_DTOR(rpt_OSectionUndo,NULL);
+}
+// -----------------------------------------------------------------------------
+void OSectionUndo::collectControls(const uno::Reference< report::XSection >& _xSection)
+{
+ m_aControls.clear();
+ try
+ {
+ // copy all properties for restoring
+ uno::Reference< beans::XPropertySetInfo> xInfo = _xSection->getPropertySetInfo();
+ uno::Sequence< beans::Property> aSeq = xInfo->getProperties();
+ const beans::Property* pIter = aSeq.getConstArray();
+ const beans::Property* pEnd = pIter + aSeq.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ if ( 0 == (pIter->Attributes & beans::PropertyAttribute::READONLY) )
+ m_aValues.push_back(::std::pair< ::rtl::OUString ,uno::Any>(pIter->Name,_xSection->getPropertyValue(pIter->Name)));
+ }
+ lcl_collectElements(_xSection,m_aControls);
+ }
+ catch(uno::Exception&)
+ {
+ }
+}
+//----------------------------------------------------------------------------
+void OSectionUndo::Undo()
+{
+ try
+ {
+ switch ( m_eAction )
+ {
+ case Inserted:
+ implReRemove();
+ break;
+
+ case Removed:
+ implReInsert();
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OSectionUndo::Undo: caught an exception!" );
+ }
+}
+//----------------------------------------------------------------------------
+void OSectionUndo::Redo()
+{
+ try
+ {
+ switch ( m_eAction )
+ {
+ case Inserted:
+ implReInsert();
+ break;
+
+ case Removed:
+ implReRemove();
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OSectionUndo::Redo: caught an exception!" );
+ }
+}
+//----------------------------------------------------------------------------
+TYPEINIT1( OReportSectionUndo, OSectionUndo );
+//----------------------------------------------------------------------------
+OReportSectionUndo::OReportSectionUndo(OReportModel& _rMod,sal_uInt16 _nSlot
+ ,::std::mem_fun_t< uno::Reference< report::XSection >
+ ,OReportHelper> _pMemberFunction
+ ,const uno::Reference< report::XReportDefinition >& _xReport
+ ,Action _eAction
+ ,sal_uInt16 nCommentID)
+: OSectionUndo(_rMod,_nSlot,_eAction,nCommentID)
+,m_aReportHelper(_xReport)
+,m_pMemberFunction(_pMemberFunction)
+{
+ if( m_eAction == Removed )
+ collectControls(m_pMemberFunction(&m_aReportHelper));
+}
+// -----------------------------------------------------------------------------
+OReportSectionUndo::~OReportSectionUndo()
+{
+}
+//----------------------------------------------------------------------------
+void OReportSectionUndo::implReInsert( )
+{
+ const uno::Sequence< beans::PropertyValue > aArgs;
+ m_pController->executeChecked(m_nSlot,aArgs);
+ uno::Reference< report::XSection > xSection = m_pMemberFunction(&m_aReportHelper);
+ lcl_insertElements(xSection,m_aControls);
+ lcl_setValues(xSection,m_aValues);
+ m_bInserted = true;
+}
+//----------------------------------------------------------------------------
+void OReportSectionUndo::implReRemove( )
+{
+ if( m_eAction == Removed )
+ collectControls(m_pMemberFunction(&m_aReportHelper));
+ const uno::Sequence< beans::PropertyValue > aArgs;
+ m_pController->executeChecked(m_nSlot,aArgs);
+ m_bInserted = false;
+}
+//----------------------------------------------------------------------------
+TYPEINIT1( OGroupSectionUndo, OSectionUndo );
+//----------------------------------------------------------------------------
+OGroupSectionUndo::OGroupSectionUndo(OReportModel& _rMod,sal_uInt16 _nSlot
+ ,::std::mem_fun_t< uno::Reference< report::XSection >
+ ,OGroupHelper> _pMemberFunction
+ ,const uno::Reference< report::XGroup >& _xGroup
+ ,Action _eAction
+ ,sal_uInt16 nCommentID)
+: OSectionUndo(_rMod,_nSlot,_eAction,nCommentID)
+,m_aGroupHelper(_xGroup)
+,m_pMemberFunction(_pMemberFunction)
+{
+ if( m_eAction == Removed )
+ {
+ uno::Reference< report::XSection > xSection = m_pMemberFunction(&m_aGroupHelper);
+ if ( xSection.is() )
+ m_sName = xSection->getName();
+ collectControls(xSection);
+ }
+}
+//----------------------------------------------------------------------------
+String OGroupSectionUndo::GetComment() const
+{
+ if ( !m_sName.getLength() )
+ {
+ try
+ {
+ uno::Reference< report::XSection > xSection = const_cast<OGroupSectionUndo*>(this)->m_pMemberFunction(&const_cast<OGroupSectionUndo*>(this)->m_aGroupHelper);
+
+ if ( xSection.is() )
+ m_sName = xSection->getName();
+ }
+ catch(uno::Exception&)
+ {}
+ }
+ return m_strComment + m_sName;
+}
+//----------------------------------------------------------------------------
+void OGroupSectionUndo::implReInsert( )
+{
+ uno::Sequence< beans::PropertyValue > aArgs(2);
+
+ aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? PROPERTY_HEADERON : PROPERTY_FOOTERON;
+ aArgs[0].Value <<= sal_True;
+ aArgs[1].Name = PROPERTY_GROUP;
+ aArgs[1].Value <<= m_aGroupHelper.getGroup();
+ m_pController->executeChecked(m_nSlot,aArgs);
+
+ uno::Reference< report::XSection > xSection = m_pMemberFunction(&m_aGroupHelper);
+ lcl_insertElements(xSection,m_aControls);
+ lcl_setValues(xSection,m_aValues);
+ m_bInserted = true;
+}
+//----------------------------------------------------------------------------
+void OGroupSectionUndo::implReRemove( )
+{
+ if( m_eAction == Removed )
+ collectControls(m_pMemberFunction(&m_aGroupHelper));
+
+ uno::Sequence< beans::PropertyValue > aArgs(2);
+
+ aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? PROPERTY_HEADERON : PROPERTY_FOOTERON;
+ aArgs[0].Value <<= sal_False;
+ aArgs[1].Name = PROPERTY_GROUP;
+ aArgs[1].Value <<= m_aGroupHelper.getGroup();
+
+ m_pController->executeChecked(m_nSlot,aArgs);
+ m_bInserted = false;
+}
+//----------------------------------------------------------------------------
+TYPEINIT1( OGroupUndo, OCommentUndoAction );
+//----------------------------------------------------------------------------
+OGroupUndo::OGroupUndo(OReportModel& _rMod
+ ,sal_uInt16 nCommentID
+ ,Action _eAction
+ ,const uno::Reference< report::XGroup>& _xGroup
+ ,const uno::Reference< report::XReportDefinition >& _xReportDefinition)
+: OCommentUndoAction(_rMod,nCommentID)
+,m_xGroup(_xGroup)
+,m_xReportDefinition(_xReportDefinition)
+,m_eAction(_eAction)
+{
+ m_nLastPosition = getPositionInIndexAccess(m_xReportDefinition->getGroups().get(),m_xGroup);
+}
+//----------------------------------------------------------------------------
+void OGroupUndo::implReInsert( )
+{
+ try
+ {
+ m_xReportDefinition->getGroups()->insertByIndex(m_nLastPosition,uno::makeAny(m_xGroup));
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception catched while undoing remove group");
+ }
+}
+//----------------------------------------------------------------------------
+void OGroupUndo::implReRemove( )
+{
+ try
+ {
+ m_xReportDefinition->getGroups()->removeByIndex(m_nLastPosition);
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception catched while redoing remove group");
+ }
+}
+//----------------------------------------------------------------------------
+void OGroupUndo::Undo()
+{
+ switch ( m_eAction )
+ {
+ case Inserted:
+ implReRemove();
+ break;
+
+ case Removed:
+ implReInsert();
+ break;
+ }
+
+}
+//----------------------------------------------------------------------------
+void OGroupUndo::Redo()
+{
+ switch ( m_eAction )
+ {
+ case Inserted:
+ implReInsert();
+ break;
+
+ case Removed:
+ implReRemove();
+ break;
+ }
+}
+//----------------------------------------------------------------------------
+//============================================================================
+} // rptui
+//============================================================================
+
+
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
new file mode 100644
index 000000000000..f17f4afabb36
--- /dev/null
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -0,0 +1,1084 @@
+/*************************************************************************
+ *
+ * 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 <toolkit/helper/convert.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include "SectionView.hxx"
+#include "UITools.hxx"
+#include "Formula.hxx"
+#include "FunctionHelper.hxx"
+#include "reportformula.hxx"
+
+#include <tools/diagnose_ex.h>
+#include <tools/string.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <com/sun/star/lang/NullPointerException.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <svx/svdpool.hxx>
+
+#include <editeng/charscaleitem.hxx>
+#include <svx/algitem.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/xtable.hxx> // XColorTable
+#include <editeng/brshitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/emphitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/prszitem.hxx>
+#include <editeng/wrlmitem.hxx>
+#include <editeng/cmapitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/blnkitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/akrnitem.hxx>
+#include <editeng/colritem.hxx>
+#include <svx/drawitem.hxx>
+#include <editeng/twolinesitem.hxx>
+#include <editeng/charreliefitem.hxx>
+#include <editeng/charrotateitem.hxx>
+#include <editeng/charhiddenitem.hxx>
+#include <svx/xgrscit.hxx>
+#include <svx/svditer.hxx>
+#include <svx/xtable.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svdview.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/unoprov.hxx>
+
+#include <unotools/pathoptions.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+
+#include <comphelper/propmultiplex.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbconversion.hxx>
+#include <connectivity/dbtools.hxx>
+
+#include <com/sun/star/report/XGroups.hpp>
+#include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/report/XShape.hpp>
+#include <com/sun/star/report/Function.hpp>
+#include <com/sun/star/sdb/XParametersSupplier.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <i18npool/mslangid.hxx>
+#include "dlgpage.hxx"
+#include <vcl/msgbox.hxx>
+#include "rptui_slotid.hrc"
+#include "uistrings.hrc"
+#include "RptObject.hxx"
+#include "ModuleHelper.hxx"
+#include "RptDef.hxx"
+#include "RptResId.hrc"
+#include "ReportDefinition.hxx"
+#include "RptModel.hxx"
+
+#define ITEMID_FONT 10
+#define ITEMID_FONTHEIGHT 11
+#define ITEMID_LANGUAGE 12
+
+#define ITEMID_POSTURE 13
+#define ITEMID_WEIGHT 14
+#define ITEMID_SHADOWED 15
+#define ITEMID_WORDLINEMODE 16
+#define ITEMID_CONTOUR 17
+#define ITEMID_CROSSEDOUT 18
+#define ITEMID_UNDERLINE 19
+
+#define ITEMID_COLOR 20
+#define ITEMID_KERNING 21
+#define ITEMID_CASEMAP 22
+
+#define ITEMID_ESCAPEMENT 23
+#define ITEMID_FONTLIST 24
+#define ITEMID_AUTOKERN 25
+#define ITEMID_COLOR_TABLE 26
+#define ITEMID_BLINK 27
+#define ITEMID_EMPHASISMARK 28
+#define ITEMID_TWOLINES 29
+#define ITEMID_CHARROTATE 30
+#define ITEMID_CHARSCALE_W 31
+#define ITEMID_CHARRELIEF 32
+#define ITEMID_CHARHIDDEN 33
+#define ITEMID_BRUSH 34
+#define ITEMID_HORJUSTIFY 35
+#define ITEMID_VERJUSTIFY 36
+#define ITEMID_FONT_ASIAN 37
+#define ITEMID_FONTHEIGHT_ASIAN 38
+#define ITEMID_LANGUAGE_ASIAN 39
+#define ITEMID_POSTURE_ASIAN 40
+#define ITEMID_WEIGHT_ASIAN 41
+#define ITEMID_FONT_COMPLEX 42
+#define ITEMID_FONTHEIGHT_COMPLEX 43
+#define ITEMID_LANGUAGE_COMPLEX 44
+#define ITEMID_POSTURE_COMPLEX 45
+#define ITEMID_WEIGHT_COMPLEX 46
+
+#define WESTERN 0
+#define ASIAN 1
+#define COMPLEX 2
+
+namespace rptui
+{
+using namespace ::com::sun::star;
+using namespace formula;
+// -----------------------------------------------------------------------------
+void adjustSectionName(const uno::Reference< report::XGroup >& _xGroup,sal_Int32 _nPos)
+{
+ OSL_ENSURE(_xGroup.is(),"Group is NULL -> GPF");
+ if ( _xGroup->getHeaderOn() && !_xGroup->getHeader()->getName().getLength() )
+ {
+ ::rtl::OUString sName = String(ModuleRes(RID_STR_GROUPHEADER));
+ sName += ::rtl::OUString::valueOf(_nPos);
+ _xGroup->getHeader()->setName(sName);
+ } // if ( _xGroup->getHeaderOn() )
+
+ if ( _xGroup->getFooterOn() && !_xGroup->getFooter()->getName().getLength() )
+ {
+ ::rtl::OUString sName = String(ModuleRes(RID_STR_GROUPFOOTER));
+ sName += ::rtl::OUString::valueOf(_nPos);
+ _xGroup->getFooter()->setName(sName);
+ } // if ( _xGroup->getHeaderOn() )
+}
+// -----------------------------------------------------------------------------
+::rtl::Reference< comphelper::OPropertyChangeMultiplexer> addStyleListener(const uno::Reference< report::XReportDefinition >& _xReportDefinition,::comphelper::OPropertyChangeListener* _pListener)
+{
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> pRet = NULL;
+ if ( _xReportDefinition.is() )
+ {
+ uno::Reference<beans::XPropertySet> xPageStyle(getUsedStyle(_xReportDefinition),uno::UNO_QUERY);
+ if ( xPageStyle.is() )
+ {
+ pRet = new comphelper::OPropertyChangeMultiplexer(_pListener,xPageStyle);
+ pRet->addProperty(PROPERTY_LEFTMARGIN);
+ pRet->addProperty(PROPERTY_RIGHTMARGIN);
+ pRet->addProperty(PROPERTY_PAPERSIZE);
+ pRet->addProperty(PROPERTY_BACKCOLOR);
+ }
+ }
+ return pRet;
+}
+
+// -----------------------------------------------------------------------------
+namespace
+{
+ // -------------------------------------------------------------------------
+ Font lcl_getReportControlFont( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat, awt::FontDescriptor& _out_rControlFont ,sal_uInt16 _nWichFont)
+ {
+ if ( !_rxReportControlFormat.is() )
+ throw uno::RuntimeException();
+
+ switch(_nWichFont)
+ {
+ case WESTERN:
+ _out_rControlFont = _rxReportControlFormat->getFontDescriptor();
+ break;
+ case ASIAN:
+ _out_rControlFont = _rxReportControlFormat->getFontDescriptorAsian();
+ break;
+ case COMPLEX:
+ _out_rControlFont = _rxReportControlFormat->getFontDescriptorComplex();
+ break;
+
+ }
+
+ Font aDefaultFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont();
+ return VCLUnoHelper::CreateFont( _out_rControlFont, aDefaultFont );
+ }
+
+ // -------------------------------------------------------------------------
+ Font lcl_getReportControlFont( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,sal_uInt16 _nWhich )
+ {
+ awt::FontDescriptor aAwtFont;
+ return lcl_getReportControlFont( _rxReportControlFormat, aAwtFont, _nWhich );
+ }
+ // -------------------------------------------------------------------------
+ const Font lcl_setFont(const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
+ SfxItemSet& _rItemSet,sal_uInt16 _nWhich,sal_uInt16 _nFont, sal_uInt16 _nFontHeight,sal_uInt16 _nLanguage,sal_uInt16 _nPosture, sal_uInt16 _nWeight)
+ {
+ // fill it
+ awt::FontDescriptor aControlFont;
+ const Font aFont( lcl_getReportControlFont( _rxReportControlFormat, aControlFont,_nWhich ) );
+
+ SvxFontItem aFontItem(_nFont);
+ aFontItem.PutValue( uno::makeAny( aControlFont ) );
+ _rItemSet.Put(aFontItem);
+
+ _rItemSet.Put(SvxFontHeightItem(OutputDevice::LogicToLogic(Size(0, (sal_Int32)aFont.GetHeight()), MAP_POINT, MAP_TWIP).Height(),100,_nFontHeight));
+ lang::Locale aLocale;
+ switch(_nWhich)
+ {
+ default:
+ aLocale = _rxReportControlFormat->getCharLocale();
+ break;
+ case ASIAN:
+ aLocale = _rxReportControlFormat->getCharLocaleAsian();
+ break;
+ case COMPLEX:
+ aLocale = _rxReportControlFormat->getCharLocaleComplex();
+ break;
+ } // switch(_nWhich)
+
+ _rItemSet.Put(SvxLanguageItem(MsLangId::convertLocaleToLanguageWithFallback(aLocale),_nLanguage));
+
+ _rItemSet.Put(SvxPostureItem(aFont.GetItalic(),_nPosture));
+ _rItemSet.Put(SvxWeightItem(aFont.GetWeight(),_nWeight));
+ return aFont;
+ }
+
+ void lcl_fillShapeToItems( const uno::Reference<report::XShape >& _xShape,SfxItemSet& _rItemSet )
+ {
+ uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo();
+ SvxUnoPropertyMapProvider aMap;
+ const SfxItemPropertyMap* pPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap();
+ PropertyEntryVector_t aPropVector = pPropertyMap->getPropertyEntries();
+ PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
+ while( aIt != aPropVector.end() )
+ {
+ if ( xInfo->hasPropertyByName(aIt->sName) )
+ {
+ const SfxPoolItem* pItem = _rItemSet.GetItem(aIt->nWID);
+ if ( pItem )
+ {
+ ::std::auto_ptr<SfxPoolItem> pClone(pItem->Clone());
+ pClone->PutValue(_xShape->getPropertyValue(aIt->sName), aIt->nMemberId);
+ _rItemSet.Put(*pClone, aIt->nWID);
+ }
+ } // if ( xInfo->hasPropertyByName(sPropertyName) )
+ ++aIt;
+ }
+ }
+
+ void lcl_fillItemsToShape( const uno::Reference<report::XShape >& _xShape,const SfxItemSet& _rItemSet )
+ {
+ const uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo();
+ SvxUnoPropertyMapProvider aMap;
+ const SfxItemPropertyMap* pPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap();
+ PropertyEntryVector_t aPropVector = pPropertyMap->getPropertyEntries();
+ PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
+ while( aIt != aPropVector.end() )
+ {
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState(aIt->nWID) && xInfo->hasPropertyByName(aIt->sName) )
+ {
+ const beans::Property aProp = xInfo->getPropertyByName( aIt->sName );
+ if ( ( aIt->nFlags & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY )
+ {
+ const SfxPoolItem* pItem = _rItemSet.GetItem(aIt->nWID);
+ if ( pItem )
+ {
+ uno::Any aValue;
+ pItem->QueryValue(aValue,aIt->nMemberId);
+ try
+ {
+ _xShape->setPropertyValue(aIt->sName, aValue);
+ }
+ catch(uno::Exception&)
+ { // shapes have a bug so we ignore this one.
+ }
+ } // if ( pItem )
+ }
+ }
+ ++aIt;
+ } // while ( pPropertyMap->pName )
+ }
+ // -------------------------------------------------------------------------
+ void lcl_CharPropertiesToItems( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
+ SfxItemSet& _rItemSet )
+ {
+ if ( !_rxReportControlFormat.is() )
+ throw lang::NullPointerException();
+
+ uno::Reference< beans::XPropertySet > xSet(_rxReportControlFormat,uno::UNO_QUERY_THROW);
+
+ // fill it
+ const Font aFont( lcl_setFont(_rxReportControlFormat, _rItemSet,WESTERN,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_LANGUAGE,ITEMID_POSTURE,ITEMID_WEIGHT ) );
+
+ _rItemSet.Put(SvxShadowedItem(_rxReportControlFormat->getCharShadowed(),ITEMID_SHADOWED));
+ _rItemSet.Put(SvxWordLineModeItem(aFont.IsWordLineMode(),ITEMID_WORDLINEMODE));
+ _rItemSet.Put(SvxContourItem(_rxReportControlFormat->getCharContoured(),ITEMID_CONTOUR));
+ _rItemSet.Put(SvxAutoKernItem(_rxReportControlFormat->getCharAutoKerning(),ITEMID_AUTOKERN));
+ _rItemSet.Put(SvxCrossedOutItem(aFont.GetStrikeout(),ITEMID_CROSSEDOUT));
+ _rItemSet.Put(SvxCaseMapItem(static_cast<SvxCaseMap>(_rxReportControlFormat->getCharCaseMap()),ITEMID_CASEMAP));
+
+ _rItemSet.Put(SvxEscapementItem(_rxReportControlFormat->getCharEscapement(),_rxReportControlFormat->getCharEscapementHeight(),ITEMID_ESCAPEMENT));
+ _rItemSet.Put(SvxBlinkItem(_rxReportControlFormat->getCharFlash(),ITEMID_BLINK));
+ _rItemSet.Put(SvxCharHiddenItem(_rxReportControlFormat->getCharHidden(),ITEMID_CHARHIDDEN));
+ _rItemSet.Put(SvxTwoLinesItem(_rxReportControlFormat->getCharCombineIsOn(),_rxReportControlFormat->getCharCombinePrefix().toChar(),_rxReportControlFormat->getCharCombineSuffix().toChar(),ITEMID_TWOLINES));
+ SvxUnderlineItem aUnderLineItem(aFont.GetUnderline(),ITEMID_UNDERLINE);
+ aUnderLineItem.SetColor(_rxReportControlFormat->getCharUnderlineColor());
+ _rItemSet.Put(aUnderLineItem);
+ _rItemSet.Put(SvxKerningItem(_rxReportControlFormat->getCharKerning(),ITEMID_KERNING));
+ _rItemSet.Put(SvxEmphasisMarkItem(static_cast<FontEmphasisMark>(_rxReportControlFormat->getCharEmphasis()),ITEMID_EMPHASISMARK));
+ //_rItemSet.Put(SvxTwoLinesItem());
+ _rItemSet.Put(SvxCharReliefItem(static_cast<FontRelief>(_rxReportControlFormat->getCharRelief()),ITEMID_CHARRELIEF));
+ _rItemSet.Put(SvxColorItem(::Color(_rxReportControlFormat->getCharColor()),ITEMID_COLOR));
+ _rItemSet.Put(SvxCharRotateItem(_rxReportControlFormat->getCharRotation(),sal_False,ITEMID_CHARROTATE));
+ _rItemSet.Put(SvxCharScaleWidthItem(_rxReportControlFormat->getCharScaleWidth(),ITEMID_CHARSCALE_W));
+
+ SvxHorJustifyItem aHorJustifyItem(ITEMID_HORJUSTIFY);
+ aHorJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_PARAADJUST),MID_HORJUST_ADJUST);
+ _rItemSet.Put(aHorJustifyItem);
+ //_rItemSet.Put(SfxInt32Item(ITEMID_DEGREES,_rxReportControlFormat->getCharRotation()));
+ SvxVerJustifyItem aVerJustifyItem(ITEMID_VERJUSTIFY);
+ aVerJustifyItem.PutValue(xSet->getPropertyValue(PROPERTY_VERTICALALIGN),MID_HORJUST_ADJUST);
+ _rItemSet.Put(aVerJustifyItem);
+ //_rItemSet.Put(SfxInt32Item(ITEMID_IDENT,_rxReportControlFormat->getCharRotation()));
+
+ uno::Reference< report::XShape> xShape(_rxReportControlFormat,uno::UNO_QUERY);
+ if ( !xShape.is() )
+ _rItemSet.Put(SvxBrushItem(::Color(_rxReportControlFormat->getControlBackground()),ITEMID_BRUSH));
+
+ lcl_setFont(_rxReportControlFormat, _rItemSet,ASIAN,ITEMID_FONT_ASIAN,ITEMID_FONTHEIGHT_ASIAN,ITEMID_LANGUAGE_ASIAN,ITEMID_POSTURE_ASIAN,ITEMID_WEIGHT_ASIAN );
+ lcl_setFont(_rxReportControlFormat, _rItemSet,COMPLEX,ITEMID_FONT_COMPLEX,ITEMID_FONTHEIGHT_COMPLEX,ITEMID_LANGUAGE_COMPLEX,ITEMID_POSTURE_COMPLEX,ITEMID_WEIGHT_COMPLEX );
+ }
+
+ // -------------------------------------------------------------------------
+ void lcl_pushBack( uno::Sequence< beans::NamedValue >& _out_rProperties, const ::rtl::OUString& _sName, const uno::Any& _rValue )
+ {
+ sal_Int32 nLen( _out_rProperties.getLength() );
+ _out_rProperties.realloc( nLen + 1 );
+ _out_rProperties[ nLen ] = beans::NamedValue( _sName, _rValue );
+ }
+
+ // -------------------------------------------------------------------------
+ void lcl_initAwtFont( const Font& _rOriginalFont, const SfxItemSet& _rItemSet, awt::FontDescriptor& _out_rAwtFont,
+ sal_uInt16 _nFont, sal_uInt16 _nFontHeight,sal_uInt16 _nPosture, sal_uInt16 _nWeight)
+ {
+ Font aNewFont( _rOriginalFont );
+ const SfxPoolItem* pItem( NULL );
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nFont,sal_True,&pItem) && pItem->ISA(SvxFontItem))
+ {
+ const SvxFontItem* pFontItem = static_cast<const SvxFontItem*>(pItem);
+ aNewFont.SetName( pFontItem->GetFamilyName());
+ aNewFont.SetStyleName(pFontItem->GetStyleName());
+ aNewFont.SetFamily(pFontItem->GetFamily());
+ aNewFont.SetPitch(pFontItem->GetPitch());
+ aNewFont.SetCharSet(pFontItem->GetCharSet());
+ } // if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_FONT,sal_True,&pItem) && pItem->ISA(SvxFontItem))
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nFontHeight,sal_True,&pItem) && pItem->ISA(SvxFontHeightItem))
+ {
+ const SvxFontHeightItem* pFontItem = static_cast<const SvxFontHeightItem*>(pItem);
+ aNewFont.SetHeight(OutputDevice::LogicToLogic(Size(0, pFontItem->GetHeight()), MAP_TWIP, MAP_POINT).Height());
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nPosture,sal_True,&pItem) && pItem->ISA(SvxPostureItem))
+ {
+ const SvxPostureItem* pFontItem = static_cast<const SvxPostureItem*>(pItem);
+ aNewFont.SetItalic(pFontItem->GetPosture());
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( _nWeight,sal_True,&pItem) && pItem->ISA(SvxWeightItem))
+ {
+ const SvxWeightItem* pFontItem = static_cast<const SvxWeightItem*>(pItem);
+ aNewFont.SetWeight(pFontItem->GetWeight());
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_WORDLINEMODE,sal_True,&pItem) && pItem->ISA(SvxWordLineModeItem))
+ {
+ const SvxWordLineModeItem* pFontItem = static_cast<const SvxWordLineModeItem*>(pItem);
+ aNewFont.SetWordLineMode(pFontItem->GetValue());
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CROSSEDOUT,sal_True,&pItem) && pItem->ISA(SvxCrossedOutItem))
+ {
+ const SvxCrossedOutItem* pFontItem = static_cast<const SvxCrossedOutItem*>(pItem);
+ aNewFont.SetStrikeout(pFontItem->GetStrikeout());
+ }
+
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARROTATE,sal_True,&pItem) && pItem->ISA(SvxCharRotateItem))
+ {
+ const SvxCharRotateItem* pRotateItem = static_cast<const SvxCharRotateItem*>(pItem);
+ aNewFont.SetOrientation(pRotateItem->GetValue());
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARSCALE_W,sal_True,&pItem) && pItem->ISA(SvxCharScaleWidthItem))
+ {
+ const SvxCharScaleWidthItem* pCharItem = static_cast<const SvxCharScaleWidthItem*>(pItem);
+ aNewFont.SetWidthType(VCLUnoHelper::ConvertFontWidth(pCharItem->GetValue()));
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_UNDERLINE,sal_True,&pItem) && pItem->ISA(SvxUnderlineItem))
+ {
+ const SvxUnderlineItem* pFontItem = static_cast<const SvxUnderlineItem*>(pItem);
+ aNewFont.SetUnderline(pFontItem->GetLineStyle());
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_COLOR,sal_True,&pItem) && pItem->ISA(SvxColorItem))
+ {
+ const SvxColorItem* pFontItem = static_cast<const SvxColorItem*>(pItem);
+ aNewFont.SetColor(pFontItem->GetValue().GetColor());
+ }
+
+ _out_rAwtFont = VCLUnoHelper::CreateFontDescriptor( aNewFont );
+ }
+
+ // -------------------------------------------------------------------------
+ void lcl_itemsToCharProperties( const Font& _rOriginalControlFont,const Font& _rOriginalControlFontAsian,const Font& _rOriginalControlFontComplex, const SfxItemSet& _rItemSet, uno::Sequence< beans::NamedValue >& _out_rProperties )
+ {
+ const SfxPoolItem* pItem( NULL );
+
+ // create an AWT font
+ awt::FontDescriptor aAwtFont;
+ lcl_initAwtFont( _rOriginalControlFont, _rItemSet, aAwtFont,ITEMID_FONT,ITEMID_FONTHEIGHT,ITEMID_POSTURE, ITEMID_WEIGHT);
+ lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Font")), uno::makeAny( aAwtFont ) );
+ lcl_initAwtFont( _rOriginalControlFontAsian, _rItemSet, aAwtFont,ITEMID_FONT_ASIAN,ITEMID_FONTHEIGHT_ASIAN,ITEMID_POSTURE_ASIAN, ITEMID_WEIGHT_ASIAN);
+ lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FontAsian")), uno::makeAny( aAwtFont ) );
+ lcl_initAwtFont( _rOriginalControlFontComplex, _rItemSet, aAwtFont,ITEMID_FONT_COMPLEX,ITEMID_FONTHEIGHT_COMPLEX,ITEMID_POSTURE_COMPLEX, ITEMID_WEIGHT_COMPLEX);
+ lcl_pushBack( _out_rProperties, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FontComplex")), uno::makeAny( aAwtFont ) );
+
+ // properties which cannot be represented in an AWT font need to be preserved directly
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_SHADOWED,sal_True,&pItem) && pItem->ISA(SvxShadowedItem))
+ {
+ const SvxShadowedItem* pFontItem = static_cast<const SvxShadowedItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARSHADOWED, uno::makeAny( pFontItem->GetValue() ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CONTOUR,sal_True,&pItem) && pItem->ISA(SvxContourItem))
+ {
+ const SvxContourItem* pFontItem = static_cast<const SvxContourItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARCONTOURED, uno::makeAny( pFontItem->GetValue() ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_UNDERLINE,sal_True,&pItem) && pItem->ISA(SvxUnderlineItem))
+ {
+ const SvxUnderlineItem* pFontItem = static_cast<const SvxUnderlineItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARUNDERLINECOLOR, uno::makeAny( pFontItem->GetColor().GetColor() ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_HORJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxHorJustifyItem))
+ {
+ const SvxHorJustifyItem* pJustifyItem = static_cast<const SvxHorJustifyItem*>(pItem);
+ uno::Any aValue;
+ pJustifyItem->QueryValue(aValue,MID_HORJUST_ADJUST);
+ lcl_pushBack( _out_rProperties, PROPERTY_PARAADJUST, aValue );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_VERJUSTIFY,sal_True,&pItem) && pItem->ISA(SvxVerJustifyItem))
+ {
+ const SvxVerJustifyItem* pJustifyItem = static_cast<const SvxVerJustifyItem*>(pItem);
+ uno::Any aValue;
+ pJustifyItem->QueryValue(aValue,MID_HORJUST_ADJUST);
+ lcl_pushBack( _out_rProperties, PROPERTY_VERTICALALIGN, aValue );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARRELIEF,sal_True,&pItem) && pItem->ISA(SvxCharReliefItem))
+ {
+ const SvxCharReliefItem* pFontItem = static_cast<const SvxCharReliefItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARRELIEF, uno::makeAny( static_cast< sal_Int16 >( pFontItem->GetEnumValue() ) ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CHARHIDDEN,sal_True,&pItem) && pItem->ISA(SvxCharHiddenItem))
+ {
+ const SvxCharHiddenItem* pFontItem = static_cast<const SvxCharHiddenItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARHIDDEN, uno::makeAny( pFontItem->GetValue() ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_AUTOKERN,sal_True,&pItem) && pItem->ISA(SvxAutoKernItem))
+ {
+ const SvxAutoKernItem* pFontItem = static_cast<const SvxAutoKernItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARAUTOKERNING, uno::makeAny( pFontItem->GetValue() ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_BRUSH,sal_True,&pItem) && pItem->ISA(SvxBrushItem))
+ {
+ const SvxBrushItem* pFontItem = static_cast<const SvxBrushItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CONTROLBACKGROUND, uno::makeAny( pFontItem->GetColor().GetColor() ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_BLINK,sal_True,&pItem) && pItem->ISA(SvxBlinkItem))
+ {
+ const SvxBlinkItem* pFontItem = static_cast<const SvxBlinkItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARFLASH, uno::makeAny( pFontItem->GetValue() ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_EMPHASISMARK,sal_True,&pItem) && pItem->ISA(SvxEmphasisMarkItem))
+ {
+ const SvxEmphasisMarkItem* pFontItem = static_cast<const SvxEmphasisMarkItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHAREMPHASIS, uno::makeAny( static_cast< sal_Int16 >( pFontItem->GetEmphasisMark() ) ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_TWOLINES,sal_True,&pItem) && pItem->ISA(SvxTwoLinesItem))
+ {
+ const SvxTwoLinesItem* pFontItem = static_cast<const SvxTwoLinesItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINEISON, uno::makeAny( pFontItem->GetValue() ) );
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINEPREFIX, uno::makeAny( ::rtl::OUString( pFontItem->GetStartBracket() ) ) );
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARCOMBINESUFFIX, uno::makeAny( ::rtl::OUString( pFontItem->GetEndBracket() ) ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_COLOR,sal_True,&pItem) && pItem->ISA(SvxColorItem))
+ {
+ const SvxColorItem* pFontItem = static_cast<const SvxColorItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARCOLOR, uno::makeAny( pFontItem->GetValue().GetColor() ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_KERNING,sal_True,&pItem) && pItem->ISA(SvxKerningItem))
+ {
+ const SvxKerningItem* pFontItem = static_cast<const SvxKerningItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARKERNING, uno::makeAny( pFontItem->GetValue() ) );
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CASEMAP,sal_True,&pItem) && pItem->ISA(SvxCaseMapItem))
+ {
+ const SvxCaseMapItem* pFontItem = static_cast<const SvxCaseMapItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARCASEMAP, uno::makeAny( pFontItem->GetValue() ) );
+ } // if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_CASEMAP,sal_True,&pItem) && pItem->ISA(SvxCaseMapItem))
+ struct Items {
+ sal_uInt16 nWhich;
+ ::rtl::OUString sPropertyName;
+ };
+ const Items pItems[] = { {ITEMID_LANGUAGE,PROPERTY_CHARLOCALE}
+ ,{ITEMID_LANGUAGE_ASIAN,PROPERTY_CHARLOCALEASIAN}
+ ,{ITEMID_LANGUAGE_COMPLEX,PROPERTY_CHARLOCALECOMPLEX}
+ };
+ for(size_t k = 0; k < sizeof(pItems)/sizeof(pItems[0]);++k)
+ {
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( pItems[k].nWhich,sal_True,&pItem) && pItem->ISA(SvxLanguageItem))
+ {
+ const SvxLanguageItem* pFontItem = static_cast<const SvxLanguageItem*>(pItem);
+ lang::Locale aCharLocale;
+ MsLangId::convertLanguageToLocale( pFontItem->GetLanguage(), aCharLocale );
+ lcl_pushBack( _out_rProperties, pItems[k].sPropertyName, uno::makeAny( aCharLocale ) );
+ } // if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_LANGUAGE,sal_True,&pItem) && pItem->ISA(SvxLanguageItem))
+ }
+ if ( SFX_ITEM_SET == _rItemSet.GetItemState( ITEMID_ESCAPEMENT,sal_True,&pItem) && pItem->ISA(SvxEscapementItem))
+ {
+ const SvxEscapementItem* pFontItem = static_cast<const SvxEscapementItem*>(pItem);
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARESCAPEMENT, uno::makeAny( pFontItem->GetEsc() ) );
+ lcl_pushBack( _out_rProperties, PROPERTY_CHARESCAPEMENTHEIGHT, uno::makeAny( (sal_Int8)pFontItem->GetProp() ) );
+ }
+ }
+
+ // -------------------------------------------------------------------------
+ template< class ATTRIBUTE_TYPE >
+ void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName,
+ const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
+ void (SAL_CALL report::XReportControlFormat::*pSetter)( ATTRIBUTE_TYPE ) )
+ {
+ ATTRIBUTE_TYPE aAttributeValue = ATTRIBUTE_TYPE();
+ if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) )
+ (_rxReportControlFormat.get()->*pSetter)( aAttributeValue );
+ }
+
+ // -------------------------------------------------------------------------
+ void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName,
+ const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
+ void (SAL_CALL report::XReportControlFormat::*pSetter)( const ::rtl::OUString& ) )
+ {
+ ::rtl::OUString aAttributeValue;
+ if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) )
+ (_rxReportControlFormat.get()->*pSetter)( aAttributeValue );
+ }
+
+ // -------------------------------------------------------------------------
+ void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const sal_Char* _pAttributeName,
+ const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
+ void (SAL_CALL report::XReportControlFormat::*pSetter)( const lang::Locale& ) )
+ {
+ lang::Locale aAttributeValue;
+ if ( _rAttrValues.get_ensureType( _pAttributeName, aAttributeValue ) )
+ (_rxReportControlFormat.get()->*pSetter)( aAttributeValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
+ const uno::Reference< awt::XWindow>& _rxParentWindow, uno::Sequence< beans::NamedValue >& _out_rNewValues )
+{
+ OSL_PRECOND( _rxReportControlFormat.is() && _rxParentWindow.is(), "openCharDialog: invalid parameters!" );
+ if ( !_rxReportControlFormat.is() || !_rxParentWindow.is() )
+ return false;
+
+ _out_rNewValues = uno::Sequence< beans::NamedValue >();
+
+ // ------------
+ // UNO->ItemSet
+ static SfxItemInfo aItemInfos[] =
+ {
+ { SID_ATTR_CHAR_FONT, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_LANGUAGE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_POSTURE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_WEIGHT, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_SHADOWED, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CONTOUR, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_UNDERLINE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_COLOR, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_KERNING, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CASEMAP, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_FONTLIST, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_AUTOKERN, SFX_ITEM_POOLABLE },
+ { SID_COLOR_TABLE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_FLASH, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_TWO_LINES, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_ROTATED, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_HIDDEN, SFX_ITEM_POOLABLE },
+ //{ SID_ATTR_BRUSH_CHAR, SFX_ITEM_POOLABLE },
+ { SID_ATTR_BRUSH, SFX_ITEM_POOLABLE },
+ { SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEM_POOLABLE },
+ { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEM_POOLABLE },
+
+ // Asian
+ { SID_ATTR_CHAR_CJK_FONT, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEM_POOLABLE },
+ // Complex
+ { SID_ATTR_CHAR_CTL_FONT, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEM_POOLABLE }
+ };
+ Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
+ ::std::auto_ptr<FontList> pFontList(new FontList( pParent ));
+ ::std::auto_ptr<XColorTable> pColorTable( new XColorTable( SvtPathOptions().GetPalettePath() ));
+ SfxPoolItem* pDefaults[] =
+ {
+ new SvxFontItem(ITEMID_FONT),
+ new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT),
+ new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE),
+ new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE),
+ new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT),
+
+ new SvxShadowedItem(sal_False,ITEMID_SHADOWED),
+ new SvxWordLineModeItem(sal_False,ITEMID_WORDLINEMODE),
+ new SvxContourItem(sal_False,ITEMID_CONTOUR),
+ new SvxCrossedOutItem(STRIKEOUT_NONE,ITEMID_CROSSEDOUT),
+ new SvxUnderlineItem(UNDERLINE_NONE,ITEMID_UNDERLINE),
+
+ new SvxColorItem(ITEMID_COLOR),
+ new SvxKerningItem(0,ITEMID_KERNING),
+ new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED,ITEMID_CASEMAP),
+ new SvxEscapementItem(ITEMID_ESCAPEMENT),
+ new SvxFontListItem(pFontList.get(),ITEMID_FONTLIST),
+ new SvxAutoKernItem(sal_False,ITEMID_AUTOKERN),
+ new SvxColorTableItem(pColorTable.get(),ITEMID_COLOR_TABLE),
+ new SvxBlinkItem(sal_False,ITEMID_BLINK),
+ new SvxEmphasisMarkItem(EMPHASISMARK_NONE,ITEMID_EMPHASISMARK),
+ new SvxTwoLinesItem(sal_True,0,0,ITEMID_TWOLINES),
+ new SvxCharRotateItem(0,sal_False,ITEMID_CHARROTATE),
+ new SvxCharScaleWidthItem(100,ITEMID_CHARSCALE_W),
+ new SvxCharReliefItem(RELIEF_NONE,ITEMID_CHARRELIEF),
+ new SvxCharHiddenItem(sal_False,ITEMID_CHARHIDDEN),
+ new SvxBrushItem(ITEMID_BRUSH),
+ new SvxHorJustifyItem(ITEMID_HORJUSTIFY),
+ new SvxVerJustifyItem(ITEMID_VERJUSTIFY),
+// Asian
+ new SvxFontItem(ITEMID_FONT_ASIAN),
+ new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_ASIAN),
+ new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_ASIAN),
+ new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_ASIAN),
+ new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_ASIAN),
+// Complex
+ new SvxFontItem(ITEMID_FONT_COMPLEX),
+ new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_COMPLEX),
+ new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_COMPLEX),
+ new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_COMPLEX),
+ new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_COMPLEX)
+
+ };
+
+ OSL_ASSERT((sizeof(pDefaults)/sizeof(pDefaults[0])) == (sizeof(aItemInfos)/sizeof(aItemInfos[0])));
+
+ static sal_uInt16 pRanges[] =
+ {
+ ITEMID_FONT,ITEMID_WEIGHT_COMPLEX,
+ 0
+ };
+
+ SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ReportCharProperties"), ITEMID_FONT,ITEMID_WEIGHT_COMPLEX, aItemInfos, pDefaults) );
+ // not needed for font height pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why
+ pPool->FreezeIdRanges(); // the same
+ bool bSuccess = false;
+ try
+ {
+ ::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( *pPool, pRanges ) );
+ lcl_CharPropertiesToItems( _rxReportControlFormat, *pDescriptor );
+
+ { // want the dialog to be destroyed before our set
+ ORptPageDialog aDlg(pParent, pDescriptor.get(),RID_PAGEDIALOG_CHAR);
+ uno::Reference< report::XShape > xShape( _rxReportControlFormat, uno::UNO_QUERY );
+ if ( xShape.is() )
+ aDlg.RemoveTabPage( RID_PAGE_BACKGROUND );
+ bSuccess = ( RET_OK == aDlg.Execute() );
+ if ( bSuccess )
+ {
+ lcl_itemsToCharProperties( lcl_getReportControlFont( _rxReportControlFormat,WESTERN ),
+ lcl_getReportControlFont( _rxReportControlFormat,ASIAN ),
+ lcl_getReportControlFont( _rxReportControlFormat,COMPLEX ), *aDlg.GetOutputItemSet(), _out_rNewValues );
+ }
+ }
+ }
+ catch(uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ SfxItemPool::Free(pPool);
+ for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i)
+ delete pDefaults[i];
+
+ return bSuccess;
+}
+// -----------------------------------------------------------------------------
+bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::Reference< awt::XWindow>& _rxParentWindow )
+{
+ OSL_PRECOND( _xShape.is() && _rxParentWindow.is(), "openAreaDialog: invalid parameters!" );
+ if ( !_xShape.is() || !_rxParentWindow.is() )
+ return false;
+
+ ::boost::shared_ptr<rptui::OReportModel> pModel = ::reportdesign::OReportDefinition::getSdrModel(_xShape->getSection()->getReportDefinition());
+
+ Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
+
+ //static sal_uInt16 pRanges[] =
+ //{
+ // XATTR_START,XATTR_END,
+ // 0
+ //};
+
+ bool bSuccess = false;
+ try
+ {
+ SfxItemPool& rItemPool = pModel->GetItemPool();
+ ::std::auto_ptr<SfxItemSet> pDescriptor( new SfxItemSet( rItemPool, rItemPool.GetFirstWhich(),rItemPool.GetLastWhich() ) );
+
+ lcl_fillShapeToItems(_xShape,*pDescriptor);
+
+ { // want the dialog to be destroyed before our set
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog( pParent,pDescriptor.get(),pModel.get() ));
+ // #i74099# by default, the dialog deletes the current color table if a different one is loaded
+ // (see SwDrawShell::ExecDrawDlg)
+ const SvxColorTableItem* pColorItem = static_cast<const SvxColorTableItem*>( pDescriptor->GetItem(SID_COLOR_TABLE) );
+ if (pColorItem && pColorItem->GetColorTable() == XColorTable::GetStdColorTable())
+ pDialog->DontDeleteColorTable();
+ bSuccess = ( RET_OK == pDialog->Execute() );
+ if ( bSuccess )
+ {
+ lcl_fillItemsToShape(_xShape,*pDialog->GetOutputItemSet());
+ }
+ }
+
+ }
+ catch(uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return bSuccess;
+}
+
+// -----------------------------------------------------------------------------
+void applyCharacterSettings( const uno::Reference< report::XReportControlFormat >& _rxReportControlFormat, const uno::Sequence< beans::NamedValue >& _rSettings )
+{
+ ::comphelper::NamedValueCollection aSettings( _rSettings );
+
+ try
+ {
+ awt::FontDescriptor aAwtFont;
+ if ( aSettings.get( "Font" ) >>= aAwtFont )
+ {
+ ::rtl::OUString sTemp = aAwtFont.Name;
+ aAwtFont.Name = ::rtl::OUString(); // hack to
+ _rxReportControlFormat->setFontDescriptor( aAwtFont );
+ _rxReportControlFormat->setCharFontName( sTemp );
+ } // if ( aSettings.get( "Font" ) >>= aAwtFont )
+ if ( aSettings.get( "FontAsian" ) >>= aAwtFont )
+ {
+ ::rtl::OUString sTemp = aAwtFont.Name;
+ aAwtFont.Name = ::rtl::OUString(); // hack to
+ _rxReportControlFormat->setFontDescriptorAsian( aAwtFont );
+ _rxReportControlFormat->setCharFontNameAsian( sTemp );
+ } // if ( aSettings.get( "Font" ) >>= aAwtFont )
+ if ( aSettings.get( "FontComplex" ) >>= aAwtFont )
+ {
+ ::rtl::OUString sTemp = aAwtFont.Name;
+ aAwtFont.Name = ::rtl::OUString(); // hack to
+ _rxReportControlFormat->setFontDescriptorComplex( aAwtFont );
+ _rxReportControlFormat->setCharFontNameComplex( sTemp );
+ }
+
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARSHADOWED, _rxReportControlFormat, &report::XReportControlFormat::setCharShadowed );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARCONTOURED, _rxReportControlFormat, &report::XReportControlFormat::setCharContoured );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARUNDERLINECOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharUnderlineColor );
+ lcl_applyFontAttribute( aSettings, PROPERTY_PARAADJUST, _rxReportControlFormat, &report::XReportControlFormat::setParaAdjust );
+ lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN, _rxReportControlFormat, &report::XReportControlFormat::setVerticalAlign );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARRELIEF, _rxReportControlFormat, &report::XReportControlFormat::setCharRelief );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARHIDDEN, _rxReportControlFormat, &report::XReportControlFormat::setCharHidden );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARAUTOKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharAutoKerning );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CONTROLBACKGROUND, _rxReportControlFormat, &report::XReportControlFormat::setControlBackground );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARFLASH, _rxReportControlFormat, &report::XReportControlFormat::setCharFlash );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHAREMPHASIS, _rxReportControlFormat, &report::XReportControlFormat::setCharEmphasis );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEISON, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineIsOn );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEPREFIX, _rxReportControlFormat, &report::XReportControlFormat::setCharCombinePrefix );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINESUFFIX, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineSuffix );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharColor );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharKerning );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARCASEMAP, _rxReportControlFormat, &report::XReportControlFormat::setCharCaseMap );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALE, _rxReportControlFormat, &report::XReportControlFormat::setCharLocale );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENT, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapement );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENTHEIGHT, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapementHeight );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALEASIAN, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleAsian );
+ lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALECOMPLEX, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleComplex );
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// -----------------------------------------------------------------------------
+void notifySystemWindow(Window* _pWindow,Window* _pToRegister, ::comphelper::mem_fun1_t<TaskPaneList,Window*> _rMemFunc)
+{
+ OSL_ENSURE(_pWindow,"Window can not be null!");
+ SystemWindow* pSystemWindow = _pWindow ? _pWindow->GetSystemWindow() : NULL;
+ if ( pSystemWindow )
+ {
+ _rMemFunc( pSystemWindow->GetTaskPaneList(), _pToRegister );
+ }
+}
+// -----------------------------------------------------------------------------
+SdrObject* isOver(const Rectangle& _rRect, SdrPage& _rPage, SdrView& _rView, bool _bAllObjects, SdrObject* _pIgnore, sal_Int16 _nIgnoreType)
+{
+ SdrObject* pOverlappedObj = NULL;
+ SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS);
+ SdrObject* pObjIter = NULL;
+
+ while( !pOverlappedObj && (pObjIter = aIter.Next()) != NULL )
+ {
+ if ( _pIgnore != pObjIter
+ && (_bAllObjects || !_rView.IsObjMarked(pObjIter))
+ && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ {
+ if (_nIgnoreType == ISOVER_IGNORE_CUSTOMSHAPES && pObjIter->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
+ {
+ continue;
+ }
+
+ OUnoObject* pObj = dynamic_cast<OUnoObject*>(pObjIter);
+ if (pObj != NULL)
+ {
+
+ Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
+ if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
+ pOverlappedObj = pObjIter;
+ }
+ }
+ }
+ return pOverlappedObj;
+}
+// -----------------------------------------------------------------------------
+bool checkArrayForOccurance(SdrObject* _pObjToCheck, SdrUnoObj* _pIgnore[], int _nListLength)
+{
+ for(int i=0;i<_nListLength;i++)
+ {
+ SdrObject *pIgnore = _pIgnore[i];
+ if (pIgnore == _pObjToCheck)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj * _pIgnoreList[], int _nIgnoreListLength)
+{
+ SdrObject* pOverlappedObj = NULL;
+ SdrObjListIter aIter(_rPage,IM_DEEPNOGROUPS);
+ SdrObject* pObjIter = NULL;
+
+ while( !pOverlappedObj && (pObjIter = aIter.Next()) != NULL )
+ {
+ if (checkArrayForOccurance(pObjIter, _pIgnoreList, _nIgnoreListLength))
+ {
+ continue;
+ }
+
+ if ( (_bAllObjects || !_rView.IsObjMarked(pObjIter))
+ && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ {
+ Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
+ if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
+ pOverlappedObj = pObjIter;
+ }
+ }
+ return pOverlappedObj;
+}
+
+//----------------------------------------------------------------------------
+SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bUnMarkedObjects)
+{
+ SdrObject* pOverlappedObj = NULL;
+ OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(_pObj);
+ if ( pUnoObj ) // this doesn't need to be done for shapes
+ {
+ Rectangle aRect = pUnoObj->GetCurrentBoundRect();
+ pOverlappedObj = isOver(aRect,_rPage,_rView,_bUnMarkedObjects,_pObj);
+ }
+ return pOverlappedObj;
+}
+
+// -----------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > getParameterNames( const uno::Reference< sdbc::XRowSet >& _rxRowSet )
+{
+ uno::Sequence< ::rtl::OUString > aNames;
+
+ try
+ {
+ uno::Reference< sdb::XParametersSupplier > xSuppParams( _rxRowSet, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xParams( xSuppParams->getParameters() );
+ if ( xParams.is() )
+ {
+ sal_Int32 count( xParams->getCount() );
+ aNames.realloc( count );
+
+ uno::Reference< beans::XPropertySet > xParam;
+ ::rtl::OUString sParamName;
+ for ( sal_Int32 i=0; i<count; ++i )
+ {
+ xParam.set( xParams->getByIndex(i), uno::UNO_QUERY_THROW );
+ OSL_VERIFY( xParam->getPropertyValue( PROPERTY_NAME ) >>= sParamName );
+ aNames[i] = sParamName;
+ }
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return aNames;
+}
+// -----------------------------------------------------------------------------
+Rectangle getRectangleFromControl(SdrObject* _pControl)
+{
+ if (_pControl)
+ {
+ uno::Reference< report::XReportComponent > xComponent( _pControl->getUnoShape(), uno::UNO_QUERY);
+ if (xComponent.is())
+ {
+ Rectangle aRect(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize()));
+ aRect.setHeight(aRect.getHeight() + 1);
+ aRect.setWidth(aRect.getWidth() + 1);
+ return aRect;
+ }
+ }
+ return Rectangle();
+}
+// -----------------------------------------------------------------------------
+// check overlapping
+void correctOverlapping(SdrObject* _pControl,OReportSection& _aReportSection,bool _bInsert)
+{
+ OSectionView& rSectionView = _aReportSection.getSectionView();
+ uno::Reference< report::XReportComponent> xComponent(_pControl->getUnoShape(),uno::UNO_QUERY);
+ // Rectangle aRet(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize()));
+ // aRet.setHeight(aRet.getHeight() + 1);
+ // aRet.setWidth(aRet.getWidth() + 1);
+ Rectangle aRect = getRectangleFromControl(_pControl);
+
+ bool bOverlapping = true;
+ while ( bOverlapping )
+ {
+ SdrObject* pOverlappedObj = isOver(aRect,*_aReportSection.getPage(),rSectionView,true, _pControl);
+ bOverlapping = pOverlappedObj != NULL;
+ if ( bOverlapping )
+ {
+ const Rectangle& aLogicRect = pOverlappedObj->GetLogicRect();
+ aRect.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aRect.Top());
+ xComponent->setPositionY(aRect.Top());
+ }
+ }
+ if ( !bOverlapping && _bInsert ) // now insert objects
+ rSectionView.InsertObjectAtView(_pControl,*rSectionView.GetSdrPageView(),SDRINSERT_ADDMARK);
+}
+// -----------------------------------------------------------------------------
+void setZoomFactor(const Fraction& _aZoom,Window& _rWindow)
+{
+ MapMode aMapMode( _rWindow.GetMapMode() );
+ aMapMode.SetScaleX(_aZoom);
+ aMapMode.SetScaleY(_aZoom);
+ _rWindow.SetMapMode(aMapMode);
+}
+// -----------------------------------------------------------------------------
+bool openDialogFormula_nothrow( ::rtl::OUString& _in_out_rFormula
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext
+ , const uno::Reference< awt::XWindow>& _xInspectorWindow
+ , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet
+ )
+{
+ OSL_PRECOND( _xInspectorWindow.is(), "openDialogFormula_nothrow: invalid parameters!" );
+ if ( !_xInspectorWindow.is() )
+ return false;
+ // _out_rFormula = ::rtl::OUString();
+ bool bSuccess = false;
+ ::dbtools::SQLExceptionInfo aErrorInfo;
+ uno::Reference< awt::XWindow > xInspectorWindow;
+ uno::Reference< lang::XMultiComponentFactory > xFactory;
+ uno::Reference<lang::XMultiServiceFactory> xServiceFactory;
+ try
+ {
+ xFactory = _xContext->getServiceManager();
+ xServiceFactory.set(xFactory,uno::UNO_QUERY);
+ Window* pParent = VCLUnoHelper::GetWindow( _xInspectorWindow );
+
+ uno::Reference< report::meta::XFunctionManager> xMgr(xFactory->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOFunctionManager")),_xContext),uno::UNO_QUERY);
+ if ( xMgr.is() )
+ {
+ ::boost::shared_ptr< formula::IFunctionManager > pFormulaManager(new FunctionManager(xMgr) );
+ ReportFormula aFormula( _in_out_rFormula );
+ FormulaDialog aDlg(pParent,xServiceFactory,pFormulaManager,aFormula.getUndecoratedContent(),_xRowSet);
+ bSuccess = aDlg.Execute() == RET_OK;
+ if ( bSuccess )
+ {
+ String sFormula = aDlg.getCurrentFormula();
+ xub_StrLen nIndex = 0;
+ if ( sFormula.GetChar(0) == '=' )
+ nIndex = 1;
+ _in_out_rFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:")) + sFormula.Copy(nIndex);
+ }
+ }
+ }
+ catch (sdb::SQLContext& e) { aErrorInfo = e; }
+ catch (sdbc::SQLWarning& e) { aErrorInfo = e; }
+ catch (sdbc::SQLException& e) { aErrorInfo = e; }
+ catch( const uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "GeometryHandler::impl_dialogFilter_nothrow: caught an exception!" );
+ }
+
+ if ( aErrorInfo.isValid() )
+ ::dbtools::showError( aErrorInfo, xInspectorWindow, xServiceFactory );
+
+ return bSuccess;
+}
+// -----------------------------------------------------------------------------
+} // namespace rptui
+// -----------------------------------------------------------------------------
diff --git a/reportdesign/source/ui/misc/makefile.mk b/reportdesign/source/ui/misc/makefile.mk
new file mode 100644
index 000000000000..494b68023d62
--- /dev/null
+++ b/reportdesign/source/ui/misc/makefile.mk
@@ -0,0 +1,62 @@
+#*************************************************************************
+#
+# 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=uimisc
+
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+# .INCLUDE : $(PRJ)$/util$/dll.pmk
+
+# --- Files -------------------------------------
+
+# ... resource files ............................
+
+# ... object files ............................
+
+EXCEPTIONSFILES= \
+ $(SLO)$/RptUndo.obj \
+ $(SLO)$/ColorListener.obj \
+ $(SLO)$/UITools.obj \
+ $(SLO)$/rptuiservices.obj \
+ $(SLO)$/toolboxcontroller.obj \
+ $(SLO)$/statusbarcontroller.obj \
+ $(SLO)$/FunctionHelper.obj
+
+
+SLOFILES= \
+ $(EXCEPTIONSFILES)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/reportdesign/source/ui/misc/rptuiservices.cxx b/reportdesign/source/ui/misc/rptuiservices.cxx
new file mode 100644
index 000000000000..312abfbddd5f
--- /dev/null
+++ b/reportdesign/source/ui/misc/rptuiservices.cxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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 <cppuhelper/factory.hxx>
+#include <osl/diagnose.h>
+#include <cppuhelper/implementationentry.hxx>
+#include "ReportController.hxx"
+#include "toolboxcontroller.hxx"
+#include "statusbarcontroller.hxx"
+#include "DefaultInspection.hxx"
+#include "ReportComponentHandler.hxx"
+#include "GeometryHandler.hxx"
+#include "DataProviderHandler.hxx"
+
+/********************************************************************************************/
+
+using namespace ::rptui;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+//***************************************************************************************
+//
+// registry functions
+namespace
+{
+
+cppu::ImplementationEntry entries[] = {
+ { &OReportController::create, &OReportController::getImplementationName_Static, &OReportController::getSupportedServiceNames_Static,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { &OToolboxController::create, &OToolboxController::getImplementationName_Static, &OToolboxController::getSupportedServiceNames_Static,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { &OStatusbarController::create, &OStatusbarController::getImplementationName_Static, &OStatusbarController::getSupportedServiceNames_Static,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { &DefaultComponentInspectorModel::create, &DefaultComponentInspectorModel::getImplementationName_Static, &DefaultComponentInspectorModel::getSupportedServiceNames_static,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { &ReportComponentHandler::create, &ReportComponentHandler::getImplementationName_Static, &ReportComponentHandler::getSupportedServiceNames_static,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { &GeometryHandler::create, &GeometryHandler::getImplementationName_Static, &GeometryHandler::getSupportedServiceNames_static,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { &DataProviderHandler::create, &DataProviderHandler::getImplementationName_Static, &DataProviderHandler::getSupportedServiceNames_static,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ char const * implName, void * serviceManager, void * registryKey)
+{
+ return cppu::component_getFactoryHelper(
+ implName, serviceManager, registryKey, entries);
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ char const ** envTypeName, uno_Environment **)
+{
+ *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
diff --git a/reportdesign/source/ui/misc/statusbarcontroller.cxx b/reportdesign/source/ui/misc/statusbarcontroller.cxx
new file mode 100644
index 000000000000..2e815d90f81f
--- /dev/null
+++ b/reportdesign/source/ui/misc/statusbarcontroller.cxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * 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 "statusbarcontroller.hxx"
+
+#include <svx/zoomsliderctrl.hxx>
+#include <svx/zoomctrl.hxx>
+#include <svx/svxids.hrc>
+#include <svx/zoomitem.hxx>
+#include <svx/zoomslideritem.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/status.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+namespace rptui
+{
+ using namespace svt;
+ using namespace com::sun::star::uno;
+ using namespace com::sun::star::beans;
+ using namespace com::sun::star::lang;
+ using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::util;
+
+::rtl::OUString SAL_CALL OStatusbarController::getImplementationName() throw( RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString OStatusbarController::getImplementationName_Static() throw( RuntimeException )
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.comp.StatusbarController"));
+}
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString> OStatusbarController::getSupportedServiceNames_Static(void) throw( RuntimeException )
+{
+ Sequence< ::rtl::OUString> aSupported(1);
+ aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StatusbarController"));
+ return aSupported;
+}
+// -----------------------------------------------------------------------------
+::sal_Bool SAL_CALL OStatusbarController::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+{
+ return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static());
+}
+//-------------------------------------------------------------------------
+Sequence< ::rtl::OUString> SAL_CALL OStatusbarController::getSupportedServiceNames() throw(RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+// -------------------------------------------------------------------------
+Reference< XInterface > OStatusbarController::create(Reference< XComponentContext > const & xContext)
+{
+ return *(new OStatusbarController(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY)));
+}
+IMPLEMENT_FORWARD_XINTERFACE2(OStatusbarController, ::svt::StatusbarController,OStatusbarController_BASE)
+
+OStatusbarController::OStatusbarController(const Reference< XMultiServiceFactory >& _rxORB)
+: m_nSlotId(0)
+,m_nId(1)
+{
+ m_xServiceManager = _rxORB;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OStatusbarController::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException)
+{
+ StatusbarController::initialize(_rArguments);
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ StatusBar* pStatusBar = static_cast<StatusBar*>(VCLUnoHelper::GetWindow(m_xParentWindow));
+ if ( pStatusBar )
+ {
+ const sal_uInt16 nCount = pStatusBar->GetItemCount();
+ for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos)
+ {
+ const sal_uInt16 nItemId = pStatusBar->GetItemId(nPos);
+ if ( pStatusBar->GetItemCommand(nItemId) == String(m_aCommandURL) )
+ {
+ m_nId = nItemId;
+ break;
+ }
+ }
+ if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") )
+ {
+ m_pController = TStatusbarHelper::createFromQuery(new SvxZoomSliderControl(m_nSlotId = SID_ATTR_ZOOMSLIDER,m_nId,*pStatusBar));
+ } // if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") )
+ else if ( m_aCommandURL.equalsAscii(".uno:Zoom") )
+ {
+ m_pController = TStatusbarHelper::createFromQuery(new SvxZoomStatusBarControl(m_nSlotId = SID_ATTR_ZOOM,m_nId,*pStatusBar));
+ }
+
+ if ( m_pController.is() )
+ {
+ m_pController->initialize(_rArguments);
+ m_pController->update();
+ }
+
+ addStatusListener(m_aCommandURL);
+ update();
+ }
+}
+// XStatusListener
+void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEvent)throw ( RuntimeException )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ if ( m_pController.is() )
+ {
+ if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") )
+ {
+ Sequence< PropertyValue > aSeq;
+ if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 2 )
+ {
+ SvxZoomSliderItem aZoomSlider(100,20,400);
+ aZoomSlider.PutValue(_aEvent.State);
+ static_cast<SvxZoomSliderControl*>(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoomSlider);
+ }
+ } // if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") )
+ else if ( m_aCommandURL.equalsAscii(".uno:Zoom") )
+ {
+ Sequence< PropertyValue > aSeq;
+ if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 3 )
+ {
+ SvxZoomItem aZoom;
+ aZoom.PutValue(_aEvent.State);
+ static_cast<SvxZoomStatusBarControl*>(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoom);
+ }
+ }
+ }
+}
+
+// XStatusbarController
+::sal_Bool SAL_CALL OStatusbarController::mouseButtonDown(const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_pController.is() && m_pController.getRef()->mouseButtonDown(_aEvent);
+}
+
+::sal_Bool SAL_CALL OStatusbarController::mouseMove( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_pController.is() && m_pController.getRef()->mouseMove(_aEvent);
+}
+
+::sal_Bool SAL_CALL OStatusbarController::mouseButtonUp( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_pController.is() && m_pController.getRef()->mouseButtonUp(_aEvent);
+}
+
+void SAL_CALL OStatusbarController::command(
+ const ::com::sun::star::awt::Point& aPos,
+ ::sal_Int32 nCommand,
+ ::sal_Bool bMouseEvent,
+ const ::com::sun::star::uno::Any& aData )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( m_pController.is() )
+ m_pController.getRef()->command( aPos, nCommand, bMouseEvent, aData );
+}
+
+void SAL_CALL OStatusbarController::paint(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
+ const ::com::sun::star::awt::Rectangle& rOutputRectangle,
+ ::sal_Int32 nItemId,
+ ::sal_Int32 nStyle )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( m_pController.is() )
+ m_pController.getRef()->paint( xGraphics, rOutputRectangle, nItemId, nStyle );
+}
+
+void SAL_CALL OStatusbarController::click() throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( m_pController.is() )
+ m_pController.getRef()->click();
+}
+
+void SAL_CALL OStatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( m_pController.is() )
+ m_pController.getRef()->doubleClick();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OStatusbarController::update() throw ( RuntimeException )
+{
+ ::svt::StatusbarController::update();
+ Reference< XUpdatable > xUp(m_pController.getRef(),UNO_QUERY);
+ if ( xUp.is() )
+ xUp->update();
+}
+// -----------------------------------------------------------------------------
+// XComponent
+void SAL_CALL OStatusbarController::dispose() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XComponent > xComp( m_pController.getRef(), UNO_QUERY );
+ ::comphelper::disposeComponent(xComp);
+ m_pController.dispose();
+ svt::StatusbarController::dispose();
+}
+// =============================================================================
+} // rptui
+// =============================================================================
diff --git a/reportdesign/source/ui/misc/toolboxcontroller.cxx b/reportdesign/source/ui/misc/toolboxcontroller.cxx
new file mode 100644
index 000000000000..e89cc5c6297e
--- /dev/null
+++ b/reportdesign/source/ui/misc/toolboxcontroller.cxx
@@ -0,0 +1,360 @@
+/*************************************************************************
+ *
+ * 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 "toolboxcontroller.hxx"
+#include <com/sun/star/ui/ImageType.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/menu.hxx>
+#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/ui/ImageType.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/util/Color.hpp>
+#include <vcl/svapp.hxx>
+#include <vcl/toolbox.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <svtools/menuoptions.hxx>
+#include <vos/mutex.hxx>
+#include <svx/svxids.hrc>
+#define ITEMID_COLOR 1
+#define ITEMID_BRUSH 2
+#define ITEMID_FONT 3
+#define ITEMID_FONTHEIGHT 4
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svx/tbcontrl.hxx>
+#include <editeng/colritem.hxx>
+#include <svx/tbxcustomshapes.hxx>
+
+#include <comphelper/sequence.hxx>
+
+#include <memory>
+
+namespace rptui
+{
+ using namespace svt;
+ using namespace com::sun::star;
+ using namespace com::sun::star::uno;
+ using namespace com::sun::star::beans;
+ using namespace com::sun::star::lang;
+ using namespace frame;
+ using namespace util;
+ using namespace ui;
+
+::rtl::OUString SAL_CALL OToolboxController::getImplementationName() throw( RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString OToolboxController::getImplementationName_Static() throw( RuntimeException )
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.comp.ReportToolboxController"));
+}
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString> OToolboxController::getSupportedServiceNames_Static(void) throw( RuntimeException )
+{
+ Sequence< ::rtl::OUString> aSupported(1);
+ aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ReportToolboxController"));
+ return aSupported;
+}
+// -----------------------------------------------------------------------------
+::sal_Bool SAL_CALL OToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException)
+{
+ return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static());
+}
+//-------------------------------------------------------------------------
+Sequence< ::rtl::OUString> SAL_CALL OToolboxController::getSupportedServiceNames() throw(RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+// -------------------------------------------------------------------------
+Reference< XInterface > OToolboxController::create(Reference< XComponentContext > const & xContext)
+{
+ return *(new OToolboxController(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY)));
+}
+// -----------------------------------------------------------------------------
+DBG_NAME(rpt_OToolboxController)
+OToolboxController::OToolboxController(const Reference< XMultiServiceFactory >& _rxORB)
+ : m_pToolbarController(NULL)
+ ,m_nToolBoxId(1)
+ ,m_nSlotId(0)
+{
+ DBG_CTOR(rpt_OToolboxController,NULL);
+ osl_incrementInterlockedCount(&m_refCount);
+ m_xServiceManager = _rxORB;
+ osl_decrementInterlockedCount(&m_refCount);
+
+}
+// -----------------------------------------------------------------------------
+OToolboxController::~OToolboxController()
+{
+ DBG_DTOR(rpt_OToolboxController,NULL);
+}
+// -----------------------------------------------------------------------------
+// XInterface
+Any SAL_CALL OToolboxController::queryInterface( const Type& _rType ) throw (RuntimeException)
+{
+ Any aReturn = ToolboxController::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = TToolboxController_BASE::queryInterface(_rType);
+ return aReturn;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OToolboxController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OToolboxController::release() throw ()
+{
+ ToolboxController::release();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException)
+{
+ ToolboxController::initialize(_rArguments);
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
+ if ( pToolBox )
+ {
+ const sal_uInt16 nCount = pToolBox->GetItemCount();
+ for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos)
+ {
+ const sal_uInt16 nItemId = pToolBox->GetItemId(nPos);
+ if ( pToolBox->GetItemCommand(nItemId) == String(m_aCommandURL) )
+ {
+ m_nToolBoxId = nItemId;
+ break;
+ }
+ }
+ if ( m_aCommandURL.equalsAscii(".uno:BasicShapes") )
+ {
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:BasicShapes")),sal_True));
+ m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_BASIC,m_nToolBoxId,*pToolBox));
+ }
+ else if ( m_aCommandURL.equalsAscii(".uno:SymbolShapes") )
+ {
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:SymbolShapes")),sal_True));
+ m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_SYMBOL,m_nToolBoxId,*pToolBox));
+ }
+ else if ( m_aCommandURL.equalsAscii(".uno:ArrowShapes") )
+ {
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:ArrowShapes")),sal_True));
+ m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_ARROW,m_nToolBoxId,*pToolBox));
+ }
+ else if ( m_aCommandURL.equalsAscii(".uno:FlowChartShapes") )
+ {
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FlowChartShapes")),sal_True));
+ m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_FLOWCHART,m_nToolBoxId,*pToolBox));
+ }
+ else if ( m_aCommandURL.equalsAscii(".uno:CalloutShapes") )
+ {
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:CalloutShapes")),sal_True));
+ m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_CALLOUT,m_nToolBoxId,*pToolBox));
+ }
+ else if ( m_aCommandURL.equalsAscii(".uno:StarShapes") )
+ {
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:StarShapes")),sal_True));
+ m_pToolbarController = TToolbarHelper::createFromQuery(new SvxTbxCtlCustomShapes(m_nSlotId = SID_DRAWTBX_CS_STAR,m_nToolBoxId,*pToolBox));
+ }
+ else if ( m_aCommandURL.equalsAscii(".uno:CharFontName") )
+ {
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:CharFontName")),sal_True));
+ m_pToolbarController = TToolbarHelper::createFromQuery(new SvxFontNameToolBoxControl/*SvxStyleToolBoxControl*/(m_nSlotId = SID_ATTR_CHAR_FONT,m_nToolBoxId,*pToolBox));
+ }
+ else if ( m_aCommandURL.equalsAscii(".uno:FontColor") || m_aCommandURL.equalsAscii(".uno:Color") )
+ {
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FontColor")),sal_True));
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Color")),sal_True));
+ m_pToolbarController = TToolbarHelper::createFromQuery(new SvxFontColorExtToolBoxControl/*SvxFontColorToolBoxControl*/(m_nSlotId = SID_ATTR_CHAR_COLOR2,m_nToolBoxId,*pToolBox));
+ }
+ else
+ {
+ m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:BackgroundColor")),sal_True));
+ m_pToolbarController = TToolbarHelper::createFromQuery(new SvxColorToolBoxControl(m_nSlotId = SID_BACKGROUND_COLOR,m_nToolBoxId,*pToolBox));
+ }
+
+ TCommandState::iterator aIter = m_aStates.begin();
+ for (; aIter != m_aStates.end(); ++aIter)
+ addStatusListener(aIter->first);
+
+ if ( m_pToolbarController.is() )
+ m_pToolbarController->initialize(_rArguments);
+ // check if paste special is allowed, when not don't add DROPDOWN
+ pToolBox->SetItemBits(m_nToolBoxId,pToolBox->GetItemBits(m_nToolBoxId) | TIB_DROPDOWN);
+ }
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ TCommandState::iterator aFind = m_aStates.find( Event.FeatureURL.Complete );
+ if ( aFind != m_aStates.end() )
+ {
+ aFind->second = Event.IsEnabled;
+ if ( m_pToolbarController.is() )
+ {
+ // All other status events will be processed here
+ sal_Bool bSetCheckmark = sal_False;
+ sal_Bool bCheckmark = sal_False;
+ //m_pToolbarController->GetToolBox().Enable(Event.IsEnabled);
+ ToolBox& rTb = m_pToolbarController->GetToolBox();
+ for ( sal_uInt16 i = 0; i < rTb.GetItemCount(); i++ )
+ {
+ sal_uInt16 nId = rTb.GetItemId( i );
+ if ( nId == 0 )
+ continue;
+
+ rtl::OUString aCmd = rTb.GetItemCommand( nId );
+ if ( aCmd == Event.FeatureURL.Complete )
+ {
+ // Enable/disable item
+ rTb.EnableItem( nId, Event.IsEnabled );
+
+ // Checkmark
+ if ( Event.State >>= bCheckmark )
+ bSetCheckmark = sal_True;
+
+ if ( bSetCheckmark )
+ rTb.CheckItem( nId, bCheckmark );
+ else
+ {
+ rtl::OUString aItemText;
+
+ if ( Event.State >>= aItemText )
+ rTb.SetItemText( nId, aItemText );
+ }
+ }
+ }
+
+ switch(m_nSlotId)
+ {
+ case SID_ATTR_CHAR_COLOR2:
+ case SID_BACKGROUND_COLOR:
+ {
+ util::Color nColor(COL_TRANSPARENT);
+ Event.State >>= nColor;
+ ::Color aGcc3WorkaroundTemporary( nColor);
+ SvxColorItem aColorItem(aGcc3WorkaroundTemporary,1);
+ if ( SID_ATTR_CHAR_COLOR2 == m_nSlotId )
+ static_cast<SvxFontColorExtToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_SET : SFX_ITEM_DISABLED,&aColorItem);
+ else
+ static_cast<SvxColorToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_SET : SFX_ITEM_DISABLED,&aColorItem);
+ }
+ break;
+ case SID_ATTR_CHAR_FONT:
+ {
+ SvxFontItem aItem(ITEMID_FONT);
+ aItem.PutValue(Event.State);
+ static_cast<SvxFontNameToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_AVAILABLE : SFX_ITEM_DISABLED,&aItem);
+ }
+ break;
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+Reference< awt::XWindow > SAL_CALL OToolboxController::createPopupWindow() throw (RuntimeException)
+{
+ // execute the menu
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ Reference< awt::XWindow > xRet;
+ if ( m_pToolbarController.is() )
+ xRet = m_pToolbarController.getRef()->createPopupWindow();
+
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+::sal_Bool SAL_CALL OToolboxController::opensSubToolbar() throw (uno::RuntimeException)
+{
+ return m_nSlotId == SID_DRAWTBX_CS_BASIC;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OToolboxController::getSubToolbarName() throw (uno::RuntimeException)
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
+ uno::Reference< frame::XSubToolbarController> xSub(m_pToolbarController.getRef(),uno::UNO_QUERY);
+ if ( xSub.is() )
+ return xSub->getSubToolbarName();
+ return ::rtl::OUString();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OToolboxController::functionSelected( const ::rtl::OUString& rCommand ) throw (uno::RuntimeException)
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ uno::Reference< frame::XSubToolbarController> xSub(m_pToolbarController.getRef(),uno::UNO_QUERY);
+ if ( xSub.is() )
+ {
+ xSub->functionSelected(m_aCommandURL = rCommand);
+ }
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OToolboxController::updateImage( ) throw (uno::RuntimeException)
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ uno::Reference< frame::XSubToolbarController> xSub(m_pToolbarController.getRef(),uno::UNO_QUERY);
+ if ( xSub.is() )
+ xSub->updateImage();
+}
+// -----------------------------------------------------------------------------
+uno::Reference< awt::XWindow > SAL_CALL OToolboxController::createItemWindow( const uno::Reference< awt::XWindow >& _xParent)
+throw (uno::RuntimeException)
+{
+ uno::Reference< awt::XWindow > xWindow;
+ if ( m_pToolbarController.is() )
+ {
+ switch(m_nSlotId)
+ {
+ case SID_ATTR_CHAR_FONT:
+ xWindow = VCLUnoHelper::GetInterface(static_cast<SvxFontNameToolBoxControl*>(m_pToolbarController.get())->CreateItemWindow(VCLUnoHelper::GetWindow(_xParent)));
+ break;
+ default:
+ ;
+ }
+ }
+ return xWindow;
+}
+// -----------------------------------------------------------------------------
+//..........................................................................
+} // rptui
+//..........................................................................
+
+
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
new file mode 100644
index 000000000000..1e0557a4edcc
--- /dev/null
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -0,0 +1,792 @@
+/*************************************************************************
+ *
+ * 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 "DesignView.hxx"
+#include <tools/debug.hxx>
+#include "ReportController.hxx"
+#include <comphelper/types.hxx>
+#include <unotools/syslocale.hxx>
+#include <unotools/viewoptions.hxx>
+#include "RptDef.hxx"
+#include "UITools.hxx"
+#include "RptObject.hxx"
+#include "propbrw.hxx"
+#include <toolkit/helper/convert.hxx>
+#include "helpids.hrc"
+#include "SectionView.hxx"
+#include "ReportSection.hxx"
+#include "rptui_slotid.hrc"
+#include <svx/svxids.hrc>
+#include "AddField.hxx"
+#include "ScrollHelper.hxx"
+#include "Navigator.hxx"
+#include "SectionWindow.hxx"
+#include "RptResId.hrc"
+#include <vcl/svapp.hxx>
+
+namespace rptui
+{
+using namespace ::dbaui;
+using namespace ::utl;
+using namespace ::com::sun::star;
+using namespace uno;
+using namespace lang;
+using namespace beans;
+using namespace container;
+
+#define LINE_SIZE 50
+#define START_SIZE_TASKPANE 30
+#define COLSET_ID 1
+#define REPORT_ID 2
+#define TASKPANE_ID 3
+
+class OTaskWindow : public Window
+{
+ PropBrw* m_pPropWin;
+public:
+ OTaskWindow(Window* _pParent) : Window(_pParent),m_pPropWin(NULL){}
+
+ inline void setPropertyBrowser(PropBrw* _pPropWin)
+ {
+ m_pPropWin = _pPropWin;
+ }
+
+ virtual void Resize()
+ {
+ const Size aSize = GetOutputSizePixel();
+ if ( m_pPropWin && aSize.Height() && aSize.Width() )
+ m_pPropWin->SetSizePixel(aSize);
+ }
+ long getMinimumWidth() const
+ {
+ long nRet = 0;
+ if ( m_pPropWin )
+ nRet = m_pPropWin->getMinimumSize().Width();
+ return nRet;
+ }
+};
+class OwnSplitWindow : public SplitWindow
+{
+public:
+ OwnSplitWindow(Window* pParent) : SplitWindow(pParent,WB_DIALOGCONTROL){SetBackground( );}
+
+ virtual void Split()
+ {
+ SplitWindow::Split();
+ setItemSizes();
+ }
+ void setItemSizes()
+ {
+ const long nOutWidth = GetOutputSizePixel().Width();
+ long nTaskPaneMinSplitSize = static_cast<OTaskWindow*>(GetItemWindow(TASKPANE_ID))->getMinimumWidth();
+ nTaskPaneMinSplitSize = static_cast<long>(nTaskPaneMinSplitSize*100/nOutWidth);
+ if ( !nTaskPaneMinSplitSize )
+ nTaskPaneMinSplitSize = START_SIZE_TASKPANE;
+
+ const long nReportMinSplitSize = static_cast<long>(12000/nOutWidth);
+
+ long nReportSize = GetItemSize( REPORT_ID );
+ long nTaskPaneSize = GetItemSize( TASKPANE_ID );
+
+ sal_Bool bMod = sal_False;
+ if( nReportSize < nReportMinSplitSize )
+ {
+ nReportSize = nReportMinSplitSize;
+ nTaskPaneSize = 99 - nReportMinSplitSize;
+
+ bMod = sal_True;
+ }
+ else if( nTaskPaneSize < nTaskPaneMinSplitSize )
+ {
+ nTaskPaneSize = nTaskPaneMinSplitSize;
+ nReportSize = 99 - nTaskPaneMinSplitSize;
+
+ bMod = sal_True;
+ }
+
+ if( bMod )
+ {
+ SetItemSize( REPORT_ID, nReportSize );
+ SetItemSize( TASKPANE_ID, nTaskPaneSize );
+ }
+ }
+};
+//==================================================================
+// class ODesignView
+//==================================================================
+DBG_NAME( rpt_ODesignView )
+//------------------------------------------------------------------------------
+ODesignView::ODesignView( Window* pParent,
+ const Reference< XMultiServiceFactory >& _rxOrb,
+ OReportController& _rController) :
+ ODataView( pParent, _rController, _rxOrb, WB_DIALOGCONTROL )
+ ,m_aSplitWin(this)
+ ,m_rReportController( _rController )
+ ,m_aScrollWindow(this)
+ ,m_pPropWin(NULL)
+ ,m_pAddField(NULL)
+ ,m_pCurrentView(NULL)
+ ,m_pReportExplorer(NULL)
+ ,m_eMode( RPTUI_SELECT )
+ ,m_nCurrentPosition(USHRT_MAX)
+ ,m_eActObj( OBJ_NONE )
+ ,m_bFirstDraw(sal_False)
+ ,m_aGridSizeCoarse( 1000, 1000 ) // #i93595# 100TH_MM changed to grid using coarse 1 cm grid
+ ,m_aGridSizeFine( 250, 250 ) // and a 0,25 cm subdivision for better visualisation
+ ,m_bGridVisible(sal_True)
+ ,m_bGridSnap(sal_True)
+ ,m_bDeleted( sal_False )
+{
+ DBG_CTOR( rpt_ODesignView,NULL);
+ SetHelpId(UID_RPT_RPT_APP_VIEW);
+ ImplInitSettings();
+
+ SetMapMode( MapMode( MAP_100TH_MM ) );
+
+ // now create the task pane on the right side :-)
+ m_pTaskPane = new OTaskWindow(this);
+ //m_pTaskPane->Show();
+
+ m_aSplitWin.InsertItem( COLSET_ID,100,SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE | SWIB_COLSET );
+ m_aSplitWin.InsertItem( REPORT_ID, &m_aScrollWindow, 100/*m_aScrollWindow.getMaxMarkerWidth(sal_False)*/, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE /*SWIB_COLSET*/);
+ //m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE );
+
+ // Splitter einrichten
+ //m_aSplitter.SetSplitHdl(LINK(this, ODesignView,SplitHdl));
+ m_aSplitWin.SetSplitHdl(LINK(this, ODesignView,SplitHdl));
+ m_aSplitWin.ShowAutoHideButton();
+ m_aSplitWin.SetAlign(WINDOWALIGN_LEFT);
+ m_aSplitWin.Show();
+
+ m_aMarkTimer.SetTimeout( 100 );
+ m_aMarkTimer.SetTimeoutHdl( LINK( this, ODesignView, MarkTimeout ) );
+}
+
+//------------------------------------------------------------------------------
+ODesignView::~ODesignView()
+{
+ DBG_DTOR( rpt_ODesignView,NULL);
+ m_bDeleted = sal_True;
+ Hide();
+ m_aScrollWindow.Hide();
+ m_aMarkTimer.Stop();
+ if ( m_pPropWin )
+ {
+ notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
+ ::std::auto_ptr<Window> aTemp2(m_pPropWin);
+ m_pPropWin = NULL;
+ }
+ if ( m_pAddField )
+ {
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromAscii( UID_RPT_RPT_APP_VIEW ) );
+ aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) );
+ notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
+ ::std::auto_ptr<Window> aTemp2(m_pAddField);
+ m_pAddField = NULL;
+ }
+ if ( m_pReportExplorer )
+ {
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) );
+ aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pReportExplorer->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) );
+ notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
+ ::std::auto_ptr<Window> aTemp2(m_pReportExplorer);
+ m_pReportExplorer = NULL;
+ }
+ {
+ ::std::auto_ptr<Window> aTemp2(m_pTaskPane);
+ m_pTaskPane = NULL;
+ }
+}
+// -----------------------------------------------------------------------------
+void ODesignView::initialize()
+{
+ SetMapMode( MapMode( MAP_100TH_MM ) );
+ m_aScrollWindow.initialize();
+ m_aScrollWindow.Show();
+}
+//-----------------------------------------------------------------------------
+void ODesignView::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ODataView::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+//------------------------------------------------------------------------------
+long ODesignView::PreNotify( NotifyEvent& rNEvt )
+{
+ long nRet = ODataView::PreNotify(rNEvt); // 1 := has to be handled here
+ switch(rNEvt.GetType())
+ {
+ case EVENT_KEYINPUT:
+ if ( (m_pPropWin && m_pPropWin->HasChildPathFocus()) )
+ return 0L;
+ if ( (m_pAddField && m_pAddField->HasChildPathFocus()) )
+ return 0L;
+ if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) )
+ return 0L;
+ {
+ const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
+ if ( handleKeyEvent(*pKeyEvent) )
+ nRet = 1L;
+ else if ( nRet == 1L && m_pAccel.get() )
+ {
+ const KeyCode& rCode = pKeyEvent->GetKeyCode();
+ util::URL aUrl;
+ aUrl.Complete = m_pAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rCode));
+ if ( !aUrl.Complete.getLength() || !m_rController.isCommandEnabled( aUrl.Complete ) )
+ nRet = 0L;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return nRet;
+}
+//------------------------------------------------------------------------------
+void ODesignView::resizeDocumentView(Rectangle& _rPlayground)
+{
+ if ( !_rPlayground.IsEmpty() )
+ {
+ const Size aPlaygroundSize( _rPlayground.GetSize() );
+
+ // calc the split pos, and forward it to the controller
+ sal_Int32 nSplitPos = getController().getSplitPos();
+ if ( 0 != aPlaygroundSize.Width() )
+ {
+ if ( ( -1 == nSplitPos )
+ || ( nSplitPos >= aPlaygroundSize.Width() )
+ )
+ {
+ long nMinWidth = static_cast<long>(0.1*aPlaygroundSize.Width());
+ if ( m_pPropWin && m_pPropWin->IsVisible() )
+ nMinWidth = m_pPropWin->GetMinOutputSizePixel().Width();
+ nSplitPos = static_cast<sal_Int32>(_rPlayground.Right() - nMinWidth);
+ getController().setSplitPos(nSplitPos);
+ }
+ } // if ( 0 != _rPlaygroundSize.Width() )
+
+ Size aReportWindowSize(aPlaygroundSize);
+ if ( m_aSplitWin.IsItemValid(TASKPANE_ID) )
+ {
+ // normalize the split pos
+ const long nSplitterWidth = GetSettings().GetStyleSettings().GetSplitSize();
+ Point aTaskPanePos(nSplitPos + nSplitterWidth, _rPlayground.Top());
+ if ( m_pTaskPane && m_pTaskPane->IsVisible() )
+ {
+ aTaskPanePos.X() = aPlaygroundSize.Width() - m_pTaskPane->GetSizePixel().Width();
+ sal_Int32 nMinWidth = m_pPropWin->getMinimumSize().Width();
+ if ( nMinWidth > (aPlaygroundSize.Width() - aTaskPanePos.X()) )
+ {
+ aTaskPanePos.X() = aPlaygroundSize.Width() - nMinWidth;
+ }
+ nSplitPos = aTaskPanePos.X() - nSplitterWidth;
+ getController().setSplitPos(nSplitPos);
+
+ const long nTaskPaneSize = static_cast<long>((aPlaygroundSize.Width() - aTaskPanePos.X())*100/aPlaygroundSize.Width());
+ if ( m_aSplitWin.GetItemSize( TASKPANE_ID ) != nTaskPaneSize )
+ {
+ m_aSplitWin.SetItemSize( REPORT_ID, 99 - nTaskPaneSize );
+ m_aSplitWin.SetItemSize( TASKPANE_ID, nTaskPaneSize );
+ }
+ }
+ }
+ // set the size of the report window
+ m_aSplitWin.SetPosSizePixel( _rPlayground.TopLeft(),aPlaygroundSize );
+ }
+ // just for completeness: there is no space left, we occupied it all ...
+ _rPlayground.SetPos( _rPlayground.BottomRight() );
+ _rPlayground.SetSize( Size( 0, 0 ) );
+
+}
+// -----------------------------------------------------------------------------
+// set the view readonly or not
+void ODesignView::setReadOnly(sal_Bool /*_bReadOnly*/)
+{
+}
+//----------------------------------------------------------------------------
+IMPL_LINK( ODesignView, MarkTimeout, Timer *, EMPTYARG )
+{
+ if ( m_pPropWin && m_pPropWin->IsVisible() )
+ {
+ m_pPropWin->Update(m_pCurrentView);
+ uno::Reference<beans::XPropertySet> xProp(m_xReportComponent,uno::UNO_QUERY);
+ if ( xProp.is() )
+ {
+ m_pPropWin->Update(xProp);
+ static_cast<OTaskWindow*>(m_pTaskPane)->Resize();
+ }
+ Resize();
+ }
+
+ return 0;
+}
+
+//----------------------------------------------------------------------------
+void ODesignView::SetMode( DlgEdMode _eNewMode )
+{
+ m_eMode = _eNewMode;
+ if ( m_eMode == RPTUI_SELECT )
+ m_eActObj = OBJ_NONE;
+
+ m_aScrollWindow.SetMode(_eNewMode);
+}
+//----------------------------------------------------------------------------
+void ODesignView::SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType )
+{
+ m_eActObj = eObj;
+ m_aScrollWindow.SetInsertObj( eObj,_sShapeType );
+}
+//----------------------------------------------------------------------------
+rtl::OUString ODesignView::GetInsertObjString() const
+{
+ return m_aScrollWindow.GetInsertObjString();
+}
+//----------------------------------------------------------------------------
+
+sal_uInt16 ODesignView::GetInsertObj() const
+{
+ return m_eActObj;
+}
+
+//----------------------------------------------------------------------------
+void ODesignView::Cut()
+{
+ Copy();
+ Delete();
+}
+
+//----------------------------------------------------------------------------
+
+void ODesignView::Copy()
+{
+ m_aScrollWindow.Copy();
+}
+
+//----------------------------------------------------------------------------
+
+void ODesignView::Paste()
+{
+ m_aScrollWindow.Paste();
+}
+//----------------------------------------------------------------------------
+void ODesignView::Delete()
+{
+ m_aScrollWindow.Delete();
+}
+//----------------------------------------------------------------------------
+sal_Bool ODesignView::HasSelection() const
+{
+ return m_aScrollWindow.HasSelection();
+}
+//----------------------------------------------------------------------------
+
+sal_Bool ODesignView::IsPasteAllowed() const
+{
+ return m_aScrollWindow.IsPasteAllowed();
+}
+
+//----------------------------------------------------------------------------
+void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView)
+{
+ if ( m_pCurrentView != &_rView )
+ {
+ if ( m_pCurrentView )
+ m_aScrollWindow.setMarked(m_pCurrentView,sal_False);
+ m_pCurrentView = &_rView;
+ if ( m_pCurrentView )
+ m_aScrollWindow.setMarked(m_pCurrentView,sal_True);
+ m_xReportComponent.clear();
+ DlgEdHint aHint( RPTUI_HINT_SELECTIONCHANGED );
+ Broadcast( aHint );
+ }
+ m_aMarkTimer.Start();
+}
+
+//----------------------------------------------------------------------------
+void ODesignView::toggleGrid(sal_Bool _bGridVisible)
+{
+ m_aScrollWindow.toggleGrid(_bGridVisible);
+}
+//----------------------------------------------------------------------------
+sal_uInt16 ODesignView::getSectionCount() const
+{
+ return m_aScrollWindow.getSectionCount();
+}
+//----------------------------------------------------------------------------
+void ODesignView::showRuler(sal_Bool _bShow)
+{
+ m_aScrollWindow.showRuler(_bShow);
+}
+//----------------------------------------------------------------------------
+void ODesignView::removeSection(sal_uInt16 _nPosition)
+{
+ m_aScrollWindow.removeSection(_nPosition);
+}
+//----------------------------------------------------------------------------
+void ODesignView::addSection(const uno::Reference< report::XSection >& _xSection,const ::rtl::OUString& _sColorEntry,sal_uInt16 _nPosition)
+{
+ m_aScrollWindow.addSection(_xSection,_sColorEntry,_nPosition);
+}
+// -----------------------------------------------------------------------------
+void ODesignView::GetFocus()
+{
+ Window::GetFocus();
+
+ if ( !m_bDeleted )
+ {
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aScrollWindow.getMarkedSection();
+ if ( pSectionWindow )
+ pSectionWindow->GrabFocus();
+ }
+}
+// -----------------------------------------------------------------------------
+void ODesignView::ImplInitSettings()
+{
+//#if OSL_DEBUG_LEVEL > 0
+// SetBackground( Wallpaper( COL_RED ));
+//#else
+ SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
+//#endif
+ SetFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
+ SetTextFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
+}
+//-----------------------------------------------------------------------------
+IMPL_LINK( ODesignView, SplitHdl, void*, )
+{
+ const Size aOutputSize = GetOutputSizePixel();
+ const long nTest = aOutputSize.Width() * m_aSplitWin.GetItemSize(TASKPANE_ID) / 100;
+ long nMinWidth = static_cast<long>(0.1*aOutputSize.Width());
+ if ( m_pPropWin && m_pPropWin->IsVisible() )
+ nMinWidth = m_pPropWin->GetMinOutputSizePixel().Width();
+
+ if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow.getMaxMarkerWidth(sal_False) )
+ {
+ long nOldSplitPos = getController().getSplitPos();
+ getController().setSplitPos(nTest);
+ if ( nOldSplitPos != -1 && nOldSplitPos <= nTest )
+ {
+ Invalidate(/*INVALIDATE_NOCHILDREN*/);
+ }
+ }
+
+ return 0L;
+}
+//-----------------------------------------------------------------------------
+void ODesignView::SelectAll(const sal_uInt16 _nObjectType)
+{
+ m_aScrollWindow.SelectAll(_nObjectType);
+}
+//-----------------------------------------------------------------------------
+void ODesignView::unmarkAllObjects(OSectionView* _pSectionView)
+{
+ m_aScrollWindow.unmarkAllObjects(_pSectionView);
+}
+//-----------------------------------------------------------------------------
+void ODesignView::togglePropertyBrowser(sal_Bool _bToogleOn)
+{
+ if ( !m_pPropWin && _bToogleOn )
+ {
+ m_pPropWin = new PropBrw(getController().getORB(),m_pTaskPane,this);
+ m_pPropWin->Invalidate();
+ static_cast<OTaskWindow*>(m_pTaskPane)->setPropertyBrowser(m_pPropWin);
+ notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::AddWindow));
+ }
+ if ( m_pPropWin && _bToogleOn != m_pPropWin->IsVisible() )
+ {
+ if ( !m_pCurrentView && !m_xReportComponent.is() )
+ m_xReportComponent = getController().getReportDefinition();
+
+ const sal_Bool bWillBeVisible = _bToogleOn;
+ m_pPropWin->Show(bWillBeVisible);
+ m_pTaskPane->Show(bWillBeVisible);
+ m_pTaskPane->Invalidate();
+
+ if ( bWillBeVisible )
+ m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane,START_SIZE_TASKPANE, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE/*|SWIB_COLSET */);
+ else
+ m_aSplitWin.RemoveItem(TASKPANE_ID);
+
+ // TRY
+ // Invalidate(/*INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE*/);
+ if ( bWillBeVisible )
+ m_aMarkTimer.Start();
+ }
+}
+//-----------------------------------------------------------------------------
+void ODesignView::showProperties(const uno::Reference< uno::XInterface>& _xReportComponent)
+{
+ if ( m_xReportComponent != _xReportComponent )
+ {
+ m_xReportComponent = _xReportComponent;
+ if ( m_pCurrentView )
+ m_aScrollWindow.setMarked(m_pCurrentView,sal_False);
+ m_pCurrentView = NULL;
+ m_aMarkTimer.Start();
+ }
+}
+//-----------------------------------------------------------------------------
+sal_Bool ODesignView::isReportExplorerVisible() const
+{
+ return m_pReportExplorer && m_pReportExplorer->IsVisible();
+}
+//-----------------------------------------------------------------------------
+void ODesignView::toggleReportExplorer()
+{
+ if ( !m_pReportExplorer )
+ {
+ OReportController& rReportController = getController();
+ m_pReportExplorer = new ONavigator(this,rReportController);
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) );
+ if ( aDlgOpt.Exists() )
+ m_pReportExplorer->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+ m_pReportExplorer->AddEventListener(LINK(&rReportController,OReportController,EventLstHdl));
+ notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::AddWindow));
+ }
+ else
+ m_pReportExplorer->Show(!m_pReportExplorer->IsVisible());
+}
+//-----------------------------------------------------------------------------
+sal_Bool ODesignView::isAddFieldVisible() const
+{
+ return m_pAddField && m_pAddField->IsVisible();
+}
+//-----------------------------------------------------------------------------
+void ODesignView::toggleAddField()
+{
+ if ( !m_pAddField )
+ {
+ uno::Reference< report::XReportDefinition > xReport(m_xReportComponent,uno::UNO_QUERY);
+ uno::Reference< report::XReportComponent > xReportComponent(m_xReportComponent,uno::UNO_QUERY);
+ OReportController& rReportController = getController();
+ if ( !m_pCurrentView && !xReport.is() )
+ {
+ if ( xReportComponent.is() )
+ xReport = xReportComponent->getSection()->getReportDefinition();
+ else
+ xReport = rReportController.getReportDefinition().get();
+ }
+ else if ( m_pCurrentView )
+ {
+ uno::Reference< report::XSection > xSection = m_pCurrentView->getReportSection()->getSection();
+ xReport = xSection->getReportDefinition();
+ }
+ uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY);
+ m_pAddField = new OAddFieldWindow(this,xSet);
+ m_pAddField->SetCreateHdl(LINK( &rReportController, OReportController, OnCreateHdl ) );
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromAscii( UID_RPT_RPT_APP_VIEW ) );
+ if ( aDlgOpt.Exists() )
+ m_pAddField->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+ m_pAddField->Update();
+ m_pAddField->AddEventListener(LINK(&rReportController,OReportController,EventLstHdl));
+ notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::AddWindow));
+ m_pAddField->Show();
+ }
+ else
+ m_pAddField->Show(!m_pAddField->IsVisible());
+}
+// -------------------------------------------------------------------------
+uno::Reference< report::XSection > ODesignView::getCurrentSection() const
+{
+ uno::Reference< report::XSection > xSection;
+ if ( m_pCurrentView )
+ xSection = m_pCurrentView->getReportSection()->getSection();
+
+ // why do we need the code below?
+ //else
+ // {
+ // OReportController& rReportController = getController();
+ // xSection = rReportController.getReportDefinition()->getDetail();
+ // }
+ return xSection;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel() const
+{
+ uno::Reference< report::XReportComponent > xModel;
+ if ( m_pCurrentView )
+ {
+ xModel = m_pCurrentView->getReportSection()->getCurrentControlModel();
+ }
+ return xModel;
+}
+// -------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> ODesignView::getMarkedSection(NearSectionAccess nsa) const
+{
+ return m_aScrollWindow.getMarkedSection(nsa);
+}
+//-----------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
+{
+ return m_aScrollWindow.getSectionWindow(_xSection);
+}
+// -------------------------------------------------------------------------
+void ODesignView::markSection(const sal_uInt16 _nPos)
+{
+ m_aScrollWindow.markSection(_nPos);
+}
+// -----------------------------------------------------------------------------
+void ODesignView::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
+{
+ m_aScrollWindow.fillCollapsedSections(_rCollapsedPositions);
+}
+// -----------------------------------------------------------------------------
+void ODesignView::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollpasedSections)
+{
+ m_aScrollWindow.collapseSections(_aCollpasedSections);
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString ODesignView::getCurrentPage() const
+{
+ return m_pPropWin ? m_pPropWin->getCurrentPage() : ::rtl::OUString();
+}
+// -----------------------------------------------------------------------------
+void ODesignView::setCurrentPage(const ::rtl::OUString& _sLastActivePage)
+{
+ if ( m_pPropWin )
+ m_pPropWin->setCurrentPage(_sLastActivePage);
+}
+// -----------------------------------------------------------------------------
+void ODesignView::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects)
+{
+ m_aScrollWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects);
+}
+#if 0
+// -----------------------------------------------------------------------------
+sal_Bool ODesignView::isAlignPossible() const
+{
+ ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
+ return pMarkedSection.get() && pMarkedSection->getReportSection().getSectionView().IsAlignPossible();
+}
+#endif
+//------------------------------------------------------------------------------
+sal_Bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent)
+{
+ if ( (m_pPropWin && m_pPropWin->HasChildPathFocus()) )
+ return sal_False;
+ if ( (m_pAddField && m_pAddField->HasChildPathFocus()) )
+ return sal_False;
+ if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) )
+ return sal_False;
+ return m_aScrollWindow.handleKeyEvent(_rEvent);
+}
+//------------------------------------------------------------------------
+void ODesignView::setMarked(const uno::Reference< report::XSection>& _xSection,sal_Bool _bMark)
+{
+ m_aScrollWindow.setMarked(_xSection,_bMark);
+ if ( _bMark )
+ UpdatePropertyBrowserDelayed(getMarkedSection()->getReportSection().getSectionView());
+ else
+ m_pCurrentView = NULL;
+}
+//------------------------------------------------------------------------
+void ODesignView::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes,sal_Bool _bMark)
+{
+ m_aScrollWindow.setMarked(_aShapes,_bMark);
+ if ( _aShapes.hasElements() && _bMark )
+ showProperties(_aShapes[0]);
+ else
+ m_xReportComponent.clear();
+}
+//------------------------------------------------------------------------------
+void ODesignView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ const uno::Sequence< beans::PropertyValue> aArgs;
+ getController().executeChecked(SID_SELECT_REPORT,aArgs);
+ }
+ ODataView::MouseButtonDown(rMEvt);
+}
+// -----------------------------------------------------------------------------
+uno::Any ODesignView::getCurrentlyShownProperty() const
+{
+ uno::Any aRet;
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = getMarkedSection();
+ if ( pSectionWindow )
+ {
+ ::std::vector< uno::Reference< uno::XInterface > > aSelection;
+ pSectionWindow->getReportSection().fillControlModelSelection(aSelection);
+ if ( !aSelection.empty() )
+ {
+ ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aSelection.begin();
+ uno::Sequence< uno::Reference< report::XReportComponent > > aSeq(aSelection.size());
+ for(sal_Int32 i = 0; i < aSeq.getLength(); ++i,++aIter)
+ {
+ aSeq[i].set(*aIter,uno::UNO_QUERY);
+ }
+ aRet <<= aSeq;
+ }
+ }
+ return aRet;
+}
+// -----------------------------------------------------------------------------
+void ODesignView::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
+{
+ m_aScrollWindow.fillControlModelSelection(_rSelection);
+}
+// -----------------------------------------------------------------------------
+void ODesignView::setGridSnap(sal_Bool bOn)
+{
+ m_aScrollWindow.setGridSnap(bOn);
+
+}
+// -----------------------------------------------------------------------------
+void ODesignView::setDragStripes(sal_Bool bOn)
+{
+ m_aScrollWindow.setDragStripes(bOn);
+}
+// -----------------------------------------------------------------------------
+sal_Bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const
+{
+ return m_pPropWin && m_pPropWin->HasChildPathFocus();
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 ODesignView::getMarkedObjectCount() const
+{
+ return m_aScrollWindow.getMarkedObjectCount();
+}
+// -----------------------------------------------------------------------------
+void ODesignView::zoom(const Fraction& _aZoom)
+{
+ m_aScrollWindow.zoom(_aZoom);
+}
+// -----------------------------------------------------------------------------
+sal_uInt16 ODesignView::getZoomFactor(SvxZoomType _eType) const
+{
+ return m_aScrollWindow.getZoomFactor(_eType);
+}
+//============================================================================
+} // rptui
+//============================================================================
diff --git a/reportdesign/source/ui/report/EndMarker.cxx b/reportdesign/source/ui/report/EndMarker.cxx
new file mode 100644
index 000000000000..5ace128c3a2f
--- /dev/null
+++ b/reportdesign/source/ui/report/EndMarker.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * 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 "EndMarker.hxx"
+#include "ColorChanger.hxx"
+#include "SectionWindow.hxx"
+#include "helpids.hrc"
+#include <vcl/svapp.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/lineinfo.hxx>
+
+
+#define CORNER_SPACE 5
+//=====================================================================
+namespace rptui
+{
+//=====================================================================
+ DBG_NAME( rpt_OEndMarker )
+OEndMarker::OEndMarker(Window* _pParent ,const ::rtl::OUString& _sColorEntry)
+: OColorListener(_pParent,_sColorEntry)
+{
+ DBG_CTOR( rpt_OEndMarker,NULL);
+ SetUniqueId(HID_RPT_ENDMARKER);
+ ImplInitSettings();
+ SetPaintTransparent(sal_True);
+}
+// -----------------------------------------------------------------------------
+OEndMarker::~OEndMarker()
+{
+ DBG_DTOR( rpt_OEndMarker,NULL);
+}
+// -----------------------------------------------------------------------------
+void OEndMarker::Paint( const Rectangle& /*rRect*/ )
+{
+ Fraction aCornerSpace(long(CORNER_SPACE));
+ aCornerSpace *= GetMapMode().GetScaleX();
+ const long nCornerSpace = aCornerSpace;
+
+ Size aSize = GetSizePixel();
+ aSize.Width() += nCornerSpace;
+ Rectangle aWholeRect(Point(-nCornerSpace,0),aSize);
+ PolyPolygon aPoly;
+ aPoly.Insert(Polygon(aWholeRect,nCornerSpace,nCornerSpace));
+
+ Color aStartColor(m_nColor);
+ aStartColor.IncreaseLuminance(10);
+ sal_uInt16 nHue = 0;
+ sal_uInt16 nSat = 0;
+ sal_uInt16 nBri = 0;
+ aStartColor.RGBtoHSB(nHue, nSat, nBri);
+ nSat += 40;
+ Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri));
+ Gradient aGradient(GRADIENT_LINEAR,aStartColor,aEndColor);
+ aGradient.SetSteps(static_cast<sal_uInt16>(aSize.Height()));
+
+ DrawGradient(PixelToLogic(aPoly) ,aGradient);
+ if ( m_bMarked )
+ {
+ Rectangle aRect( Point(-nCornerSpace,nCornerSpace),
+ Size(aSize.Width()- nCornerSpace,aSize.Height() - nCornerSpace- nCornerSpace));
+ ColorChanger aColors( this, COL_WHITE, COL_WHITE );
+ DrawPolyLine(Polygon(PixelToLogic(aRect)),LineInfo(LINE_SOLID,2));
+ }
+}
+// -----------------------------------------------------------------------
+void OEndMarker::ImplInitSettings()
+{
+ SetBackground( Wallpaper( svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND).nColor) );
+ SetFillColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
+}
+// -----------------------------------------------------------------------
+void OEndMarker::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( !rMEvt.IsLeft() && !rMEvt.IsRight())
+ return;
+ static_cast<OSectionWindow*>(GetParent())->showProperties();
+}
+// =======================================================================
+}
+// =======================================================================
diff --git a/reportdesign/source/ui/report/FixedTextColor.cxx b/reportdesign/source/ui/report/FixedTextColor.cxx
new file mode 100644
index 000000000000..d80a79dde0f7
--- /dev/null
+++ b/reportdesign/source/ui/report/FixedTextColor.cxx
@@ -0,0 +1,283 @@
+/*************************************************************************
+ *
+ * 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 <FixedTextColor.hxx>
+#include <com/sun/star/report/XFixedText.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/InvalidateStyle.hpp>
+
+#include <RptObject.hxx>
+#include <RptModel.hxx>
+#include <RptPage.hxx>
+#include <ViewsWindow.hxx>
+#include <ReportSection.hxx>
+#include <ReportController.hxx>
+#include <uistrings.hrc>
+#include <reportformula.hxx>
+#include <toolkit/helper/property.hxx>
+
+#include <tools/color.hxx> // COL_TRANSPARENT
+#include <svtools/extcolorcfg.hxx>
+#include <unotools/confignode.hxx>
+
+// DBG_*
+#include <tools/debug.hxx>
+// DBG_UNHANDLED_EXCEPTION
+#include <tools/diagnose_ex.h>
+
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
+
+namespace rptui
+{
+ using namespace ::com::sun::star;
+
+ DBG_NAME(rpt_FixedTextColor)
+
+ FixedTextColor::FixedTextColor(const OReportController& _aController)
+ :m_rReportController(_aController)
+ {
+ DBG_CTOR(rpt_FixedTextColor, NULL);
+ }
+
+ //--------------------------------------------------------------------
+ // sal_Int32 FixedTextColor::getTextColor()
+ // {
+ // const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings();
+ // sal_Bool bHighContrast = aStyleSettings.GetHighContrastMode();
+ //
+ // Color aGetFaceColor = aStyleSettings.GetFaceColor();
+ // Color aGetCheckedColor = aStyleSettings.GetCheckedColor();
+ // Color aGetLightColor = aStyleSettings.GetLightColor();
+ // Color aGetLightBorderColor = aStyleSettings.GetLightBorderColor();
+ // Color aGetShadowColor = aStyleSettings.GetShadowColor();
+ // Color aGetDarkShadowColor = aStyleSettings.GetDarkShadowColor();
+ // Color aGetButtonTextColor = aStyleSettings.GetButtonTextColor();
+ // Color aGetButtonRolloverTextColor = aStyleSettings.GetButtonRolloverTextColor();
+ // Color aGetRadioCheckTextColor = aStyleSettings.GetRadioCheckTextColor();
+ // Color aGetGroupTextColor = aStyleSettings.GetGroupTextColor();
+ // Color aGetLabelTextColor = aStyleSettings.GetLabelTextColor();
+ // Color aGetInfoTextColor = aStyleSettings.GetInfoTextColor();
+ // Color aGetWindowColor = aStyleSettings.GetWindowColor();
+ // Color aGetWindowTextColor = aStyleSettings.GetWindowTextColor();
+ // Color aGetDialogColor = aStyleSettings.GetDialogColor();
+ // Color aGetDialogTextColor = aStyleSettings.GetDialogTextColor();
+ // Color aGetWorkspaceColor = aStyleSettings.GetWorkspaceColor();
+ // Color aGetFieldColor = aStyleSettings.GetFieldColor();
+ // Color aGetFieldTextColor = aStyleSettings.GetFieldTextColor();
+ // Color aGetFieldRolloverTextColor = aStyleSettings.GetFieldRolloverTextColor();
+ // Color aGetActiveColor = aStyleSettings.GetActiveColor();
+ // Color aGetActiveColor2 = aStyleSettings.GetActiveColor2();
+ // Color aGetActiveTextColor = aStyleSettings.GetActiveTextColor();
+ // Color aGetActiveBorderColor = aStyleSettings.GetActiveBorderColor();
+ // Color aGetDeactiveColor = aStyleSettings.GetDeactiveColor();
+ // Color aGetDeactiveColor2 = aStyleSettings.GetDeactiveColor2();
+ // Color aGetDeactiveTextColor = aStyleSettings.GetDeactiveTextColor();
+ // Color aGetDeactiveBorderColor = aStyleSettings.GetDeactiveBorderColor();
+ // Color aGetHighlightColor = aStyleSettings.GetHighlightColor();
+ // Color aGetHighlightTextColor = aStyleSettings.GetHighlightTextColor();
+ // Color aGetDisableColor = aStyleSettings.GetDisableColor();
+ // Color aGetHelpColor = aStyleSettings.GetHelpColor();
+ // Color aGetHelpTextColor = aStyleSettings.GetHelpTextColor();
+ // Color aGetMenuColor = aStyleSettings.GetMenuColor();
+ // Color aGetMenuBarColor = aStyleSettings.GetMenuBarColor();
+ // Color aGetMenuBorderColor = aStyleSettings.GetMenuBorderColor();
+ // Color aGetMenuTextColor = aStyleSettings.GetMenuTextColor();
+ // Color aGetMenuHighlightColor = aStyleSettings.GetMenuHighlightColor();
+ // Color aGetMenuHighlightTextColor = aStyleSettings.GetMenuHighlightTextColor();
+ // Color aGetLinkColor = aStyleSettings.GetLinkColor();
+ // Color aGetVisitedLinkColor = aStyleSettings.GetVisitedLinkColor();
+ // Color aGetHighlightLinkColor = aStyleSettings.GetHighlightLinkColor();
+ // Color aGetMonoColor = aStyleSettings.GetMonoColor();
+ // Color aGetActiveTabColor = aStyleSettings.GetActiveTabColor();
+ // Color aGetInactiveTabColor = aStyleSettings.GetInactiveTabColor();
+ //
+ // Color aWindowColor = aStyleSettings.GetWindowColor();
+ // Color aLabelColor = aStyleSettings.GetLabelTextColor();
+ //
+ // // if (m_nTextColor == -1)
+ // // {
+ // // svtools::ExtendedColorConfig aConfig;
+ // // m_nTextColor = aConfig.GetColorValue(CFG_REPORTDESIGNER, DBTEXTBOXBOUNDCONTENT).getColor();
+ // // }
+ // return aLabelColor.GetColor();
+ // }
+
+ //--------------------------------------------------------------------
+ FixedTextColor::~FixedTextColor()
+ {
+ DBG_DTOR(rpt_FixedTextColor,NULL);
+ }
+ // -----------------------------------------------------------------------------
+
+ void FixedTextColor::notifyPropertyChange( const beans::PropertyChangeEvent& _rEvent )
+ {
+ // (void)_rEvent;
+ uno::Reference< report::XFixedText > xFixedText( _rEvent.Source, uno::UNO_QUERY );
+ if ( ! xFixedText.is() )
+ {
+ return;
+ }
+
+ try
+ {
+ uno::Reference< lang::XComponent > xComponent( xFixedText, uno::UNO_QUERY_THROW );
+ handle(xComponent);
+ // uno::Reference<awt::XVclWindowPeer> xVclWindowPeer = getVclWindowPeer(xComponent);
+
+ // setPropertyTextColor(xVclWindowPeer, getTextColor());
+ }
+ catch (uno::Exception e)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ void FixedTextColor::setPropertyTextColor(const uno::Reference< awt::XVclWindowPeer >& _xVclWindowPeer, sal_Int32 _nTextColor)
+ {
+ _xVclWindowPeer->setProperty(PROPERTY_TEXTCOLOR, uno::makeAny(sal_Int32(_nTextColor)));
+ }
+
+ // -----------------------------------------------------------------------------
+ void FixedTextColor::notifyElementInserted( const uno::Reference< uno::XInterface >& _rxElement )
+ {
+ handle(_rxElement);
+ }
+
+// -----------------------------------------------------------------------------
+ void FixedTextColor::handle( const uno::Reference< uno::XInterface >& _rxElement )
+ {
+ // (void) _rxElement;
+ uno::Reference< report::XFixedText > xFixedText( _rxElement, uno::UNO_QUERY );
+ if ( ! xFixedText.is() )
+ {
+ return;
+ }
+
+ try
+ {
+ sal_Bool bIsDark = sal_False;
+ const sal_Int32 nBackColor( xFixedText->getControlBackground() );
+ if ((sal_uInt32)nBackColor == COL_TRANSPARENT)
+ {
+ uno::Reference <report::XSection> xSection(xFixedText->getParent(), uno::UNO_QUERY_THROW);
+
+ sal_Bool bSectionBackColorIsTransparent = xSection->getBackTransparent();
+ if (bSectionBackColorIsTransparent)
+ {
+ // Label Transparent, Section Transparent set LabelTextColor
+ const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings();
+ Color aWindowColor = aStyleSettings.GetWindowColor();
+ bIsDark = aWindowColor.IsDark();
+ }
+ else
+ {
+ com::sun::star::util::Color aColor2 = xSection->getBackColor();
+ Color aBackColor(aColor2);
+ bIsDark = aBackColor.IsDark();
+ }
+ }
+ else
+ {
+ Color aLabelBackColor(nBackColor);
+ bIsDark = aLabelBackColor.IsDark();
+ }
+
+ uno::Reference<awt::XVclWindowPeer> xVclWindowPeer = getVclWindowPeer(xFixedText);
+ if (bIsDark)
+ {
+ const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings();
+ Color aLabelTextColor = aStyleSettings.GetLabelTextColor();
+ setPropertyTextColor(xVclWindowPeer, aLabelTextColor.GetColor());
+ }
+ else
+ {
+ util::Color aLabelColor = xFixedText->getCharColor();
+ setPropertyTextColor(xVclWindowPeer, aLabelColor);
+ }
+
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+ // XPropertyChangeListener
+ uno::Reference<awt::XControl> FixedTextColor::getXControl(const uno::Reference< report::XFixedText >& _xFixedText) throw(uno::RuntimeException)
+ {
+
+ uno::Reference<awt::XControl> xControl;
+ OReportController *pController = (OReportController *)&m_rReportController;
+
+ ::boost::shared_ptr<OReportModel> pModel = pController->getSdrModel();
+
+ uno::Reference<report::XSection> xSection(_xFixedText->getSection());
+ if ( xSection.is() )
+ {
+ OReportPage *pPage = pModel->getPage(xSection);
+ sal_uLong nIndex = pPage->getIndexOf(_xFixedText.get());
+ if (nIndex < pPage->GetObjCount() )
+ {
+ SdrObject *pObject = pPage->GetObj(nIndex);
+ OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject);
+ if ( pUnoObj ) // this doesn't need to be done for shapes
+ {
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = pController->getSectionWindow(xSection);
+ if (pSectionWindow != NULL)
+ {
+ OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice
+ OSectionView& aSdrView = aOutputDevice.getSectionView(); // SdrView
+ xControl = pUnoObj->GetUnoControl(aSdrView, aOutputDevice);
+ }
+ }
+ }
+ }
+ return xControl;
+ }
+
+// -----------------------------------------------------------------------------
+ uno::Reference<awt::XVclWindowPeer> FixedTextColor::getVclWindowPeer(const uno::Reference< report::XFixedText >& _xComponent) throw(uno::RuntimeException)
+ {
+ uno::Reference<awt::XVclWindowPeer> xVclWindowPeer;
+ uno::Reference<awt::XControl> xControl = getXControl(_xComponent);
+
+ xVclWindowPeer = uno::Reference<awt::XVclWindowPeer>( xControl->getPeer(), uno::UNO_QUERY);
+
+ return xVclWindowPeer;
+ }
+
+
+
+
+}
diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
new file mode 100644
index 000000000000..4a56a4392262
--- /dev/null
+++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * 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 <FormattedFieldBeautifier.hxx>
+
+#include <com/sun/star/report/XFormattedField.hpp>
+#include <com/sun/star/report/XImageControl.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/InvalidateStyle.hpp>
+
+#include <RptObject.hxx>
+#include <RptModel.hxx>
+#include <RptPage.hxx>
+#include <ViewsWindow.hxx>
+#include <ReportSection.hxx>
+#include <ReportController.hxx>
+#include <uistrings.hrc>
+#include <reportformula.hxx>
+#include <toolkit/helper/property.hxx>
+
+#include <svtools/extcolorcfg.hxx>
+#include <unotools/confignode.hxx>
+
+// DBG_*
+#include <tools/debug.hxx>
+// DBG_UNHANDLED_EXCEPTION
+#include <tools/diagnose_ex.h>
+
+namespace rptui
+{
+ using namespace ::com::sun::star;
+
+ DBG_NAME(rpt_FormattedFieldBeautifier)
+
+ //--------------------------------------------------------------------
+ FormattedFieldBeautifier::FormattedFieldBeautifier(const OReportController& _aController)
+ :m_rReportController(_aController)
+ ,m_nTextColor(-1)
+ {
+ DBG_CTOR(rpt_FormattedFieldBeautifier, NULL);
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 FormattedFieldBeautifier::getTextColor()
+ {
+ if (m_nTextColor == -1)
+ {
+ svtools::ExtendedColorConfig aConfig;
+ m_nTextColor = aConfig.GetColorValue(CFG_REPORTDESIGNER, DBTEXTBOXBOUNDCONTENT).getColor();
+ }
+ return m_nTextColor;
+ }
+
+ //--------------------------------------------------------------------
+ FormattedFieldBeautifier::~FormattedFieldBeautifier()
+ {
+ DBG_DTOR(rpt_FormattedFieldBeautifier,NULL);
+ }
+
+ // -----------------------------------------------------------------------------
+ void FormattedFieldBeautifier::setPlaceholderText( const uno::Reference< uno::XInterface >& _rxComponent )
+ {
+ ::rtl::OUString sDataField;
+
+ try
+ {
+ uno::Reference< report::XFormattedField > xControlModel( _rxComponent, uno::UNO_QUERY );
+ if ( xControlModel.is() )
+ {
+ sDataField = xControlModel->getDataField();
+
+ if ( sDataField.getLength() )
+ {
+ ReportFormula aFormula( sDataField );
+ bool bSet = true;
+ if ( aFormula.getType() == ReportFormula::Field )
+ {
+ const ::rtl::OUString sColumnName = aFormula.getFieldName();
+ ::rtl::OUString sLabel = m_rReportController.getColumnLabel_throw(sColumnName);
+ if ( sLabel.getLength() )
+ {
+ ::rtl::OUStringBuffer aBuffer;
+ aBuffer.appendAscii( "=" );
+ aBuffer.append( sLabel );
+ sDataField = aBuffer.makeStringAndClear();
+ bSet = false;
+ }
+ }
+ if ( bSet )
+ sDataField = aFormula.getEqualUndecoratedContent();
+ }
+ }
+
+ if ( xControlModel.is() )
+ setPlaceholderText( getVclWindowPeer( xControlModel.get() ), sDataField );
+ }
+ catch (uno::Exception)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ void FormattedFieldBeautifier::setPlaceholderText( const uno::Reference< awt::XVclWindowPeer >& _xVclWindowPeer, const ::rtl::OUString& _rText )
+ {
+ OSL_ENSURE( _xVclWindowPeer.is(), "FormattedFieldBeautifier::setPlaceholderText: invalid peer!" );
+ if ( !_xVclWindowPeer.is() )
+ throw uno::RuntimeException();
+
+ // the actual text
+ _xVclWindowPeer->setProperty(PROPERTY_TEXT, uno::makeAny(_rText));
+ // the text color
+ _xVclWindowPeer->setProperty(PROPERTY_TEXTCOLOR, uno::makeAny(getTextColor()));
+ // font->italic
+ uno::Any aFontDescriptor = _xVclWindowPeer->getProperty(PROPERTY_FONTDESCRIPTOR);
+ awt::FontDescriptor aFontDescriptorStructure;
+ aFontDescriptor >>= aFontDescriptorStructure;
+ aFontDescriptorStructure.Slant = ::com::sun::star::awt::FontSlant_ITALIC;
+ _xVclWindowPeer->setProperty(PROPERTY_FONTDESCRIPTOR, uno::makeAny(aFontDescriptorStructure));
+ }
+
+ // -----------------------------------------------------------------------------
+ void FormattedFieldBeautifier::notifyPropertyChange( const beans::PropertyChangeEvent& _rEvent )
+ {
+ if ( !_rEvent.PropertyName.equalsAscii( "DataField" ) )
+ // not interested in
+ return;
+
+ setPlaceholderText( _rEvent.Source );
+ }
+
+ // -----------------------------------------------------------------------------
+ void FormattedFieldBeautifier::handle( const uno::Reference< uno::XInterface >& _rxElement )
+ {
+ setPlaceholderText( _rxElement );
+ }
+
+ // -----------------------------------------------------------------------------
+ void FormattedFieldBeautifier::notifyElementInserted( const uno::Reference< uno::XInterface >& _rxElement )
+ {
+ handle( _rxElement );
+ }
+
+ // -----------------------------------------------------------------------------
+ uno::Reference<awt::XVclWindowPeer> FormattedFieldBeautifier::getVclWindowPeer(const uno::Reference< report::XReportComponent >& _xComponent) throw(uno::RuntimeException)
+ {
+ uno::Reference<awt::XVclWindowPeer> xVclWindowPeer;
+
+ ::boost::shared_ptr<OReportModel> pModel = const_cast< OReportController& >( m_rReportController ).getSdrModel();
+
+ uno::Reference<report::XSection> xSection(_xComponent->getSection());
+ if ( xSection.is() )
+ {
+ OReportPage *pPage = pModel->getPage(xSection);
+ sal_uLong nIndex = pPage->getIndexOf(_xComponent);
+ if (nIndex < pPage->GetObjCount() )
+ {
+ SdrObject *pObject = pPage->GetObj(nIndex);
+ OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject);
+ if ( pUnoObj ) // this doesn't need to be done for shapes
+ {
+ // Rectangle aRect = pUnoObj->GetCurrentBoundRect();
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_rReportController.getSectionWindow(xSection);
+ if (pSectionWindow != NULL)
+ {
+ OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice
+ OSectionView& aSdrView = aOutputDevice.getSectionView(); // SdrView
+ uno::Reference<awt::XControl> xControl = pUnoObj->GetUnoControl(aSdrView, aOutputDevice);
+ xVclWindowPeer = uno::Reference<awt::XVclWindowPeer>( xControl->getPeer(), uno::UNO_QUERY);
+ }
+ }
+ }
+ }
+ return xVclWindowPeer;
+ }
+}
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
new file mode 100644
index 000000000000..ae8967394c59
--- /dev/null
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -0,0 +1,4421 @@
+/*************************************************************************
+ *
+ * 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"
+
+#define RPTUI_ID_LRSPACE 1
+#define RPTUI_ID_ULSPACE 2
+#define RPTUI_ID_PAGE 3
+#define RPTUI_ID_SIZE 4
+#define RPTUI_ID_PAGE_MODE 5
+#define RPTUI_ID_START 6
+#define RPTUI_ID_END 7
+#define RPTUI_ID_BRUSH 8
+#define RPTUI_ID_METRIC 9
+
+#define ITEMID_LRSPACE RPTUI_ID_LRSPACE
+#define ITEMID_ULSPACE RPTUI_ID_ULSPACE
+#define ITEMID_SIZE RPTUI_ID_SIZE
+#define ITEMID_PAGE RPTUI_ID_PAGE
+#define ITEMID_BRUSH RPTUI_ID_BRUSH
+
+
+#include "ReportController.hxx"
+#include "ReportDefinition.hxx"
+#include "CondFormat.hxx"
+#include "UITools.hxx"
+#include "AddField.hxx"
+#include <toolkit/helper/vclunohelper.hxx>
+#include "DateTime.hxx"
+
+#include <sfx2/filedlghelper.hxx>
+#include <tools/string.hxx>
+#include <tools/diagnose_ex.h>
+#include "rptui_slotid.hrc"
+#include "reportformula.hxx"
+
+#include <comphelper/documentconstants.hxx>
+#include <comphelper/mediadescriptor.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/types.hxx>
+
+#include <connectivity/dbtools.hxx>
+#include <com/sun/star/view/PaperFormat.hpp>
+#include <com/sun/star/style/GraphicLocation.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/report/XImageControl.hpp>
+#include <com/sun/star/report/XFixedLine.hpp>
+#include <com/sun/star/report/Function.hpp>
+#include <com/sun/star/report/XShape.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+#include <com/sun/star/sdb/XParametersSupplier.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/EmbedMapUnits.hpp>
+#include <comphelper/streamsection.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/frame/status/FontHeight.hpp>
+#include <com/sun/star/report/XFormattedField.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
+
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/waitobj.hxx>
+
+#include <svx/fmview.hxx>
+#include <editeng/paperinf.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdobj.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <editeng/svxenum.hxx>
+#include <svx/pageitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <svx/zoomitem.hxx>
+#include <svx/zoomslideritem.hxx>
+#include <editeng/brshitem.hxx>
+#include <svx/flagsdef.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/zoom_def.hxx>
+#include <svx/dialogs.hrc>
+
+#include "DesignView.hxx"
+#include "ModuleHelper.hxx"
+#include "RptObject.hxx"
+#include "RptUndo.hxx"
+#include "uistrings.hrc"
+#include "RptDef.hxx"
+#include "ReportSection.hxx"
+#include "SectionView.hxx"
+#include "UndoActions.hxx"
+#include "dlgpage.hxx"
+#include "RptResId.hrc"
+
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/aeitem.hxx>
+#include <svtools/cliplistener.hxx>
+#include <unotools/syslocale.hxx>
+#include <unotools/viewoptions.hxx>
+
+#include <vos/mutex.hxx>
+#include "PropertyForward.hxx"
+#include "SectionWindow.hxx"
+
+#include <toolkit/helper/convert.hxx>
+#include "GroupsSorting.hxx"
+#include "PageNumber.hxx"
+#include <toolkit/helper/vclunohelper.hxx>
+#include "UndoEnv.hxx"
+#include "InsertFunctions.hxx"
+#include "ReportControllerObserver.hxx"
+
+#include <boost/mem_fn.hpp>
+#include <boost/bind.hpp>
+#include <boost/utility.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <cppuhelper/exc_hlp.hxx>
+#include <unotools/confignode.hxx>
+#include <helpids.hrc>
+
+#include <ReportControllerObserver.hxx>
+
+#define MAX_ROWS_FOR_PREVIEW 20
+
+using namespace ::com::sun::star;
+using namespace uno;
+using namespace io;
+using namespace beans;
+using namespace frame;
+using namespace util;
+using namespace lang;
+using namespace container;
+using namespace sdbcx;
+using namespace sdbc;
+using namespace sdb;
+using namespace ui;
+using namespace ui::dialogs;
+using namespace util;
+using namespace ::dbtools;
+using namespace ::rptui;
+using namespace ::dbaui;
+using namespace ::comphelper;
+using namespace ::cppu;
+
+// -----------------------------------------------------------------------------
+namespace
+{
+ // comparing two PropertyValue instances
+ struct PropertyValueCompare : public ::std::binary_function< beans::PropertyValue, ::rtl::OUString , bool >
+ {
+ bool operator() (const beans::PropertyValue& x, const ::rtl::OUString& y) const
+ {
+ return x.Name.equals(y);// ? true : false;
+ }
+ bool operator() (const ::rtl::OUString& x,const beans::PropertyValue& y) const
+ {
+ return x.equals(y.Name);// ? true : false;
+ }
+ };
+
+ void lcl_setFontWPU_nothrow(const uno::Reference< report::XReportControlFormat>& _xReportControlFormat,const sal_Int32 _nId)
+ {
+ if ( _xReportControlFormat.is() )
+ {
+ try
+ {
+ awt::FontDescriptor aFontDescriptor = _xReportControlFormat->getFontDescriptor();
+ switch(_nId)
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ aFontDescriptor.Weight = (awt::FontWeight::NORMAL + awt::FontWeight::BOLD) - aFontDescriptor.Weight;
+ break;
+ case SID_ATTR_CHAR_POSTURE:
+ aFontDescriptor.Slant = static_cast<awt::FontSlant>(static_cast<sal_Int16>(awt::FontSlant_ITALIC) - static_cast<sal_Int16>(aFontDescriptor.Slant));
+ break;
+ case SID_ATTR_CHAR_UNDERLINE:
+ aFontDescriptor.Underline = awt::FontUnderline::SINGLE - aFontDescriptor.Underline;
+ break;
+ default:
+ OSL_ENSURE(0,"Illegal value in default!");
+ break;
+ }
+
+ _xReportControlFormat->setFontDescriptor(aFontDescriptor);
+ }
+ catch(beans::UnknownPropertyException&)
+ {
+ }
+ } // if ( xReportControlFormat.is() )
+ }
+}
+
+// -----------------------------------------------------------------------------
+void lcl_getReportControlFormat(const Sequence< PropertyValue >& aArgs,
+ ODesignView* _pView,
+ uno::Reference< awt::XWindow>& _xWindow,
+ ::std::vector< uno::Reference< uno::XInterface > >& _rControlsFormats)
+{
+ uno::Reference< report::XReportControlFormat> xReportControlFormat;
+ if ( aArgs.getLength() )
+ {
+ SequenceAsHashMap aMap(aArgs);
+ xReportControlFormat = aMap.getUnpackedValueOrDefault(REPORTCONTROLFORMAT,uno::Reference< report::XReportControlFormat>());
+ _xWindow = aMap.getUnpackedValueOrDefault(CURRENT_WINDOW,uno::Reference< awt::XWindow>());
+ }
+
+ if ( !xReportControlFormat.is() )
+ {
+ _pView->fillControlModelSelection(_rControlsFormats);
+ }
+ else
+ {
+ _rControlsFormats.push_back(xReportControlFormat);
+ }
+
+ if ( !_xWindow.is() )
+ _xWindow = VCLUnoHelper::GetInterface(_pView);
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OReportController::getImplementationName() throw( RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString OReportController::getImplementationName_Static() throw( RuntimeException )
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.comp.ReportDesign"));
+}
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString> OReportController::getSupportedServiceNames_Static(void) throw( RuntimeException )
+{
+ Sequence< ::rtl::OUString> aSupported(1);
+ aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.ReportDesign"));
+ return aSupported;
+}
+//-------------------------------------------------------------------------
+Sequence< ::rtl::OUString> SAL_CALL OReportController::getSupportedServiceNames() throw(RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+// -------------------------------------------------------------------------
+Reference< XInterface > OReportController::create(Reference< XComponentContext > const & xContext)
+{
+ return *(new OReportController(xContext));
+}
+
+#define PROPERTY_ID_ZOOMVALUE 1
+
+DBG_NAME( rpt_OReportController )
+// -----------------------------------------------------------------------------
+OReportController::OReportController(Reference< XComponentContext > const & xContext)
+ :OReportController_BASE(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY))
+ ,OPropertyStateContainer(OGenericUnoController_Base::rBHelper)
+ ,m_aSelectionListeners( getMutex() )
+ ,m_pClipbordNotifier(NULL)
+ ,m_pGroupsFloater(NULL)
+ ,m_xContext(xContext)
+ ,m_nSplitPos(-1)
+ ,m_nPageNum(-1)
+ ,m_nSelectionCount(0)
+ ,m_nZoomValue(100)
+ ,m_eZoomType(SVX_ZOOM_PERCENT)
+ ,m_bShowRuler(sal_True)
+ ,m_bGridVisible(sal_True)
+ ,m_bGridUse(sal_True)
+ ,m_bShowProperties(sal_True)
+ ,m_bGroupFloaterWasVisible(sal_False)
+ ,m_bHelplinesMove(sal_True)
+ ,m_bChartEnabled(false)
+ ,m_bChartEnabledAsked(false)
+ ,m_bInGeneratePreview(false)
+{
+ // new Observer
+ m_pReportControllerObserver = new OXReportControllerObserver(*this);
+ m_pReportControllerObserver->acquire();
+
+ m_sMode = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("normal"));
+ DBG_CTOR( rpt_OReportController,NULL);
+ registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZoomValue")),PROPERTY_ID_ZOOMVALUE,beans::PropertyAttribute::BOUND| beans::PropertyAttribute::TRANSIENT,&m_nZoomValue,::getCppuType(reinterpret_cast< sal_Int16*>(NULL)));
+
+}
+// -----------------------------------------------------------------------------
+OReportController::~OReportController()
+{
+ DBG_DTOR( rpt_OReportController,NULL);
+}
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XTYPEPROVIDER2(OReportController,OReportController_BASE,OReportController_Listener)
+IMPLEMENT_FORWARD_XINTERFACE2(OReportController,OReportController_BASE,OReportController_Listener)
+// -----------------------------------------------------------------------------
+void OReportController::disposing()
+{
+
+ if ( m_pClipbordNotifier )
+ {
+ m_pClipbordNotifier->ClearCallbackLink();
+ m_pClipbordNotifier->AddRemoveListener( getView(), sal_False );
+ m_pClipbordNotifier->release();
+ m_pClipbordNotifier = NULL;
+ } // if ( getView() && m_pClipbordNotifier )
+ if ( m_pGroupsFloater )
+ {
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_GROUPS_SORTING ) );
+ aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pGroupsFloater->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) );
+ ::std::auto_ptr<FloatingWindow> aTemp(m_pGroupsFloater);
+ m_pGroupsFloater = NULL;
+ }
+
+ try
+ {
+ m_xHoldAlive.clear();
+ m_xColumns.clear();
+ ::comphelper::disposeComponent( m_xRowSet );
+ ::comphelper::disposeComponent( m_xRowSetMediator );
+ ::comphelper::disposeComponent( m_xFormatter );
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught while disposing row sets.");
+ }
+ m_xRowSet.clear();
+ m_xRowSetMediator.clear();
+
+ if ( m_xReportDefinition.is() )
+ {
+ try
+ {
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow;
+ if ( getDesignView() )
+ pSectionWindow = getDesignView()->getMarkedSection();
+ if ( pSectionWindow )
+ pSectionWindow->getReportSection().deactivateOle();
+ clearUndoManager();
+ if ( m_aReportModel )
+ listen(false);
+ m_pReportControllerObserver->Clear();
+ m_pReportControllerObserver->release();
+ }
+ catch ( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ {
+ EventObject aDisposingEvent( *this );
+ m_aSelectionListeners.disposeAndClear( aDisposingEvent );
+ }
+
+ OReportController_BASE::disposing();
+
+
+ try
+ {
+ m_xReportDefinition.clear();
+ m_aReportModel.reset();
+ m_xFrameLoader.clear();
+ m_xReportEngine.clear();
+ }
+ catch(uno::Exception&)
+ {
+ }
+ if ( getDesignView() )
+ EndListening( *getDesignView() );
+ clearView();
+}
+// -----------------------------------------------------------------------------
+FeatureState OReportController::GetState(sal_uInt16 _nId) const
+{
+ FeatureState aReturn;
+ // (disabled automatically)
+ aReturn.bEnabled = sal_False;
+ // check this first
+ if ( !getView() )
+ return aReturn;
+
+ switch (_nId)
+ {
+ case SID_RPT_TEXTDOCUMENT:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = (m_xReportDefinition.is() && m_xReportDefinition->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_TEXT);
+ break;
+ case SID_RPT_SPREADSHEET:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = (m_xReportDefinition.is() && m_xReportDefinition->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET);
+ break;
+ case SID_REPORTHEADER_WITHOUT_UNDO:
+ case SID_REPORTFOOTER_WITHOUT_UNDO:
+ case SID_REPORTHEADERFOOTER:
+ {
+ aReturn.bEnabled = isEditable();
+ ::rtl::OUString sText = String(ModuleRes((m_xReportDefinition.is() && m_xReportDefinition->getReportHeaderOn()) ? RID_STR_REPORTHEADERFOOTER_DELETE : RID_STR_REPORTHEADERFOOTER_INSERT));
+ aReturn.sTitle = sText;
+ }
+ break;
+ case SID_PAGEHEADER_WITHOUT_UNDO:
+ case SID_PAGEFOOTER_WITHOUT_UNDO:
+ case SID_PAGEHEADERFOOTER:
+ {
+ aReturn.bEnabled = isEditable();
+ ::rtl::OUString sText = String(ModuleRes((m_xReportDefinition.is() && m_xReportDefinition->getPageHeaderOn()) ? RID_STR_PAGEHEADERFOOTER_DELETE : RID_STR_PAGEHEADERFOOTER_INSERT));
+ aReturn.sTitle = sText;
+ }
+ break;
+ case SID_GROUP_APPEND:
+ case SID_GROUP_REMOVE:
+ case SID_GROUPHEADER_WITHOUT_UNDO:
+ case SID_GROUPHEADER:
+ case SID_GROUPFOOTER_WITHOUT_UNDO:
+ case SID_GROUPFOOTER:
+ aReturn.bEnabled = isEditable();
+ break;
+ case SID_ADD_CONTROL_PAIR:
+ aReturn.bEnabled = isEditable();
+ break;
+ case SID_REDO:
+ case SID_UNDO:
+ {
+ size_t ( SfxUndoManager::*retrieveCount )( bool const ) const =
+ ( _nId == SID_UNDO ) ? &SfxUndoManager::GetUndoActionCount : &SfxUndoManager::GetRedoActionCount;
+
+ SfxUndoManager& rUndoManager( getUndoManager() );
+ aReturn.bEnabled = ( rUndoManager.*retrieveCount )( ::svl::IUndoManager::TopLevel ) > 0;
+ if ( aReturn.bEnabled )
+ {
+ // TODO: add "Undo/Redo: prefix"
+ String ( SfxUndoManager::*retrieveComment )( size_t, bool const ) const =
+ ( _nId == SID_UNDO ) ? &SfxUndoManager::GetUndoActionComment : &SfxUndoManager::GetRedoActionComment;
+ aReturn.sTitle = (rUndoManager.*retrieveComment)( 0, ::svl::IUndoManager::TopLevel );
+ }
+ }
+ break;
+ case SID_OBJECT_RESIZING:
+ case SID_OBJECT_SMALLESTWIDTH:
+ case SID_OBJECT_SMALLESTHEIGHT:
+ case SID_OBJECT_GREATESTWIDTH:
+ case SID_OBJECT_GREATESTHEIGHT:
+ aReturn.bEnabled = isEditable() && getDesignView()->HasSelection();// && getDesignView()->isAlignPossible();
+ if ( aReturn.bEnabled )
+ aReturn.bEnabled = m_nSelectionCount > 1;
+ break;
+
+ case SID_DISTRIBUTION:
+ aReturn.bEnabled = isEditable() && getDesignView()->HasSelection();
+ if ( aReturn.bEnabled )
+ {
+ OSectionView* pSectionView = getCurrentSectionView();
+ aReturn.bEnabled = pSectionView && pSectionView->GetMarkedObjectCount() > 2;
+ }
+ break;
+ case SID_ARRANGEMENU:
+ case SID_FRAME_DOWN:
+ case SID_FRAME_UP:
+ case SID_FRAME_TO_TOP:
+ case SID_FRAME_TO_BOTTOM:
+ case SID_OBJECT_HEAVEN:
+ case SID_OBJECT_HELL:
+ aReturn.bEnabled = isEditable() && getDesignView()->HasSelection();
+ if ( aReturn.bEnabled )
+ {
+ OSectionView* pSectionView = getCurrentSectionView();
+ aReturn.bEnabled = pSectionView && pSectionView->OnlyShapesMarked();
+ if ( aReturn.bEnabled )
+ {
+ if ( SID_OBJECT_HEAVEN == _nId )
+ aReturn.bEnabled = pSectionView->GetLayerIdOfMarkedObjects() != RPT_LAYER_FRONT;
+ else if ( SID_OBJECT_HELL == _nId )
+ aReturn.bEnabled = pSectionView->GetLayerIdOfMarkedObjects() != RPT_LAYER_BACK;
+ }
+ }
+ break;
+
+ case SID_SECTION_SHRINK:
+ case SID_SECTION_SHRINK_TOP:
+ case SID_SECTION_SHRINK_BOTTOM:
+ {
+ sal_Int32 nCount = 0;
+ uno::Reference<report::XSection> xSection = getDesignView()->getCurrentSection();
+ if ( xSection.is() )
+ {
+ nCount = xSection->getCount();
+ }
+ aReturn.bEnabled = isEditable() && nCount > 0;
+ }
+ break;
+ case SID_OBJECT_ALIGN:
+ case SID_OBJECT_ALIGN_LEFT:
+ case SID_OBJECT_ALIGN_CENTER:
+ case SID_OBJECT_ALIGN_RIGHT:
+ case SID_OBJECT_ALIGN_UP:
+ case SID_OBJECT_ALIGN_MIDDLE:
+ case SID_OBJECT_ALIGN_DOWN:
+ case SID_SECTION_ALIGN:
+ case SID_SECTION_ALIGN_LEFT:
+ case SID_SECTION_ALIGN_CENTER:
+ case SID_SECTION_ALIGN_RIGHT:
+ case SID_SECTION_ALIGN_UP:
+ case SID_SECTION_ALIGN_MIDDLE:
+ case SID_SECTION_ALIGN_DOWN:
+ aReturn.bEnabled = isEditable() && getDesignView()->HasSelection();// && getDesignView()->isAlignPossible();
+ break;
+ case SID_CUT:
+ aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId);
+ break;
+ case SID_COPY:
+ aReturn.bEnabled = getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId);
+ break;
+ case SID_PASTE:
+ aReturn.bEnabled = isEditable() && !getDesignView()->isHandleEvent(_nId) && getDesignView()->IsPasteAllowed();
+ break;
+ case SID_SELECTALL:
+ aReturn.bEnabled = !getDesignView()->isHandleEvent(_nId);
+ break;
+ case SID_SELECTALL_IN_SECTION:
+ aReturn.bEnabled = !getDesignView()->isHandleEvent(_nId);
+ if ( aReturn.bEnabled )
+ aReturn.bEnabled = getCurrentSectionView() != NULL;
+ break;
+ case SID_ESCAPE:
+ aReturn.bEnabled = getDesignView()->GetMode() == RPTUI_INSERT;
+ break;
+ case SID_TERMINATE_INPLACEACTIVATION:
+ aReturn.bEnabled = sal_True;
+ break;
+ case SID_SELECT_ALL_EDITS:
+ case SID_SELECT_ALL_LABELS:
+ aReturn.bEnabled = sal_True;
+ break;
+ case SID_RPT_NEW_FUNCTION:
+ aReturn.bEnabled = isEditable();
+ break;
+ case SID_COLLAPSE_SECTION:
+ case SID_EXPAND_SECTION:
+ case SID_NEXT_MARK:
+ case SID_PREV_MARK:
+ aReturn.bEnabled = isEditable() && !getDesignView()->isHandleEvent(_nId);
+ break;
+ case SID_SELECT:
+ case SID_SELECT_REPORT:
+ aReturn.bEnabled = sal_True;
+ break;
+ case SID_EXECUTE_REPORT:
+ aReturn.bEnabled = isConnected() && m_xReportDefinition.is();
+ break;
+ case SID_DELETE:
+ aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId);
+ if ( aReturn.bEnabled )
+ {
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
+ if ( pSectionWindow )
+ aReturn.bEnabled = !pSectionWindow->getReportSection().isUiActive();
+ }
+ {
+ ::rtl::OUString sText = String(ModuleRes(RID_STR_DELETE));
+ aReturn.sTitle = sText;
+ }
+ break;
+ case SID_GRID_VISIBLE:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = m_bGridVisible;
+ break;
+ case SID_GRID_USE:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = m_bGridUse;
+ break;
+ case SID_HELPLINES_MOVE:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = m_bHelplinesMove;
+ break;
+ case SID_RULER:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = m_bShowRuler;
+ break;
+ case SID_OBJECT_SELECT:
+ aReturn.bEnabled = sal_True;
+ aReturn.bChecked = getDesignView()->GetMode() == RPTUI_SELECT;
+ break;
+ case SID_INSERT_DIAGRAM:
+ aReturn.bEnabled = isEditable();
+ aReturn.bInvisible = optional< bool >(!m_bChartEnabled);
+ aReturn.bChecked = getDesignView()->GetInsertObj() == OBJ_OLE2;
+ break;
+ case SID_FM_FIXEDTEXT:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = getDesignView()->GetInsertObj() == OBJ_DLG_FIXEDTEXT;
+ break;
+ case SID_INSERT_HFIXEDLINE:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = getDesignView()->GetInsertObj() == OBJ_DLG_HFIXEDLINE;
+ break;
+ case SID_INSERT_VFIXEDLINE:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = getDesignView()->GetInsertObj() == OBJ_DLG_VFIXEDLINE;
+ break;
+ case SID_FM_EDIT:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = getDesignView()->GetInsertObj() == OBJ_DLG_FORMATTEDFIELD;
+ break;
+ case SID_FM_IMAGECONTROL:
+ aReturn.bEnabled = isEditable();
+ aReturn.bChecked = getDesignView()->GetInsertObj() == OBJ_DLG_IMAGECONTROL;
+ break;
+ case SID_DRAWTBX_CS_BASIC:
+ case SID_DRAWTBX_CS_BASIC1:
+ case SID_DRAWTBX_CS_BASIC2:
+ case SID_DRAWTBX_CS_BASIC3:
+ case SID_DRAWTBX_CS_BASIC4:
+ case SID_DRAWTBX_CS_BASIC5:
+ case SID_DRAWTBX_CS_BASIC6:
+ case SID_DRAWTBX_CS_BASIC7:
+ case SID_DRAWTBX_CS_BASIC8:
+ case SID_DRAWTBX_CS_BASIC9:
+ case SID_DRAWTBX_CS_BASIC10:
+ case SID_DRAWTBX_CS_BASIC11:
+ case SID_DRAWTBX_CS_BASIC12:
+ case SID_DRAWTBX_CS_BASIC13:
+ case SID_DRAWTBX_CS_BASIC14:
+ case SID_DRAWTBX_CS_BASIC15:
+ case SID_DRAWTBX_CS_BASIC16:
+ case SID_DRAWTBX_CS_BASIC17:
+ case SID_DRAWTBX_CS_BASIC18:
+ case SID_DRAWTBX_CS_BASIC19:
+ case SID_DRAWTBX_CS_BASIC20:
+ case SID_DRAWTBX_CS_BASIC21:
+ case SID_DRAWTBX_CS_BASIC22:
+ impl_fillCustomShapeState_nothrow("diamond",aReturn);
+ break;
+ case SID_DRAWTBX_CS_SYMBOL:
+ case SID_DRAWTBX_CS_SYMBOL1:
+ case SID_DRAWTBX_CS_SYMBOL2:
+ case SID_DRAWTBX_CS_SYMBOL3:
+ case SID_DRAWTBX_CS_SYMBOL4:
+ case SID_DRAWTBX_CS_SYMBOL5:
+ case SID_DRAWTBX_CS_SYMBOL6:
+ case SID_DRAWTBX_CS_SYMBOL7:
+ case SID_DRAWTBX_CS_SYMBOL8:
+ case SID_DRAWTBX_CS_SYMBOL9:
+ case SID_DRAWTBX_CS_SYMBOL10:
+ case SID_DRAWTBX_CS_SYMBOL11:
+ case SID_DRAWTBX_CS_SYMBOL12:
+ case SID_DRAWTBX_CS_SYMBOL13:
+ case SID_DRAWTBX_CS_SYMBOL14:
+ case SID_DRAWTBX_CS_SYMBOL15:
+ case SID_DRAWTBX_CS_SYMBOL16:
+ case SID_DRAWTBX_CS_SYMBOL17:
+ case SID_DRAWTBX_CS_SYMBOL18:
+ impl_fillCustomShapeState_nothrow("smiley",aReturn);
+ break;
+ case SID_DRAWTBX_CS_ARROW:
+ case SID_DRAWTBX_CS_ARROW1:
+ case SID_DRAWTBX_CS_ARROW2:
+ case SID_DRAWTBX_CS_ARROW3:
+ case SID_DRAWTBX_CS_ARROW4:
+ case SID_DRAWTBX_CS_ARROW5:
+ case SID_DRAWTBX_CS_ARROW6:
+ case SID_DRAWTBX_CS_ARROW7:
+ case SID_DRAWTBX_CS_ARROW8:
+ case SID_DRAWTBX_CS_ARROW9:
+ case SID_DRAWTBX_CS_ARROW10:
+ case SID_DRAWTBX_CS_ARROW11:
+ case SID_DRAWTBX_CS_ARROW12:
+ case SID_DRAWTBX_CS_ARROW13:
+ case SID_DRAWTBX_CS_ARROW14:
+ case SID_DRAWTBX_CS_ARROW15:
+ case SID_DRAWTBX_CS_ARROW16:
+ case SID_DRAWTBX_CS_ARROW17:
+ case SID_DRAWTBX_CS_ARROW18:
+ case SID_DRAWTBX_CS_ARROW19:
+ case SID_DRAWTBX_CS_ARROW20:
+ case SID_DRAWTBX_CS_ARROW21:
+ case SID_DRAWTBX_CS_ARROW22:
+ case SID_DRAWTBX_CS_ARROW23:
+ case SID_DRAWTBX_CS_ARROW24:
+ case SID_DRAWTBX_CS_ARROW25:
+ case SID_DRAWTBX_CS_ARROW26:
+ impl_fillCustomShapeState_nothrow("left-right-arrow",aReturn);
+ break;
+ case SID_DRAWTBX_CS_STAR:
+ case SID_DRAWTBX_CS_STAR1:
+ case SID_DRAWTBX_CS_STAR2:
+ case SID_DRAWTBX_CS_STAR3:
+ case SID_DRAWTBX_CS_STAR4:
+ case SID_DRAWTBX_CS_STAR5:
+ case SID_DRAWTBX_CS_STAR6:
+ case SID_DRAWTBX_CS_STAR7:
+ case SID_DRAWTBX_CS_STAR8:
+ case SID_DRAWTBX_CS_STAR9:
+ case SID_DRAWTBX_CS_STAR10:
+ case SID_DRAWTBX_CS_STAR11:
+ case SID_DRAWTBX_CS_STAR12:
+ impl_fillCustomShapeState_nothrow("star5",aReturn);
+ break;
+ case SID_DRAWTBX_CS_FLOWCHART:
+ case SID_DRAWTBX_CS_FLOWCHART1:
+ case SID_DRAWTBX_CS_FLOWCHART2:
+ case SID_DRAWTBX_CS_FLOWCHART3:
+ case SID_DRAWTBX_CS_FLOWCHART4:
+ case SID_DRAWTBX_CS_FLOWCHART5:
+ case SID_DRAWTBX_CS_FLOWCHART6:
+ case SID_DRAWTBX_CS_FLOWCHART7:
+ case SID_DRAWTBX_CS_FLOWCHART8:
+ case SID_DRAWTBX_CS_FLOWCHART9:
+ case SID_DRAWTBX_CS_FLOWCHART10:
+ case SID_DRAWTBX_CS_FLOWCHART11:
+ case SID_DRAWTBX_CS_FLOWCHART12:
+ case SID_DRAWTBX_CS_FLOWCHART13:
+ case SID_DRAWTBX_CS_FLOWCHART14:
+ case SID_DRAWTBX_CS_FLOWCHART15:
+ case SID_DRAWTBX_CS_FLOWCHART16:
+ case SID_DRAWTBX_CS_FLOWCHART17:
+ case SID_DRAWTBX_CS_FLOWCHART18:
+ case SID_DRAWTBX_CS_FLOWCHART19:
+ case SID_DRAWTBX_CS_FLOWCHART20:
+ case SID_DRAWTBX_CS_FLOWCHART21:
+ case SID_DRAWTBX_CS_FLOWCHART22:
+ case SID_DRAWTBX_CS_FLOWCHART23:
+ case SID_DRAWTBX_CS_FLOWCHART24:
+ case SID_DRAWTBX_CS_FLOWCHART25:
+ case SID_DRAWTBX_CS_FLOWCHART26:
+ case SID_DRAWTBX_CS_FLOWCHART27:
+ case SID_DRAWTBX_CS_FLOWCHART28:
+ impl_fillCustomShapeState_nothrow("flowchart-internal-storage",aReturn);
+ break;
+ case SID_DRAWTBX_CS_CALLOUT:
+ case SID_DRAWTBX_CS_CALLOUT1:
+ case SID_DRAWTBX_CS_CALLOUT2:
+ case SID_DRAWTBX_CS_CALLOUT3:
+ case SID_DRAWTBX_CS_CALLOUT4:
+ case SID_DRAWTBX_CS_CALLOUT5:
+ case SID_DRAWTBX_CS_CALLOUT6:
+ case SID_DRAWTBX_CS_CALLOUT7:
+ impl_fillCustomShapeState_nothrow("round-rectangular-callout",aReturn);
+ break;
+ case SID_RPT_SHOWREPORTEXPLORER:
+ aReturn.bEnabled = m_xReportDefinition.is();
+ aReturn.bChecked = getDesignView() && getDesignView()->isReportExplorerVisible();
+ break;
+ case SID_FM_ADD_FIELD:
+ aReturn.bEnabled = isConnected() && isEditable() && m_xReportDefinition.is()
+ && m_xReportDefinition->getCommand().getLength();
+ aReturn.bChecked = getDesignView() && getDesignView()->isAddFieldVisible();
+ break;
+ case SID_SHOW_PROPERTYBROWSER:
+ aReturn.bEnabled = sal_True;
+ aReturn.bChecked = m_bShowProperties;
+ break;
+ case SID_PROPERTYBROWSER_LAST_PAGE:
+ aReturn.bEnabled = sal_True;
+ aReturn.aValue <<= m_sLastActivePage;
+ break;
+ case SID_SPLIT_POSITION:
+ aReturn.bEnabled = sal_True;
+ aReturn.aValue <<= getSplitPos();
+ break;
+ case SID_SAVEDOC:
+ aReturn.bEnabled = impl_isModified() && isEditable();
+ break;
+ case SID_SAVEASDOC:
+ aReturn.bEnabled = isConnected() && isEditable();
+ break;
+ case SID_EDITDOC:
+ aReturn.bChecked = isEditable();
+ break;
+ case SID_PAGEDIALOG:
+ aReturn.bEnabled = isEditable();
+ break;
+ case SID_BACKGROUND_COLOR:
+ impl_fillState_nothrow(PROPERTY_CONTROLBACKGROUND,aReturn);
+ break;
+ case SID_ATTR_CHAR_COLOR_BACKGROUND:
+ aReturn.bEnabled = isEditable();
+ {
+ uno::Reference<report::XSection> xSection = getDesignView()->getCurrentSection();
+ if ( xSection.is() )
+ try
+ {
+ aReturn.aValue <<= xSection->getBackColor();
+ const uno::Reference< report::XReportControlModel> xControlModel(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
+ aReturn.bEnabled = !xControlModel.is();
+ }
+ catch(beans::UnknownPropertyException&)
+ {
+ }
+ else
+ aReturn.bEnabled = sal_False;
+ }
+ break;
+ case SID_SORTINGANDGROUPING:
+ aReturn.bEnabled = sal_True;
+ aReturn.bChecked = m_pGroupsFloater && m_pGroupsFloater->IsVisible();
+ break;
+ case SID_ATTR_CHAR_WEIGHT:
+ case SID_ATTR_CHAR_POSTURE:
+ case SID_ATTR_CHAR_UNDERLINE:
+ impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR,aReturn);
+ if ( aReturn.bEnabled )
+ {
+ awt::FontDescriptor aFontDescriptor;
+ aReturn.aValue >>= aFontDescriptor;
+ aReturn.aValue.clear();
+
+ switch(_nId)
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ aReturn.bChecked = awt::FontWeight::BOLD == aFontDescriptor.Weight;
+ break;
+ case SID_ATTR_CHAR_POSTURE:
+ aReturn.bChecked = awt::FontSlant_ITALIC == aFontDescriptor.Slant;
+ break;
+ case SID_ATTR_CHAR_UNDERLINE:
+ aReturn.bChecked = awt::FontUnderline::SINGLE == aFontDescriptor.Underline;
+ break;
+ default:
+ ;
+ } // switch(_nCommand)
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR:
+ case SID_ATTR_CHAR_COLOR2:
+ impl_fillState_nothrow(PROPERTY_CHARCOLOR,aReturn);
+ break;
+ case SID_ATTR_CHAR_FONT:
+ impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR,aReturn);
+ break;
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ impl_fillState_nothrow(PROPERTY_CHARHEIGHT,aReturn);
+ if ( aReturn.aValue.hasValue() )
+ {
+ frame::status::FontHeight aFontHeight;
+ aReturn.aValue >>= aFontHeight.Height;
+ aReturn.aValue <<= aFontHeight; // another type is needed here, so
+ }
+ break;
+ case SID_ATTR_PARA_ADJUST_LEFT:
+ case SID_ATTR_PARA_ADJUST_CENTER:
+ case SID_ATTR_PARA_ADJUST_RIGHT:
+ case SID_ATTR_PARA_ADJUST_BLOCK:
+ impl_fillState_nothrow(PROPERTY_PARAADJUST,aReturn);
+ if ( aReturn.bEnabled )
+ {
+ ::sal_Int16 nParaAdjust = 0;
+ if ( aReturn.aValue >>= nParaAdjust )
+ {
+ switch(nParaAdjust)
+ {
+ case style::ParagraphAdjust_LEFT:
+ aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_LEFT;
+ break;
+ case style::ParagraphAdjust_RIGHT:
+ aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_RIGHT;
+ break;
+ case style::ParagraphAdjust_BLOCK:
+ case style::ParagraphAdjust_STRETCH:
+ aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_BLOCK;
+ break;
+ case style::ParagraphAdjust_CENTER:
+ aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_CENTER;
+ break;
+ }
+ } // if ( aReturn.aValue >>= nParaAdjust )
+ aReturn.aValue.clear();
+ }
+ break;
+
+ case SID_INSERT_GRAPHIC:
+ aReturn.bEnabled = m_xReportDefinition.is() && isEditable() && getDesignView()->getCurrentSection().is();
+ break;
+ case SID_CHAR_DLG:
+ case SID_SETCONTROLDEFAULTS:
+ aReturn.bEnabled = m_xReportDefinition.is() && isEditable();// && getDesignView()->getCurrentControlModel().is();
+ if ( aReturn.bEnabled )
+ {
+ ::std::vector< uno::Reference< uno::XInterface > > aSelection;
+ getDesignView()->fillControlModelSelection(aSelection);
+ ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aSelection.begin();
+ for(; aIter != aSelection.end()
+ && !uno::Reference< report::XFixedLine >(*aIter,uno::UNO_QUERY).is()
+ && !uno::Reference< report::XImageControl >(*aIter,uno::UNO_QUERY).is()
+ && uno::Reference< report::XReportControlFormat >(*aIter,uno::UNO_QUERY).is() ;++aIter)
+ ;
+ aReturn.bEnabled = !aSelection.empty() && aIter == aSelection.end();
+ }
+ break;
+ case SID_CONDITIONALFORMATTING:
+ {
+ const uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
+ aReturn.bEnabled = xFormattedField.is();
+ }
+ break;
+ case SID_INSERT_FLD_PGNUMBER:
+ case SID_DATETIME:
+ aReturn.bEnabled = m_xReportDefinition.is() && isEditable() && getDesignView()->getCurrentSection().is();
+ break;
+ case SID_EXPORTDOC:
+ case SID_EXPORTDOCASPDF:
+ aReturn.bEnabled = m_xReportDefinition.is();
+ break;
+ case SID_PRINTPREVIEW:
+ aReturn.bEnabled = sal_False;
+ break;
+ case SID_ATTR_ZOOM:
+ aReturn.bEnabled = sal_True;
+ {
+ SvxZoomItem aZoom(m_eZoomType,m_nZoomValue);
+ aZoom.SetValueSet(SVX_ZOOM_ENABLE_50|SVX_ZOOM_ENABLE_75|SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_200);
+ aZoom.QueryValue(aReturn.aValue);
+ //aReturn.sTitle = ::rtl::OUString::valueOf((sal_Int32)m_nZoomValue);
+ }
+ break;
+ case SID_ATTR_ZOOMSLIDER:
+ aReturn.bEnabled = sal_True;
+ {
+ SvxZoomSliderItem aZoomSlider(m_nZoomValue,20,400);
+ aZoomSlider.AddSnappingPoint(50);
+ aZoomSlider.AddSnappingPoint(75);
+ aZoomSlider.AddSnappingPoint(100);
+ aZoomSlider.AddSnappingPoint(200);
+ aZoomSlider.QueryValue(aReturn.aValue);
+ //aReturn.sTitle = ::rtl::OUString::valueOf((sal_Int32)m_nZoomValue);
+ }
+ break;
+ default:
+ aReturn = OReportController_BASE::GetState(_nId);
+ }
+ return aReturn;
+}
+
+// -----------------------------------------------------------------------------
+namespace
+{
+ /** extracts a background color from a dispatched SID_BACKGROUND_COLOR call
+
+ The dispatch might originate from either the toolbar, or the conditional
+ formatting dialog. In both cases, argument formats are different.
+ */
+ util::Color lcl_extractBackgroundColor( const Sequence< PropertyValue >& _rDispatchArgs )
+ {
+ util::Color aColor( COL_TRANSPARENT );
+ if ( _rDispatchArgs.getLength() == 1 )
+ {
+ OSL_VERIFY( _rDispatchArgs[0].Value >>= aColor );
+ }
+ else
+ {
+ SequenceAsHashMap aMap( _rDispatchArgs );
+ aColor = aMap.getUnpackedValueOrDefault( PROPERTY_FONTCOLOR, aColor );
+ }
+ return aColor;
+ }
+}
+
+// -----------------------------------------------------------------------------
+void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ sal_Bool bForceBroadcast = sal_False;
+ switch(_nId)
+ {
+ case SID_RPT_TEXTDOCUMENT:
+ if ( m_xReportDefinition.is() )
+ m_xReportDefinition->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_TEXT );
+ break;
+ case SID_RPT_SPREADSHEET:
+ if (m_xReportDefinition.is() )
+ m_xReportDefinition->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET );
+ break;
+ case SID_REPORTHEADER_WITHOUT_UNDO:
+ case SID_REPORTFOOTER_WITHOUT_UNDO:
+ case SID_REPORTHEADERFOOTER:
+ switchReportSection(_nId);
+ break;
+ case SID_PAGEHEADER_WITHOUT_UNDO:
+ case SID_PAGEFOOTER_WITHOUT_UNDO:
+ case SID_PAGEHEADERFOOTER:
+ switchPageSection(_nId);
+ break;
+ case SID_GROUP_APPEND:
+ case SID_GROUP_REMOVE:
+ modifyGroup(_nId == SID_GROUP_APPEND,aArgs);
+ break;
+ case SID_GROUPHEADER_WITHOUT_UNDO:
+ case SID_GROUPHEADER:
+ createGroupSection(SID_GROUPHEADER == _nId,true,aArgs);
+ break;
+ case SID_GROUPFOOTER_WITHOUT_UNDO:
+ case SID_GROUPFOOTER:
+ createGroupSection(SID_GROUPFOOTER == _nId,false,aArgs);
+ break;
+ case SID_ADD_CONTROL_PAIR:
+ addPairControls(aArgs);
+ break;
+ case SID_REDO:
+ case SID_UNDO:
+ {
+ const OXUndoEnvironment::OUndoMode aLock( m_aReportModel->GetUndoEnv() );
+ sal_Bool ( SfxUndoManager::*doXDo )() =
+ ( _nId == SID_UNDO ) ? &SfxUndoManager::Undo : &SfxUndoManager::Redo;
+
+ SfxUndoManager& rUndoManager( getUndoManager() );
+ (rUndoManager.*doXDo)();
+ InvalidateAll();
+ updateFloater();
+ }
+ break;
+ case SID_CUT:
+ executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION,::std::mem_fun(&ODesignView::Cut));
+ break;
+ case SID_COPY:
+ getDesignView()->Copy();
+ break;
+ case SID_PASTE:
+ executeMethodWithUndo(RID_STR_UNDO_PASTE,::std::mem_fun(&ODesignView::Paste));
+ break;
+
+ case SID_FRAME_TO_TOP:
+ case SID_FRAME_DOWN:
+ case SID_FRAME_UP:
+ case SID_FRAME_TO_BOTTOM:
+ case SID_OBJECT_HEAVEN:
+ case SID_OBJECT_HELL:
+ changeZOrder(_nId);
+ break;
+ case SID_DISTRIBUTION:
+ {
+ OSectionView* pSectionView = getCurrentSectionView();
+ if ( pSectionView )
+ pSectionView->DistributeMarkedObjects();
+ }
+ break;
+ case SID_OBJECT_SMALLESTWIDTH:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::WIDTH_SMALLEST);
+ break;
+ case SID_OBJECT_SMALLESTHEIGHT:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::HEIGHT_SMALLEST);
+ break;
+ case SID_OBJECT_GREATESTWIDTH:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::WIDTH_GREATEST);
+ break;
+ case SID_OBJECT_GREATESTHEIGHT:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::HEIGHT_GREATEST);
+ break;
+ case SID_SECTION_ALIGN_LEFT:
+ case SID_OBJECT_ALIGN_LEFT:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::LEFT,SID_SECTION_ALIGN_LEFT == _nId);
+ break;
+ case SID_SECTION_ALIGN_CENTER:
+ case SID_OBJECT_ALIGN_CENTER:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::CENTER_HORIZONTAL,SID_SECTION_ALIGN_CENTER == _nId);
+ break;
+ case SID_SECTION_ALIGN_RIGHT:
+ case SID_OBJECT_ALIGN_RIGHT:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::RIGHT,SID_SECTION_ALIGN_RIGHT == _nId);
+ break;
+ case SID_SECTION_ALIGN_UP:
+ case SID_OBJECT_ALIGN_UP:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::TOP,SID_SECTION_ALIGN_UP == _nId);
+ break;
+ case SID_SECTION_ALIGN_MIDDLE:
+ case SID_OBJECT_ALIGN_MIDDLE:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::CENTER_VERTICAL,SID_SECTION_ALIGN_MIDDLE == _nId);
+ break;
+ case SID_SECTION_ALIGN_DOWN:
+ case SID_OBJECT_ALIGN_DOWN:
+ alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::BOTTOM,SID_SECTION_ALIGN_DOWN == _nId);
+ break;
+
+ case SID_SECTION_SHRINK_BOTTOM:
+ case SID_SECTION_SHRINK_TOP:
+ case SID_SECTION_SHRINK:
+ {
+ uno::Reference<report::XSection> xSection = getDesignView()->getCurrentSection();
+ shrinkSection(RID_STR_UNDO_SHRINK, xSection, _nId);
+ }
+ break;
+
+ case SID_SELECTALL:
+ getDesignView()->SelectAll(OBJ_NONE);
+ break;
+ case SID_SELECTALL_IN_SECTION:
+ {
+ OSectionView* pSectionView = getCurrentSectionView();
+ if ( pSectionView )
+ pSectionView->MarkAll();
+ }
+ break;
+ case SID_ESCAPE:
+ getDesignView()->SetMode(RPTUI_SELECT);
+ InvalidateFeature( SID_OBJECT_SELECT );
+ break;
+ case SID_SELECT_ALL_EDITS:
+ getDesignView()->SelectAll(OBJ_DLG_FORMATTEDFIELD);
+ break;
+ case SID_SELECT_ALL_LABELS:
+ getDesignView()->SelectAll(OBJ_DLG_FIXEDTEXT);
+ break;
+ case SID_TERMINATE_INPLACEACTIVATION:
+ {
+ ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection();
+ if ( pSection )
+ pSection->getReportSection().deactivateOle();
+ }
+ break;
+ case SID_SELECT:
+ if ( aArgs.getLength() == 1 )
+ select(aArgs[0].Value);
+ break;
+ case SID_SELECT_REPORT:
+ select(uno::makeAny(m_xReportDefinition));
+ break;
+ case SID_EXECUTE_REPORT:
+ /*m_nExecuteReportEvent = */getView()->PostUserEvent(LINK(this, OReportController,OnExecuteReport));
+ break;
+ case SID_RPT_NEW_FUNCTION:
+ createNewFunction(aArgs[0].Value);
+ break;
+ case SID_COLLAPSE_SECTION:
+ collapseSection(true);
+ break;
+ case SID_EXPAND_SECTION:
+ collapseSection(false);
+ break;
+ case SID_NEXT_MARK:
+ markSection(true);
+ break;
+ case SID_PREV_MARK:
+ markSection(false);
+ break;
+ case SID_DELETE:
+ if ( aArgs.getLength() == 1 )
+ {
+ uno::Reference< report::XFunction> xFunction;
+ aArgs[0].Value >>= xFunction;
+ if ( xFunction.is() )
+ {
+ uno::Reference< report::XFunctions> xFunctions(xFunction->getParent(),uno::UNO_QUERY_THROW);
+ sal_Int32 nIndex = getPositionInIndexAccess(xFunctions.get(),xFunction);
+ const String sUndoAction = String((ModuleRes(RID_STR_UNDO_REMOVE_FUNCTION)));
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+ xFunctions->removeByIndex(nIndex);
+ select(uno::makeAny(xFunctions->getParent()));
+ InvalidateFeature( SID_SAVEDOC );
+ InvalidateFeature( SID_UNDO );
+ }
+ }
+ else
+ executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION,::std::mem_fun(&ODesignView::Delete));
+ break;
+ case SID_GRID_USE:
+ getDesignView()->setGridSnap(m_bGridUse = !m_bGridUse);
+ break;
+ case SID_HELPLINES_MOVE:
+ getDesignView()->setDragStripes(m_bHelplinesMove = !m_bHelplinesMove);
+ break;
+ case SID_GRID_VISIBLE:
+ getDesignView()->toggleGrid(m_bGridVisible = !m_bGridVisible);
+ break;
+ case SID_RULER:
+ getDesignView()->showRuler(m_bShowRuler = !m_bShowRuler);
+ break;
+ case SID_OBJECT_SELECT:
+ getDesignView()->SetMode(RPTUI_SELECT);
+ InvalidateAll();
+ break;
+ case SID_INSERT_DIAGRAM:
+ getDesignView()->SetMode( RPTUI_INSERT );
+ getDesignView()->SetInsertObj( OBJ_OLE2);
+ createDefaultControl(aArgs);
+ InvalidateAll();
+ break;
+ case SID_FM_FIXEDTEXT:
+ getDesignView()->SetMode( RPTUI_INSERT );
+ getDesignView()->SetInsertObj( OBJ_DLG_FIXEDTEXT );
+ createDefaultControl(aArgs);
+ InvalidateAll();
+ break;
+ case SID_INSERT_HFIXEDLINE:
+ getDesignView()->SetMode( RPTUI_INSERT );
+ getDesignView()->SetInsertObj( OBJ_DLG_HFIXEDLINE );
+ createDefaultControl(aArgs);
+ InvalidateAll();
+ break;
+ case SID_INSERT_VFIXEDLINE:
+ getDesignView()->SetMode( RPTUI_INSERT );
+ getDesignView()->SetInsertObj( OBJ_DLG_VFIXEDLINE );
+ createDefaultControl(aArgs);
+ InvalidateAll();
+ break;
+ case SID_FM_EDIT:
+ getDesignView()->SetMode( RPTUI_INSERT );
+ getDesignView()->SetInsertObj( OBJ_DLG_FORMATTEDFIELD );
+ createDefaultControl(aArgs);
+ InvalidateAll();
+ break;
+ case SID_FM_IMAGECONTROL:
+ getDesignView()->SetMode( RPTUI_INSERT );
+ getDesignView()->SetInsertObj( OBJ_DLG_IMAGECONTROL );
+ createDefaultControl(aArgs);
+ InvalidateAll();
+ break;
+ case SID_DRAWTBX_CS_BASIC:
+ case SID_DRAWTBX_CS_BASIC1:
+ case SID_DRAWTBX_CS_BASIC2:
+ case SID_DRAWTBX_CS_BASIC3:
+ case SID_DRAWTBX_CS_BASIC4:
+ case SID_DRAWTBX_CS_BASIC5:
+ case SID_DRAWTBX_CS_BASIC6:
+ case SID_DRAWTBX_CS_BASIC7:
+ case SID_DRAWTBX_CS_BASIC8:
+ case SID_DRAWTBX_CS_BASIC9:
+ case SID_DRAWTBX_CS_BASIC10:
+ case SID_DRAWTBX_CS_BASIC11:
+ case SID_DRAWTBX_CS_BASIC12:
+ case SID_DRAWTBX_CS_BASIC13:
+ case SID_DRAWTBX_CS_BASIC14:
+ case SID_DRAWTBX_CS_BASIC15:
+ case SID_DRAWTBX_CS_BASIC16:
+ case SID_DRAWTBX_CS_BASIC17:
+ case SID_DRAWTBX_CS_BASIC18:
+ case SID_DRAWTBX_CS_BASIC19:
+ case SID_DRAWTBX_CS_BASIC20:
+ case SID_DRAWTBX_CS_BASIC21:
+ case SID_DRAWTBX_CS_BASIC22:
+ case SID_DRAWTBX_CS_SYMBOL1:
+ case SID_DRAWTBX_CS_SYMBOL2:
+ case SID_DRAWTBX_CS_SYMBOL3:
+ case SID_DRAWTBX_CS_SYMBOL4:
+ case SID_DRAWTBX_CS_SYMBOL5:
+ case SID_DRAWTBX_CS_SYMBOL6:
+ case SID_DRAWTBX_CS_SYMBOL7:
+ case SID_DRAWTBX_CS_SYMBOL8:
+ case SID_DRAWTBX_CS_SYMBOL9:
+ case SID_DRAWTBX_CS_SYMBOL10:
+ case SID_DRAWTBX_CS_SYMBOL11:
+ case SID_DRAWTBX_CS_SYMBOL12:
+ case SID_DRAWTBX_CS_SYMBOL13:
+ case SID_DRAWTBX_CS_SYMBOL14:
+ case SID_DRAWTBX_CS_SYMBOL15:
+ case SID_DRAWTBX_CS_SYMBOL16:
+ case SID_DRAWTBX_CS_SYMBOL17:
+ case SID_DRAWTBX_CS_SYMBOL18:
+ case SID_DRAWTBX_CS_ARROW1:
+ case SID_DRAWTBX_CS_ARROW2:
+ case SID_DRAWTBX_CS_ARROW3:
+ case SID_DRAWTBX_CS_ARROW4:
+ case SID_DRAWTBX_CS_ARROW5:
+ case SID_DRAWTBX_CS_ARROW6:
+ case SID_DRAWTBX_CS_ARROW7:
+ case SID_DRAWTBX_CS_ARROW8:
+ case SID_DRAWTBX_CS_ARROW9:
+ case SID_DRAWTBX_CS_ARROW10:
+ case SID_DRAWTBX_CS_ARROW11:
+ case SID_DRAWTBX_CS_ARROW12:
+ case SID_DRAWTBX_CS_ARROW13:
+ case SID_DRAWTBX_CS_ARROW14:
+ case SID_DRAWTBX_CS_ARROW15:
+ case SID_DRAWTBX_CS_ARROW16:
+ case SID_DRAWTBX_CS_ARROW17:
+ case SID_DRAWTBX_CS_ARROW18:
+ case SID_DRAWTBX_CS_ARROW19:
+ case SID_DRAWTBX_CS_ARROW20:
+ case SID_DRAWTBX_CS_ARROW21:
+ case SID_DRAWTBX_CS_ARROW22:
+ case SID_DRAWTBX_CS_ARROW23:
+ case SID_DRAWTBX_CS_ARROW24:
+ case SID_DRAWTBX_CS_ARROW25:
+ case SID_DRAWTBX_CS_ARROW26:
+ case SID_DRAWTBX_CS_STAR1:
+ case SID_DRAWTBX_CS_STAR2:
+ case SID_DRAWTBX_CS_STAR3:
+ case SID_DRAWTBX_CS_STAR4:
+ case SID_DRAWTBX_CS_STAR5:
+ case SID_DRAWTBX_CS_STAR6:
+ case SID_DRAWTBX_CS_STAR7:
+ case SID_DRAWTBX_CS_STAR8:
+ case SID_DRAWTBX_CS_STAR9:
+ case SID_DRAWTBX_CS_STAR10:
+ case SID_DRAWTBX_CS_STAR11:
+ case SID_DRAWTBX_CS_STAR12:
+ case SID_DRAWTBX_CS_FLOWCHART1:
+ case SID_DRAWTBX_CS_FLOWCHART2:
+ case SID_DRAWTBX_CS_FLOWCHART3:
+ case SID_DRAWTBX_CS_FLOWCHART4:
+ case SID_DRAWTBX_CS_FLOWCHART5:
+ case SID_DRAWTBX_CS_FLOWCHART6:
+ case SID_DRAWTBX_CS_FLOWCHART7:
+ case SID_DRAWTBX_CS_FLOWCHART8:
+ case SID_DRAWTBX_CS_FLOWCHART9:
+ case SID_DRAWTBX_CS_FLOWCHART10:
+ case SID_DRAWTBX_CS_FLOWCHART11:
+ case SID_DRAWTBX_CS_FLOWCHART12:
+ case SID_DRAWTBX_CS_FLOWCHART13:
+ case SID_DRAWTBX_CS_FLOWCHART14:
+ case SID_DRAWTBX_CS_FLOWCHART15:
+ case SID_DRAWTBX_CS_FLOWCHART16:
+ case SID_DRAWTBX_CS_FLOWCHART17:
+ case SID_DRAWTBX_CS_FLOWCHART18:
+ case SID_DRAWTBX_CS_FLOWCHART19:
+ case SID_DRAWTBX_CS_FLOWCHART20:
+ case SID_DRAWTBX_CS_FLOWCHART21:
+ case SID_DRAWTBX_CS_FLOWCHART22:
+ case SID_DRAWTBX_CS_FLOWCHART23:
+ case SID_DRAWTBX_CS_FLOWCHART24:
+ case SID_DRAWTBX_CS_FLOWCHART25:
+ case SID_DRAWTBX_CS_FLOWCHART26:
+ case SID_DRAWTBX_CS_FLOWCHART27:
+ case SID_DRAWTBX_CS_FLOWCHART28:
+ case SID_DRAWTBX_CS_CALLOUT1:
+ case SID_DRAWTBX_CS_CALLOUT2:
+ case SID_DRAWTBX_CS_CALLOUT3:
+ case SID_DRAWTBX_CS_CALLOUT4:
+ case SID_DRAWTBX_CS_CALLOUT5:
+ case SID_DRAWTBX_CS_CALLOUT6:
+ case SID_DRAWTBX_CS_CALLOUT7:
+ case SID_DRAWTBX_CS_SYMBOL:
+ case SID_DRAWTBX_CS_ARROW:
+ case SID_DRAWTBX_CS_FLOWCHART:
+ case SID_DRAWTBX_CS_CALLOUT:
+ case SID_DRAWTBX_CS_STAR:
+ getDesignView()->SetMode( RPTUI_INSERT );
+ {
+ URL aUrl = getURLForId(_nId);
+ sal_Int32 nIndex = 1;
+ ::rtl::OUString sType = aUrl.Complete.getToken(0,'.',nIndex);
+ if ( nIndex == -1 || !sType.getLength() )
+ {
+ switch(_nId)
+ {
+ case SID_DRAWTBX_CS_SYMBOL:
+ sType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("smiley"));
+ break;
+ case SID_DRAWTBX_CS_ARROW:
+ sType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("left-right-arrow"));
+ break;
+ case SID_DRAWTBX_CS_FLOWCHART:
+ sType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("flowchart-internal-storage"));
+ break;
+ case SID_DRAWTBX_CS_CALLOUT:
+ sType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("round-rectangular-callout"));
+ break;
+ case SID_DRAWTBX_CS_STAR:
+ sType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("star5"));
+ break;
+ case SID_DRAWTBX_CS_BASIC:
+ default:
+ sType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diamond"));
+ }
+ }
+ else
+ sType = aUrl.Complete.getToken(0,'.',nIndex);
+
+ getDesignView()->SetInsertObj( OBJ_CUSTOMSHAPE ,sType);
+ createDefaultControl(aArgs);
+ }
+ InvalidateAll();
+ break;
+ case SID_RPT_SHOWREPORTEXPLORER:
+ if ( isUiVisible() )
+ getDesignView()->toggleReportExplorer();
+ break;
+ case SID_FM_ADD_FIELD:
+ if ( isUiVisible() )
+ getDesignView()->toggleAddField();
+ break;
+ case SID_SHOW_PROPERTYBROWSER:
+ if ( m_bShowProperties )
+ m_sLastActivePage = getDesignView()->getCurrentPage();
+ else
+ getDesignView()->setCurrentPage(m_sLastActivePage);
+
+ if ( isUiVisible() )
+ {
+ m_bShowProperties = !m_bShowProperties;
+ if ( aArgs.getLength() == 1 )
+ aArgs[0].Value >>= m_bShowProperties;
+
+ getDesignView()->togglePropertyBrowser(m_bShowProperties);
+ }
+ break;
+ case SID_PROPERTYBROWSER_LAST_PAGE: // nothing to do
+ m_sLastActivePage = getDesignView()->getCurrentPage();
+ break;
+ case SID_SPLIT_POSITION:
+ getDesignView()->Resize();
+ break;
+ case SID_PAGEDIALOG:
+ case SID_ATTR_CHAR_COLOR_BACKGROUND:
+ {
+ uno::Reference<report::XSection> xSection;
+ if (aArgs.getLength() == 1 )
+ aArgs[0].Value >>= xSection;
+ openPageDialog(xSection);
+ bForceBroadcast = sal_True;
+ }
+ break;
+ case SID_SORTINGANDGROUPING:
+ openSortingAndGroupingDialog();
+ m_bGroupFloaterWasVisible = m_pGroupsFloater && m_pGroupsFloater->IsVisible();
+ break;
+ case SID_BACKGROUND_COLOR:
+ {
+ const util::Color aColor( lcl_extractBackgroundColor( aArgs ) );
+ if ( !impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CONTROLBACKGROUND,uno::makeAny(aColor),aArgs) )
+ {
+ uno::Reference< report::XSection > xSection = getDesignView()->getCurrentSection();
+ if ( xSection.is() )
+ {
+ xSection->setBackColor( aColor );
+ }
+ }
+ bForceBroadcast = sal_True;
+ }
+ break;
+ case SID_ATTR_CHAR_WEIGHT:
+ case SID_ATTR_CHAR_POSTURE:
+ case SID_ATTR_CHAR_UNDERLINE:
+ {
+ uno::Reference< awt::XWindow> xWindow;
+ ::std::vector< uno::Reference< uno::XInterface > > aControlsFormats;
+ lcl_getReportControlFormat( aArgs, getDesignView(), xWindow, aControlsFormats );
+
+ const String sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEFONT));
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+
+ ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aControlsFormats.begin();
+ for(; aIter != aControlsFormats.end();++aIter)
+ {
+ uno::Reference< report::XReportControlFormat> xReportControlFormat(*aIter,uno::UNO_QUERY);
+ lcl_setFontWPU_nothrow(xReportControlFormat,_nId);
+ }
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR:
+ case SID_ATTR_CHAR_COLOR2:
+ {
+ const SequenceAsHashMap aMap(aArgs);
+ const util::Color aColor = aMap.getUnpackedValueOrDefault(PROPERTY_FONTCOLOR,util::Color());
+ impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARCOLOR,uno::makeAny(aColor),aArgs);
+ bForceBroadcast = sal_True;
+ }
+ break;
+ case SID_ATTR_CHAR_FONT:
+ if ( aArgs.getLength() == 1 )
+ {
+ awt::FontDescriptor aFont;
+ if ( aArgs[0].Value >>= aFont )
+ {
+ impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARFONTNAME,uno::makeAny(aFont.Name),aArgs);
+ } // if ( aArgs[0].Value >>= aFont )
+ }
+ break;
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ if ( aArgs.getLength() == 1 )
+ {
+ float fSelVal = 0.0;
+ if ( aArgs[0].Value >>= fSelVal )
+ impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARHEIGHT,aArgs[0].Value,aArgs);
+ }
+ break;
+ case SID_ATTR_PARA_ADJUST_LEFT:
+ case SID_ATTR_PARA_ADJUST_CENTER:
+ case SID_ATTR_PARA_ADJUST_RIGHT:
+ case SID_ATTR_PARA_ADJUST_BLOCK:
+ {
+ sal_Int16 eParagraphAdjust = style::ParagraphAdjust_LEFT;
+ switch(_nId)
+ {
+ case SID_ATTR_PARA_ADJUST_LEFT:
+ eParagraphAdjust = style::ParagraphAdjust_LEFT;
+ break;
+ case SID_ATTR_PARA_ADJUST_CENTER:
+ eParagraphAdjust = style::ParagraphAdjust_CENTER;
+ break;
+ case SID_ATTR_PARA_ADJUST_RIGHT:
+ eParagraphAdjust = style::ParagraphAdjust_RIGHT;
+ break;
+ case SID_ATTR_PARA_ADJUST_BLOCK:
+ eParagraphAdjust = style::ParagraphAdjust_BLOCK;
+ break;
+ } // switch(_nId)
+ impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT,PROPERTY_PARAADJUST,uno::makeAny(eParagraphAdjust),aArgs);
+
+ InvalidateFeature(SID_ATTR_PARA_ADJUST_LEFT);
+ InvalidateFeature(SID_ATTR_PARA_ADJUST_CENTER);
+ InvalidateFeature(SID_ATTR_PARA_ADJUST_RIGHT);
+ InvalidateFeature(SID_ATTR_PARA_ADJUST_BLOCK);
+ }
+ break;
+ case SID_CHAR_DLG:
+ {
+ uno::Sequence< beans::NamedValue > aSettings;
+ uno::Reference< awt::XWindow> xWindow;
+ ::std::vector< uno::Reference< uno::XInterface > > aControlsFormats;
+ lcl_getReportControlFormat( aArgs, getDesignView(), xWindow, aControlsFormats );
+
+ if ( !aControlsFormats.empty() )
+ {
+ const String sUndoAction( ModuleRes( RID_STR_UNDO_CHANGEFONT ) );
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+
+ ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aControlsFormats.begin();
+ for(; aIter != aControlsFormats.end();++aIter)
+ {
+ uno::Reference< report::XReportControlFormat > xFormat( *aIter, uno::UNO_QUERY );
+ if ( !xFormat.is() )
+ continue;
+
+ if ( aSettings.getLength() == 0 )
+ {
+ ::rptui::openCharDialog( xFormat, xWindow, aSettings );
+ if ( aSettings.getLength() == 0 )
+ break;
+ }
+
+ applyCharacterSettings( xFormat, aSettings );
+ }
+
+ InvalidateAll();
+ }
+ }
+ break;
+ case SID_INSERT_GRAPHIC:
+ insertGraphic();
+ break;
+ case SID_SETCONTROLDEFAULTS:
+ break;
+ case SID_CONDITIONALFORMATTING:
+ {
+ uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
+ if ( xFormattedField.is() )
+ {
+ ConditionalFormattingDialog aDlg( getView(), xFormattedField.get(), *this );
+ aDlg.Execute();
+ }
+ }
+ break;
+ case SID_DATETIME:
+ if ( m_xReportDefinition.is() )
+ {
+ if ( !aArgs.getLength() )
+ {
+ ODateTimeDialog aDlg(getView(),getDesignView()->getCurrentSection(),this);
+ aDlg.Execute();
+ }
+ else
+ createDateTime(aArgs);
+ } // if ( m_xReportDefinition.is() )
+ break;
+ case SID_INSERT_FLD_PGNUMBER:
+ if ( m_xReportDefinition.is() )
+ {
+ if ( !aArgs.getLength() )
+ {
+ OPageNumberDialog aDlg(getView(),m_xReportDefinition,this);
+ aDlg.Execute();
+ }
+ else
+ createPageNumber(aArgs);
+ } // if ( m_xReportDefinition.is() )
+ break;
+ case SID_EXPORTDOC:
+ case SID_EXPORTDOCASPDF:
+ break;
+ case SID_PRINTPREVIEW:
+ if ( m_xReportDefinition.is() )
+ {
+ }
+ break;
+ case SID_EDITDOC:
+ if(isEditable())
+ { // the state should be changed to not editable
+ switch (saveModified())
+ {
+ case RET_CANCEL:
+ // don't change anything here so return
+ return;
+ case RET_NO:
+ setModified(sal_False); // and we are not modified yet
+ break;
+ default:
+ break;
+ }
+ }
+ setEditable(!isEditable());
+ //getJoinView()->setReadOnly(!isEditable());
+ InvalidateAll();
+ return;
+ case SID_GROUP:
+ break;
+ case SID_ATTR_ZOOM:
+ if ( aArgs.getLength() == 0 )
+ {
+ openZoomDialog();
+ }
+ else if ( aArgs.getLength() == 1 && aArgs[0].Name.equalsAscii("Zoom") )
+ {
+ SvxZoomItem aZoomItem;
+ aZoomItem.PutValue(aArgs[0].Value);
+ m_nZoomValue = aZoomItem.GetValue();
+ m_eZoomType = aZoomItem.GetType();
+ impl_zoom_nothrow();
+ } // if ( aArgs.getLength() == 1 && aArgs[0].Name.equalsAscii("Zoom") )
+ break;
+ case SID_ATTR_ZOOMSLIDER:
+ if ( aArgs.getLength() == 1 && aArgs[0].Name.equalsAscii("ZoomSlider") )
+ {
+ SvxZoomSliderItem aZoomSlider;
+ aZoomSlider.PutValue(aArgs[0].Value);
+ m_nZoomValue = aZoomSlider.GetValue();
+ m_eZoomType = SVX_ZOOM_PERCENT;
+ impl_zoom_nothrow();
+ }
+ break;
+ default:
+ OReportController_BASE::Execute(_nId,aArgs);
+ }
+ InvalidateFeature(_nId,Reference< XStatusListener >(),bForceBroadcast);
+}
+// -----------------------------------------------------------------------------
+short OReportController::saveModified()
+{
+ return RET_NO;
+}
+
+// -----------------------------------------------------------------------------
+void OReportController::impl_initialize( )
+{
+ OReportController_BASE::impl_initialize();
+
+ const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
+
+ rArguments.get_ensureType( (::rtl::OUString)PROPERTY_REPORTNAME, m_sName );
+ if ( !m_sName.getLength() )
+ rArguments.get_ensureType( "DocumentTitle", m_sName );
+
+ try
+ {
+ if ( m_xReportDefinition.is() )
+ {
+ //m_sName = m_xReportDefinition->getName();
+ getView()->initialize(); // show the windows and fill with our informations
+
+ m_aReportModel = reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition);
+ if ( !m_aReportModel )
+ throw RuntimeException();
+ m_aReportModel->attachController( *this );
+
+ clearUndoManager();
+ UndoSuppressor aSuppressUndo( getUndoManager() );
+
+ ::comphelper::NamedValueCollection aArgs(getModel()->getArgs());
+ setMode(aArgs.getOrDefault("Mode", rtl::OUString::createFromAscii("normal")));
+
+ listen(true);
+ setEditable( !m_aReportModel->IsReadOnly() );
+ m_xFormatter.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY);
+ m_xFormatter->attachNumberFormatsSupplier(Reference< XNumberFormatsSupplier>(m_xReportDefinition,uno::UNO_QUERY));
+
+ ::comphelper::MediaDescriptor aDescriptor( m_xReportDefinition->getArgs() );
+ ::rtl::OUString sHierarchicalDocumentName;
+ sHierarchicalDocumentName = aDescriptor.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName")),sHierarchicalDocumentName);
+
+ if ( !sHierarchicalDocumentName.getLength() && getConnection().is() )
+ {
+ uno::Reference<sdbcx::XTablesSupplier> xTablesSup(getConnection(),uno::UNO_QUERY_THROW);
+ uno::Reference<container::XNameAccess> xTables = xTablesSup->getTables();
+ const uno::Sequence< ::rtl::OUString > aNames( xTables->getElementNames() );
+
+ if ( aNames.hasElements() )
+ {
+ m_xReportDefinition->setCommand(aNames[0]);
+ m_xReportDefinition->setCommandType(sdb::CommandType::TABLE);
+ }
+ } // if ( !sHierarchicalDocumentName.getLength() && getConnection().is() )
+
+ m_aVisualAreaSize = m_xReportDefinition->getVisualAreaSize(0);
+
+ } // if ( m_xReportDefinition.is() )
+
+ // check if chart is supported by the engine
+ checkChartEnabled();
+ // restore the view data
+ getDesignView()->toggleGrid(m_bGridVisible);
+ getDesignView()->showRuler(m_bShowRuler);
+ getDesignView()->togglePropertyBrowser(m_bShowProperties);
+ getDesignView()->setCurrentPage(m_sLastActivePage);
+ getDesignView()->unmarkAllObjects(NULL);
+
+ if ( m_nPageNum != -1 )
+ {
+ if ( m_nPageNum < m_aReportModel->GetPageCount() )
+ {
+ const OReportPage* pPage = dynamic_cast<OReportPage*>(m_aReportModel->GetPage(static_cast<sal_uInt16>(m_nPageNum)));
+ if ( pPage )
+ {
+ uno::Sequence< beans::PropertyValue> aArgs(1);
+ aArgs[0].Value <<= pPage->getSection();
+ executeUnChecked(SID_SELECT,aArgs);
+ }
+ }
+ else
+ m_nPageNum = -1;
+ }
+ getDesignView()->collapseSections(m_aCollapsedSections);
+ impl_zoom_nothrow();
+ getDesignView()->Resize();
+ getDesignView()->Invalidate();
+ InvalidateAll();
+
+ if ( m_bShowProperties && m_nPageNum == -1 )
+ {
+ m_sLastActivePage = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data"));
+ getDesignView()->setCurrentPage(m_sLastActivePage);
+ uno::Sequence< beans::PropertyValue> aArgs;
+ executeUnChecked(SID_SELECT_REPORT,aArgs);
+ } // if ( m_bShowProperties && m_nPageNum == -1 )
+
+ setModified(sal_False); // and we are not modified yet
+
+ // open the global help agent
+ // we need a Frame but at this time there is no frame, therefore we send a UserEvent
+ getView()->PostUserEvent(LINK(this, OReportController, OnOpenHelpAgent));
+ }
+ catch(const SQLException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( OReportController, OnOpenHelpAgent, void* ,/*_pMemfun*/)
+{
+ //m_nExecuteReportEvent = 0;
+ doOpenHelpAgent();
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( OReportController, OnCreateHdl, OAddFieldWindow* ,_pAddFieldDlg)
+{
+ WaitObject aObj( getDesignView() );
+ uno::Sequence< beans::PropertyValue > aArgs = _pAddFieldDlg->getSelectedFieldDescriptors();
+ // we use this way to create undo actions
+ if ( aArgs.getLength() )
+ {
+ executeChecked(SID_ADD_CONTROL_PAIR,aArgs);
+ }
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+
+void OReportController::doOpenHelpAgent()
+{
+ if (getFrame().is())
+ {
+ rtl::OUString suURL = rtl::OUString::createFromAscii("vnd.sun.star.help://shared/text/shared/explorer/database/rep_main.xhp?UseDB=no&DbPAR=swriter");
+ openHelpAgent(suURL);
+ // openHelpAgent(68245 /* HID_REPORT_DESIGN... UNKNOWN */ );
+ // HID_APP_REPORT_TREE
+ }
+ else
+ {
+ // as long as we don't get a Frame, we send the user event again.
+ getView()->PostUserEvent(LINK(this, OReportController, OnOpenHelpAgent));
+ }
+}
+// -----------------------------------------------------------------------------
+sal_Bool OReportController::Construct(Window* pParent)
+{
+ ODesignView* pMyOwnView = new ODesignView( pParent, getORB(), *this );
+ StartListening( *pMyOwnView );
+ setView( *pMyOwnView );
+
+ // now that we have a view we can create the clipboard listener
+ m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() );
+ m_aSystemClipboard.StartClipboardListening( );
+ m_pClipbordNotifier = new TransferableClipboardListener( LINK( this, OReportController, OnClipboardChanged ) );
+ m_pClipbordNotifier->acquire();
+ m_pClipbordNotifier->AddRemoveListener( getView(), sal_True );
+
+ OReportController_BASE::Construct(pParent);
+ //getView()->Show();
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL OReportController::suspend(sal_Bool /*_bSuspend*/) throw( RuntimeException )
+{
+ if ( getBroadcastHelper().bInDispose || getBroadcastHelper().bDisposed )
+ return sal_True;
+
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ if ( getView() && getView()->IsInModalMode() )
+ return sal_False;
+
+ // this suspend will be handled in the DBAccess interceptor implementation
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+void OReportController::describeSupportedFeatures()
+{
+ DBSubComponentController::describeSupportedFeatures();
+
+ implDescribeSupportedFeature( ".uno:TextDocument", SID_RPT_TEXTDOCUMENT, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( ".uno:Spreadsheet", SID_RPT_SPREADSHEET, CommandGroup::APPLICATION );
+
+ implDescribeSupportedFeature( ".uno:Redo", SID_REDO, CommandGroup::EDIT );
+ implDescribeSupportedFeature( ".uno:Undo", SID_UNDO, CommandGroup::EDIT );
+ //implDescribeSupportedFeature( ".uno:PasteSpecial", SID_PASTE, CommandGroup::EDIT );
+ implDescribeSupportedFeature( ".uno:SelectAll", SID_SELECTALL, CommandGroup::EDIT );
+ implDescribeSupportedFeature( ".uno:SelectAllInSection", SID_SELECTALL_IN_SECTION, CommandGroup::EDIT );
+ implDescribeSupportedFeature( ".uno:Delete", SID_DELETE, CommandGroup::EDIT );
+ implDescribeSupportedFeature( ".uno:SelectReport", SID_SELECT_REPORT, CommandGroup::EDIT );
+ implDescribeSupportedFeature( ".uno:ExecuteReport", SID_EXECUTE_REPORT, CommandGroup::EDIT );
+
+ implDescribeSupportedFeature( ".uno:GridVisible", SID_GRID_VISIBLE, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:GridUse", SID_GRID_USE, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:HelplinesMove", SID_HELPLINES_MOVE, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:ShowRuler", SID_RULER, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:AddField", SID_FM_ADD_FIELD, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:ReportNavigator", SID_RPT_SHOWREPORTEXPLORER, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:ControlProperties", SID_SHOW_PROPERTYBROWSER, CommandGroup::VIEW );
+ //implDescribeSupportedFeature( ".uno:SwitchControlDesignMode", SID_FM_DESIGN_MODE, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:DbSortingAndGrouping", SID_SORTINGANDGROUPING, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:PageHeaderFooter", SID_PAGEHEADERFOOTER, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:ReportHeaderFooter", SID_REPORTHEADERFOOTER, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:ZoomSlider", SID_ATTR_ZOOMSLIDER, CommandGroup::VIEW );
+ implDescribeSupportedFeature( ".uno:Zoom", SID_ATTR_ZOOM, CommandGroup::VIEW );
+ //implDescribeSupportedFeature( ".uno:SwitchControlDesignMode", SID_FM_DESIGN_MODE, CommandGroup::VIEW );
+
+ implDescribeSupportedFeature( ".uno:ConditionalFormatting", SID_CONDITIONALFORMATTING, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:PageDialog", SID_PAGEDIALOG, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:ResetAttributes", SID_SETCONTROLDEFAULTS, CommandGroup::FORMAT );
+
+ implDescribeSupportedFeature( ".uno:Bold", SID_ATTR_CHAR_WEIGHT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:Italic", SID_ATTR_CHAR_POSTURE, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:Underline", SID_ATTR_CHAR_UNDERLINE, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:BackColor", SID_ATTR_CHAR_COLOR_BACKGROUND, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:BackgroundColor", SID_BACKGROUND_COLOR, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:Color", SID_ATTR_CHAR_COLOR);
+ implDescribeSupportedFeature( ".uno:FontColor", SID_ATTR_CHAR_COLOR2, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:FontDialog", SID_CHAR_DLG, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:LeftPara", SID_ATTR_PARA_ADJUST_LEFT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:CenterPara", SID_ATTR_PARA_ADJUST_CENTER, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:RightPara", SID_ATTR_PARA_ADJUST_RIGHT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:JustifyPara", SID_ATTR_PARA_ADJUST_BLOCK, CommandGroup::FORMAT );
+
+ implDescribeSupportedFeature( ".uno:FontHeight", SID_ATTR_CHAR_FONTHEIGHT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:CharFontName", SID_ATTR_CHAR_FONT, CommandGroup::FORMAT );
+
+ implDescribeSupportedFeature( ".uno:ArrangeMenu", SID_ARRANGEMENU, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:BringToFront", SID_FRAME_TO_TOP, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:ObjectBackOne", SID_FRAME_DOWN, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:ObjectForwardOne", SID_FRAME_UP, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SendToBack", SID_FRAME_TO_BOTTOM, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SetObjectToForeground", SID_OBJECT_HEAVEN, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SetObjectToBackground", SID_OBJECT_HELL, CommandGroup::FORMAT );
+
+ implDescribeSupportedFeature( ".uno:ObjectAlign", SID_OBJECT_ALIGN, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:ObjectAlignLeft", SID_OBJECT_ALIGN_LEFT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:AlignCenter", SID_OBJECT_ALIGN_CENTER, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:ObjectAlignRight", SID_OBJECT_ALIGN_RIGHT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:AlignUp", SID_OBJECT_ALIGN_UP, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:AlignMiddle", SID_OBJECT_ALIGN_MIDDLE, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:AlignDown", SID_OBJECT_ALIGN_DOWN, CommandGroup::FORMAT );
+
+ implDescribeSupportedFeature( ".uno:SectionAlign", SID_SECTION_ALIGN, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SectionAlignLeft", SID_SECTION_ALIGN_LEFT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SectionAlignCenter", SID_SECTION_ALIGN_CENTER, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SectionAlignRight", SID_SECTION_ALIGN_RIGHT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SectionAlignTop", SID_SECTION_ALIGN_UP, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SectionAlignMiddle", SID_SECTION_ALIGN_MIDDLE, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SectionAlignBottom", SID_SECTION_ALIGN_DOWN, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SectionShrink", SID_SECTION_SHRINK, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SectionShrinkTop", SID_SECTION_SHRINK_TOP, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SectionShrinkBottom", SID_SECTION_SHRINK_BOTTOM, CommandGroup::FORMAT );
+
+ implDescribeSupportedFeature( ".uno:ObjectResize", SID_OBJECT_RESIZING, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SmallestWidth", SID_OBJECT_SMALLESTWIDTH, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:SmallestHeight", SID_OBJECT_SMALLESTHEIGHT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:GreatestWidth", SID_OBJECT_GREATESTWIDTH, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:GreatestHeight", SID_OBJECT_GREATESTHEIGHT, CommandGroup::FORMAT );
+ implDescribeSupportedFeature( ".uno:Distribution", SID_DISTRIBUTION, CommandGroup::FORMAT );
+
+ implDescribeSupportedFeature( ".uno:HelpMenu", SID_HELPMENU, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( ".uno:ExportTo", SID_EXPORTDOC, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( ".uno:ExportToPDF", SID_EXPORTDOCASPDF, CommandGroup::APPLICATION );
+ implDescribeSupportedFeature( ".uno:PrintPreview", SID_PRINTPREVIEW, CommandGroup::APPLICATION );
+
+ implDescribeSupportedFeature( ".uno:NewDoc", SID_NEWDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( ".uno:Save", SID_SAVEDOC, CommandGroup::DOCUMENT );
+ implDescribeSupportedFeature( ".uno:SaveAs", SID_SAVEASDOC, CommandGroup::DOCUMENT );
+
+ implDescribeSupportedFeature( ".uno:InsertPageNumberField", SID_INSERT_FLD_PGNUMBER, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:InsertDateTimeField", SID_DATETIME, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:InsertObjectChart", SID_INSERT_DIAGRAM, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:InsertGraphic", SID_INSERT_GRAPHIC, CommandGroup::INSERT );
+ // controls
+ implDescribeSupportedFeature( ".uno:SelectObject", SID_OBJECT_SELECT, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:Label", SID_FM_FIXEDTEXT, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:Edit", SID_FM_EDIT, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ImageControl", SID_FM_IMAGECONTROL, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:HFixedLine", SID_INSERT_HFIXEDLINE, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:VFixedLine", SID_INSERT_VFIXEDLINE, CommandGroup::INSERT );
+
+ // shapes
+ implDescribeSupportedFeature( ".uno:BasicShapes", SID_DRAWTBX_CS_BASIC, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.rectangle", SID_DRAWTBX_CS_BASIC1, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.round-rectangle",SID_DRAWTBX_CS_BASIC2, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.quadrat", SID_DRAWTBX_CS_BASIC3, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.round-quadrat", SID_DRAWTBX_CS_BASIC4, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.circle", SID_DRAWTBX_CS_BASIC5, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.ellipse", SID_DRAWTBX_CS_BASIC6, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.circle-pie", SID_DRAWTBX_CS_BASIC7, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.isosceles-triangle",SID_DRAWTBX_CS_BASIC8, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.right-triangle",SID_DRAWTBX_CS_BASIC9, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.trapezoid", SID_DRAWTBX_CS_BASIC10, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.diamond", SID_DRAWTBX_CS_BASIC11, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.parallelogram", SID_DRAWTBX_CS_BASIC12, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.pentagon", SID_DRAWTBX_CS_BASIC13, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.hexagon", SID_DRAWTBX_CS_BASIC14, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.octagon", SID_DRAWTBX_CS_BASIC15, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.cross", SID_DRAWTBX_CS_BASIC16, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.ring", SID_DRAWTBX_CS_BASIC17, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.block-arc", SID_DRAWTBX_CS_BASIC18, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.can", SID_DRAWTBX_CS_BASIC19, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.cube", SID_DRAWTBX_CS_BASIC20, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.paper", SID_DRAWTBX_CS_BASIC21, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:BasicShapes.frame", SID_DRAWTBX_CS_BASIC22, CommandGroup::INSERT );
+
+ implDescribeSupportedFeature( ".uno:SymbolShapes", SID_DRAWTBX_CS_SYMBOL, CommandGroup::INSERT );
+
+ implDescribeSupportedFeature( ".uno:SymbolShapes.smiley" , SID_DRAWTBX_CS_SYMBOL1, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.sun" , SID_DRAWTBX_CS_SYMBOL2, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.moon" , SID_DRAWTBX_CS_SYMBOL3, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.lightning" , SID_DRAWTBX_CS_SYMBOL4, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.heart" , SID_DRAWTBX_CS_SYMBOL5, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.flower" , SID_DRAWTBX_CS_SYMBOL6, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.cloud" , SID_DRAWTBX_CS_SYMBOL7, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.forbidden" , SID_DRAWTBX_CS_SYMBOL8, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.puzzle" , SID_DRAWTBX_CS_SYMBOL9, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.bracket-pair" ,SID_DRAWTBX_CS_SYMBOL10, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.left-bracket" ,SID_DRAWTBX_CS_SYMBOL11, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.right-bracket",SID_DRAWTBX_CS_SYMBOL12, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.brace-pair" , SID_DRAWTBX_CS_SYMBOL13, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.left-brace" , SID_DRAWTBX_CS_SYMBOL14, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.right-brace" , SID_DRAWTBX_CS_SYMBOL15, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.quad-bevel" , SID_DRAWTBX_CS_SYMBOL16, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.octagon-bevel",SID_DRAWTBX_CS_SYMBOL17, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:SymbolShapes.diamond-bevel",SID_DRAWTBX_CS_SYMBOL18, CommandGroup::INSERT );
+
+ implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow" , SID_DRAWTBX_CS_ARROW1, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow" , SID_DRAWTBX_CS_ARROW2, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow" , SID_DRAWTBX_CS_ARROW3, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow" , SID_DRAWTBX_CS_ARROW4, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow" , SID_DRAWTBX_CS_ARROW5, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow" , SID_DRAWTBX_CS_ARROW6, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow" , SID_DRAWTBX_CS_ARROW7, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-down-arrow" , SID_DRAWTBX_CS_ARROW8, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow" , SID_DRAWTBX_CS_ARROW9, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.corner-right-arrow" , SID_DRAWTBX_CS_ARROW10, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.split-arrow" , SID_DRAWTBX_CS_ARROW11, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.striped-right-arrow" , SID_DRAWTBX_CS_ARROW12, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.notched-right-arrow" , SID_DRAWTBX_CS_ARROW13, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.pentagon-right" , SID_DRAWTBX_CS_ARROW14, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.chevron" , SID_DRAWTBX_CS_ARROW15, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow-callout" , SID_DRAWTBX_CS_ARROW16, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow-callout" , SID_DRAWTBX_CS_ARROW17, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow-callout" , SID_DRAWTBX_CS_ARROW18, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow-callout" , SID_DRAWTBX_CS_ARROW19, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow-callout",SID_DRAWTBX_CS_ARROW20, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow-callout" ,SID_DRAWTBX_CS_ARROW21, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow-callout",SID_DRAWTBX_CS_ARROW22, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow-callout" , SID_DRAWTBX_CS_ARROW23, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.circular-arrow" , SID_DRAWTBX_CS_ARROW24, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.split-round-arrow" , SID_DRAWTBX_CS_ARROW25, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:ArrowShapes.s-sharped-arrow" , SID_DRAWTBX_CS_ARROW26, CommandGroup::INSERT );
+
+ implDescribeSupportedFeature( ".uno:StarShapes.bang" , SID_DRAWTBX_CS_STAR1, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.star4" , SID_DRAWTBX_CS_STAR2, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.star5" , SID_DRAWTBX_CS_STAR3, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.star6" , SID_DRAWTBX_CS_STAR4, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.star8" , SID_DRAWTBX_CS_STAR5, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.star12" , SID_DRAWTBX_CS_STAR6, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.star24" , SID_DRAWTBX_CS_STAR7, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.concave-star6" , SID_DRAWTBX_CS_STAR8, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.vertical-scroll" , SID_DRAWTBX_CS_STAR9, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.horizontal-scroll" , SID_DRAWTBX_CS_STAR10, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.signet" , SID_DRAWTBX_CS_STAR11, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes.doorplate" , SID_DRAWTBX_CS_STAR12, CommandGroup::INSERT );
+
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-process" , SID_DRAWTBX_CS_FLOWCHART1, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-alternate-process" , SID_DRAWTBX_CS_FLOWCHART2, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-decision" , SID_DRAWTBX_CS_FLOWCHART3, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-data" , SID_DRAWTBX_CS_FLOWCHART4, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-predefined-process" , SID_DRAWTBX_CS_FLOWCHART5, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-internal-storage" , SID_DRAWTBX_CS_FLOWCHART6, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-document" , SID_DRAWTBX_CS_FLOWCHART7, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-multidocument" , SID_DRAWTBX_CS_FLOWCHART8, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-terminator" , SID_DRAWTBX_CS_FLOWCHART9, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-preparation" , SID_DRAWTBX_CS_FLOWCHART10, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-input" , SID_DRAWTBX_CS_FLOWCHART11, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-operation" , SID_DRAWTBX_CS_FLOWCHART12, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-connector" , SID_DRAWTBX_CS_FLOWCHART13, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-off-page-connector" , SID_DRAWTBX_CS_FLOWCHART14, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-card" , SID_DRAWTBX_CS_FLOWCHART15, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-punched-tape" , SID_DRAWTBX_CS_FLOWCHART16, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-summing-junction" , SID_DRAWTBX_CS_FLOWCHART17, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-or" , SID_DRAWTBX_CS_FLOWCHART18, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-collate" , SID_DRAWTBX_CS_FLOWCHART19, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sort" , SID_DRAWTBX_CS_FLOWCHART20, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-extract" , SID_DRAWTBX_CS_FLOWCHART21, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-merge" , SID_DRAWTBX_CS_FLOWCHART22, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-stored-data" , SID_DRAWTBX_CS_FLOWCHART23, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-delay" , SID_DRAWTBX_CS_FLOWCHART24, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sequential-access" , SID_DRAWTBX_CS_FLOWCHART25, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-magnetic-disk" , SID_DRAWTBX_CS_FLOWCHART26, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-direct-access-storage",SID_DRAWTBX_CS_FLOWCHART27, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-display" , SID_DRAWTBX_CS_FLOWCHART28, CommandGroup::INSERT );
+
+ implDescribeSupportedFeature( ".uno:CalloutShapes.rectangular-callout" , SID_DRAWTBX_CS_CALLOUT1, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:CalloutShapes.round-rectangular-callout" , SID_DRAWTBX_CS_CALLOUT2, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:CalloutShapes.round-callout" , SID_DRAWTBX_CS_CALLOUT3, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:CalloutShapes.cloud-callout" , SID_DRAWTBX_CS_CALLOUT4, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-1" , SID_DRAWTBX_CS_CALLOUT5, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-2" , SID_DRAWTBX_CS_CALLOUT6, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-3" , SID_DRAWTBX_CS_CALLOUT7, CommandGroup::INSERT );
+
+ implDescribeSupportedFeature( ".uno:ArrowShapes", SID_DRAWTBX_CS_ARROW, CommandGroup::INSERT );
+
+ implDescribeSupportedFeature( ".uno:FlowChartShapes", SID_DRAWTBX_CS_FLOWCHART, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:CalloutShapes", SID_DRAWTBX_CS_CALLOUT, CommandGroup::INSERT );
+ implDescribeSupportedFeature( ".uno:StarShapes", SID_DRAWTBX_CS_STAR, CommandGroup::INSERT );
+
+
+ // keys
+ implDescribeSupportedFeature( ".uno:Escape", SID_ESCAPE, CommandGroup::CONTROLS);
+
+ // internal one
+ implDescribeSupportedFeature( ".uno:RPT_RPTHEADER_UNDO", SID_REPORTHEADER_WITHOUT_UNDO);
+ implDescribeSupportedFeature( ".uno:RPT_RPTFOOTER_UNDO", SID_REPORTFOOTER_WITHOUT_UNDO);
+ implDescribeSupportedFeature( ".uno:RPT_PGHEADER_UNDO", SID_PAGEHEADER_WITHOUT_UNDO);
+ implDescribeSupportedFeature( ".uno:RPT_PGFOOTER_UNDO", SID_PAGEFOOTER_WITHOUT_UNDO);
+ implDescribeSupportedFeature( ".uno:DBBackgroundColor", SID_ATTR_CHAR_COLOR_BACKGROUND);
+ implDescribeSupportedFeature( ".uno:SID_GROUPHEADER", SID_GROUPHEADER);
+ implDescribeSupportedFeature( ".uno:SID_GROUPHEADER_WITHOUT_UNDO", SID_GROUPHEADER_WITHOUT_UNDO);
+ implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER", SID_GROUPFOOTER);
+ implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER_WITHOUT_UNDO", SID_GROUPFOOTER_WITHOUT_UNDO);
+ implDescribeSupportedFeature( ".uno:SID_GROUP_REMOVE", SID_GROUP_REMOVE);
+ implDescribeSupportedFeature( ".uno:SID_GROUP_APPEND", SID_GROUP_APPEND);
+ implDescribeSupportedFeature( ".uno:SID_ADD_CONTROL_PAIR", SID_ADD_CONTROL_PAIR);
+ implDescribeSupportedFeature( ".uno:SplitPosition", SID_SPLIT_POSITION);
+ implDescribeSupportedFeature( ".uno:LastPropertyBrowserPage", SID_PROPERTYBROWSER_LAST_PAGE);
+ implDescribeSupportedFeature( ".uno:Select", SID_SELECT);
+ implDescribeSupportedFeature( ".uno:InsertFunction", SID_RPT_NEW_FUNCTION);
+ implDescribeSupportedFeature( ".uno:NextMark", SID_NEXT_MARK);
+ implDescribeSupportedFeature( ".uno:PrevMark", SID_PREV_MARK);
+ implDescribeSupportedFeature( ".uno:TerminateInplaceActivation", SID_TERMINATE_INPLACEACTIVATION);
+ implDescribeSupportedFeature( ".uno:SelectAllLabels", SID_SELECT_ALL_LABELS);
+ implDescribeSupportedFeature( ".uno:SelectAllEdits", SID_SELECT_ALL_EDITS);
+ implDescribeSupportedFeature( ".uno:CollapseSection", SID_COLLAPSE_SECTION);
+ implDescribeSupportedFeature( ".uno:ExpandSection", SID_EXPAND_SECTION);
+}
+// -----------------------------------------------------------------------------
+void OReportController::impl_onModifyChanged()
+{
+ try
+ {
+ if ( m_xReportDefinition.is() )
+ m_xReportDefinition->setModified( impl_isModified() );
+ DBSubComponentController::impl_onModifyChanged();
+ }
+ catch(uno::Exception)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _xLayoutManager)
+{
+ if ( _xLayoutManager.is() )
+ {
+ static const ::rtl::OUString s_sMenu[] = {
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/statusbar/statusbar"))
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/reportcontrols"))
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/drawbar"))
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/Formatting"))
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/alignmentbar"))
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/sectionalignmentbar"))
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/resizebar"))
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/sectionshrinkbar"))
+ };
+ for (size_t i = 0; i< sizeof(s_sMenu)/sizeof(s_sMenu[0]); ++i)
+ {
+ _xLayoutManager->createElement( s_sMenu[i] );
+ _xLayoutManager->requestElement( s_sMenu[i] );
+ }
+ } // if ( _xLayoutManager.is() )
+}
+// -----------------------------------------------------------------------------
+void OReportController::notifyGroupSections(const ContainerEvent& _rEvent,bool _bShow)
+{
+ uno::Reference< report::XGroup> xGroup(_rEvent.Element,uno::UNO_QUERY);
+ if ( xGroup.is() )
+ {
+ ::vos::OGuard aSolarGuard(Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard( getMutex() );
+ sal_Int32 nGroupPos = 0;
+ _rEvent.Accessor >>= nGroupPos;
+
+ if ( _bShow )
+ {
+ xGroup->addPropertyChangeListener(PROPERTY_HEADERON, static_cast<XPropertyChangeListener*>(this));
+ xGroup->addPropertyChangeListener(PROPERTY_FOOTERON, static_cast<XPropertyChangeListener*>(this));
+ }
+ else
+ {
+ xGroup->removePropertyChangeListener(PROPERTY_HEADERON, static_cast<XPropertyChangeListener*>(this));
+ xGroup->removePropertyChangeListener(PROPERTY_FOOTERON, static_cast<XPropertyChangeListener*>(this));
+ }
+
+ if ( xGroup->getHeaderOn() )
+ {
+ groupChange(xGroup,PROPERTY_HEADERON,nGroupPos,_bShow);
+ if (_bShow)
+ {
+ m_pReportControllerObserver->AddSection(xGroup->getHeader());
+ }
+ else
+ {
+ m_pReportControllerObserver->RemoveSection(xGroup->getHeader());
+ }
+ }
+ if ( xGroup->getFooterOn() )
+ {
+ groupChange(xGroup,PROPERTY_FOOTERON,nGroupPos,_bShow);
+ if (_bShow)
+ {
+ m_pReportControllerObserver->AddSection(xGroup->getFooter());
+ }
+ else
+ {
+ m_pReportControllerObserver->RemoveSection(xGroup->getFooter());
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+// ::container::XContainerListener
+void SAL_CALL OReportController::elementInserted( const ContainerEvent& _rEvent ) throw(RuntimeException)
+{
+ notifyGroupSections(_rEvent,true);
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OReportController::elementRemoved( const ContainerEvent& _rEvent ) throw(RuntimeException)
+{
+ notifyGroupSections(_rEvent,false);
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OReportController::elementReplaced( const ContainerEvent& /*_rEvent*/ ) throw(RuntimeException)
+{
+ ::vos::OGuard aSolarGuard(Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard( getMutex() );
+ OSL_ENSURE(0,"Not yet implemented!");
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OReportController::propertyChange( const beans::PropertyChangeEvent& evt ) throw (RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( getMutex() );
+ try
+ {
+ sal_Bool bShow = sal_False;
+ evt.NewValue >>= bShow;
+ if ( evt.Source == m_xReportDefinition )
+ {
+ if ( evt.PropertyName.equals( PROPERTY_REPORTHEADERON ) )
+ {
+ const sal_uInt16 nPosition = m_xReportDefinition->getPageHeaderOn() ? 1 : 0;
+ if ( bShow )
+ {
+ getDesignView()->addSection(m_xReportDefinition->getReportHeader(),DBREPORTHEADER,nPosition);
+ m_pReportControllerObserver->AddSection(m_xReportDefinition->getReportHeader());
+ }
+ else
+ {
+ getDesignView()->removeSection(nPosition);
+ }
+ }
+ else if ( evt.PropertyName.equals( PROPERTY_REPORTFOOTERON ) )
+ {
+ sal_uInt16 nPosition = getDesignView()->getSectionCount();
+ if ( m_xReportDefinition->getPageFooterOn() )
+ --nPosition;
+ if ( bShow )
+ {
+ getDesignView()->addSection(m_xReportDefinition->getReportFooter(),DBREPORTFOOTER,nPosition);
+ m_pReportControllerObserver->AddSection(m_xReportDefinition->getReportFooter());
+ }
+ else
+ {
+ getDesignView()->removeSection(nPosition - 1);
+ }
+ }
+ else if ( evt.PropertyName.equals( PROPERTY_PAGEHEADERON ) )
+ {
+ if ( bShow )
+ {
+ getDesignView()->addSection(m_xReportDefinition->getPageHeader(),DBPAGEHEADER,0);
+ m_pReportControllerObserver->AddSection(m_xReportDefinition->getPageHeader());
+ }
+ else
+ {
+ getDesignView()->removeSection(sal_uInt16(0));
+ }
+ }
+ else if ( evt.PropertyName.equals( PROPERTY_PAGEFOOTERON ) )
+ {
+ if ( bShow )
+ {
+ getDesignView()->addSection(m_xReportDefinition->getPageFooter(),DBPAGEFOOTER);
+ m_pReportControllerObserver->AddSection(m_xReportDefinition->getPageFooter());
+ }
+ else
+ {
+ getDesignView()->removeSection(getDesignView()->getSectionCount() - 1);
+ }
+ }
+ else if ( evt.PropertyName.equals( PROPERTY_COMMAND )
+ || evt.PropertyName.equals( PROPERTY_COMMANDTYPE )
+ || evt.PropertyName.equals( PROPERTY_ESCAPEPROCESSING )
+ || evt.PropertyName.equals( PROPERTY_FILTER )
+ )
+ {
+ m_xColumns.clear();
+ m_xHoldAlive.clear();
+ InvalidateFeature(SID_FM_ADD_FIELD);
+ if ( !getDesignView()->isAddFieldVisible() && isUiVisible() )
+ getDesignView()->toggleAddField();
+ }
+ /// TODO: check what we need to notify here TitleHelper
+ /*else if ( evt.PropertyName.equals( PROPERTY_CAPTION ) )
+ updateTitle();*/
+ } // if ( evt.Source == m_xReportDefinition )
+ else
+ {
+ uno::Reference< report::XGroup> xGroup(evt.Source,uno::UNO_QUERY);
+ if ( xGroup.is() )
+ {
+ sal_Int32 nGroupPos = getGroupPosition(xGroup);
+
+ groupChange(xGroup,evt.PropertyName,nGroupPos,bShow);
+ }
+ }
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// -----------------------------------------------------------------------------
+void SAL_CALL OReportController::disposing( const lang::EventObject& Source ) throw(uno::RuntimeException)
+{
+ // simply disambiguate
+ OReportController_BASE::disposing(Source);
+}
+
+// -----------------------------------------------------------------------------
+sal_uInt16 lcl_getNonVisbleGroupsBefore( const uno::Reference< report::XGroups>& _xGroups
+ ,sal_Int32 _nGroupPos
+ ,::std::mem_fun_t<sal_Bool,OGroupHelper>&_pGroupMemberFunction)
+{
+ uno::Reference< report::XGroup> xGroup;
+ sal_uInt16 nNonVisibleGroups = 0;
+ sal_Int32 nCount = _xGroups->getCount();
+ for( sal_Int32 i = 0; i < _nGroupPos && i < nCount; ++i)
+ {
+ xGroup.set(_xGroups->getByIndex(i),uno::UNO_QUERY);
+ OSL_ENSURE(xGroup.is(),"Group is NULL! -> GPF");
+ OGroupHelper aGroupHelper(xGroup);
+ if ( !_pGroupMemberFunction(&aGroupHelper) )
+ ++nNonVisibleGroups;
+ }
+ return nNonVisibleGroups;
+}
+// -----------------------------------------------------------------------------
+void OReportController::groupChange( const uno::Reference< report::XGroup>& _xGroup,const ::rtl::OUString& _sPropName,sal_Int32 _nGroupPos,bool _bShow)
+{
+ //adjustSectionName(_xGroup,_nGroupPos);
+ ::std::mem_fun_t<sal_Bool,OGroupHelper> pMemFun = ::std::mem_fun(&OGroupHelper::getHeaderOn);
+ ::std::mem_fun_t<uno::Reference<report::XSection> , OGroupHelper> pMemFunSection = ::std::mem_fun(&OGroupHelper::getHeader);
+ ::rtl::OUString sColor(DBGROUPHEADER);
+ sal_uInt16 nPosition = 0;
+ bool bHandle = false;
+ if ( _sPropName.equals( PROPERTY_HEADERON ) )
+ {
+ nPosition = m_xReportDefinition->getPageHeaderOn() ? (m_xReportDefinition->getReportHeaderOn() ? 2 : 1) : (m_xReportDefinition->getReportHeaderOn() ? 1 : 0);
+ nPosition += (static_cast<sal_uInt16>(_nGroupPos) - lcl_getNonVisbleGroupsBefore(m_xReportDefinition->getGroups(),_nGroupPos,pMemFun));
+ bHandle = true;
+ }
+ else if ( _sPropName.equals( PROPERTY_FOOTERON ) )
+ {
+ pMemFun = ::std::mem_fun(&OGroupHelper::getFooterOn);
+ pMemFunSection = ::std::mem_fun(&OGroupHelper::getFooter);
+ nPosition = getDesignView()->getSectionCount();
+
+ if ( m_xReportDefinition->getPageFooterOn() )
+ --nPosition;
+ if ( m_xReportDefinition->getReportFooterOn() )
+ --nPosition;
+ sColor = DBGROUPFOOTER;
+ nPosition -= (static_cast<sal_uInt16>(_nGroupPos) - lcl_getNonVisbleGroupsBefore(m_xReportDefinition->getGroups(),_nGroupPos,pMemFun));
+ if ( !_bShow )
+ --nPosition;
+ bHandle = true;
+ }
+ if ( bHandle )
+ {
+ if ( _bShow )
+ {
+ OGroupHelper aGroupHelper(_xGroup);
+ getDesignView()->addSection(pMemFunSection(&aGroupHelper),sColor,nPosition);
+ }
+ else
+ {
+ getDesignView()->removeSection(nPosition);
+ }
+ }
+}
+//------------------------------------------------------------------------------
+IMPL_LINK( OReportController, OnClipboardChanged, void*, EMPTYARG )
+{
+ return OnInvalidateClipboard( NULL );
+}
+//------------------------------------------------------------------------------
+IMPL_LINK(OReportController, OnInvalidateClipboard, void*, EMPTYARG)
+{
+ InvalidateFeature(SID_CUT);
+ InvalidateFeature(SID_COPY);
+ InvalidateFeature(SID_PASTE);
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+void OReportController::openPageDialog(const uno::Reference<report::XSection>& _xSection)
+{
+ if ( !m_xReportDefinition.is() )
+ return;
+ // ------------
+ // UNO->ItemSet
+ static SfxItemInfo aItemInfos[] =
+ {
+ { SID_ATTR_LRSPACE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_ULSPACE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_PAGE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_PAGE_SIZE, SFX_ITEM_POOLABLE },
+ { SID_ENUM_PAGE_MODE, SFX_ITEM_POOLABLE },
+ { SID_PAPER_START, SFX_ITEM_POOLABLE },
+ { SID_PAPER_END, SFX_ITEM_POOLABLE },
+ { SID_ATTR_BRUSH, SFX_ITEM_POOLABLE },
+ { SID_FLAG_TYPE, SFX_ITEM_POOLABLE },
+ { SID_ATTR_METRIC, SFX_ITEM_POOLABLE }
+ };
+
+ MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
+ FieldUnit eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
+ SfxPoolItem* pDefaults[] =
+ {
+ new SvxLRSpaceItem(RPTUI_ID_LRSPACE),
+ new SvxULSpaceItem(RPTUI_ID_ULSPACE),
+ new SvxPageItem(RPTUI_ID_PAGE),
+ new SvxSizeItem(RPTUI_ID_SIZE),
+ new SfxAllEnumItem(RPTUI_ID_PAGE_MODE,SVX_PAGE_MODE_STANDARD),
+ new SfxAllEnumItem(RPTUI_ID_START,PAPER_A4),
+ new SfxAllEnumItem(RPTUI_ID_END,PAPER_E),
+ new SvxBrushItem(ITEMID_BRUSH),
+ new SfxUInt16Item(RPTUI_ID_METRIC,static_cast<sal_uInt16>(eUserMetric))
+ };
+
+ static sal_uInt16 pRanges[] =
+ {
+ RPTUI_ID_LRSPACE,RPTUI_ID_BRUSH,
+ SID_ATTR_METRIC,SID_ATTR_METRIC,
+ 0
+ };
+ SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ReportPageProperties"), RPTUI_ID_LRSPACE,RPTUI_ID_METRIC, aItemInfos, pDefaults) );
+ pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why
+ pPool->FreezeIdRanges(); // the same
+
+ try
+ {
+ ::std::auto_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges));
+ // fill it
+ if ( _xSection.is() )
+ pDescriptor->Put(SvxBrushItem(::Color(_xSection->getBackColor()),ITEMID_BRUSH));
+ else
+ {
+ pDescriptor->Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE))));
+ pDescriptor->Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN)
+ ,getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN),0,0,RPTUI_ID_LRSPACE));
+ pDescriptor->Put(SvxULSpaceItem(static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN))
+ ,static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BOTTOMMARGIN)),RPTUI_ID_ULSPACE));
+ pDescriptor->Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<sal_uInt16>(eUserMetric)));
+
+ uno::Reference< style::XStyle> xPageStyle(getUsedStyle(m_xReportDefinition));
+ if ( xPageStyle.is() )
+ {
+ SvxPageItem aPageItem(RPTUI_ID_PAGE);
+ aPageItem.SetDescName(xPageStyle->getName());
+ uno::Reference<beans::XPropertySet> xProp(xPageStyle,uno::UNO_QUERY_THROW);
+ aPageItem.PutValue(xProp->getPropertyValue(PROPERTY_PAGESTYLELAYOUT),MID_PAGE_LAYOUT);
+ aPageItem.SetLandscape(getStyleProperty<sal_Bool>(m_xReportDefinition,PROPERTY_ISLANDSCAPE));
+ aPageItem.SetNumType((SvxNumType)getStyleProperty<sal_Int16>(m_xReportDefinition,PROPERTY_NUMBERINGTYPE));
+ pDescriptor->Put(aPageItem);
+ pDescriptor->Put(SvxBrushItem(::Color(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH));
+ }
+ }
+
+ { // want the dialog to be destroyed before our set
+ ORptPageDialog aDlg(getView(), pDescriptor.get(),_xSection.is() ? RID_PAGEDIALOG_BACKGROUND : RID_PAGEDIALOG_PAGE);
+ if (RET_OK == aDlg.Execute())
+ {
+ // ------------
+ // ItemSet->UNO
+ // UNO-properties
+ const SfxItemSet* pSet = aDlg.GetOutputItemSet();
+ if ( _xSection.is() )
+ {
+ const SfxPoolItem* pItem;
+ if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_BRUSH,sal_True,&pItem))
+ _xSection->setBackColor(static_cast<const SvxBrushItem*>(pItem)->GetColor().GetColor());
+ }
+ else
+ {
+ uno::Reference< beans::XPropertySet> xProp(getUsedStyle(m_xReportDefinition),uno::UNO_QUERY_THROW);
+ const String sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEPAGE));
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+ const SfxPoolItem* pItem = NULL;
+ if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_SIZE,sal_True,&pItem))
+ {
+ const Size aPaperSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
+ uno::Any aValue;
+ static_cast<const SvxSizeItem*>(pItem)->QueryValue(aValue,MID_SIZE_SIZE);
+ xProp->setPropertyValue(PROPERTY_PAPERSIZE,aValue);
+ resetZoomType();
+ }
+
+ if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_LRSPACE,sal_True,&pItem))
+ {
+ xProp->setPropertyValue(PROPERTY_LEFTMARGIN,uno::makeAny(static_cast<const SvxLRSpaceItem*>(pItem)->GetLeft()));
+ xProp->setPropertyValue(PROPERTY_RIGHTMARGIN,uno::makeAny(static_cast<const SvxLRSpaceItem*>(pItem)->GetRight()));
+ }
+ if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_ULSPACE,sal_True,&pItem))
+ {
+ xProp->setPropertyValue(PROPERTY_TOPMARGIN,uno::makeAny(static_cast<const SvxULSpaceItem*>(pItem)->GetUpper()));
+ xProp->setPropertyValue(PROPERTY_BOTTOMMARGIN,uno::makeAny(static_cast<const SvxULSpaceItem*>(pItem)->GetLower()));
+ }
+ if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_PAGE,sal_True,&pItem))
+ {
+ const SvxPageItem* pPageItem = static_cast<const SvxPageItem*>(pItem);
+ xProp->setPropertyValue(PROPERTY_ISLANDSCAPE,uno::makeAny(static_cast<sal_Bool>(pPageItem->IsLandscape())));
+ xProp->setPropertyValue(PROPERTY_NUMBERINGTYPE,uno::makeAny(static_cast<sal_Int16>(pPageItem->GetNumType())));
+ uno::Any aValue;
+ pPageItem->QueryValue(aValue,MID_PAGE_LAYOUT);
+ xProp->setPropertyValue(PROPERTY_PAGESTYLELAYOUT,aValue);
+ resetZoomType();
+ }
+ if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_BRUSH,sal_True,&pItem))
+ {
+ ::Color aBackColor = static_cast<const SvxBrushItem*>(pItem)->GetColor();
+ xProp->setPropertyValue(PROPERTY_BACKTRANSPARENT,uno::makeAny(aBackColor == COL_TRANSPARENT));
+ xProp->setPropertyValue(PROPERTY_BACKCOLOR,uno::makeAny(aBackColor.GetColor()));
+ }
+ }
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ SfxItemPool::Free(pPool);
+
+ for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i)
+ delete pDefaults[i];
+
+}
+
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL OReportController::attachModel(const uno::Reference< frame::XModel > & xModel) throw( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ uno::Reference< report::XReportDefinition > xReportDefinition( xModel, UNO_QUERY );
+ if ( !xReportDefinition.is() )
+ return sal_False;
+
+ uno::Reference< document::XUndoManagerSupplier > xTestSuppUndo( xModel, UNO_QUERY );
+ if ( !xTestSuppUndo.is() )
+ return sal_False;
+
+ m_xReportDefinition = xReportDefinition;
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+void OReportController::openSortingAndGroupingDialog()
+{
+ if ( !m_xReportDefinition.is() )
+ return;
+ if ( !m_pGroupsFloater )
+ {
+ m_pGroupsFloater = new OGroupsSortingDialog(getView(),!isEditable(),this);
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_GROUPS_SORTING ) );
+ if ( aDlgOpt.Exists() )
+ m_pGroupsFloater->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+ m_pGroupsFloater->AddEventListener(LINK(this,OReportController,EventLstHdl));
+ }
+ else if ( isUiVisible() )
+ m_pGroupsFloater->Show(!m_pGroupsFloater->IsVisible());
+}
+// -----------------------------------------------------------------------------
+sal_Int32 OReportController::getGroupPosition(const uno::Reference< report::XGroup >& _xGroup)
+{
+ return rptui::getPositionInIndexAccess(m_xReportDefinition->getGroups().get(),_xGroup);
+}
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+IMPL_LINK( OReportController, EventLstHdl, VclWindowEvent*, _pEvent )
+{
+ if ( _pEvent && _pEvent->GetId() == VCLEVENT_WINDOW_CLOSE )
+ {
+ InvalidateFeature(SID_SORTINGANDGROUPING);
+ InvalidateFeature(SID_FM_ADD_FIELD);
+ InvalidateFeature(SID_RPT_SHOWREPORTEXPLORER);
+ }
+ return 1L;
+}
+// -----------------------------------------------------------------------------
+void OReportController::Notify(SfxBroadcaster & /* _rBc */, SfxHint const & _rHint)
+{
+ if (_rHint.ISA(DlgEdHint)
+ && (static_cast< DlgEdHint const & >(_rHint).GetKind()
+ == RPTUI_HINT_SELECTIONCHANGED))
+ {
+ const sal_Int32 nSelectionCount = getDesignView()->getMarkedObjectCount();
+ if ( m_nSelectionCount != nSelectionCount )
+ {
+ m_nSelectionCount = nSelectionCount;
+ InvalidateAll();
+ }
+ lang::EventObject aEvent(*this);
+ m_aSelectionListeners.forEach<view::XSelectionChangeListener>(
+ ::boost::bind(&view::XSelectionChangeListener::selectionChanged,_1,boost::cref(aEvent)));
+
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::executeMethodWithUndo(sal_uInt16 _nUndoStrId,const ::std::mem_fun_t<void,ODesignView>& _pMemfun)
+{
+ const String sUndoAction = String((ModuleRes(_nUndoStrId)));
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+ _pMemfun( getDesignView() );
+ InvalidateFeature( SID_SAVEDOC );
+ InvalidateFeature( SID_UNDO );
+}
+// -----------------------------------------------------------------------------
+void OReportController::alignControlsWithUndo(sal_uInt16 _nUndoStrId,sal_Int32 _nControlModification,bool _bAlignAtSection)
+{
+ const String sUndoAction = String((ModuleRes(_nUndoStrId)));
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+ getDesignView()->alignMarkedObjects(_nControlModification,_bAlignAtSection);
+ InvalidateFeature( SID_SAVEDOC );
+ InvalidateFeature( SID_UNDO );
+}
+// -----------------------------------------------------------------------------
+void OReportController::shrinkSectionBottom(uno::Reference<report::XSection> _xSection)
+{
+ const sal_Int32 nElements = _xSection->getCount();
+ if (nElements == 0)
+ {
+ // there are no elements
+ return;
+ }
+ const sal_Int32 nSectionHeight = _xSection->getHeight();
+ // sal_Int32 nMinPositionY = nSectionHeight;
+ sal_Int32 nMaxPositionY = 0;
+ uno::Reference< report::XReportComponent> xReportComponent;
+
+ // for every component get it's Y-position and compare it to the current Y-position
+ for (int i=0;i<nElements;i++)
+ {
+ xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY);
+ const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY();
+ const sal_Int32 nReportComponentHeight = xReportComponent->getHeight();
+ const sal_Int32 nReportComponentPositionYAndHeight = nReportComponentPositionY + nReportComponentHeight;
+ // nMinPositionY = std::min(nReportComponentPositionY, nMinPositionY);
+ nMaxPositionY = std::max(nReportComponentPositionYAndHeight, nMaxPositionY);
+ }
+ // now we know the minimal Y-Position and maximal Y-Position
+
+ if (nMaxPositionY > (nSectionHeight - 7) ) // Magic Number, we use a little bit less heights for right positioning
+ {
+ // the lowest position is already 0
+ return;
+ }
+ _xSection->setHeight(nMaxPositionY);
+}
+
+void OReportController::shrinkSectionTop(uno::Reference<report::XSection> _xSection)
+{
+ const sal_Int32 nElements = _xSection->getCount();
+ if (nElements == 0)
+ {
+ // there are no elements
+ return;
+ }
+
+ const sal_Int32 nSectionHeight = _xSection->getHeight();
+ sal_Int32 nMinPositionY = nSectionHeight;
+ // sal_Int32 nMaxPositionY = 0;
+ uno::Reference< report::XReportComponent> xReportComponent;
+
+ // for every component get it's Y-position and compare it to the current Y-position
+ for (int i=0;i<nElements;i++)
+ {
+ xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY);
+ const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY();
+ // const sal_Int32 nReportComponentHeight = xReportComponent->getHeight();
+ // const sal_Int32 nReportComponentPositionYAndHeight = nReportComponentPositionY + nReportComponentHeight;
+ nMinPositionY = std::min(nReportComponentPositionY, nMinPositionY);
+ // nMaxPositionY = std::max(nReportComponentPositionYAndHeight, nMaxPositionY);
+ }
+ // now we know the minimal Y-Position and maximal Y-Position
+ if (nMinPositionY == 0)
+ {
+ // the lowest position is already 0
+ return;
+ }
+ for (int i=0;i<nElements;i++)
+ {
+ xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY);
+ const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY();
+ const sal_Int32 nNewPositionY = nReportComponentPositionY - nMinPositionY;
+ xReportComponent->setPositionY(nNewPositionY);
+ }
+ const sal_Int32 nNewSectionHeight = nSectionHeight - nMinPositionY;
+ _xSection->setHeight(nNewSectionHeight);
+}
+
+void OReportController::shrinkSection(sal_uInt16 _nUndoStrId, uno::Reference<report::XSection> _xSection, sal_Int32 _nSid)
+{
+ if ( _xSection.is() )
+ {
+ const String sUndoAction = String((ModuleRes(_nUndoStrId)));
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+
+ if (_nSid == SID_SECTION_SHRINK)
+ {
+ shrinkSectionTop(_xSection);
+ shrinkSectionBottom(_xSection);
+ }
+ else if (_nSid == SID_SECTION_SHRINK_TOP)
+ {
+ shrinkSectionTop(_xSection);
+ }
+ else if (_nSid == SID_SECTION_SHRINK_BOTTOM)
+ {
+ shrinkSectionBottom(_xSection);
+ }
+ }
+
+ InvalidateFeature( SID_SAVEDOC );
+ InvalidateFeature( SID_UNDO );
+}
+
+// -----------------------------------------------------------------------------
+uno::Any SAL_CALL OReportController::getViewData(void) throw( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ sal_Int32 nCommandIDs[] =
+ {
+ SID_GRID_VISIBLE,
+ SID_GRID_USE,
+ SID_HELPLINES_MOVE,
+ SID_RULER,
+ SID_SHOW_PROPERTYBROWSER,
+ SID_PROPERTYBROWSER_LAST_PAGE,
+ SID_SPLIT_POSITION
+ };
+
+ ::comphelper::NamedValueCollection aCommandProperties;
+ for ( size_t i=0; i < sizeof( nCommandIDs ) / sizeof( nCommandIDs[0] ); ++i )
+ {
+ const FeatureState aFeatureState = GetState( nCommandIDs[i] );
+
+ ::rtl::OUString sCommandURL( getURLForId( nCommandIDs[i] ).Main );
+ OSL_ENSURE( sCommandURL.indexOfAsciiL( ".uno:", 5 ) == 0, "OReportController::getViewData: illegal command URL!" );
+ sCommandURL = sCommandURL.copy( 5 );
+
+ Any aCommandState;
+ if ( !!aFeatureState.bChecked )
+ aCommandState <<= (*aFeatureState.bChecked) ? sal_True : sal_False;
+ else if ( aFeatureState.aValue.hasValue() )
+ aCommandState = aFeatureState.aValue;
+
+ aCommandProperties.put( sCommandURL, aCommandState );
+ }
+
+ ::comphelper::NamedValueCollection aViewData;
+ aViewData.put( "CommandProperties", aCommandProperties.getPropertyValues() );
+
+ if ( getDesignView() )
+ {
+ ::std::vector<sal_uInt16> aCollapsedPositions;
+ getDesignView()->fillCollapsedSections(aCollapsedPositions);
+ if ( !aCollapsedPositions.empty() )
+ {
+ uno::Sequence<beans::PropertyValue> aCollapsedSections(aCollapsedPositions.size());
+ beans::PropertyValue* pCollapsedIter = aCollapsedSections.getArray();
+ ::std::vector<sal_uInt16>::iterator aIter = aCollapsedPositions.begin();
+ ::std::vector<sal_uInt16>::iterator aEnd = aCollapsedPositions.end();
+ for (sal_Int32 i = 1; aIter != aEnd ; ++aIter,++pCollapsedIter,++i)
+ {
+ pCollapsedIter->Name = PROPERTY_SECTION + ::rtl::OUString::valueOf(i);
+ pCollapsedIter->Value <<= static_cast<sal_Int32>(*aIter);
+ }
+
+ aViewData.put( "CollapsedSections", aCollapsedSections );
+ }
+
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
+ if ( pSectionWindow.get() )
+ {
+ aViewData.put( "MarkedSection", (sal_Int32)pSectionWindow->getReportSection().getPage()->GetPageNum() );
+ } // if ( pSectionWindow.get() )
+ } // if ( getDesignView() )
+
+ aViewData.put( "ZoomFactor", m_nZoomValue );
+ return uno::makeAny( aViewData.getPropertyValues() );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OReportController::restoreViewData(const uno::Any& i_data) throw( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ try
+ {
+ const ::comphelper::NamedValueCollection aViewData( i_data );
+
+ m_aCollapsedSections = aViewData.getOrDefault( "CollapsedSections", m_aCollapsedSections );
+ m_nPageNum = aViewData.getOrDefault( "MarkedSection", m_nPageNum );
+ m_nZoomValue = aViewData.getOrDefault( "ZoomFactor", m_nZoomValue );
+ // TODO: setting those 3 members is not enough - in theory, restoreViewData can be called when the
+ // view is fully alive, so we need to reflect those 3 values in the view.
+ // (At the moment, the method is called only during construction phase)
+
+
+ ::comphelper::NamedValueCollection aCommandProperties( aViewData.get( "CommandProperties" ) );
+ const ::std::vector< ::rtl::OUString > aCommandNames( aCommandProperties.getNames() );
+
+ for ( ::std::vector< ::rtl::OUString >::const_iterator commandName = aCommandNames.begin();
+ commandName != aCommandNames.end();
+ ++commandName
+ )
+ {
+ const Any& rCommandValue = aCommandProperties.get( *commandName );
+ if ( !rCommandValue.hasValue() )
+ continue;
+
+ if ( getView() )
+ {
+ util::URL aCommand;
+ aCommand.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ) ) + *commandName;
+
+ Sequence< PropertyValue > aCommandArgs(1);
+ aCommandArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value" ) );
+ aCommandArgs[0].Value = rCommandValue;
+
+ executeUnChecked( aCommand, aCommandArgs );
+ }
+ else
+ {
+ if ( commandName->equalsAscii( "ShowRuler" ) )
+ OSL_VERIFY( rCommandValue >>= m_bShowRuler );
+ else if ( commandName->equalsAscii( "HelplinesMove" ) )
+ OSL_VERIFY( rCommandValue >>= m_bHelplinesMove );
+ else if ( commandName->equalsAscii( "GridVisible" ) )
+ OSL_VERIFY( rCommandValue >>= m_bGridVisible );
+ else if ( commandName->equalsAscii( "GridUse" ) )
+ OSL_VERIFY( rCommandValue >>= m_bGridUse );
+ else if ( commandName->equalsAscii( "ControlProperties" ) )
+ OSL_VERIFY( rCommandValue >>= m_bShowProperties );
+ else if ( commandName->equalsAscii( "LastPropertyBrowserPage" ) )
+ OSL_VERIFY( rCommandValue >>= m_sLastActivePage );
+ else if ( commandName->equalsAscii( "SplitPosition" ) )
+ OSL_VERIFY( rCommandValue >>= m_nSplitPos );
+ }
+ }
+ }
+ catch ( const IllegalArgumentException& e )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::updateFloater()
+{
+ if ( m_pGroupsFloater && m_pGroupsFloater->IsVisible() )
+ m_pGroupsFloater->UpdateData();
+}
+
+// -----------------------------------------------------------------------------
+Reference<XFrame> OReportController::getXFrame()
+{
+ if ( !m_xFrameLoader.is() )
+ {
+ m_xFrameLoader.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))),uno::UNO_QUERY_THROW);
+ }
+ const sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
+ const ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank"));
+ Reference<XFrame> xFrame = Reference<XFrame>(m_xFrameLoader,uno::UNO_QUERY_THROW)->findFrame(sTarget,nFrameSearchFlag);
+ return xFrame;
+}
+
+// -----------------------------------------------------------------------------
+uno::Reference<frame::XModel> OReportController::executeReport()
+{
+ OSL_ENSURE(m_xReportDefinition.is(),"Where is my report?");
+
+ uno::Reference<frame::XModel> xModel;
+ if ( m_xReportDefinition.is() )
+ {
+ sal_uInt16 nErrorId = RID_ERR_NO_COMMAND;
+ bool bEnabled = m_xReportDefinition->getCommand().getLength() != 0;
+ if ( bEnabled )
+ {
+ bEnabled = false;
+ const sal_uInt16 nCount = m_aReportModel->GetPageCount();
+ sal_uInt16 i = 0;
+ for (; i < nCount && !bEnabled ; ++i)
+ {
+ const SdrPage* pPage = m_aReportModel->GetPage(i);
+ bEnabled = pPage->GetObjCount() != 0;
+ }
+ if ( !bEnabled )
+ nErrorId = RID_ERR_NO_OBJECTS;
+ }
+
+ dbtools::SQLExceptionInfo aInfo;
+ if ( !bEnabled )
+ {
+ sdb::SQLContext aFirstMessage;
+ String sInfo = String( ModuleRes( nErrorId ) );
+ aFirstMessage.Message = sInfo;
+ aInfo = aFirstMessage;
+ if ( isEditable() )
+ {
+ sal_uInt16 nCommand = 0;
+ if ( nErrorId == RID_ERR_NO_COMMAND )
+ {
+ if ( !m_bShowProperties )
+ executeUnChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue>());
+
+ m_sLastActivePage = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data"));
+ getDesignView()->setCurrentPage(m_sLastActivePage);
+ nCommand = SID_SELECT_REPORT;
+ }
+ else if ( getDesignView() && !getDesignView()->isAddFieldVisible() )
+ {
+ nCommand = SID_FM_ADD_FIELD;
+ }
+ if ( nCommand )
+ {
+ uno::Sequence< beans::PropertyValue> aArgs;
+ executeUnChecked(nCommand,aArgs);
+ }
+ }
+ }
+ else
+ {
+ m_bInGeneratePreview = true;
+ try
+ {
+ WaitObject aWait(getView()); // cursor
+ if ( !m_xReportEngine.is() )
+ m_xReportEngine.set(getORB()->createInstance(SERVICE_REPORTENGINE),uno::UNO_QUERY_THROW);
+ m_xReportEngine->setReportDefinition(m_xReportDefinition);
+ m_xReportEngine->setActiveConnection(getConnection());
+ Reference<XFrame> xFrame = getXFrame();
+ xModel = m_xReportEngine->createDocumentAlive(xFrame);
+ }
+ catch( const sdbc::SQLException& /*e*/ )
+ { // SQLExceptions and derived exceptions must not be translated
+ aInfo = ::cppu::getCaughtException();
+ }
+ catch(const uno::Exception& e)
+ {
+ uno::Any aCaughtException( ::cppu::getCaughtException() );
+
+ // our first message says: we caught an exception
+ sdb::SQLContext aFirstMessage;
+ String sInfo = String( ModuleRes( RID_STR_CAUGHT_FOREIGN_EXCEPTION ) );
+ sInfo.SearchAndReplaceAllAscii( "$type$", aCaughtException.getValueTypeName() );
+ aFirstMessage.Message = sInfo;
+
+ // our second message: the message of the exception we caught
+ sdbc::SQLException aSecondMessage;
+ aSecondMessage.Message = e.Message;
+ aSecondMessage.Context = e.Context;
+
+ // maybe our third message: the message which is wrapped in the exception we caught
+ sdbc::SQLException aThirdMessage;
+ lang::WrappedTargetException aWrapped;
+ if ( aCaughtException >>= aWrapped )
+ {
+ aThirdMessage.Message = aWrapped.Message;
+ aThirdMessage.Context = aWrapped.Context;
+ }
+
+ if ( aThirdMessage.Message.getLength() )
+ aSecondMessage.NextException <<= aThirdMessage;
+ aFirstMessage.NextException <<= aSecondMessage;
+
+ aInfo = aFirstMessage;
+ }
+ if (aInfo.isValid())
+ {
+ const String suSQLContext = String( ModuleRes( RID_STR_COULD_NOT_CREATE_REPORT ) );
+ aInfo.prepend(suSQLContext);
+ } // if (aInfo.isValid())
+ m_bInGeneratePreview = false;
+ }
+
+ if (aInfo.isValid())
+ {
+ showError(aInfo);
+ }
+ }
+ return xModel;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< frame::XModel > SAL_CALL OReportController::getModel(void) throw( uno::RuntimeException )
+{
+ return m_xReportDefinition.get();
+}
+// -----------------------------------------------------------------------------
+uno::Reference< sdbc::XRowSet > OReportController::getRowSet()
+{
+ OSL_PRECOND( m_xReportDefinition.is(), "OReportController::getRowSet: no report definition?!" );
+
+ if ( m_xRowSet.is() || !m_xReportDefinition.is() )
+ return m_xRowSet;
+
+ try
+ {
+ uno::Reference< sdbc::XRowSet > xRowSet( getORB()->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.RowSet" ) ) ), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet> xRowSetProp( xRowSet, uno::UNO_QUERY_THROW );
+
+ xRowSetProp->setPropertyValue( PROPERTY_ACTIVECONNECTION, uno::makeAny( getConnection() ) );
+ xRowSetProp->setPropertyValue( PROPERTY_APPLYFILTER, uno::makeAny( sal_True ) );
+
+ ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
+ TPropertyNamePair aPropertyMediation;
+ aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMAND, TPropertyConverter(PROPERTY_COMMAND,aNoConverter) ) );
+ aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_COMMANDTYPE, TPropertyConverter(PROPERTY_COMMANDTYPE,aNoConverter) ) );
+ aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_ESCAPEPROCESSING, TPropertyConverter(PROPERTY_ESCAPEPROCESSING,aNoConverter) ) );
+ aPropertyMediation.insert( TPropertyNamePair::value_type( PROPERTY_FILTER, TPropertyConverter(PROPERTY_FILTER,aNoConverter) ) );
+
+ m_xRowSetMediator = new OPropertyMediator( m_xReportDefinition.get(), xRowSetProp, aPropertyMediation );
+ m_xRowSet = xRowSet;
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return m_xRowSet;
+}
+// -----------------------------------------------------------------------------
+void OReportController::insertGraphic()
+{
+ const String sTitle(ModuleRes(RID_STR_IMPORT_GRAPHIC));
+ // build some arguments for the upcoming dialog
+ try
+ {
+ uno::Reference< report::XSection> xSection = getDesignView()->getCurrentSection();
+ ::sfx2::FileDialogHelper aDialog( ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, SFXWB_GRAPHIC );
+ aDialog.SetTitle( sTitle );
+
+ uno::Reference< ui::dialogs::XFilePickerControlAccess > xController(aDialog.GetFilePicker(), UNO_QUERY_THROW);
+ xController->setValue(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
+ xController->enableControl(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False/*sal_True*/);
+ sal_Bool bLink = sal_True;
+ xController->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any( bLink ) );
+
+ if ( ERRCODE_NONE == aDialog.Execute() )
+ {
+ xController->getValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bLink;
+ uno::Sequence<beans::PropertyValue> aArgs(2);
+ aArgs[0].Name = PROPERTY_IMAGEURL;
+ aArgs[0].Value <<= ::rtl::OUString(aDialog.GetPath());
+ aArgs[1].Name = PROPERTY_PRESERVEIRI;
+ aArgs[1].Value <<= bLink;
+ createControl(aArgs,xSection,::rtl::OUString(),OBJ_DLG_IMAGECONTROL);
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+// -----------------------------------------------------------------------------
+::boost::shared_ptr<rptui::OReportModel> OReportController::getSdrModel() const
+{
+ return m_aReportModel;
+}
+// -----------------------------------------------------------------------------
+::sal_Bool SAL_CALL OReportController::select( const Any& aSelection ) throw (IllegalArgumentException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+ ::sal_Bool bRet = sal_True;
+ if ( getDesignView() )
+ {
+ getDesignView()->unmarkAllObjects(NULL);
+ getDesignView()->SetMode(RPTUI_SELECT);
+
+ uno::Sequence< uno::Reference<report::XReportComponent> > aElements;
+ if ( aSelection >>= aElements )
+ {
+ if ( aElements.getLength() > 0 )
+ getDesignView()->showProperties(uno::Reference<uno::XInterface>(aElements[0],uno::UNO_QUERY));
+ getDesignView()->setMarked(aElements,sal_True);
+ }
+ else
+ {
+ uno::Reference<uno::XInterface> xObject(aSelection,uno::UNO_QUERY);
+ uno::Reference<report::XReportComponent> xProp(xObject,uno::UNO_QUERY);
+ if ( xProp.is() )
+ {
+ getDesignView()->showProperties(xObject);
+ aElements.realloc(1);
+ aElements[0] = xProp;
+ getDesignView()->setMarked(aElements,sal_True);
+ }
+ else
+ {
+ uno::Reference<report::XSection> xSection(aSelection,uno::UNO_QUERY);
+ if ( !xSection.is() && xObject.is() )
+ getDesignView()->showProperties(xObject);
+ getDesignView()->setMarked(xSection,xSection.is());
+ }
+ }
+ InvalidateAll();
+ }
+ return bRet;
+}
+// -----------------------------------------------------------------------------
+Any SAL_CALL OReportController::getSelection( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+ Any aRet;
+ if ( getDesignView() )
+ {
+ aRet = getDesignView()->getCurrentlyShownProperty();
+ if ( !aRet.hasValue() )
+ aRet <<= getDesignView()->getCurrentSection();
+ }
+ return aRet;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OReportController::addSelectionChangeListener( const Reference< view::XSelectionChangeListener >& _Listener ) throw (RuntimeException)
+{
+ m_aSelectionListeners.addInterface( _Listener );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OReportController::removeSelectionChangeListener( const Reference< view::XSelectionChangeListener >& _Listener ) throw (RuntimeException)
+{
+ m_aSelectionListeners.removeInterface( _Listener );
+}
+// -----------------------------------------------------------------------------
+void OReportController::createNewFunction(const uno::Any& _aValue)
+{
+ uno::Reference< container::XIndexContainer> xFunctions(_aValue,uno::UNO_QUERY_THROW);
+ const ::rtl::OUString sNewName = String(ModuleRes(RID_STR_FUNCTION));
+ uno::Reference< report::XFunction> xFunction(report::Function::create(m_xContext));
+ xFunction->setName(sNewName);
+ // the call below will also create an undo action -> listener
+ xFunctions->insertByIndex(xFunctions->getCount(),uno::makeAny(xFunction));
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( OReportController, OnExecuteReport, void* ,/*_pMemfun*/)
+{
+ //m_nExecuteReportEvent = 0;
+ executeReport();
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,const uno::Reference< report::XSection>& _xSection,const ::rtl::OUString& _sFunction,sal_uInt16 _nObjectId)
+{
+ SequenceAsHashMap aMap(_aArgs);
+ getDesignView()->setMarked(_xSection ,sal_True);
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
+ if ( !pSectionWindow )
+ return;
+
+ OSL_ENSURE(pSectionWindow->getReportSection().getSection() == _xSection,"Invalid section after marking the corrct one.");
+
+ sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN);
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN);
+ const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE).Width - nRightMargin;
+ awt::Point aPos = aMap.getUnpackedValueOrDefault(PROPERTY_POSITION,awt::Point(nLeftMargin,0));
+ if ( aPos.X < nLeftMargin )
+ aPos.X = nLeftMargin;
+
+ SdrObject* pNewControl = NULL;
+ uno::Reference< report::XReportComponent> xShapeProp;
+ if ( _nObjectId == OBJ_CUSTOMSHAPE )
+ {
+ pNewControl = SdrObjFactory::MakeNewObject( ReportInventor, _nObjectId, pSectionWindow->getReportSection().getPage(),m_aReportModel.get() );
+ xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY);
+ ::rtl::OUString sCustomShapeType = getDesignView()->GetInsertObjString();
+ if ( !sCustomShapeType.getLength() )
+ sCustomShapeType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diamond"));
+ pSectionWindow->getReportSection().createDefault(sCustomShapeType,pNewControl);
+ pNewControl->SetLogicRect(Rectangle(3000,500,6000,3500)); // switch height and width
+ } // if ( _nObjectId == OBJ_CUSTOMSHAPE )
+ else if ( _nObjectId == OBJ_OLE2 || OBJ_DLG_SUBREPORT == _nObjectId )
+ {
+ pNewControl = SdrObjFactory::MakeNewObject( ReportInventor, _nObjectId, pSectionWindow->getReportSection().getPage(),m_aReportModel.get() );
+
+ pNewControl->SetLogicRect(Rectangle(3000,500,8000,5500)); // switch height and width
+ xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY_THROW);
+ OOle2Obj* pObj = dynamic_cast<OOle2Obj*>(pNewControl);
+ if ( pObj && !pObj->IsEmpty() )
+ {
+ pObj->initializeChart(getModel());
+ }
+ }
+ else
+ {
+ SdrUnoObj* pLabel( NULL );
+ SdrUnoObj* pControl( NULL );
+ FmFormView::createControlLabelPair( getDesignView()
+ ,nLeftMargin,0
+ ,NULL,NULL,_nObjectId,::rtl::OUString(),ReportInventor,OBJ_DLG_FIXEDTEXT,
+ NULL,pSectionWindow->getReportSection().getPage(),m_aReportModel.get(),
+ pLabel,pControl);
+ delete pLabel;
+
+ pNewControl = pControl;
+ OUnoObject* pObj = dynamic_cast<OUnoObject*>(pControl);
+ uno::Reference<beans::XPropertySet> xUnoProp(pObj->GetUnoControlModel(),uno::UNO_QUERY);
+ xShapeProp.set(pObj->getUnoShape(),uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
+ uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
+
+ const ::rtl::OUString sProps[] = { PROPERTY_NAME
+ ,PROPERTY_FONTDESCRIPTOR
+ ,PROPERTY_FONTDESCRIPTORASIAN
+ ,PROPERTY_FONTDESCRIPTORCOMPLEX
+ ,PROPERTY_ORIENTATION
+ ,PROPERTY_BORDER
+ ,PROPERTY_FORMATSSUPPLIER
+ ,PROPERTY_BACKGROUNDCOLOR
+ };
+ for(size_t i = 0; i < sizeof(sProps)/sizeof(sProps[0]);++i)
+ {
+ if ( xInfo->hasPropertyByName(sProps[i]) && xShapeInfo->hasPropertyByName(sProps[i]) )
+ xUnoProp->setPropertyValue(sProps[i],xShapeProp->getPropertyValue(sProps[i]));
+ } // for(size_t i = 0; i < sizeof(sProps)/sizeof(sProps[0]);++i)
+
+ if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
+ xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
+
+
+ if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) && _sFunction.getLength() )
+ {
+ ReportFormula aFunctionFormula( ReportFormula::Expression, _sFunction );
+ xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::makeAny( aFunctionFormula.getCompleteFormula() ) );
+ }
+
+ sal_Int32 nFormatKey = aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEY,sal_Int32(0));
+ if ( nFormatKey && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
+ xUnoProp->setPropertyValue( PROPERTY_FORMATKEY, uno::makeAny( nFormatKey ) );
+
+ ::rtl::OUString sUrl = aMap.getUnpackedValueOrDefault(PROPERTY_IMAGEURL,::rtl::OUString());
+ if ( sUrl.getLength() && xInfo->hasPropertyByName(PROPERTY_IMAGEURL) )
+ xUnoProp->setPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( sUrl ) );
+
+ pObj->CreateMediator(sal_True);
+
+ if ( _nObjectId == OBJ_DLG_FIXEDTEXT ) // special case for fixed text
+ xUnoProp->setPropertyValue(PROPERTY_LABEL,uno::makeAny(OUnoObject::GetDefaultName(pObj)));
+ else if ( _nObjectId == OBJ_DLG_VFIXEDLINE )
+ {
+ awt::Size aOlSize = xShapeProp->getSize();
+ xShapeProp->setSize(awt::Size(aOlSize.Height,aOlSize.Width)); // switch height and width
+ }
+ }
+
+ const sal_Int32 nShapeWidth = aMap.getUnpackedValueOrDefault(PROPERTY_WIDTH,xShapeProp->getWidth());
+ if ( nShapeWidth != xShapeProp->getWidth() )
+ xShapeProp->setWidth( nShapeWidth );
+
+ const bool bChangedPos = (aPos.X + nShapeWidth) > nPaperWidth;
+ if ( bChangedPos )
+ aPos.X = nPaperWidth - nShapeWidth;
+ xShapeProp->setPosition(aPos);
+
+ correctOverlapping(pNewControl,pSectionWindow->getReportSection());
+}
+// -----------------------------------------------------------------------------
+void OReportController::createDateTime(const Sequence< PropertyValue >& _aArgs)
+{
+ getDesignView()->unmarkAllObjects(NULL);
+
+ const String sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL));
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+
+ SequenceAsHashMap aMap(_aArgs);
+ aMap.createItemIfMissing(PROPERTY_FORMATKEY,aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYDATE,sal_Int32(0)));
+
+ uno::Reference< report::XSection> xSection = aMap.getUnpackedValueOrDefault(PROPERTY_SECTION,uno::Reference< report::XSection>());
+ ::rtl::OUString sFunction;
+
+ sal_Bool bDate = aMap.getUnpackedValueOrDefault(PROPERTY_DATE_STATE,sal_False);
+ if ( bDate )
+ {
+ sFunction = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("TODAY()"));
+ createControl(aMap.getAsConstPropertyValueList(),xSection,sFunction);
+ }
+ sal_Bool bTime = aMap.getUnpackedValueOrDefault(PROPERTY_TIME_STATE,sal_False);
+ if ( bTime )
+ {
+ sFunction = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("TIMEVALUE(NOW())"));
+ aMap[PROPERTY_FORMATKEY] <<= aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYTIME,sal_Int32(0));
+ createControl(aMap.getAsConstPropertyValueList(),xSection,sFunction);
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::createPageNumber(const Sequence< PropertyValue >& _aArgs)
+{
+ getDesignView()->unmarkAllObjects(NULL);
+
+ const String sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL));
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+
+ if ( !m_xReportDefinition->getPageHeaderOn() )
+ {
+ uno::Sequence< beans::PropertyValue > aArgs;
+ executeChecked(SID_PAGEHEADERFOOTER,aArgs);
+ } // if ( !m_xHoldAlive->getPageHeaderOn() )
+
+ SequenceAsHashMap aMap(_aArgs);
+ sal_Bool bStateOfPage = aMap.getUnpackedValueOrDefault(PROPERTY_STATE,sal_False);
+
+ String sFunction = String(ModuleRes(STR_RPT_PN_PAGE));
+ ::rtl::OUString sPageNumber(RTL_CONSTASCII_USTRINGPARAM("PageNumber()"));
+ sFunction.SearchAndReplace(String::CreateFromAscii("#PAGENUMBER#"),sPageNumber);
+
+ if ( bStateOfPage )
+ {
+ ::rtl::OUString sPageCount(RTL_CONSTASCII_USTRINGPARAM("PageCount()"));
+ sFunction += String(ModuleRes(STR_RPT_PN_PAGE_OF));
+ sFunction.SearchAndReplace(String::CreateFromAscii("#PAGECOUNT#"),sPageCount);
+ }
+
+ sal_Bool bInPageHeader = aMap.getUnpackedValueOrDefault(PROPERTY_PAGEHEADERON,sal_True);
+ createControl(_aArgs,bInPageHeader ? m_xReportDefinition->getPageHeader() : m_xReportDefinition->getPageFooter(),sFunction);
+}
+
+// -----------------------------------------------------------------------------
+void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
+{
+ getDesignView()->unmarkAllObjects(NULL);
+ //////////////////////////////////////////////////////////////////////
+ // Anhand des FormatKeys wird festgestellt, welches Feld benoetigt wird
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow[2];
+ pSectionWindow[0] = getDesignView()->getMarkedSection();
+
+ if ( !pSectionWindow[0] )
+ {
+ select(uno::makeAny(m_xReportDefinition->getDetail()));
+ pSectionWindow[0] = getDesignView()->getMarkedSection();
+ if ( !pSectionWindow[0] )
+ return;
+ }
+
+ uno::Reference<report::XSection> xCurrentSection = getDesignView()->getCurrentSection();
+ UndoContext aUndoContext( getUndoManager(), String( ModuleRes( RID_STR_UNDO_INSERT_CONTROL ) ) );
+
+ try
+ {
+ bool bHandleOnlyOne = false;
+ const PropertyValue* pIter = aArgs.getConstArray();
+ const PropertyValue* pEnd = pIter + aArgs.getLength();
+ for(;pIter != pEnd && !bHandleOnlyOne;++pIter)
+ {
+ Sequence< PropertyValue > aValue;
+ if ( !(pIter->Value >>= aValue) )
+ { // the sequence has only one element which already contains the descriptor
+ bHandleOnlyOne = true;
+ aValue = aArgs;
+ }
+ ::svx::ODataAccessDescriptor aDescriptor(aValue);
+ SequenceAsHashMap aMap(aValue);
+ uno::Reference<report::XSection> xSection = aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Section")),xCurrentSection);
+ uno::Reference<report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
+
+ getDesignView()->setMarked(xSection,sal_True);
+ pSectionWindow[0] = getDesignView()->getMarkedSection();
+
+ sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN);
+ awt::Point aPos = aMap.getUnpackedValueOrDefault(PROPERTY_POSITION,awt::Point(nLeftMargin,0));
+ if ( aPos.X < nLeftMargin )
+ aPos.X = nLeftMargin;
+
+ // LLA: new feature, add the Label in dependency of the given DND_ACTION one section up, normal or one section down
+ sal_Int8 nDNDAction = aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DNDAction")), sal_Int8(0));
+ pSectionWindow[1] = pSectionWindow[0];
+ // ::boost::shared_ptr<OReportSection> pReportSectionPost;
+ sal_Bool bLabelAboveTextField = nDNDAction == DND_ACTION_COPY;
+ if ( bLabelAboveTextField || nDNDAction == DND_ACTION_LINK )
+ {
+ // Add the Label one Section up
+ pSectionWindow[1] = getDesignView()->getMarkedSection(bLabelAboveTextField ? PREVIOUS : POST);
+ if (!pSectionWindow[1])
+ {
+ // maybe out of bounds
+ pSectionWindow[1] = pSectionWindow[0];
+ }
+ }
+ // clear all selections
+ getDesignView()->unmarkAllObjects(NULL);
+
+ uno::Reference< beans::XPropertySet > xField( aDescriptor[ ::svx::daColumnObject ], uno::UNO_QUERY );
+ uno::Reference< lang::XComponent > xHoldAlive;
+ if ( !xField.is() )
+ {
+ ::rtl::OUString sCommand;
+ ::rtl::OUString sColumnName;
+ sal_Int32 nCommandType( -1 );
+ OSL_VERIFY( aDescriptor[ ::svx::daCommand ] >>= sCommand );
+ OSL_VERIFY( aDescriptor[ ::svx::daColumnName ] >>= sColumnName );
+ OSL_VERIFY( aDescriptor[ ::svx::daCommandType ] >>= nCommandType );
+
+ uno::Reference< container::XNameAccess > xColumns;
+ uno::Reference< sdbc::XConnection > xConnection( getConnection() );
+ if ( sCommand.getLength() && nCommandType != -1 && sColumnName.getLength() && xConnection.is() )
+ {
+ if ( !xReportDefinition->getCommand().getLength() )
+ {
+ xReportDefinition->setCommand(sCommand);
+ xReportDefinition->setCommandType(nCommandType);
+ } // if ( !xReportDefinition->getCommand().getLength() )
+
+ xColumns = dbtools::getFieldsByCommandDescriptor(xConnection,nCommandType,sCommand,xHoldAlive);
+ if ( xColumns.is() && xColumns->hasByName(sColumnName) )
+ xField.set( xColumns->getByName( sColumnName ), uno::UNO_QUERY );
+ }
+
+ if ( !xField.is() )
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ try
+ {
+ uno::Reference< beans::XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW );
+ ::rtl::OUString sRowSetCommand;
+ sal_Int32 nRowSetCommandType( -1 );
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND ) >>= sRowSetCommand );
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nRowSetCommandType );
+ OSL_ENSURE( ( sRowSetCommand == sCommand ) && ( nCommandType == nRowSetCommandType ),
+ "OReportController::addPairControls: this only works for a data source which equals our current settings!" );
+ // if this asserts, then either our row set and our report definition are not in sync, or somebody
+ // requested the creation of a control/pair for another data source than what our report
+ // definition is bound to - which is not supported for the parameters case, since we
+ // can retrieve parameters from the RowSet only.
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ #endif
+
+ // no column name - perhaps a parameter name?
+ uno::Reference< sdb::XParametersSupplier > xSuppParam( getRowSet(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xParams( xSuppParam->getParameters(), uno::UNO_QUERY_THROW );
+ sal_Int32 nParamCount( xParams->getCount() );
+ for ( sal_Int32 i=0; i<nParamCount; ++i)
+ {
+ uno::Reference< beans::XPropertySet > xParamCol( xParams->getByIndex(i), uno::UNO_QUERY_THROW );
+ ::rtl::OUString sParamName;
+ OSL_VERIFY( xParamCol->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sParamName );
+ if ( sParamName == sColumnName )
+ {
+ xField = xParamCol;
+ break;
+ }
+ }
+ }
+ }
+ if ( !xField.is() )
+ continue;
+
+ sal_uInt16 nOBJID = 0;
+ sal_Int32 nDataType = sdbc::DataType::BINARY;
+ xField->getPropertyValue(PROPERTY_TYPE) >>= nDataType;
+ switch ( nDataType )
+ {
+ case sdbc::DataType::BINARY:
+ case sdbc::DataType::VARBINARY:
+ case sdbc::DataType::LONGVARBINARY:
+ nOBJID = OBJ_DLG_IMAGECONTROL;
+ break;
+ default:
+ nOBJID = OBJ_DLG_FORMATTEDFIELD;
+ break;
+ }
+
+ if ( !nOBJID )
+ continue;
+
+ Reference< util::XNumberFormatsSupplier > xSupplier = getReportNumberFormatter()->getNumberFormatsSupplier();
+ if ( !xSupplier.is() )
+ continue;
+
+ Reference< XNumberFormats > xNumberFormats(xSupplier->getNumberFormats());
+ SdrUnoObj* pControl[2];
+ pControl[0] = NULL;
+ pControl[1] = NULL;
+ //getDesignView()->GetModel()->GetUndoEnv().Lock();
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN);
+ const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE).Width - nRightMargin;
+ OSectionView* pSectionViews[2];
+ pSectionViews[0] = &pSectionWindow[1]->getReportSection().getSectionView();
+ pSectionViews[1] = &pSectionWindow[0]->getReportSection().getSectionView();
+ // find this in svx
+ FmFormView::createControlLabelPair( getDesignView()
+ ,nLeftMargin,0
+ ,xField,xNumberFormats,nOBJID,::rtl::OUString(),ReportInventor,OBJ_DLG_FIXEDTEXT,
+ pSectionWindow[1]->getReportSection().getPage(),pSectionWindow[0]->getReportSection().getPage(),m_aReportModel.get(),
+ pControl[0],pControl[1]);
+ //getDesignView()->GetModel()->GetUndoEnv().UnLock();
+ if ( pControl[0] && pControl[1] )
+ {
+ SdrPageView* pPgViews[2];
+ pPgViews[0] = pSectionViews[0]->GetSdrPageView();
+ pPgViews[1] = pSectionViews[1]->GetSdrPageView();
+ if ( pPgViews[0] && pPgViews[1] )
+ {
+ ::rtl::OUString sDefaultName;
+ size_t i = 0;
+ OUnoObject* pObjs[2];
+ for(i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i)
+ {
+ pObjs[i] = dynamic_cast<OUnoObject*>(pControl[i]);
+ uno::Reference<beans::XPropertySet> xUnoProp(pObjs[i]->GetUnoControlModel(),uno::UNO_QUERY_THROW);
+ uno::Reference< report::XReportComponent> xShapeProp(pObjs[i]->getUnoShape(),uno::UNO_QUERY_THROW);
+ xUnoProp->setPropertyValue(PROPERTY_NAME,xShapeProp->getPropertyValue(PROPERTY_NAME));
+
+ uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
+ uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
+ const ::rtl::OUString sProps[] = { PROPERTY_FONTDESCRIPTOR
+ ,PROPERTY_FONTDESCRIPTORASIAN
+ ,PROPERTY_FONTDESCRIPTORCOMPLEX
+ ,PROPERTY_BORDER
+ ,PROPERTY_BACKGROUNDCOLOR
+ };
+ for(size_t k = 0; k < sizeof(sProps)/sizeof(sProps[0]);++k)
+ {
+ if ( xInfo->hasPropertyByName(sProps[k]) && xShapeInfo->hasPropertyByName(sProps[k]) )
+ xUnoProp->setPropertyValue(sProps[k],xShapeProp->getPropertyValue(sProps[k]));
+ }
+ if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
+ {
+ ::rtl::OUString sName;
+ xUnoProp->getPropertyValue(PROPERTY_DATAFIELD) >>= sName;
+ sDefaultName = sName;
+ xUnoProp->setPropertyValue(PROPERTY_NAME,uno::makeAny(sDefaultName));
+
+ ReportFormula aFormula( ReportFormula::Field, sName );
+ xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::makeAny( aFormula.getCompleteFormula() ) );
+ } // if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
+
+ if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
+ xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
+
+ pObjs[i]->CreateMediator(sal_True);
+ // need SectionView from the above or follow Section
+ // (getMarkedSection) returns the current Section
+ //pSectionViews[i]->InsertObjectAtView(pControl[i],*pPgViews[i],SDRINSERT_ADDMARK);
+
+ const sal_Int32 nShapeWidth = xShapeProp->getWidth();
+ const bool bChangedPos = (aPos.X + nShapeWidth) > nPaperWidth;
+ if ( bChangedPos )
+ aPos.X = nPaperWidth - nShapeWidth;
+ xShapeProp->setPosition(aPos);
+ if ( bChangedPos )
+ aPos.Y += xShapeProp->getHeight();
+ aPos.X += nShapeWidth;
+ }
+ ::rtl::OUString sLabel;
+ if ( xField->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xField->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+
+ if (pSectionViews[0] != pSectionViews[1] &&
+ nOBJID == OBJ_DLG_FORMATTEDFIELD) // we want this nice feature only at FORMATTEDFIELD
+ {
+ // we have two different Views, so set the position x new.
+ // pSectionViews[1].position.x = pSectionViews[0].position.x
+ uno::Reference< report::XReportComponent> xShapePropLabel(pObjs[0]->getUnoShape(),uno::UNO_QUERY_THROW);
+ uno::Reference< report::XReportComponent> xShapePropTextField(pObjs[1]->getUnoShape(),uno::UNO_QUERY_THROW);
+ if ( sLabel.getLength() )
+ xShapePropTextField->setName(sLabel);
+ awt::Point aPosLabel = xShapePropLabel->getPosition();
+ awt::Point aPosTextField = xShapePropTextField->getPosition();
+ aPosTextField.X = aPosLabel.X;
+ xShapePropTextField->setPosition(aPosTextField);
+ if (bLabelAboveTextField)
+ {
+ // move the label down near the splitter
+ const uno::Reference<report::XSection> xLabelSection = pSectionWindow[1]->getReportSection().getSection();
+ aPosLabel.Y = xLabelSection->getHeight() - xShapePropLabel->getHeight();
+ }
+ else
+ {
+ // move the label up to the splitter
+ aPosLabel.Y = 0;
+ }
+ xShapePropLabel->setPosition(aPosLabel);
+ }
+ OUnoObject* pObj = dynamic_cast<OUnoObject*>(pControl[0]);
+ uno::Reference< report::XFixedText> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW);
+ xShapeProp->setName(xShapeProp->getName() + sDefaultName );
+
+ for(i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i) // insert controls
+ {
+ correctOverlapping(pControl[i],pSectionWindow[1-i]->getReportSection());
+ }
+
+ if (!bLabelAboveTextField )
+ {
+ if ( pSectionViews[0] == pSectionViews[1] )
+ {
+ Rectangle aLabel = getRectangleFromControl(pControl[0]);
+ Rectangle aTextfield = getRectangleFromControl(pControl[1]);
+
+ // create a Union of the given Label and Textfield
+ Rectangle aLabelAndTextfield( aLabel );
+ aLabelAndTextfield.Union(aTextfield);
+
+ // check if there exists other fields and if yes, move down
+ bool bOverlapping = true;
+ bool bHasToMove = false;
+ while ( bOverlapping )
+ {
+ const SdrObject* pOverlappedObj = isOver(aLabelAndTextfield, *pSectionWindow[0]->getReportSection().getPage(), *pSectionViews[0], true, pControl, 2);
+ bOverlapping = pOverlappedObj != NULL;
+ if ( bOverlapping )
+ {
+ const Rectangle& aLogicRect = pOverlappedObj->GetLogicRect();
+ aLabelAndTextfield.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aLabelAndTextfield.Top());
+ bHasToMove = true;
+ }
+ }
+
+ if (bHasToMove)
+ {
+ // There was a move down, we need to move the Label and the Textfield down
+ aLabel.Move(0, aLabelAndTextfield.Top() - aLabel.Top());
+ aTextfield.Move(0, aLabelAndTextfield.Top() - aTextfield.Top());
+
+ uno::Reference< report::XReportComponent> xLabel(pControl[0]->getUnoShape(),uno::UNO_QUERY_THROW);
+ xLabel->setPositionY(aLabel.Top());
+
+ uno::Reference< report::XReportComponent> xTextfield(pControl[1]->getUnoShape(),uno::UNO_QUERY_THROW);
+ xTextfield->setPositionY(aTextfield.Top());
+ }
+ }
+ // this should never happen.
+ // else
+ // {
+ // DBG_ERROR("unhandled case.");
+ // }
+ }
+ }
+ }
+ else
+ {
+ for(size_t i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i)
+ delete pControl[i];
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// -----------------------------------------------------------------------------
+OSectionView* OReportController::getCurrentSectionView() const
+{
+ OSectionView* pSectionView = NULL;
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection();
+ if ( pSectionWindow.get() )
+ pSectionView = &pSectionWindow->getReportSection().getSectionView();
+ return pSectionView;
+}
+// -----------------------------------------------------------------------------
+void OReportController::changeZOrder(sal_Int32 _nId)
+{
+ OSectionView* pSectionView = getCurrentSectionView();
+ if ( pSectionView )
+ {
+ switch(_nId)
+ {
+ case SID_FRAME_TO_BOTTOM:
+ pSectionView->PutMarkedToBtm();
+ break;
+ case SID_FRAME_TO_TOP:
+ pSectionView->PutMarkedToTop();
+ break;
+ case SID_FRAME_DOWN:
+ pSectionView->MovMarkedToBtm();
+ break;
+ case SID_FRAME_UP:
+ pSectionView->MovMarkedToTop();
+ break;
+
+ case SID_OBJECT_HEAVEN:
+ pSectionView->SetMarkedToLayer( RPT_LAYER_FRONT );
+ break;
+ case SID_OBJECT_HELL:
+ pSectionView->SetMarkedToLayer( RPT_LAYER_BACK );
+ break;
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::listen(const bool _bAdd)
+{
+ const ::rtl::OUString aProps [] = { PROPERTY_REPORTHEADERON,PROPERTY_REPORTFOOTERON
+ ,PROPERTY_PAGEHEADERON,PROPERTY_PAGEFOOTERON
+ ,PROPERTY_COMMAND, PROPERTY_COMMANDTYPE,PROPERTY_CAPTION
+ };
+
+ void (SAL_CALL XPropertySet::*pPropertyListenerAction)( const ::rtl::OUString&, const uno::Reference< XPropertyChangeListener >& ) =
+ _bAdd ? &XPropertySet::addPropertyChangeListener : &XPropertySet::removePropertyChangeListener;
+
+ for (size_t i = 0; i < sizeof(aProps)/sizeof(aProps[0]); ++i)
+ (m_xReportDefinition.get()->*pPropertyListenerAction)( aProps[i], static_cast< XPropertyChangeListener* >( this ) );
+
+ OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv();
+ uno::Reference< XPropertyChangeListener > xUndo = &rUndoEnv;
+ uno::Sequence< beans::Property> aSeq = m_xReportDefinition->getPropertySetInfo()->getProperties();
+ const beans::Property* pIter = aSeq.getConstArray();
+ const beans::Property* pEnd = pIter + aSeq.getLength();
+ const ::rtl::OUString* pPropsBegin = &aProps[0];
+ const ::rtl::OUString* pPropsEnd = pPropsBegin + (sizeof(aProps)/sizeof(aProps[0])) - 3;
+ for(;pIter != pEnd;++pIter)
+ {
+ if ( ::std::find(pPropsBegin,pPropsEnd,pIter->Name) == pPropsEnd )
+ (m_xReportDefinition.get()->*pPropertyListenerAction)( pIter->Name, xUndo );
+ }
+
+ // Add Listeners to UndoEnvironment
+ void (OXUndoEnvironment::*pElementUndoFunction)( const uno::Reference< uno::XInterface >& ) =
+ _bAdd ? &OXUndoEnvironment::AddElement : &OXUndoEnvironment::RemoveElement;
+
+ (rUndoEnv.*pElementUndoFunction)( m_xReportDefinition->getStyleFamilies() );
+ (rUndoEnv.*pElementUndoFunction)( m_xReportDefinition->getFunctions() );
+
+ // Add Listeners to ReportControllerObserver
+ OXReportControllerObserver& rObserver = *m_pReportControllerObserver;
+ // void (OXReportControllerObserver::*pObserverFunction)( const uno::Reference< uno::XInterface >& ) =
+ // _bAdd ? &OXReportControllerObserver::AddElement : &OXReportControllerObserver::RemoveElement;
+
+ // (rObserver.*pObserverFunction)( m_xReportDefinition->getStyleFamilies() );
+ // (rObserver.*pObserverFunction)( m_xReportDefinition->getFunctions() );
+
+ if ( m_xReportDefinition->getPageHeaderOn() && _bAdd )
+ {
+ getDesignView()->addSection(m_xReportDefinition->getPageHeader(),DBPAGEHEADER);
+ rObserver.AddSection(m_xReportDefinition->getPageHeader());
+ }
+ if ( m_xReportDefinition->getReportHeaderOn() && _bAdd )
+ {
+ getDesignView()->addSection(m_xReportDefinition->getReportHeader(),DBREPORTHEADER);
+ rObserver.AddSection(m_xReportDefinition->getReportHeader());
+ }
+
+ uno::Reference< report::XGroups > xGroups = m_xReportDefinition->getGroups();
+ const sal_Int32 nCount = xGroups->getCount();
+ _bAdd ? xGroups->addContainerListener(&rUndoEnv) : xGroups->removeContainerListener(&rUndoEnv);
+ _bAdd ? xGroups->addContainerListener(&rObserver) : xGroups->removeContainerListener(&rObserver);
+
+ for (sal_Int32 i=0;i<nCount ; ++i)
+ {
+ uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i),uno::UNO_QUERY);
+ (xGroup.get()->*pPropertyListenerAction)( PROPERTY_HEADERON, static_cast< XPropertyChangeListener* >( this ) );
+ (xGroup.get()->*pPropertyListenerAction)( PROPERTY_FOOTERON, static_cast< XPropertyChangeListener* >( this ) );
+
+ (rUndoEnv.*pElementUndoFunction)( xGroup );
+ (rUndoEnv.*pElementUndoFunction)( xGroup->getFunctions() );
+ if ( xGroup->getHeaderOn() && _bAdd )
+ {
+ getDesignView()->addSection(xGroup->getHeader(),DBGROUPHEADER);
+ rObserver.AddSection(xGroup->getHeader());
+ }
+ } // for (sal_Int32 i=0;i<nCount ; ++i)
+
+ if ( _bAdd )
+ {
+ getDesignView()->addSection(m_xReportDefinition->getDetail(),DBDETAIL);
+ rObserver.AddSection(m_xReportDefinition->getDetail());
+
+ for (sal_Int32 i=nCount;i > 0 ; --i)
+ {
+ uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i-1),uno::UNO_QUERY);
+ if ( xGroup->getFooterOn() )
+ {
+ getDesignView()->addSection(xGroup->getFooter(),DBGROUPFOOTER);
+ rObserver.AddSection(xGroup->getFooter());
+ }
+ }
+ if ( m_xReportDefinition->getReportFooterOn() )
+ {
+ getDesignView()->addSection(m_xReportDefinition->getReportFooter(),DBREPORTFOOTER);
+ rObserver.AddSection(m_xReportDefinition->getReportFooter());
+ }
+ if ( m_xReportDefinition->getPageFooterOn())
+ {
+ getDesignView()->addSection(m_xReportDefinition->getPageFooter(),DBPAGEFOOTER);
+ rObserver.AddSection(m_xReportDefinition->getPageFooter());
+ }
+
+ xGroups->addContainerListener(static_cast<XContainerListener*>(this));
+ m_xReportDefinition->addModifyListener(static_cast<XModifyListener*>(this));
+ }
+ else /* ! _bAdd */
+ {
+ rObserver.RemoveSection(m_xReportDefinition->getDetail());
+ xGroups->removeContainerListener(static_cast<XContainerListener*>(this));
+ m_xReportDefinition->removeModifyListener(static_cast<XModifyListener*>(this));
+ m_aReportModel->detachController();
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::switchReportSection(const sal_Int16 _nId)
+{
+ OSL_ENSURE(_nId == SID_REPORTHEADER_WITHOUT_UNDO || _nId == SID_REPORTFOOTER_WITHOUT_UNDO || _nId == SID_REPORTHEADERFOOTER ,"Illegal id given!");
+
+ if ( m_xReportDefinition.is() )
+ {
+ const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() );
+ const bool bSwitchOn = !m_xReportDefinition->getReportHeaderOn();
+
+ ::boost::scoped_ptr< UndoContext > pUndoContext;
+ if ( SID_REPORTHEADERFOOTER == _nId )
+ {
+ const String sUndoAction(ModuleRes(bSwitchOn ? RID_STR_UNDO_ADD_REPORTHEADERFOOTER : RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER));
+ pUndoContext.reset( new UndoContext( getUndoManager(), sUndoAction ) );
+
+ addUndoAction(new OReportSectionUndo(*(m_aReportModel),SID_REPORTHEADER_WITHOUT_UNDO
+ ,::std::mem_fun(&OReportHelper::getReportHeader)
+ ,m_xReportDefinition
+ ,bSwitchOn ? Inserted : Removed
+ ,0
+ ));
+
+ addUndoAction(new OReportSectionUndo(*(m_aReportModel),SID_REPORTFOOTER_WITHOUT_UNDO
+ ,::std::mem_fun(&OReportHelper::getReportFooter)
+ ,m_xReportDefinition
+ ,bSwitchOn ? Inserted : Removed
+ ,0
+ ));
+ }
+
+ switch( _nId )
+ {
+ case SID_REPORTHEADER_WITHOUT_UNDO:
+ m_xReportDefinition->setReportHeaderOn( bSwitchOn );
+ break;
+ case SID_REPORTFOOTER_WITHOUT_UNDO:
+ m_xReportDefinition->setReportFooterOn( !m_xReportDefinition->getReportFooterOn() );
+ break;
+ case SID_REPORTHEADERFOOTER:
+ m_xReportDefinition->setReportHeaderOn( bSwitchOn );
+ m_xReportDefinition->setReportFooterOn( bSwitchOn );
+ break;
+ }
+
+ if ( SID_REPORTHEADERFOOTER == _nId )
+ pUndoContext.reset();
+ getView()->Resize();
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::switchPageSection(const sal_Int16 _nId)
+{
+ OSL_ENSURE(_nId == SID_PAGEHEADERFOOTER || _nId == SID_PAGEHEADER_WITHOUT_UNDO || _nId == SID_PAGEFOOTER_WITHOUT_UNDO ,"Illegal id given!");
+ if ( m_xReportDefinition.is() )
+ {
+ const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() );
+ const bool bSwitchOn = !m_xReportDefinition->getPageHeaderOn();
+
+ ::boost::scoped_ptr< UndoContext > pUndoContext;
+ if ( SID_PAGEHEADERFOOTER == _nId )
+ {
+ const String sUndoAction(ModuleRes(bSwitchOn ? RID_STR_UNDO_ADD_REPORTHEADERFOOTER : RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER));
+ pUndoContext.reset( new UndoContext( getUndoManager(), sUndoAction ) );
+
+ addUndoAction(new OReportSectionUndo(*m_aReportModel
+ ,SID_PAGEHEADER_WITHOUT_UNDO
+ ,::std::mem_fun(&OReportHelper::getPageHeader)
+ ,m_xReportDefinition
+ ,bSwitchOn ? Inserted : Removed
+ ,0
+ ));
+
+ addUndoAction(new OReportSectionUndo(*m_aReportModel
+ ,SID_PAGEFOOTER_WITHOUT_UNDO
+ ,::std::mem_fun(&OReportHelper::getPageFooter)
+ ,m_xReportDefinition
+ ,bSwitchOn ? Inserted : Removed
+ ,0
+ ));
+ } // if ( SID_PAGEHEADERFOOTER == _nId )
+ switch( _nId )
+ {
+ case SID_PAGEHEADER_WITHOUT_UNDO:
+ m_xReportDefinition->setPageHeaderOn( bSwitchOn );
+ break;
+ case SID_PAGEFOOTER_WITHOUT_UNDO:
+ m_xReportDefinition->setPageFooterOn( !m_xReportDefinition->getPageFooterOn() );
+ break;
+ case SID_PAGEHEADERFOOTER:
+ m_xReportDefinition->setPageHeaderOn( bSwitchOn );
+ m_xReportDefinition->setPageFooterOn( bSwitchOn );
+ break;
+ }
+ if ( SID_PAGEHEADERFOOTER == _nId )
+ pUndoContext.reset();
+ getView()->Resize();
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::modifyGroup(const bool _bAppend, const Sequence< PropertyValue >& _aArgs)
+{
+ if ( !m_xReportDefinition.is() )
+ return;
+
+ try
+ {
+ const SequenceAsHashMap aMap( _aArgs );
+ uno::Reference< report::XGroup > xGroup = aMap.getUnpackedValueOrDefault( PROPERTY_GROUP, uno::Reference< report::XGroup >() );
+ if ( !xGroup.is() )
+ return;
+
+ OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv();
+ uno::Reference< report::XGroups > xGroups = m_xReportDefinition->getGroups();
+ if ( _bAppend )
+ {
+ const sal_Int32 nPos = aMap.getUnpackedValueOrDefault( PROPERTY_POSITIONY, xGroups->getCount() );
+ xGroups->insertByIndex( nPos, uno::makeAny( xGroup ) );
+ rUndoEnv.AddElement( xGroup->getFunctions() );
+ }
+
+ addUndoAction( new OGroupUndo(
+ *m_aReportModel,
+ _bAppend ? RID_STR_UNDO_APPEND_GROUP : RID_STR_UNDO_REMOVE_GROUP,
+ _bAppend ? Inserted : Removed,
+ xGroup,
+ m_xReportDefinition
+ ) );
+
+ if ( !_bAppend )
+ {
+ rUndoEnv.RemoveElement( xGroup->getFunctions() );
+ const sal_Int32 nPos = getGroupPosition( xGroup );
+ const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() );
+ xGroups->removeByIndex( nPos );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// -----------------------------------------------------------------------------
+void OReportController::createGroupSection(const bool _bUndo,const bool _bHeader, const Sequence< PropertyValue >& _aArgs)
+{
+ if ( m_xReportDefinition.is() )
+ {
+ const SequenceAsHashMap aMap(_aArgs);
+ const sal_Bool bSwitchOn = aMap.getUnpackedValueOrDefault(_bHeader ? PROPERTY_HEADERON : PROPERTY_FOOTERON,sal_False);
+ uno::Reference< report::XGroup> xGroup = aMap.getUnpackedValueOrDefault(PROPERTY_GROUP,uno::Reference< report::XGroup>());
+ if ( xGroup.is() )
+ {
+ const OXUndoEnvironment::OUndoEnvLock aLock(m_aReportModel->GetUndoEnv());
+ if ( _bUndo )
+ addUndoAction(new OGroupSectionUndo(*m_aReportModel
+ ,_bHeader ? SID_GROUPHEADER_WITHOUT_UNDO : SID_GROUPFOOTER_WITHOUT_UNDO
+ ,_bHeader ? ::std::mem_fun(&OGroupHelper::getHeader) : ::std::mem_fun(&OGroupHelper::getFooter)
+ ,xGroup
+ ,bSwitchOn ? Inserted : Removed
+ , ( _bHeader ?
+ (bSwitchOn ? RID_STR_UNDO_ADD_GROUP_HEADER : RID_STR_UNDO_REMOVE_GROUP_HEADER)
+ :(bSwitchOn ? RID_STR_UNDO_ADD_GROUP_FOOTER : RID_STR_UNDO_REMOVE_GROUP_FOOTER)
+ )
+ ));
+
+ if ( _bHeader )
+ xGroup->setHeaderOn( bSwitchOn );
+ else
+ xGroup->setFooterOn( bSwitchOn );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::collapseSection(const bool _bCollapse)
+{
+ ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection();
+ if ( pSection )
+ {
+ pSection->setCollapsed(_bCollapse);
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::markSection(const bool _bNext)
+{
+ ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection();
+ if ( pSection )
+ {
+ ::boost::shared_ptr<OSectionWindow> pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS);
+ if ( pPrevSection != pSection && pPrevSection )
+ select(uno::makeAny(pPrevSection->getReportSection().getSection()));
+ else
+ select(uno::makeAny(m_xReportDefinition));
+ }
+ else
+ {
+ getDesignView()->markSection(_bNext ? 0 : getDesignView()->getSectionCount() - 1);
+ pSection = getDesignView()->getMarkedSection();
+ if ( pSection )
+ select(uno::makeAny(pSection->getReportSection().getSection()));
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportController::createDefaultControl(const uno::Sequence< beans::PropertyValue>& _aArgs)
+{
+ uno::Reference< report::XSection > xSection = getDesignView()->getCurrentSection();
+ if ( !xSection.is() )
+ xSection = m_xReportDefinition->getDetail();
+
+ if ( xSection.is() )
+ {
+ const ::rtl::OUString sKeyModifier(RTL_CONSTASCII_USTRINGPARAM("KeyModifier"));
+ const beans::PropertyValue* pIter = _aArgs.getConstArray();
+ const beans::PropertyValue* pEnd = pIter + _aArgs.getLength();
+ const beans::PropertyValue* pKeyModifier = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyValueCompare(),boost::cref(sKeyModifier)));
+ sal_Int16 nKeyModifier = 0;
+ if ( pKeyModifier == pEnd || ((pKeyModifier->Value >>= nKeyModifier) && nKeyModifier == KEY_MOD1) )
+ {
+ Sequence< PropertyValue > aCreateArgs;
+ getDesignView()->unmarkAllObjects(NULL);
+ createControl(aCreateArgs,xSection,::rtl::OUString(),getDesignView()->GetInsertObj());
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+uno::Reference< util::XNumberFormatter > OReportController::getReportNumberFormatter() const
+{
+ return m_xFormatter;
+}
+// -----------------------------------------------------------------------------
+void OReportController::checkChartEnabled()
+{
+ if ( !m_bChartEnabledAsked )
+ {
+ m_bChartEnabledAsked = true;
+ const ::rtl::OUString sConfigName( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.ReportDesign" ) );
+ const ::rtl::OUString sPropertyName( RTL_CONSTASCII_USTRINGPARAM( "UserData/Chart" ) );
+
+ try
+ {
+ ::utl::OConfigurationTreeRoot aConfiguration(
+ ::utl::OConfigurationTreeRoot::createWithServiceFactory( m_xServiceFactory, sConfigName ) );
+
+ sal_Bool bChartEnabled = sal_False;
+ if ( aConfiguration.hasByHierarchicalName(sPropertyName) )
+ aConfiguration.getNodeValue( sPropertyName ) >>= bChartEnabled;
+ m_bChartEnabled = bChartEnabled;
+ }
+ catch(const Exception&)
+ {
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+
+// css.frame.XTitle
+::rtl::OUString SAL_CALL OReportController::getTitle()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ uno::Reference< frame::XTitle> xTitle(m_xReportDefinition,uno::UNO_QUERY_THROW);
+
+ return xTitle->getTitle ();
+}
+// -----------------------------------------------------------------------------
+void OReportController::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, Any& _rDefault ) const
+{
+ _rDefault <<= sal_Int16(100);
+}
+// -----------------------------------------------------------------------------
+// comphelper::OPropertyArrayUsageHelper
+::cppu::IPropertyArrayHelper* OReportController::createArrayHelper( ) const
+{
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+// -------------------------------------------------------------------------
+
+// cppu::OPropertySetHelper
+::cppu::IPropertyArrayHelper& SAL_CALL OReportController::getInfoHelper()
+{
+ typedef ::comphelper::OPropertyArrayUsageHelper<OReportController_BASE> OReportController_PROP;
+ return *OReportController_PROP::getArrayHelper();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OReportController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle,const Any& _aValue) throw (Exception)
+{
+ if ( _nHandle == PROPERTY_ID_ZOOMVALUE )
+ {
+ _aValue >>= m_nZoomValue;
+ impl_zoom_nothrow();
+ }
+}
+void SAL_CALL OReportController::setMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+ m_sMode = aMode;
+}
+::rtl::OUString SAL_CALL OReportController::getMode( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+ return m_sMode;
+}
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OReportController::getSupportedModes( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ static ::rtl::OUString s_sModes[] = { ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("remote")),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("normal")) };
+ return uno::Sequence< ::rtl::OUString> (&s_sModes[0],sizeof(s_sModes)/sizeof(s_sModes[0]));
+}
+::sal_Bool SAL_CALL OReportController::supportsMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString> aModes = getSupportedModes();
+ const ::rtl::OUString* pIter = aModes.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aModes.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ if ( pIter->equals(aMode ) )
+ break;
+ }
+ return pIter != pEnd;
+}
+// -----------------------------------------------------------------------------
+bool OReportController::isUiVisible() const
+{
+ return !m_sMode.equalsAscii("remote");
+}
+// -----------------------------------------------------------------------------
+void OReportController::impl_fillState_nothrow(const ::rtl::OUString& _sProperty,dbaui::FeatureState& _rState) const
+{
+ _rState.bEnabled = isEditable();
+ if ( _rState.bEnabled )
+ {
+ ::std::vector< uno::Reference< uno::XInterface > > aSelection;
+ getDesignView()->fillControlModelSelection(aSelection);
+ _rState.bEnabled = !aSelection.empty();
+ if ( _rState.bEnabled )
+ {
+ uno::Any aTemp;
+ ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aSelection.begin();
+ for(; aIter != aSelection.end() && _rState.bEnabled ;++aIter)
+ {
+ uno::Reference< beans::XPropertySet> xProp(*aIter,uno::UNO_QUERY);
+ try
+ {
+ uno::Any aTemp2 = xProp->getPropertyValue(_sProperty);
+ if ( aIter == aSelection.begin() )
+ {
+ aTemp = aTemp2;
+ }
+ else if ( !comphelper::compare(aTemp,aTemp2) )
+ break;
+ }
+ catch(beans::UnknownPropertyException&)
+ {
+ _rState.bEnabled = sal_False;
+ }
+ } // for(; aIter != aSelection.end();++aIter)
+ if ( aIter == aSelection.end() )
+ _rState.aValue = aTemp;
+ }
+ } // if ( _rState.bEnabled )
+}
+// -----------------------------------------------------------------------------
+void OReportController::impl_zoom_nothrow()
+{
+ Fraction aZoom(m_nZoomValue,100);
+ setZoomFactor( aZoom,*getDesignView() );
+ getDesignView()->zoom(aZoom);
+ // TRY
+ /*getDesignView()->Invalidate(INVALIDATE_NOCHILDREN);*/
+ InvalidateFeature(SID_ATTR_ZOOM,Reference< XStatusListener >(),sal_True);
+ InvalidateFeature(SID_ATTR_ZOOMSLIDER,Reference< XStatusListener >(),sal_True);
+}
+// -----------------------------------------------------------------------------
+sal_Bool OReportController::isFormatCommandEnabled(sal_uInt16 _nCommand,const uno::Reference< report::XReportControlFormat>& _xReportControlFormat) const
+{
+ sal_Bool bRet = sal_False;
+ if ( _xReportControlFormat.is() && !uno::Reference< report::XFixedLine>(_xReportControlFormat,uno::UNO_QUERY).is() ) // this command is really often called so we nedd a short cut here
+ {
+ try
+ {
+ const awt::FontDescriptor aFontDescriptor = _xReportControlFormat->getFontDescriptor();
+
+ switch(_nCommand)
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ bRet = awt::FontWeight::BOLD == aFontDescriptor.Weight;
+ break;
+ case SID_ATTR_CHAR_POSTURE:
+ bRet = awt::FontSlant_ITALIC == aFontDescriptor.Slant;
+ break;
+ case SID_ATTR_CHAR_UNDERLINE:
+ bRet = awt::FontUnderline::SINGLE == aFontDescriptor.Underline;
+ break;
+ default:
+ ;
+ } // switch(_nCommand)
+ }
+ catch(uno::Exception&)
+ {
+ }
+ }
+ return bRet;
+}
+// -----------------------------------------------------------------------------
+bool OReportController::impl_setPropertyAtControls_throw(const sal_uInt16 _nUndoResId,const ::rtl::OUString& _sProperty,const uno::Any& _aValue,const Sequence< PropertyValue >& _aArgs)
+{
+ ::std::vector< uno::Reference< uno::XInterface > > aSelection;
+ uno::Reference< awt::XWindow> xWindow;
+ lcl_getReportControlFormat( _aArgs, getDesignView(), xWindow, aSelection );
+ ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aSelection.begin();
+
+ const String sUndoAction = String( ModuleRes( _nUndoResId ) );
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
+
+ for(; aIter != aSelection.end();++aIter)
+ {
+ const uno::Reference< beans::XPropertySet > xControlModel(*aIter,uno::UNO_QUERY);
+ if ( xControlModel.is() )
+ xControlModel->setPropertyValue(_sProperty,_aValue);
+ }
+
+ return !aSelection.empty();
+}
+// -----------------------------------------------------------------------------
+void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomShapeType,dbaui::FeatureState& _rState) const
+{
+ _rState.bEnabled = isEditable();
+ _rState.bChecked = getDesignView()->GetInsertObj() == OBJ_CUSTOMSHAPE && getDesignView()->GetInsertObjString().compareToAscii(_pCustomShapeType) == 0;
+}
+
+// -----------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
+{
+ if ( getDesignView() )
+ {
+ return getDesignView()->getSectionWindow(_xSection);
+ }
+
+ // throw NullPointerException?
+ ::boost::shared_ptr<OSectionWindow> pEmpty;
+ return pEmpty;
+}
+
+
+// -----------------------------------------------------------------------------
+void OReportController::openZoomDialog()
+{
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ static SfxItemInfo aItemInfos[] =
+ {
+ { SID_ATTR_ZOOM, SFX_ITEM_POOLABLE }
+ };
+ SfxPoolItem* pDefaults[] =
+ {
+ new SvxZoomItem()
+ };
+ static sal_uInt16 pRanges[] =
+ {
+ SID_ATTR_ZOOM,SID_ATTR_ZOOM,
+ 0
+ };
+ SfxItemPool* pPool( new SfxItemPool(String::CreateFromAscii("ZoomProperties"), SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, pDefaults) );
+ pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why
+ pPool->FreezeIdRanges(); // the same
+ try
+ {
+ ::std::auto_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges));
+ // fill it
+ SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM );
+ aZoomItem.SetValueSet(SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_WHOLEPAGE|SVX_ZOOM_ENABLE_PAGEWIDTH);
+ pDescriptor->Put(aZoomItem);
+
+ ::std::auto_ptr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(NULL, *pDescriptor.get()) );
+ pDlg->SetLimits( 20, 400 );
+ bool bCancel = ( RET_CANCEL == pDlg->Execute() );
+
+ if ( !bCancel )
+ {
+ const SvxZoomItem& rZoomItem = (const SvxZoomItem&)pDlg->GetOutputItemSet()->Get( SID_ATTR_ZOOM );
+ m_eZoomType = rZoomItem.GetType();
+ m_nZoomValue = rZoomItem.GetValue();
+ if ( m_eZoomType != SVX_ZOOM_PERCENT )
+ m_nZoomValue = getDesignView()->getZoomFactor( m_eZoomType );
+
+ impl_zoom_nothrow();
+ } // if ( !bCancel )
+ }
+ catch(uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ SfxItemPool::Free(pPool);
+
+ for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i)
+ delete pDefaults[i];
+ } // if(pFact)
+}
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+// XVisualObject
+void SAL_CALL OReportController::setVisualAreaSize( ::sal_Int64 _nAspect, const awt::Size& _aSize ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+ //if( nAspect == embed::Aspects::MSOLE_CONTENT )
+ {
+ bool bChanged =
+ (m_aVisualAreaSize.Width != _aSize.Width ||
+ m_aVisualAreaSize.Height != _aSize.Height);
+ m_aVisualAreaSize = _aSize;
+ if( bChanged )
+ setModified( sal_True );
+ }
+ m_nAspect = _nAspect;
+}
+// -----------------------------------------------------------------------------
+awt::Size SAL_CALL OReportController::getVisualAreaSize( ::sal_Int64 /*nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+ return m_aVisualAreaSize;
+}
+// -----------------------------------------------------------------------------
+embed::VisualRepresentation SAL_CALL OReportController::getPreferredVisualRepresentation( ::sal_Int64 _nAspect ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( getMutex() );
+ embed::VisualRepresentation aResult;
+ if ( !m_bInGeneratePreview )
+ {
+ m_bInGeneratePreview = true;
+ try
+ {
+ if ( !m_xReportEngine.is() )
+ m_xReportEngine.set(getORB()->createInstance(SERVICE_REPORTENGINE),uno::UNO_QUERY_THROW);
+ const sal_Int32 nOldMaxRows = m_xReportEngine->getMaxRows();
+ m_xReportEngine->setMaxRows(MAX_ROWS_FOR_PREVIEW);
+ m_xReportEngine->setReportDefinition(m_xReportDefinition);
+ m_xReportEngine->setActiveConnection(getConnection());
+ try
+ {
+ Reference<embed::XVisualObject> xTransfer(m_xReportEngine->createDocumentModel(),UNO_QUERY);
+ if ( xTransfer.is() )
+ {
+ xTransfer->setVisualAreaSize(m_nAspect,m_aVisualAreaSize);
+ aResult = xTransfer->getPreferredVisualRepresentation( _nAspect );
+ } // if ( xTransfer.is() )
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex;
+ }
+ m_xReportEngine->setMaxRows(nOldMaxRows);
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex;
+ }
+ m_bInGeneratePreview = false;
+ }
+ return aResult;
+}
+// -----------------------------------------------------------------------------
+::sal_Int32 SAL_CALL OReportController::getMapUnit( ::sal_Int64 /*nAspect*/ ) throw (uno::Exception, uno::RuntimeException)
+{
+ return embed::EmbedMapUnits::ONE_100TH_MM;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< container::XNameAccess > OReportController::getColumns() const
+{
+ if ( !m_xColumns.is() && m_xReportDefinition.is() && m_xReportDefinition->getCommand().getLength() )
+ {
+ m_xColumns = dbtools::getFieldsByCommandDescriptor(getConnection(),m_xReportDefinition->getCommandType(),m_xReportDefinition->getCommand(),m_xHoldAlive);
+ }
+ return m_xColumns;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString OReportController::getColumnLabel_throw(const ::rtl::OUString& i_sColumnName) const
+{
+ ::rtl::OUString sLabel;
+ uno::Reference< container::XNameAccess > xColumns = getColumns();
+ if ( xColumns.is() && xColumns->hasByName(i_sColumnName) )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(xColumns->getByName(i_sColumnName),uno::UNO_QUERY_THROW);
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ }
+ return sLabel;
+}
+
+// -----------------------------------------------------------------------------
+SfxUndoManager& OReportController::getUndoManager() const
+{
+ DBG_TESTSOLARMUTEX();
+ // this is expected to be called during UI actions, so the SM is assumed to be locked
+
+ ::boost::shared_ptr< OReportModel > pReportModel( getSdrModel() );
+ ENSURE_OR_THROW( !!pReportModel, "no access to our model" );
+
+ SfxUndoManager* pUndoManager( pReportModel->GetSdrUndoManager() );
+ ENSURE_OR_THROW( pUndoManager != NULL, "no access to our model's UndoManager" );
+
+ return *pUndoManager;
+}
+
+// -----------------------------------------------------------------------------
+void OReportController::clearUndoManager() const
+{
+ getUndoManager().Clear();
+}
+
+// -----------------------------------------------------------------------------
+void OReportController::addUndoAction( SfxUndoAction* i_pAction )
+{
+ getUndoManager().AddUndoAction( i_pAction );
+
+ InvalidateFeature( SID_UNDO );
+ InvalidateFeature( SID_REDO );
+}
diff --git a/reportdesign/source/ui/report/ReportControllerObserver.cxx b/reportdesign/source/ui/report/ReportControllerObserver.cxx
new file mode 100644
index 000000000000..7c0f3a572be8
--- /dev/null
+++ b/reportdesign/source/ui/report/ReportControllerObserver.cxx
@@ -0,0 +1,462 @@
+/*************************************************************************
+ *
+ * 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 <ReportControllerObserver.hxx>
+#include <ReportController.hxx>
+#include <svl/smplhint.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/report/XFormattedField.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <FormattedFieldBeautifier.hxx>
+
+#include <svx/unopage.hxx>
+
+// DBG_*
+#include <tools/debug.hxx>
+// DBG_UNHANDLED_EXCEPTION
+#include <tools/diagnose_ex.h>
+
+namespace rptui
+{
+
+ using namespace ::com::sun::star;
+
+ // const OReportController *& m_pReportController;
+
+DECLARE_STL_USTRINGACCESS_MAP(bool, AllProperties);
+DECLARE_STL_STDKEY_MAP(uno::Reference< beans::XPropertySet >, AllProperties, PropertySetInfoCache);
+
+class OXReportControllerObserverImpl
+{
+ OXReportControllerObserverImpl(OXReportControllerObserverImpl&);
+ void operator =(OXReportControllerObserverImpl&);
+public:
+ const OReportController& m_rReportController;
+ ::std::vector< uno::Reference< container::XChild> > m_aSections;
+ ::osl::Mutex m_aMutex;
+ oslInterlockedCount m_nLocks;
+ sal_Bool m_bReadOnly;
+
+ OXReportControllerObserverImpl(const OReportController& _rController);
+ ~OXReportControllerObserverImpl();
+};
+
+// -----------------------------------------------------------------------------
+
+ OXReportControllerObserverImpl::OXReportControllerObserverImpl(const OReportController& _rController)
+ :m_rReportController(_rController)
+ ,m_nLocks(0)
+ ,m_bReadOnly(sal_False)
+ {
+ }
+
+ OXReportControllerObserverImpl::~OXReportControllerObserverImpl()
+ {
+ }
+
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+
+ DBG_NAME(rpt_OXReportControllerObserver)
+
+ OXReportControllerObserver::OXReportControllerObserver(const OReportController& _rController)
+ :m_pImpl(new OXReportControllerObserverImpl(_rController) )
+ ,m_aFormattedFieldBeautifier(_rController)
+ ,m_aFixedTextColor(_rController)
+ {
+ DBG_CTOR( rpt_OXReportControllerObserver,NULL);
+
+ Application::AddEventListener(LINK( this, OXReportControllerObserver, SettingsChanged ) );
+ }
+
+ OXReportControllerObserver::~OXReportControllerObserver()
+ {
+ DBG_CTOR( rpt_OXReportControllerObserver,NULL);
+ Application::RemoveEventListener(LINK( this, OXReportControllerObserver, SettingsChanged ) );
+ }
+
+ // -----------------------------------------------------------------------------
+ IMPL_LINK(OXReportControllerObserver, SettingsChanged, VclWindowEvent*, _pEvt)
+ {
+ if ( _pEvt )
+ {
+ sal_Int32 nEvent = _pEvt->GetId();
+ /*
+ // just for debug
+ if (nEvent == VCLEVENT_WINDOW_CHILDCREATED ||
+ nEvent == VCLEVENT_WINDOW_PAINT ||
+ nEvent == VCLEVENT_WINDOW_MOVE ||
+ nEvent == VCLEVENT_WINDOW_RESIZE ||
+ nEvent == VCLEVENT_WINDOW_SHOW ||
+ nEvent == VCLEVENT_WINDOW_MOUSEMOVE ||
+ nEvent == VCLEVENT_WINDOW_FRAMETITLECHANGED ||
+ nEvent == VCLEVENT_WINDOW_HIDE ||
+ nEvent == VCLEVENT_EDIT_MODIFY ||
+ nEvent == VCLEVENT_SCROLLBAR_ENDSCROLL ||
+ nEvent == VCLEVENT_EDIT_SELECTIONCHANGED ||
+ nEvent == VCLEVENT_TABPAGE_INSERTED ||
+ nEvent == VCLEVENT_TABPAGE_REMOVED ||
+ nEvent == VCLEVENT_TOOLBOX_FORMATCHANGED ||
+ nEvent == VCLEVENT_TOOLBOX_ITEMADDED ||
+ nEvent == VCLEVENT_TOOLBOX_ALLITEMCHANGED ||
+ nEvent == VCLEVENT_MENUBARADDED ||
+ nEvent == 1
+ )
+ {
+ return 0L;
+ }
+ */
+
+ if (nEvent == VCLEVENT_APPLICATION_DATACHANGED )
+ {
+ DataChangedEvent* pData = reinterpret_cast<DataChangedEvent*>(_pEvt->GetData());
+ if ( pData && ((( pData->GetType() == DATACHANGED_SETTINGS ) ||
+ ( pData->GetType() == DATACHANGED_DISPLAY )) &&
+ ( pData->GetFlags() & SETTINGS_STYLE )))
+ {
+ OEnvLock aLock(*this);
+
+ // sal_uInt32 nCount = m_pImpl->m_aSections.size();
+
+ // send all Section Objects a 'tingle'
+ // maybe they need a change in format, color, etc
+ ::std::vector< uno::Reference< container::XChild > >::const_iterator aIter = m_pImpl->m_aSections.begin();
+ ::std::vector< uno::Reference< container::XChild > >::const_iterator aEnd = m_pImpl->m_aSections.end();
+ for (;aIter != aEnd; aIter++)
+ {
+ const uno::Reference<container::XChild> xChild (*aIter);
+ if (xChild.is())
+ {
+ uno::Reference<report::XSection> xSection(xChild, uno::UNO_QUERY);
+ if (xSection.is())
+ {
+ const sal_Int32 nCount = xSection->getCount();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ const uno::Any aObj = xSection->getByIndex(i);
+ uno::Reference < report::XReportComponent > xReportComponent(aObj, uno::UNO_QUERY);
+ if (xReportComponent.is())
+ {
+ m_aFormattedFieldBeautifier.handle(xReportComponent);
+ m_aFixedTextColor.handle(xReportComponent);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return 0L;
+ }
+
+ // XEventListener
+ void SAL_CALL OXReportControllerObserver::disposing(const lang::EventObject& e) throw( uno::RuntimeException )
+ {
+ (void) e;
+ // check if it's an object we have cached informations about
+ uno::Reference< beans::XPropertySet > xSourceSet(e.Source, uno::UNO_QUERY);
+ if ( xSourceSet.is() )
+ {
+ uno::Reference< report::XSection> xSection(xSourceSet,uno::UNO_QUERY);
+ if ( xSection.is() )
+ RemoveSection(xSection);
+ else
+ RemoveElement(xSourceSet);
+ }
+ }
+
+ void OXReportControllerObserver::Clear()
+ {
+ OEnvLock aLock(*this);
+ // sal_uInt32 nDebugValue = m_pImpl->m_aSections.size();
+ m_pImpl->m_aSections.clear();
+ }
+
+ // XPropertyChangeListener
+ void SAL_CALL OXReportControllerObserver::propertyChange(const beans::PropertyChangeEvent& _rEvent) throw(uno::RuntimeException)
+ {
+ (void) _rEvent;
+ ::osl::ClearableMutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( IsLocked() )
+ return;
+
+ m_aFormattedFieldBeautifier.notifyPropertyChange(_rEvent);
+ m_aFixedTextColor.notifyPropertyChange(_rEvent);
+ }
+
+// -----------------------------------------------------------------------------
+void OXReportControllerObserver::Lock()
+{
+ OSL_ENSURE(m_refCount,"Illegal call to dead object!");
+ osl_incrementInterlockedCount( &m_pImpl->m_nLocks );
+}
+void OXReportControllerObserver::UnLock()
+{
+ OSL_ENSURE(m_refCount,"Illegal call to dead object!");
+
+ osl_decrementInterlockedCount( &m_pImpl->m_nLocks );
+}
+sal_Bool OXReportControllerObserver::IsLocked() const { return m_pImpl->m_nLocks != 0; }
+
+//------------------------------------------------------------------------------
+void OXReportControllerObserver::AddSection(const uno::Reference< report::XSection > & _xSection)
+{
+ OEnvLock aLock(*this);
+ try
+ {
+ uno::Reference<container::XChild> xChild = _xSection.get();
+ m_pImpl->m_aSections.push_back(xChild);
+ uno::Reference< uno::XInterface > xInt(_xSection);
+ AddElement(xInt);
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void OXReportControllerObserver::RemoveSection(const uno::Reference< report::XSection > & _xSection)
+{
+ OEnvLock aLock(*this);
+ try
+ {
+ uno::Reference<container::XChild> xChild(_xSection.get());
+ m_pImpl->m_aSections.erase(::std::remove(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),
+ xChild), m_pImpl->m_aSections.end());
+ uno::Reference< uno::XInterface > xInt(_xSection);
+ RemoveElement(xInt);
+ }
+ catch(uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void OXReportControllerObserver::TogglePropertyListening(const uno::Reference< uno::XInterface > & Element)
+{
+ // listen at Container
+ uno::Reference< container::XIndexAccess > xContainer(Element, uno::UNO_QUERY);
+ if (xContainer.is())
+ {
+ uno::Reference< uno::XInterface > xInterface;
+ sal_Int32 nCount = xContainer->getCount();
+ for(sal_Int32 i = 0;i != nCount;++i)
+ {
+ xInterface.set(xContainer->getByIndex( i ),uno::UNO_QUERY);
+ TogglePropertyListening(xInterface);
+ }
+ }
+
+ uno::Reference< beans::XPropertySet > xSet(Element, uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ if (!m_pImpl->m_bReadOnly)
+ xSet->addPropertyChangeListener( ::rtl::OUString(), this );
+ else
+ xSet->removePropertyChangeListener( ::rtl::OUString(), this );
+ }
+}
+
+
+//------------------------------------------------------------------------------
+void OXReportControllerObserver::switchListening( const uno::Reference< container::XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(())
+{
+ OSL_PRECOND( _rxContainer.is(), "OXReportControllerObserver::switchListening: invalid container!" );
+ if ( !_rxContainer.is() )
+ return;
+
+ try
+ {
+ // also handle all children of this element
+ uno::Reference< uno::XInterface > xInterface;
+ sal_Int32 nCount = _rxContainer->getCount();
+ for(sal_Int32 i = 0;i != nCount;++i)
+ {
+ xInterface.set(_rxContainer->getByIndex( i ),uno::UNO_QUERY);
+ if ( _bStartListening )
+ AddElement( xInterface );
+ else
+ RemoveElement( xInterface );
+ }
+
+ // be notified of any changes in the container elements
+ uno::Reference< container::XContainer > xSimpleContainer( _rxContainer, uno::UNO_QUERY );
+ // OSL_ENSURE( xSimpleContainer.is(), "OXReportControllerObserver::switchListening: how are we expected to be notified of changes in the container?" );
+ if ( xSimpleContainer.is() )
+ {
+ if ( _bStartListening )
+ xSimpleContainer->addContainerListener( this );
+ else
+ xSimpleContainer->removeContainerListener( this );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void OXReportControllerObserver::switchListening( const uno::Reference< uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(())
+{
+ OSL_PRECOND( _rxObject.is(), "OXReportControllerObserver::switchListening: how should I listen at a NULL object?" );
+
+ try
+ {
+ if ( !m_pImpl->m_bReadOnly )
+ {
+ uno::Reference< beans::XPropertySet > xProps( _rxObject, uno::UNO_QUERY );
+ if ( xProps.is() )
+ {
+ if ( _bStartListening )
+ xProps->addPropertyChangeListener( ::rtl::OUString(), this );
+ else
+ xProps->removePropertyChangeListener( ::rtl::OUString(), this );
+ }
+ }
+
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( _rxObject, uno::UNO_QUERY );
+ if ( xBroadcaster.is() )
+ {
+ if ( _bStartListening )
+ xBroadcaster->addModifyListener( this );
+ else
+ xBroadcaster->removeModifyListener( this );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OXReportControllerObserver::modified( const lang::EventObject& /*aEvent*/ ) throw (uno::RuntimeException)
+{
+ // implSetModified();
+}
+
+//------------------------------------------------------------------------------
+void OXReportControllerObserver::AddElement(const uno::Reference< uno::XInterface >& _rxElement )
+{
+ // if ( !IsLocked() )
+ // {
+ m_aFormattedFieldBeautifier.notifyElementInserted(_rxElement);
+ m_aFixedTextColor.notifyElementInserted(_rxElement);
+ // }
+
+ // if it's a container, start listening at all elements
+ uno::Reference< container::XIndexAccess > xContainer( _rxElement, uno::UNO_QUERY );
+ if ( xContainer.is() )
+ switchListening( xContainer, true );
+
+ switchListening( _rxElement, true );
+}
+
+//------------------------------------------------------------------------------
+void OXReportControllerObserver::RemoveElement(const uno::Reference< uno::XInterface >& _rxElement)
+{
+ switchListening( _rxElement, false );
+
+ uno::Reference< container::XIndexAccess > xContainer( _rxElement, uno::UNO_QUERY );
+ if ( xContainer.is() )
+ switchListening( xContainer, false );
+}
+
+// -----------------------------------------------------------------------------
+::std::vector< uno::Reference< container::XChild> >::const_iterator OXReportControllerObserver::getSection(const uno::Reference<container::XChild>& _xContainer) const
+{
+ ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = m_pImpl->m_aSections.end();
+ if ( _xContainer.is() )
+ {
+ aFind = ::std::find(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),_xContainer);
+
+ if ( aFind == m_pImpl->m_aSections.end() )
+ {
+ uno::Reference<container::XChild> xParent(_xContainer->getParent(),uno::UNO_QUERY);
+ aFind = getSection(xParent);
+ }
+ }
+ return aFind;
+}
+// XContainerListener
+//------------------------------------------------------------------------------
+void SAL_CALL OXReportControllerObserver::elementInserted(const container::ContainerEvent& evt) throw(uno::RuntimeException)
+{
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ // neues Object zum lauschen
+ uno::Reference< uno::XInterface > xIface( evt.Element, uno::UNO_QUERY );
+ if ( xIface.is() )
+ {
+ AddElement(xIface);
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OXReportControllerObserver::elementReplaced(const container::ContainerEvent& evt) throw(uno::RuntimeException)
+{
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ uno::Reference< uno::XInterface > xIface(evt.ReplacedElement,uno::UNO_QUERY);
+ OSL_ENSURE(xIface.is(), "OXReportControllerObserver::elementReplaced: invalid container notification!");
+ RemoveElement(xIface);
+
+ xIface.set(evt.Element,uno::UNO_QUERY);
+ AddElement(xIface);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OXReportControllerObserver::elementRemoved(const container::ContainerEvent& evt) throw(uno::RuntimeException)
+{
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ uno::Reference< uno::XInterface > xIface( evt.Element, uno::UNO_QUERY );
+ if ( xIface.is() )
+ {
+ RemoveElement(xIface);
+ }
+}
+
+
+} // namespace rptui
+
+
+
diff --git a/reportdesign/source/ui/report/ReportRuler.cxx b/reportdesign/source/ui/report/ReportRuler.cxx
new file mode 100644
index 000000000000..e0bc9751ec49
--- /dev/null
+++ b/reportdesign/source/ui/report/ReportRuler.cxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * 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 "ReportRuler.hxx"
+#include "ReportSection.hxx"
+#include "ReportWindow.hxx"
+namespace rptui
+{
+using namespace ::com::sun::star;
+DBG_NAME( rpt_OReportRuler )
+OReportRuler::OReportRuler(Window* _pParent,OReportWindow* _pReportWindow,const uno::Reference< report::XSection >& _xSection)
+:Window(_pParent)
+,m_pParent(_pReportWindow)
+{
+ DBG_CTOR( rpt_OReportRuler,NULL);
+ SetMapMode( MapMode( MAP_100TH_MM ) );
+
+ Show();
+}
+//------------------------------------------------------------------------------
+OReportRuler::~OReportRuler()
+{
+ DBG_DTOR( rpt_OReportRuler,NULL);
+ delete m_pSection;
+}
+//------------------------------------------------------------------------------
+void OReportRuler::Resize()
+{
+ m_pSection->SetPosSizePixel(Point(0,0),GetOutputSize());
+}
+//------------------------------------------------------------------------------
+void OReportRuler::SetGridVisible(sal_Bool _bVisible)
+{
+ m_pSection->SetGridVisible( _bVisible );
+}
+//------------------------------------------------------------------------------
+//==============================================================================
+} // rptui
+//==============================================================================
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
new file mode 100644
index 000000000000..632efedd579c
--- /dev/null
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -0,0 +1,878 @@
+/*************************************************************************
+ *
+ * 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 "ReportSection.hxx"
+#include "ReportWindow.hxx"
+#include "DesignView.hxx"
+#include "uistrings.hrc"
+#include "RptObject.hxx"
+#include "RptModel.hxx"
+#include "SectionView.hxx"
+#include "RptPage.hxx"
+#include "ReportController.hxx"
+#include "UITools.hxx"
+#include "ViewsWindow.hxx"
+
+#include <svx/svdpagv.hxx>
+#include <editeng/eeitemid.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/gallery.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svditer.hxx>
+#include <svx/dbaexchange.hxx>
+
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <toolkit/helper/convert.hxx>
+#include "RptDef.hxx"
+#include "SectionWindow.hxx"
+#include "helpids.hrc"
+#include "RptResId.hrc"
+#include "dlgedclip.hxx"
+#include "UndoActions.hxx"
+#include "rptui_slotid.hrc"
+
+#include <connectivity/dbtools.hxx>
+
+#include <vcl/lineinfo.hxx>
+#include "ColorChanger.hxx"
+
+#include <svl/itempool.hxx>
+#include <svtools/extcolorcfg.hxx>
+#include <unotools/confignode.hxx>
+#include <framework/imageproducer.hxx>
+
+// =============================================================================
+namespace rptui
+{
+// =============================================================================
+using namespace ::com::sun::star;
+// -----------------------------------------------------------------------------
+
+sal_Int32 lcl_getOverlappedControlColor(/*const uno::Reference <lang::XMultiServiceFactory> _rxFactory*/)
+{
+ svtools::ExtendedColorConfig aConfig;
+ sal_Int32 nColor = aConfig.GetColorValue(CFG_REPORTDESIGNER, DBOVERLAPPEDCONTROL).getColor();
+ return nColor;
+}
+//------------------------------------------------------------------------------
+DBG_NAME( rpt_OReportSection )
+OReportSection::OReportSection(OSectionWindow* _pParent,const uno::Reference< report::XSection >& _xSection)
+: Window(_pParent,WB_DIALOGCONTROL)
+, ::comphelper::OPropertyChangeListener(m_aMutex)
+, DropTargetHelper(this)
+,m_pPage(NULL)
+,m_pView(NULL)
+,m_pParent(_pParent)
+,m_pFunc(NULL)
+,m_pMulti(NULL)
+,m_pReportListener(NULL)
+,m_xSection(_xSection)
+,m_eMode(RPTUI_SELECT)
+,m_bDialogModelChanged(sal_False)
+,m_bInDrag(sal_False)
+{
+ DBG_CTOR( rpt_OReportSection,NULL);
+ EnableChildTransparentMode();
+ SetHelpId(HID_REPORTSECTION);
+ SetMapMode( MapMode( MAP_100TH_MM ) );
+
+ try
+ {
+ fill();
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception catched!");
+ }
+
+ m_pFunc.reset(new DlgEdFuncSelect( this ));
+ m_pFunc->setOverlappedControlColor(lcl_getOverlappedControlColor( /* m_pParent->getViewsWindow()->getView()->getReportView()->getController().getORB() */ ) );
+}
+//------------------------------------------------------------------------------
+OReportSection::~OReportSection()
+{
+ DBG_DTOR( rpt_OReportSection,NULL);
+ m_pPage = NULL;
+ //m_pModel->GetUndoEnv().RemoveSection(m_xSection.get());
+ if ( m_pMulti.is() )
+ m_pMulti->dispose();
+
+ if ( m_pReportListener.is() )
+ m_pReportListener->dispose();
+ m_pFunc = ::std::auto_ptr<DlgEdFunc>();
+
+ {
+ ::std::auto_ptr<OSectionView> aTemp( m_pView);
+ if ( m_pView )
+ m_pView->EndListening( *m_pModel );
+ m_pView = NULL;
+ }
+ /*m_pModel->DeletePage(m_pPage->GetPageNum());*/
+}
+//------------------------------------------------------------------------------
+void OReportSection::Paint( const Rectangle& rRect )
+{
+ Window::Paint(rRect);
+
+ if ( m_pView )
+ {
+ // repaint, get PageView and prepare Region
+ SdrPageView* pPgView = m_pView->GetSdrPageView();
+ const Region aPaintRectRegion(rRect);
+
+ // #i74769#
+ SdrPaintWindow* pTargetPaintWindow = 0;
+
+ // mark repaint start
+ if(pPgView)
+ {
+ pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(this, aPaintRectRegion);
+ OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
+ // draw background self using wallpaper
+ OutputDevice& rTargetOutDev = pTargetPaintWindow->GetTargetOutputDevice();
+ sal_Int32 nColor = m_xSection->getBackColor();
+ if ( nColor == (sal_Int32)COL_TRANSPARENT )
+ nColor = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_BACKCOLOR);
+ rTargetOutDev.DrawWallpaper(rRect, Wallpaper(Color(nColor)));
+ }
+
+ // do paint (unbuffered) and mark repaint end
+ if(pPgView)
+ {
+ pPgView->DrawLayer(0, this);
+ pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, true);
+ }
+
+ m_pView->CompleteRedraw(this,aPaintRectRegion);
+ }
+}
+//------------------------------------------------------------------------------
+void OReportSection::Resize()
+{
+ Window::Resize();
+ if ( m_xSection.is() && m_pPage && m_pView )
+ {
+ uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
+ m_pPage->SetSize( Size( getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width,5*m_xSection->getHeight()) );
+ const Size aPageSize = m_pPage->GetSize();
+ const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
+ m_pView->SetWorkArea( Rectangle( Point( nLeftMargin, 0), Size(aPageSize.Width() - nLeftMargin - nRightMargin,aPageSize.Height()) ) );
+ }
+}
+//------------------------------------------------------------------------------
+void OReportSection::fill()
+{
+ if ( !m_xSection.is() )
+ return;
+
+ m_pMulti = new comphelper::OPropertyChangeMultiplexer(this,m_xSection.get());
+ m_pMulti->addProperty(PROPERTY_BACKCOLOR);
+
+ m_pReportListener = addStyleListener(m_xSection->getReportDefinition(),this);
+
+ m_pModel = m_pParent->getViewsWindow()->getView()->getReportView()->getController().getSdrModel();
+ m_pPage = m_pModel->getPage(m_xSection);
+
+ m_pView = new OSectionView( m_pModel.get(), this, m_pParent->getViewsWindow()->getView() );
+
+ // #i93597# tell SdrPage that only left and right page border is defined
+ // instead of the full rectangle definition
+ m_pPage->setPageBorderOnlyLeftRight(true);
+
+ // without the following call, no grid is painted
+ m_pView->ShowSdrPage( m_pPage );
+
+ m_pView->SetMoveSnapOnlyTopLeft( sal_True );
+ ODesignView* pDesignView = m_pParent->getViewsWindow()->getView()->getReportView();
+
+ // #i93595# Adapted grid to a more coarse grid and subdivisions for better visualisation. This
+ // is only for visualisation and has nothing to do with the actual snap
+ const Size aGridSizeCoarse(pDesignView->getGridSizeCoarse());
+ const Size aGridSizeFine(pDesignView->getGridSizeFine());
+ m_pView->SetGridCoarse(aGridSizeCoarse);
+ m_pView->SetGridFine(aGridSizeFine);
+
+ // #i93595# set snap grid width to snap to all existing subdivisions
+ const Fraction aX(aGridSizeFine.A());
+ const Fraction aY(aGridSizeFine.B());
+ m_pView->SetSnapGridWidth(aX, aY);
+
+ m_pView->SetGridSnap( pDesignView->isGridSnap() );
+ m_pView->SetGridFront( sal_False );
+ m_pView->SetDragStripes( sal_True );
+ m_pView->SetPageVisible();
+ sal_Int32 nColor = m_xSection->getBackColor();
+ if ( nColor == (sal_Int32)COL_TRANSPARENT )
+ nColor = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_BACKCOLOR);
+ m_pView->SetApplicationDocumentColor(nColor);
+
+ const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_LEFTMARGIN);
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_RIGHTMARGIN);
+ m_pPage->SetLftBorder(nLeftMargin);
+ m_pPage->SetRgtBorder(nRightMargin);
+
+// LLA: TODO
+// m_pPage->SetUppBorder(-10000);
+
+ m_pView->SetDesignMode( sal_True );
+
+ m_pView->StartListening( *m_pModel );
+ /*Resize();*/
+ if ( m_xSection.is() && m_pPage && m_pView )
+ {
+ uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
+ m_pPage->SetSize( Size( getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width,5*m_xSection->getHeight()) );
+ const Size aPageSize = m_pPage->GetSize();
+ const sal_Int32 nWorkAreaLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
+ const sal_Int32 nWorkAreaRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
+ m_pView->SetWorkArea( Rectangle( Point( nWorkAreaLeftMargin, 0), Size(aPageSize.Width() - nWorkAreaLeftMargin - nWorkAreaRightMargin,aPageSize.Height()) ) );
+ } // if ( m_xSection.is() && m_pPage && m_pView )
+
+ //SetBackground( Wallpaper( COL_BLUE ));
+}
+// -----------------------------------------------------------------------------
+void OReportSection::Paste(const uno::Sequence< beans::NamedValue >& _aAllreadyCopiedObjects,bool _bForce)
+{
+ OSL_ENSURE(m_xSection.is(),"Why is the section here NULL!");
+ if ( m_xSection.is() && _aAllreadyCopiedObjects.getLength() )
+ {
+ // stop all drawing actions
+ m_pView->BrkAction();
+
+ // unmark all objects
+ m_pView->UnmarkAll();
+ const ::rtl::OUString sSectionName = m_xSection->getName();
+ const sal_Int32 nLength = _aAllreadyCopiedObjects.getLength();
+ const beans::NamedValue* pIter = _aAllreadyCopiedObjects.getConstArray();
+ const beans::NamedValue* pEnd = pIter + nLength;
+ for(;pIter != pEnd;++pIter)
+ {
+ if ( _bForce || pIter->Name == sSectionName)
+ {
+ try
+ {
+ uno::Sequence< uno::Reference<report::XReportComponent> > aCopies;
+ pIter->Value >>= aCopies;
+ const uno::Reference<report::XReportComponent>* pCopiesIter = aCopies.getConstArray();
+ const uno::Reference<report::XReportComponent>* pCopiesEnd = pCopiesIter + aCopies.getLength();
+ for (;pCopiesIter != pCopiesEnd ; ++pCopiesIter)
+ {
+ SvxShape* pShape = SvxShape::getImplementation( *pCopiesIter );
+ SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL;
+ if ( pObject )
+ {
+ SdrObject* pNeuObj = pObject->Clone();
+
+ pNeuObj->SetPage( m_pPage );
+ pNeuObj->SetModel( m_pModel.get() );
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ m_pPage->InsertObject(pNeuObj,CONTAINER_APPEND,&aReason);
+
+ Rectangle aRet(VCLPoint((*pCopiesIter)->getPosition()),VCLSize((*pCopiesIter)->getSize()));
+ aRet.setHeight(aRet.getHeight() + 1);
+ aRet.setWidth(aRet.getWidth() + 1);
+ bool bOverlapping = true;
+ while ( bOverlapping )
+ {
+ bOverlapping = isOver(aRet,*m_pPage,*m_pView,true,pNeuObj) != NULL;
+ if ( bOverlapping )
+ {
+ aRet.Move(0,aRet.getHeight()+1);
+ pNeuObj->SetLogicRect(aRet);
+ //(*pCopiesIter)->setPositionY(aRet.Top());
+ }
+ }
+ m_pView->AddUndo( m_pView->GetModel()->GetSdrUndoFactory().CreateUndoNewObject( *pNeuObj ) );
+ m_pView->MarkObj( pNeuObj, m_pView->GetSdrPageView() );
+ if ( m_xSection.is() && (static_cast<sal_uInt32>(aRet.getHeight() + aRet.Top()) > m_xSection->getHeight()) )
+ m_xSection->setHeight(aRet.getHeight() + aRet.Top());
+ }
+ }
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught while pasting a new object!");
+ }
+ if ( !_bForce )
+ break;
+ }
+ }
+ }
+}
+//----------------------------------------------------------------------------
+void OReportSection::Delete()
+{
+ if( !m_pView->AreObjectsMarked() )
+ return;
+
+ m_pView->BrkAction();
+ m_pView->DeleteMarked();
+}
+//----------------------------------------------------------------------------
+void OReportSection::SetMode( DlgEdMode eNewMode )
+{
+ if ( eNewMode != m_eMode )
+ {
+ if ( eNewMode == RPTUI_INSERT )
+ {
+ m_pFunc.reset(new DlgEdFuncInsert( this ));
+ }
+ else
+ {
+ m_pFunc.reset(new DlgEdFuncSelect( this ));
+ }
+ m_pFunc->setOverlappedControlColor(lcl_getOverlappedControlColor( ) );
+ m_pModel->SetReadOnly(eNewMode == RPTUI_READONLY);
+ m_eMode = eNewMode;
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportSection::Copy(uno::Sequence< beans::NamedValue >& _rAllreadyCopiedObjects)
+{
+ Copy(_rAllreadyCopiedObjects,false);
+}
+//----------------------------------------------------------------------------
+void OReportSection::Copy(uno::Sequence< beans::NamedValue >& _rAllreadyCopiedObjects,bool _bEraseAnddNoClone)
+{
+ OSL_ENSURE(m_xSection.is(),"Why is the section here NULL!");
+ if( !m_pView->AreObjectsMarked() || !m_xSection.is() )
+ return;
+
+ // stop all drawing actions
+ //m_pView->BrkAction();
+
+ // insert control models of marked objects into clipboard dialog model
+ const SdrMarkList& rMarkedList = m_pView->GetMarkedObjectList();
+ const sal_uLong nMark = rMarkedList.GetMarkCount();
+
+ ::std::vector< uno::Reference<report::XReportComponent> > aCopies;
+ aCopies.reserve(nMark);
+
+ SdrUndoFactory& rUndo = m_pView->GetModel()->GetSdrUndoFactory();
+
+ for( sal_uLong i = nMark; i > 0; )
+ {
+ --i;
+ SdrObject* pSdrObject = rMarkedList.GetMark(i)->GetMarkedSdrObj();
+ OObjectBase* pObj = dynamic_cast<OObjectBase*>(pSdrObject);
+ if ( pObj )
+ {
+ try
+ {
+ SdrObject* pNeuObj = pSdrObject->Clone();
+ aCopies.push_back(uno::Reference<report::XReportComponent>(pNeuObj->getUnoShape(),uno::UNO_QUERY));
+ if ( _bEraseAnddNoClone )
+ {
+ m_pView->AddUndo( rUndo.CreateUndoDeleteObject( *pSdrObject ) );
+ m_pPage->RemoveObject(pSdrObject->GetOrdNum());
+ }
+
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Can't copy report elements!");
+ }
+ }
+ } // for( sal_uLong i = 0; i < nMark; i++ )
+
+ if ( !aCopies.empty() )
+ {
+ ::std::reverse(aCopies.begin(),aCopies.end());
+ const sal_Int32 nLength = _rAllreadyCopiedObjects.getLength();
+ _rAllreadyCopiedObjects.realloc( nLength + 1);
+ beans::NamedValue* pNewValue = _rAllreadyCopiedObjects.getArray() + nLength;
+ pNewValue->Name = m_xSection->getName();
+ pNewValue->Value <<= uno::Sequence< uno::Reference<report::XReportComponent> >(&(*aCopies.begin()),aCopies.size());
+ }
+}
+//----------------------------------------------------------------------------
+void OReportSection::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ m_pParent->getViewsWindow()->getView()->setMarked(m_pView,sal_True); // mark the section in which is clicked
+ m_pFunc->MouseButtonDown( rMEvt );
+ Window::MouseButtonDown(rMEvt);
+}
+//----------------------------------------------------------------------------
+void OReportSection::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( !m_pFunc->MouseButtonUp( rMEvt ) )
+ m_pParent->getViewsWindow()->getView()->getReportView()->getController().executeUnChecked(SID_OBJECT_SELECT,uno::Sequence< beans::PropertyValue>());
+}
+
+//----------------------------------------------------------------------------
+
+void OReportSection::MouseMove( const MouseEvent& rMEvt )
+{
+ m_pFunc->MouseMove( rMEvt );
+
+}
+//----------------------------------------------------------------------------
+void OReportSection::SetGridVisible(sal_Bool _bVisible)
+{
+ m_pView->SetGridVisible( _bVisible );
+}
+//------------------------------------------------------------------------------
+void OReportSection::SelectAll(const sal_uInt16 _nObjectType)
+{
+ if ( m_pView )
+ {
+ if ( _nObjectType == OBJ_NONE )
+ m_pView->MarkAllObj();
+ else
+ {
+ m_pView->UnmarkAll();
+ SdrObjListIter aIter(*m_pPage,IM_DEEPNOGROUPS);
+ SdrObject* pObjIter = NULL;
+ while( (pObjIter = aIter.Next()) != NULL )
+ {
+ if ( pObjIter->GetObjIdentifier() == _nObjectType )
+ m_pView->MarkObj( pObjIter, m_pView->GetSdrPageView() );
+ }
+ }
+ }
+}
+void lcl_insertMenuItemImages(PopupMenu& rContextMenu,OReportController& rController,const uno::Reference< report::XReportDefinition>& _xReportDefinition,uno::Reference<frame::XFrame>& _rFrame,sal_Bool _bHiContrast)
+{
+ const sal_uInt16 nCount = rContextMenu.GetItemCount();
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ if ( MENUITEM_SEPARATOR != rContextMenu.GetItemType(i))
+ {
+ const sal_uInt16 nId = rContextMenu.GetItemId(i);
+ PopupMenu* pPopupMenu = rContextMenu.GetPopupMenu( nId );
+ if ( pPopupMenu )
+ {
+ lcl_insertMenuItemImages(*pPopupMenu,rController,_xReportDefinition,_rFrame,_bHiContrast);
+ }
+ else
+ {
+ const ::rtl::OUString sCommand = rContextMenu.GetItemCommand(nId);
+ rContextMenu.SetItemImage(nId,framework::GetImageFromURL(_rFrame,sCommand,sal_False,_bHiContrast));
+ if ( nId == SID_PAGEHEADERFOOTER )
+ {
+ String sText = String(ModuleRes((_xReportDefinition.is() && _xReportDefinition->getPageHeaderOn()) ? RID_STR_PAGEHEADERFOOTER_DELETE : RID_STR_PAGEHEADERFOOTER_INSERT));
+ rContextMenu.SetItemText(nId,sText);
+ }
+ else if ( nId == SID_REPORTHEADERFOOTER )
+ {
+ String sText = String(ModuleRes((_xReportDefinition.is() && _xReportDefinition->getReportHeaderOn()) ? RID_STR_REPORTHEADERFOOTER_DELETE : RID_STR_REPORTHEADERFOOTER_INSERT));
+ rContextMenu.SetItemText(nId,sText);
+ }
+ }
+ rContextMenu.CheckItem(nId,rController.isCommandChecked(nId));
+ rContextMenu.EnableItem(nId,rController.isCommandEnabled(nId));
+ }
+ } // for (sal_uInt16 i = 0; i < nCount; ++i)
+}
+//----------------------------------------------------------------------------
+void OReportSection::Command( const CommandEvent& _rCEvt )
+{
+ Window::Command(_rCEvt);
+ switch (_rCEvt.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ sal_Bool bHiContrast = rSettings.GetHighContrastMode();
+ OReportController& rController = m_pParent->getViewsWindow()->getView()->getReportView()->getController();
+ uno::Reference<frame::XFrame> xFrame = rController.getFrame();
+ PopupMenu aContextMenu( ModuleRes( RID_MENU_REPORT ) );
+ uno::Reference< report::XReportDefinition> xReportDefinition = getSection()->getReportDefinition();
+
+ lcl_insertMenuItemImages(aContextMenu,rController,xReportDefinition,xFrame,bHiContrast);
+
+ Point aPos = _rCEvt.GetMousePosPixel();
+ m_pView->EndAction();
+ const sal_uInt16 nId = aContextMenu.Execute(this, aPos);
+ if ( nId )
+ {
+ uno::Sequence< beans::PropertyValue> aArgs;
+ if ( nId == SID_ATTR_CHAR_COLOR_BACKGROUND )
+ {
+ aArgs.realloc(1);
+ aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Selection"));
+ aArgs[0].Value <<= m_xSection;
+ }
+ rController.executeChecked(nId,aArgs);
+ }
+ }
+ break;
+ }
+}
+// -----------------------------------------------------------------------------
+void OReportSection::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
+{
+ if ( m_xSection.is() )
+ {
+ if ( _rEvent.Source == m_xSection || PROPERTY_BACKCOLOR == _rEvent.PropertyName )
+ {
+ sal_Int32 nColor = m_xSection->getBackColor();
+ if ( nColor == (sal_Int32)COL_TRANSPARENT )
+ nColor = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_BACKCOLOR);
+ m_pView->SetApplicationDocumentColor(nColor);
+ Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE);
+ }
+ else
+ {
+ uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
+ if ( _rEvent.PropertyName == PROPERTY_LEFTMARGIN )
+ {
+ const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
+ m_pPage->SetLftBorder(nLeftMargin);
+ }
+ else if ( _rEvent.PropertyName == PROPERTY_RIGHTMARGIN )
+ {
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
+ m_pPage->SetRgtBorder(nRightMargin);
+ }
+
+ try
+ {
+ const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
+ const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
+ const sal_Int32 nCount = m_xSection->getCount();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ bool bChanged = false;
+ uno::Reference< report::XReportComponent> xReportComponent(m_xSection->getByIndex(i),uno::UNO_QUERY_THROW);
+ awt::Point aPos = xReportComponent->getPosition();
+ awt::Size aSize = xReportComponent->getSize();
+ SvxShape* pShape = SvxShape::getImplementation( xReportComponent );
+ SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL;
+ if ( pObject )
+ {
+ OObjectBase* pBase = dynamic_cast<OObjectBase*>(pObject);
+ pBase->EndListening(sal_False);
+ if ( aPos.X < nLeftMargin )
+ {
+ aPos.X = nLeftMargin;
+ bChanged = true;
+ }
+ if ( (aPos.X + aSize.Width) > (nPaperWidth - nRightMargin) )
+ {
+ aPos.X = nPaperWidth - nRightMargin - aSize.Width;
+ if ( aPos.X < nLeftMargin )
+ {
+ aSize.Width += aPos.X - nLeftMargin;
+ aPos.X = nLeftMargin;
+ // add listener around
+ pBase->StartListening();
+ xReportComponent->setSize(aSize);
+ pBase->EndListening(sal_False);
+ }
+ bChanged = true;
+ }
+ if ( aPos.Y < 0 )
+ aPos.Y = 0;
+ if ( bChanged )
+ {
+ xReportComponent->setPosition(aPos);
+ correctOverlapping(pObject,*this,false);
+ Rectangle aRet(VCLPoint(xReportComponent->getPosition()),VCLSize(xReportComponent->getSize()));
+ aRet.setHeight(aRet.getHeight() + 1);
+ aRet.setWidth(aRet.getWidth() + 1);
+ if ( m_xSection.is() && (static_cast<sal_uInt32>(aRet.getHeight() + aRet.Top()) > m_xSection->getHeight()) )
+ m_xSection->setHeight(aRet.getHeight() + aRet.Top());
+ }
+ pBase->StartListening();
+ }
+ } // for (sal_Int32 i = 0; i < nCount; ++i)
+ }
+ catch(uno::Exception)
+ {
+ OSL_ENSURE(0,"Exception caught: OReportSection::_propertyChanged(");
+ }
+
+ Resize();
+ }
+ }
+}
+//------------------------------------------------------------------------------
+sal_Bool OReportSection::handleKeyEvent(const KeyEvent& _rEvent)
+{
+ return m_pFunc.get() ? m_pFunc->handleKeyEvent(_rEvent) : sal_False;
+}
+// -----------------------------------------------------------------------------
+void OReportSection::deactivateOle()
+{
+ if ( m_pFunc.get() )
+ m_pFunc->deactivateOle(true);
+}
+// -----------------------------------------------------------------------------
+void OReportSection::createDefault(const ::rtl::OUString& _sType)
+{
+ SdrObject* pObj = m_pView->GetCreateObj();//rMarkList.GetMark(0)->GetObj();
+ if ( !pObj )
+ return;
+ createDefault(_sType,pObj);
+}
+// -----------------------------------------------------------------------------
+void OReportSection::createDefault(const ::rtl::OUString& _sType,SdrObject* _pObj)
+{
+ sal_Bool bAttributesAppliedFromGallery = sal_False;
+
+ if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) )
+ {
+ std::vector< rtl::OUString > aObjList;
+ if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
+ {
+ std::vector< rtl::OUString >::iterator aIter = aObjList.begin();
+ std::vector< rtl::OUString >::iterator aEnd = aObjList.end();
+ for (sal_uInt32 i=0 ; aIter != aEnd; ++aIter,++i)
+ {
+ if ( aIter->equalsIgnoreAsciiCase( _sType ) )
+ {
+ OReportModel aReportModel(NULL);
+ SfxItemPool& rPool = aReportModel.GetItemPool();
+ rPool.FreezeIdRanges();
+ if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aReportModel ) )
+ {
+ const SdrObject* pSourceObj = aReportModel.GetPage( 0 )->GetObj( 0 );
+ if( pSourceObj )
+ {
+ const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
+ SfxItemSet aDest( _pObj->GetModel()->GetItemPool(), // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+ // Graphic Attributes
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+ // 3d Properties
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+ // CustomShape properties
+ SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST,
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+ // end
+ 0, 0);
+ aDest.Set( rSource );
+ _pObj->SetMergedItemSet( aDest );
+ sal_Int32 nAngle = pSourceObj->GetRotateAngle();
+ if ( nAngle )
+ {
+ double a = nAngle * F_PI18000;
+ _pObj->NbcRotate( _pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) );
+ }
+ bAttributesAppliedFromGallery = sal_True;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ if ( !bAttributesAppliedFromGallery )
+ {
+ _pObj->SetMergedItem( SvxAdjustItem( SVX_ADJUST_CENTER ,ITEMID_ADJUST) );
+ _pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
+ _pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
+ _pObj->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) );
+ ((SdrObjCustomShape*)_pObj)->MergeDefaultAttributes( &_sType );
+ }
+}
+// -----------------------------------------------------------------------------
+uno::Reference< report::XReportComponent > OReportSection::getCurrentControlModel() const
+{
+ uno::Reference< report::XReportComponent > xModel;
+ if ( m_pView )
+ {
+ const SdrMarkList& rMarkList = m_pView->GetMarkedObjectList();
+ sal_uInt32 nMarkCount = rMarkList.GetMarkCount();
+
+ if ( nMarkCount == 1 )
+ {
+ SdrObject* pDlgEdObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ OObjectBase* pObj = dynamic_cast<OObjectBase*>(pDlgEdObj);
+ if ( pObj )
+ xModel = pObj->getReportComponent().get();
+ }
+ }
+ return xModel;
+}
+// -----------------------------------------------------------------------------
+void OReportSection::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
+{
+ if ( m_pView )
+ {
+ const SdrMarkList& rMarkList = m_pView->GetMarkedObjectList();
+ const sal_uInt32 nMarkCount = rMarkList.GetMarkCount();
+
+ for (sal_uInt32 i=0; i < nMarkCount; ++i)
+ {
+ const SdrObject* pDlgEdObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ const OObjectBase* pObj = dynamic_cast<const OObjectBase*>(pDlgEdObj);
+ if ( pObj )
+ _rSelection.push_back(pObj->getReportComponent());
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+sal_Int8 OReportSection::AcceptDrop( const AcceptDropEvent& _rEvt )
+{
+ OSL_TRACE("AcceptDrop::DropEvent.Action %i\n", _rEvt.mnAction);
+
+ ::Point aDropPos(_rEvt.maPosPixel);
+ const MouseEvent aMouseEvt(aDropPos);
+ if ( m_pFunc->isOverlapping(aMouseEvt) )
+ return DND_ACTION_NONE;
+
+ if ( _rEvt.mnAction == DND_ACTION_COPY ||
+ _rEvt.mnAction == DND_ACTION_LINK
+ )
+ {
+ if (!m_pParent) return DND_ACTION_NONE;
+ sal_uInt16 nCurrentPosition = 0;
+ nCurrentPosition = m_pParent->getViewsWindow()->getPosition(m_pParent);
+ if (_rEvt.mnAction == DND_ACTION_COPY )
+ {
+ // we must assure, we can't drop in the top section
+ if (nCurrentPosition < 1)
+ {
+ return DND_ACTION_NONE;
+ }
+ return DND_ACTION_LINK;
+ }
+ if (_rEvt.mnAction == DND_ACTION_LINK)
+ {
+ // we must assure, we can't drop in the bottom section
+ if (m_pParent->getViewsWindow()->getSectionCount() > (nCurrentPosition + 1) )
+ {
+ return DND_ACTION_COPY;
+ }
+ return DND_ACTION_NONE;
+ }
+ }
+ else
+ {
+ const DataFlavorExVector& rFlavors = GetDataFlavorExVector();
+ if ( ::svx::OMultiColumnTransferable::canExtractDescriptor(rFlavors)
+ || ::svx::OColumnTransferable::canExtractColumnDescriptor(rFlavors, CTF_FIELD_DESCRIPTOR | CTF_CONTROL_EXCHANGE | CTF_COLUMN_DESCRIPTOR) )
+ return _rEvt.mnAction;
+
+ const sal_Int8 nDropOption = ( OReportExchange::canExtract(rFlavors) ) ? DND_ACTION_COPYMOVE : DND_ACTION_NONE;
+
+ return nDropOption;
+ }
+ return DND_ACTION_NONE;
+}
+
+// -----------------------------------------------------------------------------
+sal_Int8 OReportSection::ExecuteDrop( const ExecuteDropEvent& _rEvt )
+{
+ OSL_TRACE("ExecuteDrop::DropEvent.Action %i\n", _rEvt.mnAction);
+ ::Point aDropPos(PixelToLogic(_rEvt.maPosPixel));
+ const MouseEvent aMouseEvt(aDropPos);
+ if ( m_pFunc->isOverlapping(aMouseEvt) )
+ return DND_ACTION_NONE;
+
+ sal_Int8 nDropOption = DND_ACTION_NONE;
+ const TransferableDataHelper aDropped(_rEvt.maDropEvent.Transferable);
+ DataFlavorExVector& rFlavors = aDropped.GetDataFlavorExVector();
+ bool bMultipleFormat = ::svx::OMultiColumnTransferable::canExtractDescriptor(rFlavors);
+ if ( OReportExchange::canExtract(rFlavors) )
+ {
+ OReportExchange::TSectionElements aCopies = OReportExchange::extractCopies(aDropped);
+ Paste(aCopies,true);
+ nDropOption = DND_ACTION_COPYMOVE;
+ m_pParent->getViewsWindow()->BrkAction();
+ m_pParent->getViewsWindow()->unmarkAllObjects(m_pView);
+ //m_pParent->getViewsWindow()->getView()->setMarked(m_pView,sal_True);
+ } // if ( OReportExchange::canExtract(rFlavors) )
+ else if ( bMultipleFormat
+ || ::svx::OColumnTransferable::canExtractColumnDescriptor(rFlavors, CTF_FIELD_DESCRIPTOR | CTF_CONTROL_EXCHANGE | CTF_COLUMN_DESCRIPTOR) )
+ {
+ m_pParent->getViewsWindow()->getView()->setMarked(m_pView,sal_True);
+ m_pView->UnmarkAll();
+ const Rectangle& rRect = m_pView->GetWorkArea();
+ if ( aDropPos.X() < rRect.Left() )
+ aDropPos.X() = rRect.Left();
+ else if ( aDropPos.X() > rRect.Right() )
+ aDropPos.X() = rRect.Right();
+
+ if ( aDropPos.Y() > rRect.Bottom() )
+ aDropPos.Y() = rRect.Bottom();
+
+ uno::Sequence<beans::PropertyValue> aValues;
+ if ( !bMultipleFormat )
+ {
+ ::svx::ODataAccessDescriptor aDescriptor = ::svx::OColumnTransferable::extractColumnDescriptor(aDropped);
+
+ aValues.realloc(1);
+ aValues[0].Value <<= aDescriptor.createPropertyValueSequence();
+ } // if ( !bMultipleFormat )
+ else
+ aValues = ::svx::OMultiColumnTransferable::extractDescriptor(aDropped);
+
+ beans::PropertyValue* pIter = aValues.getArray();
+ beans::PropertyValue* pEnd = pIter + aValues.getLength();
+ for(;pIter != pEnd; ++pIter)
+ {
+ uno::Sequence<beans::PropertyValue> aCurrent;
+ pIter->Value >>= aCurrent;
+ sal_Int32 nLength = aCurrent.getLength();
+ if ( nLength )
+ {
+ aCurrent.realloc(nLength + 3);
+ aCurrent[nLength].Name = PROPERTY_POSITION;
+ aCurrent[nLength++].Value <<= AWTPoint(aDropPos);
+ // give also the DND Action (Shift|Ctrl) Key to really say what we want
+ aCurrent[nLength].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DNDAction"));
+ aCurrent[nLength++].Value <<= _rEvt.mnAction;
+
+ aCurrent[nLength].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Section"));
+ aCurrent[nLength++].Value <<= getSection();
+ pIter->Value <<= aCurrent;
+ }
+ }
+
+ // we use this way to create undo actions
+ OReportController& rController = m_pParent->getViewsWindow()->getView()->getReportView()->getController();
+ rController.executeChecked(SID_ADD_CONTROL_PAIR,aValues);
+ nDropOption = DND_ACTION_COPY;
+ }
+ return nDropOption;
+}
+// -----------------------------------------------------------------------------
+void OReportSection::stopScrollTimer()
+{
+ m_pFunc->stopScrollTimer();
+}
+// -----------------------------------------------------------------------------
+bool OReportSection::isUiActive() const
+{
+ return m_pFunc->isUiActive();
+}
+// -----------------------------------------------------------------------------
+// =============================================================================
+}
+// =============================================================================
diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx
new file mode 100644
index 000000000000..d1afc5bcfd22
--- /dev/null
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * 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 "ReportWindow.hxx"
+#include "ReportSection.hxx"
+#include "SectionView.hxx"
+#include "ViewsWindow.hxx"
+#include "ReportRuler.hxx"
+#include "DesignView.hxx"
+
+#include <tools/debug.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svl/itempool.hxx>
+#include <unotools/syslocale.hxx>
+
+#include "RptDef.hxx"
+#include "dlgedfunc.hxx"
+#include "RptModel.hxx"
+#include "uistrings.hrc"
+#include "RptPage.hxx"
+#include "ReportController.hxx"
+#include "EndMarker.hxx"
+#include "ColorChanger.hxx"
+#include "ScrollHelper.hxx"
+
+#include "helpids.hrc"
+#include "dlgedfac.hxx"
+#include <boost/bind.hpp>
+#include <toolkit/helper/vclunohelper.hxx>
+
+
+#define SECTION_OFFSET 3
+namespace rptui
+{
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+//==================================================================
+// class OReportWindow
+//==================================================================
+DBG_NAME( rpt_OReportWindow )
+//------------------------------------------------------------------------------
+OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView)
+: Window(_pParent,WB_DIALOGCONTROL)
+,m_aHRuler(this)
+,m_pView(_pView)
+,m_pParent(_pParent)
+,m_aViewsWindow(this)
+,m_pObjFac( new DlgEdFactory() )
+{
+ DBG_CTOR( rpt_OReportWindow,NULL);
+ SetHelpId(UID_RPT_REPORTWINDOW);
+ SetMapMode( MapMode( MAP_100TH_MM ) );
+
+ m_aViewsWindow.Show();
+
+ m_aHRuler.Show();
+ m_aHRuler.Activate();
+ m_aHRuler.SetPagePos(0);
+ m_aHRuler.SetBorders();
+ m_aHRuler.SetIndents();
+ m_aHRuler.SetMargin1();
+ m_aHRuler.SetMargin2();
+ const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
+ m_aHRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
+
+ ImplInitSettings();
+}
+//------------------------------------------------------------------------------
+OReportWindow::~OReportWindow()
+{
+ DBG_DTOR( rpt_OReportWindow,NULL);
+}
+// -----------------------------------------------------------------------------
+void OReportWindow::initialize()
+{
+ m_aViewsWindow.initialize();
+}
+//----------------------------------------------------------------------------
+void OReportWindow::SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType )
+{
+ m_aViewsWindow.SetInsertObj( eObj,_sShapeType);
+}
+
+//----------------------------------------------------------------------------
+rtl::OUString OReportWindow::GetInsertObjString() const
+{
+ return m_aViewsWindow.GetInsertObjString();
+}
+//------------------------------------------------------------------------------
+void OReportWindow::SetMode( DlgEdMode eNewMode )
+{
+ m_aViewsWindow.SetMode(eNewMode);
+}
+//----------------------------------------------------------------------------
+void OReportWindow::removeSection(sal_uInt16 _nPosition)
+{
+ m_aViewsWindow.removeSection(_nPosition);
+ m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
+ m_aViewsWindow.Invalidate(INVALIDATE_TRANSPARENT);
+ //Resize();
+}
+//----------------------------------------------------------------------------
+void OReportWindow::addSection(const uno::Reference< report::XSection >& _xSection,const ::rtl::OUString& _sColorEntry,sal_uInt16 _nPosition)
+{
+ if ( !_xSection.is() )
+ return;
+
+ m_aViewsWindow.addSection(_xSection,_sColorEntry,_nPosition);
+
+ m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
+}
+//------------------------------------------------------------------------------
+void OReportWindow::toggleGrid(sal_Bool _bVisible)
+{
+ m_aViewsWindow.toggleGrid(_bVisible);
+}
+//----------------------------------------------------------------------------
+void OReportWindow::showRuler(sal_Bool _bShow)
+{
+ m_aHRuler.Show(_bShow);
+
+ m_aViewsWindow.showRuler(_bShow);
+}
+//------------------------------------------------------------------------------
+sal_Int32 OReportWindow::getMaxMarkerWidth(sal_Bool _bWithEnd) const
+{
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ aStartWidth *= m_aViewsWindow.GetMapMode().GetScaleX();
+ if ( _bWithEnd )
+ aStartWidth += Fraction(long(REPORT_ENDMARKER_WIDTH));
+ return sal_Int32((long)aStartWidth);
+}
+//------------------------------------------------------------------------------
+sal_Int32 OReportWindow::GetTotalWidth() const
+{
+ sal_Int32 nWidth = 0;
+ if ( !m_aViewsWindow.empty() )
+ {
+ Fraction aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH ));
+ const Fraction aZoom(m_pView->getController().getZoomValue(),100);
+ aStartWidth *= aZoom; // m_aViewsWindow.GetMapMode().GetScaleX();;
+ const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
+ Fraction aPaperWidth(nPaperWidth,1);
+ aPaperWidth *= aZoom;
+ const Size aPageSize = LogicToPixel(Size(aPaperWidth,0));
+ nWidth = aPageSize.Width() + long(aStartWidth);
+ }
+ return nWidth;
+}
+//------------------------------------------------------------------------------
+void OReportWindow::Resize()
+{
+ Window::Resize();
+ if ( !m_aViewsWindow.empty() )
+ {
+ const Size aTotalOutputSize = GetOutputSizePixel();
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100);
+
+ const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, 0 ), MAP_APPFONT );
+ Point aStartPoint((long)aStartWidth + aOffset.X(),0);
+ uno::Reference<report::XReportDefinition> xReportDefinition = getReportView()->getController().getReportDefinition();
+ const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
+ sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
+ sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
+ Size aPageSize = m_aViewsWindow.LogicToPixel(Size(nPaperWidth ,0));
+ nLeftMargin = m_aViewsWindow.LogicToPixel(Size(nLeftMargin,0)).Width();
+ nRightMargin = m_aViewsWindow.LogicToPixel(Size(nRightMargin,0)).Width();
+
+ aPageSize.Height() = m_aHRuler.GetSizePixel().Height();
+
+ const long nTermp(m_aViewsWindow.getTotalHeight() + aPageSize.Height());
+ long nSectionsHeight = ::std::max<long>(nTermp,aTotalOutputSize.Height());
+
+ m_aHRuler.SetPosSizePixel(aStartPoint,aPageSize);
+ m_aHRuler.SetNullOffset(nLeftMargin);
+ m_aHRuler.SetMargin1(0);
+ m_aHRuler.SetMargin2(aPageSize.Width() - nLeftMargin - nRightMargin);
+
+ aStartPoint.Y() += aPageSize.Height();
+ nSectionsHeight -= aStartPoint.Y();
+
+ aStartPoint.X() = aOffset.X();
+
+ m_aViewsWindow.SetPosSizePixel(aStartPoint,Size(aTotalOutputSize.Width(),nSectionsHeight));
+ }
+}
+//------------------------------------------------------------------------------
+Point OReportWindow::getThumbPos() const
+{
+ return m_pParent->getThumbPos();
+}
+//------------------------------------------------------------------------------
+void OReportWindow::ImplInitSettings()
+{
+ SetBackground( );
+}
+//-----------------------------------------------------------------------------
+void OReportWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+//------------------------------------------------------------------------------
+sal_Int32 OReportWindow::GetTotalHeight() const
+{
+ return m_aViewsWindow.getTotalHeight();
+}
+//------------------------------------------------------------------------------
+void OReportWindow::ScrollChildren(const Point& _aThumbPos)
+{
+ MapMode aMap = m_aHRuler.GetMapMode();
+ Point aOrg( aMap.GetOrigin() );
+ if ( aOrg.X() != (-_aThumbPos.X()) )
+ {
+ aMap.SetOrigin( Point(- _aThumbPos.X(), aOrg.Y()));
+ m_aHRuler.SetMapMode( aMap );
+ m_aHRuler.Scroll(-(aOrg.X() + _aThumbPos.X()),0);
+ }
+
+ /*const Point aPos(PixelToLogic(_aThumbPos));*/
+ m_aViewsWindow.scrollChildren(_aThumbPos);
+}
+//----------------------------------------------------------------------------
+sal_uInt16 OReportWindow::getSectionCount() const
+{
+ return m_aViewsWindow.getSectionCount();
+}
+//----------------------------------------------------------------------------
+void OReportWindow::notifySizeChanged()
+{
+ m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight());
+}
+//----------------------------------------------------------------------------
+sal_Bool OReportWindow::HasSelection() const
+{
+ return m_aViewsWindow.HasSelection();
+}
+//----------------------------------------------------------------------------
+void OReportWindow::Delete()
+{
+
+ m_aViewsWindow.Delete();
+}
+//----------------------------------------------------------------------------
+void OReportWindow::Copy()
+{
+
+ m_aViewsWindow.Copy();
+}
+//----------------------------------------------------------------------------
+void OReportWindow::Paste()
+{
+
+ m_aViewsWindow.Paste();
+}
+//----------------------------------------------------------------------------
+sal_Bool OReportWindow::IsPasteAllowed() const
+{
+ return m_aViewsWindow.IsPasteAllowed();
+}
+//-----------------------------------------------------------------------------
+void OReportWindow::SelectAll(const sal_uInt16 _nObjectType)
+{
+
+ m_aViewsWindow.SelectAll(_nObjectType);
+}
+//-----------------------------------------------------------------------------
+void OReportWindow::unmarkAllObjects(OSectionView* _pSectionView)
+{
+
+ m_aViewsWindow.unmarkAllObjects(_pSectionView);
+}
+//-----------------------------------------------------------------------------
+void OReportWindow::showProperties(const uno::Reference< report::XSection>& _xReportComponent)
+{
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aViewsWindow.getSectionWindow( _xReportComponent );
+ m_pView->UpdatePropertyBrowserDelayed(pSectionWindow->getReportSection().getSectionView());
+}
+//------------------------------------------------------------------------------
+sal_Bool OReportWindow::handleKeyEvent(const KeyEvent& _rEvent)
+{
+ return m_aViewsWindow.handleKeyEvent(_rEvent);
+}
+//------------------------------------------------------------------------
+void OReportWindow::setMarked(OSectionView* _pSectionView,sal_Bool _bMark)
+{
+ if ( _pSectionView )
+ m_aViewsWindow.setMarked(_pSectionView,_bMark);
+}
+//------------------------------------------------------------------------
+void OReportWindow::setMarked(const uno::Reference< report::XSection>& _xSection,sal_Bool _bMark)
+{
+
+ m_aViewsWindow.setMarked(_xSection,_bMark);
+}
+//------------------------------------------------------------------------
+void OReportWindow::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape,sal_Bool _bMark)
+{
+
+ m_aViewsWindow.setMarked(_xShape,_bMark);
+}
+//-----------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> OReportWindow::getMarkedSection(NearSectionAccess nsa) const
+{
+ return m_aViewsWindow.getMarkedSection(nsa);
+}
+//-----------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
+{
+ return m_aViewsWindow.getSectionWindow(_xSection);
+}
+// -------------------------------------------------------------------------
+void OReportWindow::markSection(const sal_uInt16 _nPos)
+{
+
+ m_aViewsWindow.markSection(_nPos);
+}
+// -----------------------------------------------------------------------------
+void OReportWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
+{
+
+ m_aViewsWindow.fillCollapsedSections(_rCollapsedPositions);
+}
+// -----------------------------------------------------------------------------
+void OReportWindow::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections)
+{
+
+ m_aViewsWindow.collapseSections(_aCollpasedSections);
+}
+// -----------------------------------------------------------------------------
+void OReportWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects)
+{
+
+ m_aViewsWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects);
+}
+// -----------------------------------------------------------------------------
+void OReportWindow::setGridSnap(sal_Bool bOn)
+{
+
+ m_aViewsWindow.setGridSnap(bOn);
+}
+// -----------------------------------------------------------------------------
+void OReportWindow::setDragStripes(sal_Bool bOn)
+{
+ m_aViewsWindow.setDragStripes(bOn);
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 OReportWindow::getMarkedObjectCount() const
+{
+ return m_aViewsWindow.getMarkedObjectCount();
+}
+// -----------------------------------------------------------------------------
+void OReportWindow::zoom(const Fraction& _aZoom)
+{
+ m_aHRuler.SetZoom(_aZoom);
+ m_aHRuler.Invalidate();
+
+ //setZoomFactor(_aZoom,*this); // if this will be include the H - ruler has the wrong size
+ m_aViewsWindow.zoom(_aZoom);
+
+ notifySizeChanged();
+ const Point aNewThumbPos( m_pParent->getThumbPos() );
+
+ ScrollChildren( aNewThumbPos );
+ Resize();
+
+ Invalidate(INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
+}
+// -----------------------------------------------------------------------------
+void OReportWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
+{
+ m_aViewsWindow.fillControlModelSelection(_rSelection);
+}
+// -----------------------------------------------------------------------------
+sal_Int32 OReportWindow::impl_getRealPixelWidth() const
+{
+ const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
+ MapMode aMap( MAP_100TH_MM );
+ const Size aPageSize = LogicToPixel(Size(nPaperWidth,0),aMap);
+ return aPageSize.Width() + REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH + SECTION_OFFSET;
+}
+// -----------------------------------------------------------------------------
+sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const
+{
+ sal_uInt16 nZoom(100);
+ const Size aSize( GetSizePixel() );
+ switch( _eType)
+ {
+ case SVX_ZOOM_PERCENT:
+ nZoom = m_pView->getController().getZoomValue();
+ break;
+ case SVX_ZOOM_OPTIMAL:
+ break;
+ case SVX_ZOOM_WHOLEPAGE:
+ {
+ nZoom = (sal_uInt16)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth());
+ MapMode aMap( MAP_100TH_MM );
+ const Size aHeight = m_aViewsWindow.LogicToPixel(m_aViewsWindow.PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler.GetSizePixel().Height())),aMap);
+ nZoom = ::std::min(nZoom,(sal_uInt16)(long)Fraction(aSize.Height()*100,aHeight.Height()));
+ }
+ break;
+ case SVX_ZOOM_PAGEWIDTH:
+ nZoom = (sal_uInt16)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth());
+ break;
+ default:
+ break;
+ }
+
+ return nZoom;
+}
+//==================================================================
+} //rptui
+//==================================================================
+
diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx
new file mode 100644
index 000000000000..13c65882e6c0
--- /dev/null
+++ b/reportdesign/source/ui/report/ScrollHelper.cxx
@@ -0,0 +1,416 @@
+/*************************************************************************
+ *
+ * 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 "ScrollHelper.hxx"
+#include "DesignView.hxx"
+#include "ReportController.hxx"
+#include "ReportWindow.hxx"
+#include "UITools.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <toolkit/helper/convert.hxx>
+#include <vcl/svapp.hxx>
+
+namespace rptui
+{
+#define LINE_SIZE 50
+#define SECTION_OFFSET 3
+#define SCR_LINE_SIZE 10
+using namespace ::com::sun::star;
+
+// -----------------------------------------------------------------------------
+void lcl_setScrollBar(sal_Int32 _nNewValue,const Point& _aPos,const Size& _aSize,ScrollBar& _rScrollBar)
+{
+ _rScrollBar.SetPosSizePixel(_aPos,_aSize);
+ _rScrollBar.SetPageSize( _nNewValue );
+ _rScrollBar.SetVisibleSize( _nNewValue );
+}
+
+// -----------------------------------------------------------------------------
+DBG_NAME( rpt_OScrollWindowHelper );
+OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView)
+ : OScrollWindowHelper_BASE( _pDesignView,WB_DIALOGCONTROL)
+ ,OPropertyChangeListener(m_aMutex)
+ ,m_aHScroll( this, WB_HSCROLL|WB_REPEAT|WB_DRAG )
+ ,m_aVScroll( this, WB_VSCROLL|WB_REPEAT|WB_DRAG )
+ ,m_aCornerWin( this )
+ ,m_pParent(_pDesignView)
+ ,m_aReportWindow(this,m_pParent)
+ ,m_pReportDefintionMultiPlexer(NULL)
+{
+ DBG_CTOR( rpt_OScrollWindowHelper,NULL);
+ SetMapMode( MapMode( MAP_100TH_MM ) );
+
+ impl_initScrollBar( m_aHScroll );
+ impl_initScrollBar( m_aVScroll );
+
+ m_aReportWindow.SetMapMode( MapMode( MAP_100TH_MM ) );
+ m_aReportWindow.Show();
+
+ // normally we should be SCROLL_PANE
+ SetAccessibleRole(accessibility::AccessibleRole::SCROLL_PANE);
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------------
+OScrollWindowHelper::~OScrollWindowHelper()
+{
+ DBG_DTOR( rpt_OScrollWindowHelper,NULL);
+ if ( m_pReportDefintionMultiPlexer.is() )
+ m_pReportDefintionMultiPlexer->dispose();
+}
+
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::impl_initScrollBar( ScrollBar& _rScrollBar ) const
+{
+ AllSettings aSettings( _rScrollBar.GetSettings() );
+ StyleSettings aStyle( aSettings.GetStyleSettings() );
+ aStyle.SetDragFullOptions( aStyle.GetDragFullOptions() | DRAGFULL_OPTION_SCROLL ); // live scrolling
+ aSettings.SetStyleSettings( aStyle );
+ _rScrollBar.SetSettings( aSettings );
+ //_rScrollBar.SetMapMode( MapMode( MAP_100TH_MM ) );
+
+ _rScrollBar.SetScrollHdl( LINK( this, OScrollWindowHelper, ScrollHdl ) );
+ _rScrollBar.SetLineSize( SCR_LINE_SIZE );
+}
+
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::initialize()
+{
+ uno::Reference<report::XReportDefinition> xReportDefinition = m_pParent->getController().getReportDefinition();
+ m_pReportDefintionMultiPlexer = addStyleListener(xReportDefinition,this);
+
+ m_aReportWindow.initialize();
+}
+//------------------------------------------------------------------------------
+void OScrollWindowHelper::setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight)
+{
+ m_aTotalPixelSize.Width() = _nWidth;
+ m_aTotalPixelSize.Height() = _nHeight;
+
+ // now set the ranges without start marker
+ Fraction aStartWidth(REPORT_STARTMARKER_WIDTH * m_pParent->getController().getZoomValue(),100);
+ long nWidth = long(_nWidth - (double)aStartWidth);
+ m_aHScroll.SetRangeMax( nWidth );
+ m_aVScroll.SetRangeMax( m_aTotalPixelSize.Height() );
+
+ Resize();
+}
+//------------------------------------------------------------------------------
+Size OScrollWindowHelper::ResizeScrollBars()
+{
+ // get the new output-size in pixel
+ Size aOutPixSz = GetOutputSizePixel();
+ if ( aOutPixSz.Width() == 0 || aOutPixSz.Height() == 0 )
+ return aOutPixSz;
+
+ aOutPixSz.Height() -= m_aReportWindow.getRulerHeight();
+ // determine the size of the output-area and if we need scrollbars
+ const long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ bool bVVisible = false; // by default no vertical-ScrollBar
+ bool bHVisible = false; // by default no horizontal-ScrollBar
+ bool bChanged; // determines if a visiblility was changed
+ do
+ {
+ bChanged = false;
+
+ // does we need a vertical ScrollBar
+ if ( aOutPixSz.Width() < m_aTotalPixelSize.Width() && !bHVisible )
+ {
+ bHVisible = true;
+ aOutPixSz.Height() -= nScrSize;
+ bChanged = true;
+ }
+
+ // does we need a horizontal ScrollBar
+ if ( aOutPixSz.Height() < m_aTotalPixelSize.Height() && !bVVisible )
+ {
+ bVVisible = true;
+ aOutPixSz.Width() -= nScrSize;
+ bChanged = true;
+ }
+
+ }
+ while ( bChanged ); // until no visibility has changed
+
+ aOutPixSz.Height() += m_aReportWindow.getRulerHeight();
+
+ // show or hide scrollbars
+ m_aVScroll.Show( bVVisible );
+ m_aHScroll.Show( bHVisible );
+
+ // disable painting in the corner between the scrollbars
+ if ( bVVisible && bHVisible )
+ {
+ m_aCornerWin.SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) );
+ m_aCornerWin.Show();
+ }
+ else
+ m_aCornerWin.Hide();
+
+ const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, SECTION_OFFSET ), MAP_APPFONT );
+ // resize scrollbars and set their ranges
+ {
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100);
+ const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - (long)aStartWidth;
+ lcl_setScrollBar(nNewWidth,Point( (long)aStartWidth + aOffset.X(), aOutPixSz.Height() ),Size( nNewWidth, nScrSize ),m_aHScroll);
+ }
+ {
+ const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow.getRulerHeight();
+ lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow.getRulerHeight() ),Size( nScrSize,nNewHeight),m_aVScroll);
+ }
+
+ return aOutPixSz;
+}
+//------------------------------------------------------------------------------
+void OScrollWindowHelper::Resize()
+{
+ OScrollWindowHelper_BASE::Resize();
+ const Size aTotalOutputSize = ResizeScrollBars();
+
+ m_aReportWindow.SetPosSizePixel(Point( 0, 0 ),aTotalOutputSize);
+}
+//------------------------------------------------------------------------------
+IMPL_LINK( OScrollWindowHelper, ScrollHdl, ScrollBar*, /*pScroll*/ )
+{
+ m_aReportWindow.ScrollChildren( getThumbPos() );
+ return 0;
+}
+//------------------------------------------------------------------------------
+void OScrollWindowHelper::addSection(const uno::Reference< report::XSection >& _xSection
+ ,const ::rtl::OUString& _sColorEntry
+ ,sal_uInt16 _nPosition)
+{
+ m_aReportWindow.addSection(_xSection,_sColorEntry,_nPosition);
+}
+//------------------------------------------------------------------------------
+void OScrollWindowHelper::removeSection(sal_uInt16 _nPosition)
+{
+ m_aReportWindow.removeSection(_nPosition);
+}
+//------------------------------------------------------------------------------
+void OScrollWindowHelper::toggleGrid(sal_Bool _bVisible)
+{
+ m_aReportWindow.toggleGrid(_bVisible);
+}
+//------------------------------------------------------------------------------
+sal_uInt16 OScrollWindowHelper::getSectionCount() const
+{
+ return m_aReportWindow.getSectionCount();
+}
+//------------------------------------------------------------------------------
+void OScrollWindowHelper::SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType )
+{
+ m_aReportWindow.SetInsertObj(eObj,_sShapeType);
+}
+//----------------------------------------------------------------------------
+rtl::OUString OScrollWindowHelper::GetInsertObjString() const
+{
+ return m_aReportWindow.GetInsertObjString();
+}
+//------------------------------------------------------------------------------
+void OScrollWindowHelper::SetMode( DlgEdMode _eNewMode )
+{
+ m_aReportWindow.SetMode(_eNewMode);
+}
+//------------------------------------------------------------------------------
+sal_Bool OScrollWindowHelper::HasSelection() const
+{
+ return m_aReportWindow.HasSelection();
+}
+//----------------------------------------------------------------------------
+void OScrollWindowHelper::Delete()
+{
+ m_aReportWindow.Delete();
+}
+//----------------------------------------------------------------------------
+void OScrollWindowHelper::Copy()
+{
+ m_aReportWindow.Copy();
+}
+//----------------------------------------------------------------------------
+void OScrollWindowHelper::Paste()
+{
+ m_aReportWindow.Paste();
+}
+//----------------------------------------------------------------------------
+sal_Bool OScrollWindowHelper::IsPasteAllowed() const
+{
+ return m_aReportWindow.IsPasteAllowed();
+}
+//-----------------------------------------------------------------------------
+void OScrollWindowHelper::SelectAll(const sal_uInt16 _nObjectType)
+{
+ m_aReportWindow.SelectAll(_nObjectType);
+}
+//----------------------------------------------------------------------------
+void OScrollWindowHelper::unmarkAllObjects(OSectionView* _pSectionView)
+{
+ m_aReportWindow.unmarkAllObjects(_pSectionView);
+}
+//------------------------------------------------------------------------------
+sal_Int32 OScrollWindowHelper::getMaxMarkerWidth(sal_Bool _bWithEnd) const
+{
+ return m_aReportWindow.getMaxMarkerWidth(_bWithEnd);
+}
+//----------------------------------------------------------------------------
+void OScrollWindowHelper::showRuler(sal_Bool _bShow)
+{
+ m_aReportWindow.showRuler(_bShow);
+}
+//------------------------------------------------------------------------------
+sal_Bool OScrollWindowHelper::handleKeyEvent(const KeyEvent& _rEvent)
+{
+ return m_aReportWindow.handleKeyEvent(_rEvent);
+}
+//------------------------------------------------------------------------
+void OScrollWindowHelper::setMarked(OSectionView* _pSectionView,sal_Bool _bMark)
+{
+ m_aReportWindow.setMarked(_pSectionView,_bMark);
+}
+//------------------------------------------------------------------------
+void OScrollWindowHelper::setMarked(const uno::Reference< report::XSection>& _xSection,sal_Bool _bMark)
+{
+ m_aReportWindow.setMarked(_xSection,_bMark);
+}
+//------------------------------------------------------------------------
+void OScrollWindowHelper::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape,sal_Bool _bMark)
+{
+ m_aReportWindow.setMarked(_xShape,_bMark);
+}
+// -------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const
+{
+ return m_aReportWindow.getMarkedSection(nsa);
+}
+// -------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const
+{
+ return m_aReportWindow.getSectionWindow(_xSection);
+}
+// -------------------------------------------------------------------------
+void OScrollWindowHelper::markSection(const sal_uInt16 _nPos)
+{
+ m_aReportWindow.markSection(_nPos);
+}
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
+{
+ m_aReportWindow.fillCollapsedSections(_rCollapsedPositions);
+}
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections)
+{
+ m_aReportWindow.collapseSections(_aCollpasedSections);
+}
+//------------------------------------------------------------------------------
+long OScrollWindowHelper::Notify( NotifyEvent& rNEvt )
+{
+ const CommandEvent* pCommandEvent = rNEvt.GetCommandEvent();
+ if ( pCommandEvent &&
+ ( ((pCommandEvent->GetCommand() == COMMAND_WHEEL) ||
+ (pCommandEvent->GetCommand() == COMMAND_STARTAUTOSCROLL) ||
+ (pCommandEvent->GetCommand() == COMMAND_AUTOSCROLL))) )
+ {
+ ScrollBar* pHScrBar = NULL;
+ ScrollBar* pVScrBar = NULL;
+ if ( m_aHScroll.IsVisible() )
+ pHScrBar = &m_aHScroll;
+
+ if ( m_aVScroll.IsVisible() )
+ pVScrBar = &m_aVScroll;
+
+ if ( HandleScrollCommand( *pCommandEvent, pHScrBar, pVScrBar ) )
+ return 1L;
+ }
+ return OScrollWindowHelper_BASE::Notify(rNEvt);
+}
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects)
+{
+ m_aReportWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects);
+}
+//------------------------------------------------------------------------------
+void OScrollWindowHelper::ImplInitSettings()
+{
+ SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
+ // SetBackground( Wallpaper( COL_LIGHTRED ));
+ SetFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
+ SetTextFillColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
+}
+//-----------------------------------------------------------------------------
+void OScrollWindowHelper::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::_propertyChanged(const beans::PropertyChangeEvent& /*_rEvent*/) throw( uno::RuntimeException)
+{
+ m_aReportWindow.notifySizeChanged();
+}
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::setGridSnap(sal_Bool bOn)
+{
+ m_aReportWindow.setGridSnap(bOn);
+}
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::setDragStripes(sal_Bool bOn)
+{
+ m_aReportWindow.setDragStripes(bOn);
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 OScrollWindowHelper::getMarkedObjectCount() const
+{
+ return m_aReportWindow.getMarkedObjectCount();
+}
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::zoom(const Fraction& _aZoom)
+{
+ m_aReportWindow.zoom(_aZoom);
+ Resize();
+ Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_TRANSPARENT);
+}
+// -----------------------------------------------------------------------------
+void OScrollWindowHelper::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
+{
+ m_aReportWindow.fillControlModelSelection(_rSelection);
+}
+// -----------------------------------------------------------------------------
+sal_uInt16 OScrollWindowHelper::getZoomFactor(SvxZoomType _eType) const
+{
+ return m_aReportWindow.getZoomFactor(_eType);
+}
+//==============================================================================
+} // rptui
+//==============================================================================
diff --git a/reportdesign/source/ui/report/SectionView.cxx b/reportdesign/source/ui/report/SectionView.cxx
new file mode 100644
index 000000000000..d8bbb68b95f3
--- /dev/null
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * 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 "SectionView.hxx"
+#include "DesignView.hxx"
+#include <RptPage.hxx>
+#include <RptObject.hxx>
+#include <RptDef.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svddrgmt.hxx>
+#include <vcl/scrbar.hxx>
+#include "ReportSection.hxx"
+#include "ReportWindow.hxx"
+#include "uistrings.hrc"
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+
+namespace rptui
+{
+ using namespace ::com::sun::star;
+TYPEINIT1( OSectionView, SdrView );
+
+//----------------------------------------------------------------------------
+DBG_NAME( rpt_OSectionView )
+OSectionView::OSectionView( SdrModel* pModel, OReportSection* _pSectionWindow, OReportWindow* pEditor )
+ :SdrView( pModel, _pSectionWindow )
+ ,m_pReportWindow( pEditor )
+ ,m_pSectionWindow(_pSectionWindow)
+{
+ DBG_CTOR( rpt_OSectionView,NULL);
+ SetBufferedOutputAllowed(true);
+ SetBufferedOverlayAllowed(true);
+ SetPageBorderVisible(false);
+ SetBordVisible();
+ SetQuickTextEditMode(sal_False);
+}
+
+//----------------------------------------------------------------------------
+
+OSectionView::~OSectionView()
+{
+ DBG_DTOR( rpt_OSectionView,NULL);
+}
+
+//----------------------------------------------------------------------------
+
+void OSectionView::MarkListHasChanged()
+{
+ DBG_CHKTHIS( rpt_OSectionView,NULL);
+ SdrView::MarkListHasChanged();
+
+ if ( m_pReportWindow && m_pSectionWindow && !m_pSectionWindow->getPage()->getSpecialMode() )
+ {
+ //m_pReportWindow->unmarkAllObjects(this); // WHY
+ DlgEdHint aHint( RPTUI_HINT_SELECTIONCHANGED );
+ m_pReportWindow->getReportView()->Broadcast( aHint );
+ m_pReportWindow->getReportView()->UpdatePropertyBrowserDelayed(*this);
+ }
+}
+
+//----------------------------------------------------------------------------
+
+void OSectionView::MakeVisible( const Rectangle& rRect, Window& rWin )
+{
+ DBG_CHKTHIS( rpt_OSectionView,NULL);
+ // visible area
+ MapMode aMap( rWin.GetMapMode() );
+ const Point aOrg( aMap.GetOrigin() );
+ const Size aVisSize( rWin.GetOutputSize() );
+ const Rectangle aVisRect( Point(-aOrg.X(),-aOrg.Y()), aVisSize );
+
+ // check, if rectangle is inside visible area
+ if ( !aVisRect.IsInside( rRect ) )
+ {
+ // calculate scroll distance; the rectangle must be inside the visible area
+ sal_Int32 nScrollX = 0, nScrollY = 0;
+
+ const sal_Int32 nVisLeft = aVisRect.Left();
+ const sal_Int32 nVisRight = aVisRect.Right();
+ const sal_Int32 nVisTop = aVisRect.Top();
+ const sal_Int32 nVisBottom = aVisRect.Bottom();
+
+ // don't scroll beyond the page size
+ Size aPageSize = m_pSectionWindow->getPage()->GetSize();
+ const sal_Int32 nPageWidth = aPageSize.Width();
+ const sal_Int32 nPageHeight = aPageSize.Height();
+
+ if ( nVisRight + nScrollX > nPageWidth )
+ nScrollX = nPageWidth - nVisRight;
+
+ if ( nVisLeft + nScrollX < 0 )
+ nScrollX = -nVisLeft;
+
+ if ( nVisBottom + nScrollY > nPageHeight )
+ nScrollY = nPageHeight - nVisBottom;
+
+ if ( nVisTop + nScrollY < 0 )
+ nScrollY = -nVisTop;
+
+ // scroll window
+ rWin.Update();
+ rWin.Scroll( -nScrollX, -nScrollY );
+ aMap.SetOrigin( Point( aOrg.X() - nScrollX, aOrg.Y() - nScrollY ) );
+ rWin.SetMapMode( aMap );
+ rWin.Update();
+ rWin.Invalidate();
+
+ if ( m_pReportWindow )
+ {
+ const DlgEdHint aHint( RPTUI_HINT_WINDOWSCROLLED );
+ m_pReportWindow->getReportView()->Broadcast( aHint );
+ }
+ }
+ else
+ {
+ rWin.Invalidate(INVALIDATE_NOERASE);
+ }
+}
+//------------------------------------------------------------------------------
+void OSectionView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ DBG_CHKTHIS( rpt_OSectionView,NULL);
+ SdrView::Notify(rBC,rHint);
+ if ( rHint.ISA(SdrHint) )
+ {
+ const SdrObject* pObj = ((SdrHint&)rHint).GetObject();
+ const SdrHintKind eKind = ((SdrHint&)rHint).GetKind();
+ // check for change of selected object
+ if(HINT_OBJCHG == eKind && pObj && IsObjMarked(const_cast<SdrObject*>(pObj)))
+ AdjustMarkHdl();
+ else if ( eKind == HINT_OBJREMOVED )
+ ObjectRemovedInAliveMode(pObj);
+ }
+}
+
+//------------------------------------------------------------------------------
+void OSectionView::ObjectRemovedInAliveMode( const SdrObject* _pObject )
+{
+ DBG_CHKTHIS( rpt_OSectionView,NULL);
+ const SdrMarkList& rMarkedList = GetMarkedObjectList();
+ const sal_uLong nMark = rMarkedList.GetMarkCount();
+
+ for( sal_uLong i = 0; i < nMark; i++ )
+ {
+ SdrObject* pSdrObj = rMarkedList.GetMark(i)->GetMarkedSdrObj();
+ if (_pObject == pSdrObj)
+ {
+ SdrPageView* pPgView = GetSdrPageView();
+ BrkAction();
+ MarkObj( pSdrObj, pPgView, sal_True );
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+void OSectionView::SetMarkedToLayer( SdrLayerID _nLayerNo )
+{
+ if (AreObjectsMarked())
+ {
+ // #i11702# use SdrUndoObjectLayerChange for undo
+ // STR_UNDO_SELATTR is "Attributes" - should use a different text later
+ BegUndo( );
+
+ const SdrMarkList& rMark = GetMarkedObjectList();
+ sal_uLong nCount = rMark.GetMarkCount();
+ for (sal_uLong i=0; i<nCount; i++)
+ {
+ SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj();
+ if ( pObj->ISA(OCustomShape) )
+ {
+ AddUndo( new SdrUndoObjectLayerChange( *pObj, pObj->GetLayer(), _nLayerNo) );
+ pObj->SetLayer( _nLayerNo );
+ OObjectBase* pBaseObj = dynamic_cast<OObjectBase*>(pObj);
+ try
+ {
+ pBaseObj->getReportComponent()->setPropertyValue(PROPERTY_OPAQUE,uno::makeAny(_nLayerNo == RPT_LAYER_FRONT));
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ EndUndo();
+
+ // #84073# check mark list now instead of later in a timer
+ CheckMarked();
+ MarkListHasChanged();
+ }
+}
+// -----------------------------------------------------------------------------
+bool OSectionView::OnlyShapesMarked() const
+{
+ const SdrMarkList& rMark = GetMarkedObjectList();
+ const sal_uLong nCount = rMark.GetMarkCount();
+ if ( !nCount )
+ return false;
+ sal_uLong i=0;
+ for (; i<nCount; i++)
+ {
+ SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj();
+ if ( !pObj->ISA(OCustomShape) )
+ {
+ break;
+ }
+ } // for (sal_uLong i=0; i<nCount; i++)
+ return i == nCount;
+}
+
+bool OSectionView::IsDragResize() const
+{
+ const SdrDragMethod* pDragMethod = GetDragMethod();
+ if (pDragMethod)
+ {
+ bool bMoveOnly = pDragMethod->getMoveOnly();
+ if (bMoveOnly == false)
+ {
+ // current marked components will be resized
+ return true;
+ }
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+short OSectionView::GetLayerIdOfMarkedObjects() const
+{
+ short nRet = SHRT_MAX;
+ const SdrMarkList &rMrkList = GetMarkedObjectList();
+ for ( sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i )
+ {
+ const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
+ if ( nRet == SHRT_MAX )
+ nRet = pObj->GetLayer();
+ else if ( nRet != pObj->GetLayer() )
+ {
+ nRet = -1;
+ break;
+ }
+ }
+ if ( nRet == SHRT_MAX )
+ nRet = -1;
+ return nRet;
+}
+
+//============================================================================
+} // rptui
+//============================================================================
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
new file mode 100644
index 000000000000..2b39503b4375
--- /dev/null
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -0,0 +1,417 @@
+/*************************************************************************
+ *
+ * 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 "SectionWindow.hxx"
+#include "ReportWindow.hxx"
+#include "ReportRuler.hxx"
+#include "rptui_slotid.hrc"
+#include "ReportController.hxx"
+#include "SectionView.hxx"
+#include "RptDef.hxx"
+#include "ReportSection.hxx"
+#include "DesignView.hxx"
+#include "uistrings.hrc"
+#include "helpids.hrc"
+#include "RptResId.hrc"
+#include "StartMarker.hxx"
+#include "EndMarker.hxx"
+#include "ViewsWindow.hxx"
+
+#include <svtools/colorcfg.hxx>
+#include <boost/bind.hpp>
+#include <functional>
+#include <algorithm>
+#include <vcl/svapp.hxx>
+#include <connectivity/dbtools.hxx>
+
+namespace rptui
+{
+#define SECTION_OFFSET 3
+
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+DBG_NAME( rpt_OSectionWindow )
+OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< report::XSection >& _xSection,const ::rtl::OUString& _sColorEntry)
+: Window( _pParent,WB_DIALOGCONTROL)
+,OPropertyChangeListener(m_aMutex)
+,m_pParent(_pParent)
+,m_aStartMarker( this,_sColorEntry)
+,m_aReportSection( this,_xSection)
+,m_aSplitter(this)
+,m_aEndMarker( this,_sColorEntry)
+{
+ DBG_CTOR( rpt_OSectionWindow,NULL);
+ SetUniqueId(UID_RPT_SECTIONSWINDOW);
+ const MapMode& rMapMode = _pParent->GetMapMode();
+ SetMapMode( rMapMode );
+ ImplInitSettings();
+ // TRY
+ m_aSplitter.SetMapMode( MapMode( MAP_100TH_MM ) );
+ m_aSplitter.SetStartSplitHdl(LINK(this, OSectionWindow,StartSplitHdl));
+ m_aSplitter.SetSplitHdl(LINK(this, OSectionWindow,SplitHdl));
+ m_aSplitter.SetEndSplitHdl(LINK(this, OSectionWindow,EndSplitHdl));
+ m_aSplitter.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
+ m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,_xSection->getHeight())).Height());
+
+
+ m_aStartMarker.setCollapsedHdl(LINK(this,OSectionWindow,Collapsed));
+
+ m_aStartMarker.zoom(rMapMode.GetScaleX());
+ setZoomFactor(rMapMode.GetScaleX(),m_aReportSection);
+ setZoomFactor(rMapMode.GetScaleX(),m_aSplitter);
+ setZoomFactor(rMapMode.GetScaleX(),m_aEndMarker);
+
+ m_aSplitter.Show();
+ m_aStartMarker.Show();
+ m_aReportSection.Show();
+ m_aEndMarker.Show();
+ Show();
+
+ m_pSectionMulti = new OPropertyChangeMultiplexer(this,_xSection.get());
+ m_pSectionMulti->addProperty(PROPERTY_NAME);
+ m_pSectionMulti->addProperty(PROPERTY_HEIGHT);
+
+ beans::PropertyChangeEvent aEvent;
+ aEvent.Source = _xSection;
+ aEvent.PropertyName = PROPERTY_NAME;
+ uno::Reference< report::XGroup > xGroup(_xSection->getGroup());
+ if ( xGroup.is() )
+ {
+ m_pGroupMulti = new OPropertyChangeMultiplexer(this,xGroup.get());
+ m_pGroupMulti->addProperty(PROPERTY_EXPRESSION);
+ aEvent.Source = xGroup;
+ aEvent.PropertyName = PROPERTY_EXPRESSION;
+ }
+
+ _propertyChanged(aEvent);
+ SetPaintTransparent(sal_True);
+}
+// -----------------------------------------------------------------------------
+OSectionWindow::~OSectionWindow()
+{
+ DBG_DTOR( rpt_OSectionWindow,NULL);
+ try
+ {
+ if ( m_pSectionMulti.is() )
+ m_pSectionMulti->dispose();
+ if ( m_pGroupMulti.is() )
+ m_pGroupMulti->dispose();
+ }
+ catch (uno::Exception&)
+ {
+ }
+}
+// -----------------------------------------------------------------------------
+void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
+{
+ const uno::Reference< report::XSection > xSection(_rEvent.Source,uno::UNO_QUERY);
+ if ( xSection.is() )
+ {
+ const uno::Reference< report::XSection> xCurrentSection = m_aReportSection.getSection();
+ if ( _rEvent.PropertyName.equals(PROPERTY_HEIGHT) )
+ {
+ m_pParent->getView()->SetUpdateMode(sal_False);
+ Resize();
+ m_pParent->getView()->notifySizeChanged();
+ m_pParent->resize(*this);
+ m_pParent->getView()->SetUpdateMode(sal_True);
+ m_aStartMarker.Invalidate(INVALIDATE_NOERASE);
+ m_aEndMarker.Invalidate(INVALIDATE_NOERASE);
+ m_aReportSection.Invalidate(/*INVALIDATE_NOERASE*/);
+ getViewsWindow()->getView()->getReportView()->getController().resetZoomType();
+ // Invalidate(INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
+ // m_pParent->Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE|INVALIDATE_TRANSPARENT);
+ // m_pParent->Invalidate(/*INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE |*/ INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
+ }
+ else if ( _rEvent.PropertyName.equals(PROPERTY_NAME) && !xSection->getGroup().is() )
+ {
+ uno::Reference< report::XReportDefinition > xReport = xSection->getReportDefinition();
+ if ( setReportSectionTitle(xReport,RID_STR_REPORT_HEADER,::std::mem_fun(&OReportHelper::getReportHeader),::std::mem_fun(&OReportHelper::getReportHeaderOn))
+ || setReportSectionTitle(xReport,RID_STR_REPORT_FOOTER,::std::mem_fun(&OReportHelper::getReportFooter),::std::mem_fun(&OReportHelper::getReportFooterOn))
+ || setReportSectionTitle(xReport,RID_STR_PAGE_HEADER,::std::mem_fun(&OReportHelper::getPageHeader),::std::mem_fun(&OReportHelper::getPageHeaderOn))
+ || setReportSectionTitle(xReport,RID_STR_PAGE_FOOTER,::std::mem_fun(&OReportHelper::getPageFooter),::std::mem_fun(&OReportHelper::getPageFooterOn)) )
+ m_aStartMarker.Invalidate(INVALIDATE_NOERASE);
+ else
+ {
+ String sTitle = String(ModuleRes(RID_STR_DETAIL));
+ m_aStartMarker.setTitle(sTitle);
+ m_aStartMarker.Invalidate(INVALIDATE_CHILDREN);
+ }
+ }
+ } // if ( xSection.is() )
+ else if ( _rEvent.PropertyName.equals(PROPERTY_EXPRESSION) )
+ {
+ uno::Reference< report::XGroup > xGroup(_rEvent.Source,uno::UNO_QUERY);
+ if ( xGroup.is() )
+ {
+ if ( !setGroupSectionTitle(xGroup,RID_STR_HEADER,::std::mem_fun(&OGroupHelper::getHeader),::std::mem_fun(&OGroupHelper::getHeaderOn)) )
+ setGroupSectionTitle(xGroup,RID_STR_FOOTER,::std::mem_fun(&OGroupHelper::getFooter),::std::mem_fun(&OGroupHelper::getFooterOn));
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+bool OSectionWindow::setReportSectionTitle(const uno::Reference< report::XReportDefinition>& _xReport,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OReportHelper> _pGetSection,::std::mem_fun_t<sal_Bool,OReportHelper> _pIsSectionOn)
+{
+ OReportHelper aReportHelper(_xReport);
+ const bool bRet = _pIsSectionOn(&aReportHelper) && _pGetSection(&aReportHelper) == m_aReportSection.getSection();
+ if ( bRet )
+ {
+ String sTitle = String(ModuleRes(_nResId));
+ m_aStartMarker.setTitle(sTitle);
+ m_aStartMarker.Invalidate(INVALIDATE_CHILDREN);
+ } // if ( bRet )
+ return bRet;
+}
+// -----------------------------------------------------------------------------
+bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>& _xGroup,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OGroupHelper> _pGetSection,::std::mem_fun_t<sal_Bool,OGroupHelper> _pIsSectionOn)
+{
+ OGroupHelper aGroupHelper(_xGroup);
+ const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection.getSection() ;
+ if ( bRet )
+ {
+ ::rtl::OUString sExpression = _xGroup->getExpression();
+ ::rtl::OUString sLabel = getViewsWindow()->getView()->getReportView()->getController().getColumnLabel_throw(sExpression);
+ if ( sLabel.getLength() )
+ {
+ sExpression = sLabel;
+ }
+
+ String sTitle = String(ModuleRes(_nResId));
+ sTitle.SearchAndReplace('#',sExpression);
+ m_aStartMarker.setTitle(sTitle);
+ m_aStartMarker.Invalidate(INVALIDATE_CHILDREN);
+ } // if ( _pIsSectionOn(&aGroupHelper) )
+ return bRet;
+}
+//------------------------------------------------------------------------------
+void OSectionWindow::ImplInitSettings()
+{
+ SetBackground( );
+ //SetBackground( Wallpaper( COL_RED ));
+}
+//-----------------------------------------------------------------------------
+void OSectionWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+//------------------------------------------------------------------------------
+void OSectionWindow::Resize()
+{
+ Window::Resize();
+
+ Size aOutputSize = GetOutputSizePixel();
+ Fraction aEndWidth(long(REPORT_ENDMARKER_WIDTH));
+ aEndWidth *= GetMapMode().GetScaleX();
+
+ const Point aThumbPos = m_pParent->getView()->getThumbPos();
+ aOutputSize.Width() -= aThumbPos.X();
+ aOutputSize.Height() -= m_aSplitter.GetSizePixel().Height();
+
+ if ( m_aStartMarker.isCollapsed() )
+ {
+ Point aPos(0,0);
+ m_aStartMarker.SetPosSizePixel(aPos,aOutputSize);
+ }
+ else
+ {
+ const bool bShowEndMarker = m_pParent->getView()->GetTotalWidth() <= (aThumbPos.X() + aOutputSize.Width() );
+
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ aStartWidth *= GetMapMode().GetScaleX();
+
+ // set start marker
+ m_aStartMarker.SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height()));
+
+ // set report section
+ const uno::Reference< report::XSection> xSection = m_aReportSection.getSection();
+ Size aSectionSize = LogicToPixel( Size( 0,xSection->getHeight() ) );
+ Point aReportPos(aStartWidth,0);
+ aSectionSize.Width() = aOutputSize.Width() - (long)aStartWidth;
+ if ( bShowEndMarker )
+ aSectionSize.Width() -= (long)aEndWidth;
+
+ m_aReportSection.SetPosSizePixel(aReportPos,aSectionSize);
+
+ // set splitter
+ aReportPos.Y() += aSectionSize.Height();
+ m_aSplitter.SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter.GetSizePixel().Height()));
+ aSectionSize.Height() = (long)(1000 * (double)GetMapMode().GetScaleY());
+ m_aSplitter.SetDragRectPixel( Rectangle(Point(aStartWidth,0),aSectionSize));
+
+ // set end marker
+ aReportPos.X() += aSectionSize.Width();
+ aReportPos.Y() = 0;
+ m_aEndMarker.Show(bShowEndMarker);
+ m_aEndMarker.SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height()));
+ }
+}
+// -----------------------------------------------------------------------------
+void OSectionWindow::setCollapsed(sal_Bool _bCollapsed)
+{
+ if ( m_aStartMarker.isCollapsed() != _bCollapsed )
+ {
+ m_aStartMarker.setCollapsed(_bCollapsed);
+ }
+}
+//-----------------------------------------------------------------------------
+void OSectionWindow::showProperties()
+{
+ m_pParent->getView()->showProperties( m_aReportSection.getSection().get() );
+}
+//-----------------------------------------------------------------------------
+void OSectionWindow::setMarked(sal_Bool _bMark)
+{
+ m_aStartMarker.setMarked(_bMark);
+ m_aEndMarker.setMarked(_bMark);
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker )
+{
+ if ( _pMarker )
+ {
+ sal_Bool bShow = !_pMarker->isCollapsed();
+ m_aReportSection.Show(bShow);
+ m_aEndMarker.Show(bShow);
+ m_aSplitter.Show(bShow);
+
+ m_pParent->resize(*this);
+ Resize();
+ // TRY
+ // m_pParent->Invalidate(INVALIDATE_TRANSPARENT | INVALIDATE_NOCHILDREN);
+ Invalidate();
+ }
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+void OSectionWindow::zoom(const Fraction& _aZoom)
+{
+ setZoomFactor(_aZoom,*this);
+ m_aStartMarker.zoom(_aZoom);
+
+ setZoomFactor(_aZoom,m_aReportSection);
+ setZoomFactor(_aZoom,m_aSplitter);
+ setZoomFactor(_aZoom,m_aEndMarker);
+ //Resize();
+ Invalidate(/*INVALIDATE_UPDATE |*/ /* | INVALIDATE_TRANSPARENT *//*INVALIDATE_NOCHILDREN*/);
+}
+//-----------------------------------------------------------------------------
+IMPL_LINK( OSectionWindow, StartSplitHdl, Splitter*, )
+{
+ const String sUndoAction( ModuleRes( RID_STR_UNDO_CHANGE_SIZE ) );
+ getViewsWindow()->getView()->getReportView()->getController().getUndoManager().EnterListAction( sUndoAction, String() );
+ return 0L;
+}
+//------------------------------------------------------------------------------
+IMPL_LINK( OSectionWindow, EndSplitHdl, Splitter*, )
+{
+ getViewsWindow()->getView()->getReportView()->getController().getUndoManager().LeaveListAction();
+ return 0L;
+}
+//-----------------------------------------------------------------------------
+IMPL_LINK( OSectionWindow, SplitHdl, Splitter*, _pSplitter )
+{
+ if ( !getViewsWindow()->getView()->getReportView()->getController().isEditable() )
+ {
+ return 0L;
+ }
+
+ sal_Int32 nSplitPos = _pSplitter->GetSplitPosPixel();
+ const Point aPos = _pSplitter->GetPosPixel();
+
+
+ const uno::Reference< report::XSection> xSection = m_aReportSection.getSection();
+ nSplitPos = m_aSplitter.PixelToLogic(Size(0,nSplitPos)).Height();
+ // nSplitPos = xSection->getHeight() + m_aSplitter.PixelToLogic(Size(0,nSplitPos - aPos.Y() )).Height();
+
+ const sal_Int32 nCount = xSection->getCount();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ uno::Reference<report::XReportComponent> xReportComponent(xSection->getByIndex(i),uno::UNO_QUERY);
+ if ( xReportComponent.is() /*&& nSplitPos < (xReportComponent->getPositionY() + xReportComponent->getHeight())*/ )
+ {
+ nSplitPos = ::std::max(nSplitPos,xReportComponent->getPositionY() + xReportComponent->getHeight());
+ }
+ } // for (sal_Int32 i = 0; i < nCount; ++i)
+
+ if ( nSplitPos < 0 )
+ nSplitPos = 0;
+
+ xSection->setHeight(nSplitPos);
+ m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,nSplitPos)).Height());
+
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+void lcl_scroll(Window& _rWindow,const Point& _aDelta)
+{
+ _rWindow.Scroll(-_aDelta.X(),-_aDelta.Y()/*,SCROLL_CHILDREN*//*|SCROLL_CLIP*/);
+ _rWindow.Invalidate(INVALIDATE_TRANSPARENT);
+}
+// -----------------------------------------------------------------------------
+void lcl_setOrigin(Window& _rWindow,long _nX, long _nY)
+{
+ MapMode aMap = _rWindow.GetMapMode();
+ aMap.SetOrigin( Point(- _nX, - _nY));
+ _rWindow.SetMapMode( aMap );
+}
+//----------------------------------------------------------------------------
+void OSectionWindow::scrollChildren(long _nX)
+{
+ const Point aDelta( _nX,0 );
+
+ MapMode aMapMode( m_aReportSection.GetMapMode() );
+ const Point aOld = aMapMode.GetOrigin();
+ lcl_setOrigin(m_aReportSection,aDelta.X(), 0);
+
+ aMapMode = m_aReportSection.GetMapMode();
+ const Point aNew = aMapMode.GetOrigin();
+ const Point aDiff = aOld - aNew;
+ {
+ //OWindowPositionCorrector aCorrector(&m_aReportSection,-aDelta.Width(),0);
+ lcl_scroll(m_aReportSection,aDiff);
+ }
+
+ //lcl_setOrigin(m_aEndMarker,_nDeltaX, 0);
+ lcl_scroll(m_aEndMarker,m_aEndMarker.PixelToLogic(Point(_nX,0)));
+
+ lcl_setOrigin(m_aSplitter,_nX, 0);
+ lcl_scroll(m_aSplitter,aDiff);
+
+ Resize();
+}
+//==============================================================================
+} // rptui
+//==============================================================================
+
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
new file mode 100644
index 000000000000..cf4be7f17161
--- /dev/null
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -0,0 +1,324 @@
+/*************************************************************************
+ *
+ * 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 "StartMarker.hxx"
+#include <vcl/image.hxx>
+#include <vcl/svapp.hxx>
+#include "RptResId.hrc"
+#include "ModuleHelper.hxx"
+#include "ColorChanger.hxx"
+#include "ReportDefines.hxx"
+#include "SectionWindow.hxx"
+#include "helpids.hrc"
+#include <vcl/help.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/lineinfo.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/syslocale.hxx>
+#include <svl/smplhint.hxx>
+
+#define CORNER_SPACE 5
+
+//=====================================================================
+namespace rptui
+{
+//=====================================================================
+
+Image* OStartMarker::s_pDefCollapsed = NULL;
+Image* OStartMarker::s_pDefExpanded = NULL;
+Image* OStartMarker::s_pDefCollapsedHC = NULL;
+Image* OStartMarker::s_pDefExpandedHC = NULL;
+oslInterlockedCount OStartMarker::s_nImageRefCount = 0;
+
+DBG_NAME( rpt_OStartMarker )
+// -----------------------------------------------------------------------------
+OStartMarker::OStartMarker(OSectionWindow* _pParent,const ::rtl::OUString& _sColorEntry)
+: OColorListener(_pParent,_sColorEntry)
+,m_aVRuler(this,WB_VERT)
+,m_aText(this,WB_HYPHENATION)
+,m_aImage(this,WB_LEFT|WB_TOP|WB_SCALE)
+,m_pParent(_pParent)
+,m_bShowRuler(sal_True)
+{
+ DBG_CTOR( rpt_OStartMarker,NULL);
+ SetUniqueId(HID_RPT_STARTMARKER);
+
+ osl_incrementInterlockedCount(&s_nImageRefCount);
+ initDefaultNodeImages();
+ ImplInitSettings();
+ m_aText.SetHelpId(HID_RPT_START_TITLE);
+ m_aImage.SetHelpId(HID_RPT_START_IMAGE);
+ m_aText.Show();
+ m_aImage.Show();
+ m_aVRuler.Show();
+ m_aVRuler.Activate();
+ m_aVRuler.SetPagePos(0);
+ m_aVRuler.SetBorders();
+ m_aVRuler.SetIndents();
+ m_aVRuler.SetMargin1();
+ m_aVRuler.SetMargin2();
+ const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
+ m_aVRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
+ SetPaintTransparent(sal_True);
+}
+// -----------------------------------------------------------------------------
+OStartMarker::~OStartMarker()
+{
+ DBG_DTOR( rpt_OStartMarker,NULL);
+ if ( osl_decrementInterlockedCount(&s_nImageRefCount) == 0 )
+ {
+ DELETEZ(s_pDefCollapsed);
+ DELETEZ(s_pDefExpanded);
+ DELETEZ(s_pDefCollapsedHC);
+ DELETEZ(s_pDefExpandedHC);
+ } // if ( osl_decrementInterlockedCount(&s_nImageRefCount) == 0 )
+}
+// -----------------------------------------------------------------------------
+sal_Int32 OStartMarker::getMinHeight() const
+{
+ Fraction aExtraWidth(long(2*REPORT_EXTRA_SPACE));
+ aExtraWidth *= GetMapMode().GetScaleX();
+ return LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() + (long)aExtraWidth;
+}
+// -----------------------------------------------------------------------------
+void OStartMarker::Paint( const Rectangle& rRect )
+{
+ Window::Paint( rRect );
+ //SetUpdateMode(sal_False);
+ Size aSize = GetOutputSizePixel();
+ long nSize = aSize.Width();
+ const long nCornerWidth = long(CORNER_SPACE * (double)GetMapMode().GetScaleX());
+
+ if ( !isCollapsed() )
+ {
+ const long nVRulerWidth = m_aVRuler.GetSizePixel().Width();
+ nSize = aSize.Width() - nVRulerWidth/* - m_nCornerSize*/;
+ SetClipRegion(Region(PixelToLogic(Rectangle(Point(),Size( nSize,aSize.Height())))));
+ aSize.Width() += nCornerWidth;
+ } // if ( !isCollapsed() )
+ else
+ SetClipRegion();
+
+ const Point aGcc3WorkaroundTemporary;
+ Rectangle aWholeRect(aGcc3WorkaroundTemporary,aSize);
+ {
+ const ColorChanger aColors( this, m_nTextBoundaries, m_nColor );
+ PolyPolygon aPoly;
+ aPoly.Insert(Polygon(aWholeRect,nCornerWidth,nCornerWidth));
+
+ Color aStartColor(m_nColor);
+ aStartColor.IncreaseLuminance(10);
+ sal_uInt16 nHue = 0;
+ sal_uInt16 nSat = 0;
+ sal_uInt16 nBri = 0;
+ aStartColor.RGBtoHSB(nHue, nSat, nBri);
+ nSat += 40;
+ Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri));
+ Gradient aGradient(GRADIENT_LINEAR,aStartColor,aEndColor);
+ aGradient.SetSteps(static_cast<sal_uInt16>(aSize.Height()));
+
+ DrawGradient(PixelToLogic(aPoly) ,aGradient);
+ }
+ if ( m_bMarked )
+ {
+ const long nCornerHeight = long(CORNER_SPACE * (double)GetMapMode().GetScaleY());
+ Rectangle aRect( Point(nCornerWidth,nCornerHeight),
+ Size(aSize.Width() - nCornerWidth - nCornerWidth,aSize.Height() - nCornerHeight - nCornerHeight));
+ ColorChanger aColors( this, COL_WHITE, COL_WHITE );
+ DrawPolyLine(Polygon(PixelToLogic(aRect)),LineInfo(LINE_SOLID,2 ));
+ }
+}
+// -----------------------------------------------------------------------------
+void OStartMarker::setColor()
+{
+ const Color aColor(m_nColor);
+ Color aTextColor = GetTextColor();
+ if ( aColor.GetLuminance() < 128 )
+ aTextColor = COL_WHITE;
+ m_aText.SetTextColor(aTextColor);
+ m_aText.SetLineColor(m_nColor);
+}
+// -----------------------------------------------------------------------
+void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( !rMEvt.IsLeft() )
+ return;
+
+ Point aPos( rMEvt.GetPosPixel());
+
+ const Size aOutputSize = GetOutputSizePixel();
+ if( aPos.X() > aOutputSize.Width() || aPos.Y() > aOutputSize.Height() )
+ return;
+ Rectangle aRect(m_aImage.GetPosPixel(),m_aImage.GetSizePixel());
+ if ( rMEvt.GetClicks() == 2 || aRect.IsInside( aPos ) )
+ {
+ m_bCollapsed = !m_bCollapsed;
+
+ changeImage();
+
+ m_aVRuler.Show(!m_bCollapsed && m_bShowRuler);
+ if ( m_aCollapsedLink.IsSet() )
+ m_aCollapsedLink.Call(this);
+ }
+
+ m_pParent->showProperties();
+}
+// -----------------------------------------------------------------------------
+void OStartMarker::changeImage()
+{
+ Image* pImage = NULL;
+ if ( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ pImage = m_bCollapsed ? s_pDefCollapsedHC : s_pDefExpandedHC;
+ else
+ pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded;
+ m_aImage.SetImage(*pImage);
+}
+// -----------------------------------------------------------------------
+void OStartMarker::initDefaultNodeImages()
+{
+ if ( !s_pDefCollapsed )
+ {
+ s_pDefCollapsed = new Image( ModuleRes( RID_IMG_TREENODE_COLLAPSED ) );
+ s_pDefCollapsedHC = new Image( ModuleRes( RID_IMG_TREENODE_COLLAPSED_HC ) );
+ s_pDefExpanded = new Image( ModuleRes( RID_IMG_TREENODE_EXPANDED ) );
+ s_pDefExpandedHC = new Image( ModuleRes( RID_IMG_TREENODE_EXPANDED_HC ) );
+ }
+
+ Image* pImage = NULL;
+ if ( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ pImage = m_bCollapsed ? s_pDefCollapsedHC : s_pDefExpandedHC;
+ }
+ else
+ {
+ pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded;
+ }
+ m_aImage.SetImage(*pImage);
+ m_aImage.SetMouseTransparent(sal_True);
+ m_aImage.SetBackground();
+ m_aText.SetBackground();
+ m_aText.SetMouseTransparent(sal_True);
+}
+// -----------------------------------------------------------------------
+void OStartMarker::ImplInitSettings()
+{
+ // SetBackground( Wallpaper( COL_YELLOW ));
+ SetBackground( );
+ SetFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
+ setColor();
+}
+//------------------------------------------------------------------------------
+void OStartMarker::Resize()
+{
+ const Size aOutputSize( GetOutputSizePixel() );
+ const long nOutputWidth = aOutputSize.Width();
+ const long nOutputHeight = aOutputSize.Height();
+
+ const long nVRulerWidth = m_aVRuler.GetSizePixel().Width();
+ const Point aRulerPos(nOutputWidth - nVRulerWidth,0);
+ m_aVRuler.SetPosSizePixel(aRulerPos,Size(nVRulerWidth,nOutputHeight));
+
+ Size aImageSize = m_aImage.GetImage().GetSizePixel();
+ const MapMode& rMapMode = GetMapMode();
+ aImageSize.Width() = long(aImageSize.Width() * (double)rMapMode.GetScaleX());
+ aImageSize.Height() = long(aImageSize.Height() * (double)rMapMode.GetScaleY());
+
+ Fraction aExtraWidth(long(REPORT_EXTRA_SPACE));
+ aExtraWidth *= rMapMode.GetScaleX();
+
+ Point aPos(aImageSize.Width() + (long)(aExtraWidth + aExtraWidth), aExtraWidth);
+ const long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText.GetTextHeight())).Height());
+ m_aText.SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight));
+
+ aPos.X() = aExtraWidth;
+ aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ;
+ m_aImage.SetPosSizePixel(aPos,aImageSize);
+}
+// -----------------------------------------------------------------------------
+void OStartMarker::setTitle(const String& _sTitle)
+{
+ m_aText.SetText(_sTitle);
+}
+// -----------------------------------------------------------------------------
+void OStartMarker::Notify(SfxBroadcaster & rBc, SfxHint const & rHint)
+{
+ OColorListener::Notify(rBc, rHint);
+ if (rHint.ISA(SfxSimpleHint)
+ && (static_cast< SfxSimpleHint const & >(rHint).GetId()
+ == SFX_HINT_COLORS_CHANGED))
+ {
+ setColor();
+ //m_aText.Invalidate();
+ Invalidate(INVALIDATE_CHILDREN);
+ }
+}
+//----------------------------------------------------------------------------
+void OStartMarker::showRuler(sal_Bool _bShow)
+{
+ m_bShowRuler = _bShow;
+ m_aVRuler.Show(!m_bCollapsed && m_bShowRuler);
+}
+//------------------------------------------------------------------------------
+void OStartMarker::RequestHelp( const HelpEvent& rHEvt )
+{
+ if( m_aText.GetText().Len())
+ {
+ // Hilfe anzeigen
+ Rectangle aItemRect(rHEvt.GetMousePosPixel(),Size(GetSizePixel().Width(),getMinHeight()));
+ //aItemRect = LogicToPixel( aItemRect );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ if( rHEvt.GetMode() == HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, m_aText.GetText());
+ else
+ Help::ShowQuickHelp( this, aItemRect, m_aText.GetText() );
+ }
+}
+// -----------------------------------------------------------------------------
+void OStartMarker::setCollapsed(sal_Bool _bCollapsed)
+{
+ OColorListener::setCollapsed(_bCollapsed);
+ showRuler(_bCollapsed);
+ changeImage();
+}
+// -----------------------------------------------------------------------
+void OStartMarker::zoom(const Fraction& _aZoom)
+{
+ setZoomFactor(_aZoom,*this);
+ m_aVRuler.SetZoom(_aZoom);
+ setZoomFactor(_aZoom,m_aText);
+ Resize();
+ Invalidate();
+}
+// -----------------------------------------------------------------------
+// =======================================================================
+}
+// =======================================================================
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
new file mode 100644
index 000000000000..4271f52ec6a8
--- /dev/null
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -0,0 +1,1869 @@
+/*************************************************************************
+ *
+ * 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 "ViewsWindow.hxx"
+#include "ScrollHelper.hxx"
+#include "UndoActions.hxx"
+#include "ReportWindow.hxx"
+#include "DesignView.hxx"
+#include <svtools/colorcfg.hxx>
+#include "ReportController.hxx"
+#include "UITools.hxx"
+#include "RptDef.hxx"
+#include "RptResId.hrc"
+#include "SectionView.hxx"
+#include "ReportSection.hxx"
+#include "uistrings.hrc"
+#include "rptui_slotid.hrc"
+#include "dlgedclip.hxx"
+#include "ColorChanger.hxx"
+#include "RptObject.hxx"
+#include "RptObject.hxx"
+#include "ModuleHelper.hxx"
+#include "EndMarker.hxx"
+#include <svx/svdpagv.hxx>
+#include <svx/unoshape.hxx>
+#include <vcl/svapp.hxx>
+#include <boost/bind.hpp>
+
+#include "helpids.hrc"
+#include <svx/svdundo.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <algorithm>
+#include <numeric>
+
+namespace rptui
+{
+#define DEFAUL_MOVE_SIZE 100
+
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+// -----------------------------------------------------------------------------
+bool lcl_getNewRectSize(const Rectangle& _aObjRect,long& _nXMov, long& _nYMov,SdrObject* _pObj,SdrView* _pView,sal_Int32 _nControlModification, bool _bBoundRects)
+{
+ bool bMoveAllowed = _nXMov != 0 || _nYMov != 0;
+ if ( bMoveAllowed )
+ {
+ Rectangle aNewRect = _aObjRect;
+ SdrObject* pOverlappedObj = NULL;
+ do
+ {
+ aNewRect = _aObjRect;
+ switch(_nControlModification)
+ {
+ case ControlModification::HEIGHT_GREATEST:
+ case ControlModification::WIDTH_GREATEST:
+ aNewRect.setWidth(_nXMov);
+ aNewRect.setHeight(_nYMov);
+ break;
+ default:
+ aNewRect.Move(_nXMov,_nYMov);
+ break;
+ }
+ if ( dynamic_cast<OUnoObject*>(_pObj) )
+ {
+ pOverlappedObj = isOver(aNewRect,*_pObj->GetPage(),*_pView,true,_pObj);
+ if ( pOverlappedObj && _pObj != pOverlappedObj )
+ {
+ Rectangle aOverlappingRect = (_bBoundRects ? pOverlappedObj->GetCurrentBoundRect() : pOverlappedObj->GetSnapRect());
+ sal_Int32 nXTemp = _nXMov;
+ sal_Int32 nYTemp = _nYMov;
+ switch(_nControlModification)
+ {
+ case ControlModification::LEFT:
+ nXTemp += aOverlappingRect.Right() - aNewRect.Left();
+ bMoveAllowed = _nXMov != nXTemp;
+ break;
+ case ControlModification::RIGHT:
+ nXTemp += aOverlappingRect.Left() - aNewRect.Right();
+ bMoveAllowed = _nXMov != nXTemp;
+ break;
+ case ControlModification::TOP:
+ nYTemp += aOverlappingRect.Bottom() - aNewRect.Top();
+ bMoveAllowed = _nYMov != nYTemp;
+ break;
+ case ControlModification::BOTTOM:
+ nYTemp += aOverlappingRect.Top() - aNewRect.Bottom();
+ bMoveAllowed = _nYMov != nYTemp;
+ break;
+ case ControlModification::CENTER_HORIZONTAL:
+ if ( _aObjRect.Left() < aOverlappingRect.Left() )
+ nXTemp += aOverlappingRect.Left() - aNewRect.Left() - aNewRect.getWidth();
+ else
+ nXTemp += aOverlappingRect.Right() - aNewRect.Left();
+ bMoveAllowed = _nXMov != nXTemp;
+ break;
+ case ControlModification::CENTER_VERTICAL:
+ if ( _aObjRect.Top() < aOverlappingRect.Top() )
+ nYTemp += aOverlappingRect.Top() - aNewRect.Top() - aNewRect.getHeight();
+ else
+ nYTemp += aOverlappingRect.Bottom() - aNewRect.Top();
+ bMoveAllowed = _nYMov != nYTemp;
+ break;
+ case ControlModification::HEIGHT_GREATEST:
+ case ControlModification::WIDTH_GREATEST:
+ {
+ Rectangle aIntersectionRect = aNewRect.GetIntersection(aOverlappingRect);
+ if ( !aIntersectionRect.IsEmpty() )
+ {
+ if ( _nControlModification == ControlModification::WIDTH_GREATEST )
+ {
+ if ( aNewRect.Left() < aIntersectionRect.Left() )
+ {
+ aNewRect.Right() = aIntersectionRect.Left();
+ }
+ else if ( aNewRect.Left() < aIntersectionRect.Right() )
+ {
+ aNewRect.Left() = aIntersectionRect.Right();
+ }
+ }
+ else if ( _nControlModification == ControlModification::HEIGHT_GREATEST )
+ {
+ if ( aNewRect.Top() < aIntersectionRect.Top() )
+ {
+ aNewRect.Bottom() = aIntersectionRect.Top();
+ }
+ else if ( aNewRect.Top() < aIntersectionRect.Bottom() )
+ {
+ aNewRect.Top() = aIntersectionRect.Bottom();
+ }
+ }
+ nYTemp = aNewRect.getHeight();
+ bMoveAllowed = _nYMov != nYTemp;
+ nXTemp = aNewRect.getWidth();
+ bMoveAllowed = bMoveAllowed && _nXMov != nXTemp;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ _nXMov = nXTemp;
+ _nYMov = nYTemp;
+ }
+ else
+ pOverlappedObj = NULL;
+ }
+ }
+ while ( pOverlappedObj && bMoveAllowed );
+ }
+ return bMoveAllowed;
+}
+// -----------------------------------------------------------------------------
+
+DBG_NAME( rpt_OViewsWindow );
+OViewsWindow::OViewsWindow( OReportWindow* _pReportWindow)
+: Window( _pReportWindow,WB_DIALOGCONTROL)
+,m_pParent(_pReportWindow)
+,m_bInUnmark(sal_False)
+{
+ DBG_CTOR( rpt_OViewsWindow,NULL);
+ SetPaintTransparent(sal_True);
+ SetUniqueId(UID_RPT_VIEWSWINDOW);
+ SetMapMode( MapMode( MAP_100TH_MM ) );
+ m_aColorConfig.AddListener(this);
+ ImplInitSettings();
+}
+// -----------------------------------------------------------------------------
+OViewsWindow::~OViewsWindow()
+{
+ m_aColorConfig.RemoveListener(this);
+ m_aSections.clear();
+
+ DBG_DTOR( rpt_OViewsWindow,NULL);
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::initialize()
+{
+
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet)
+{
+ const uno::Reference< report::XSection> xSection = _rSectionWindow.getReportSection().getSection();
+
+ Size aSectionSize = _rSectionWindow.LogicToPixel( Size( 0,xSection->getHeight() ) );
+ aSectionSize.Width() = getView()->GetTotalWidth();
+
+ const sal_Int32 nMinHeight = _rSectionWindow.getStartMarker().getMinHeight();
+ if ( _rSectionWindow.getStartMarker().isCollapsed() || nMinHeight > aSectionSize.Height() )
+ {
+ aSectionSize.Height() = nMinHeight;
+ }
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ aSectionSize.Height() += (long)(rSettings.GetSplitSize() * (double)_rSectionWindow.GetMapMode().GetScaleY());
+
+ if ( _bSet )
+ _rSectionWindow.SetPosSizePixel(_rStartPoint,aSectionSize);
+
+ _rStartPoint.Y() += aSectionSize.Height();
+}
+
+// -----------------------------------------------------------------------------
+void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)
+{
+ bool bSet = false;
+ Point aStartPoint;
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (;aIter != aEnd ; ++aIter)
+ {
+ const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter);
+ if ( pSectionWindow.get() == &_rSectionWindow )
+ {
+ aStartPoint = pSectionWindow->GetPosPixel();
+ bSet = true;
+ } // if ( pSectionWindow.get() == &_rSectionWindow )
+
+ if ( bSet )
+ {
+ impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,bSet);
+ pSectionWindow->Invalidate(INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
+ pSectionWindow->getStartMarker().Invalidate(INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT );
+ }
+ } // for (;aIter != aEnd ; ++aIter,++nPos)
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ aStartWidth *= GetMapMode().GetScaleX();
+ Size aOut = GetOutputSizePixel();
+ aOut.Width() = aStartWidth;
+ aOut = PixelToLogic(aOut);
+ m_pParent->notifySizeChanged();
+
+ Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
+ Invalidate(aRect,INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
+}
+//------------------------------------------------------------------------------
+void OViewsWindow::Resize()
+{
+ Window::Resize();
+ if ( !m_aSections.empty() )
+ {
+ const Point aOffset(m_pParent->getThumbPos());
+ Point aStartPoint(0,-aOffset.Y());
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (sal_uInt16 nPos=0;aIter != aEnd ; ++aIter,++nPos)
+ {
+ const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter);
+ impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,true);
+ } // for (;aIter != aEnd ; ++aIter)
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::Paint( const Rectangle& rRect )
+{
+ Window::Paint( rRect );
+
+ Size aOut = GetOutputSizePixel();
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ aStartWidth *= GetMapMode().GetScaleX();
+
+ aOut.Width() -= (long)aStartWidth;
+ aOut = PixelToLogic(aOut);
+
+ Rectangle aRect(PixelToLogic(Point(aStartWidth,0)),aOut);
+ Wallpaper aWall( m_aColorConfig.GetColorValue(::svtools::APPBACKGROUND).nColor );
+ DrawWallpaper(aRect,aWall);
+}
+//------------------------------------------------------------------------------
+void OViewsWindow::ImplInitSettings()
+{
+ // SetBackground( Wallpaper( COL_LIGHTBLUE ));
+ SetBackground( );
+ SetFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
+ SetTextFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
+}
+//-----------------------------------------------------------------------------
+void OViewsWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+//----------------------------------------------------------------------------
+void OViewsWindow::addSection(const uno::Reference< report::XSection >& _xSection,const ::rtl::OUString& _sColorEntry,sal_uInt16 _nPosition)
+{
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow( new OSectionWindow(this,_xSection,_sColorEntry) );
+ m_aSections.insert(getIteratorAtPos(_nPosition) , TSectionsMap::value_type(pSectionWindow));
+ m_pParent->setMarked(&pSectionWindow->getReportSection().getSectionView(),m_aSections.size() == 1);
+
+ Resize();
+}
+//----------------------------------------------------------------------------
+void OViewsWindow::removeSection(sal_uInt16 _nPosition)
+{
+ if ( _nPosition < m_aSections.size() )
+ {
+ TSectionsMap::iterator aPos = getIteratorAtPos(_nPosition);
+ TSectionsMap::iterator aNew = getIteratorAtPos(_nPosition == 0 ? _nPosition+1: _nPosition - 1);
+
+ m_pParent->getReportView()->UpdatePropertyBrowserDelayed((*aNew)->getReportSection().getSectionView());
+
+ m_aSections.erase(aPos);
+ Resize();
+ } // if ( _nPosition < m_aSections.size() )
+}
+//------------------------------------------------------------------------------
+void OViewsWindow::toggleGrid(sal_Bool _bVisible)
+{
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::bind(&OReportSection::SetGridVisible,_1,_bVisible),TReportPairHelper()));
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::bind(&OReportSection::Window::Invalidate,_1,INVALIDATE_NOERASE),TReportPairHelper()));
+}
+//------------------------------------------------------------------------------
+sal_Int32 OViewsWindow::getTotalHeight() const
+{
+ sal_Int32 nHeight = 0;
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ for (;aIter != aEnd ; ++aIter)
+ {
+ nHeight += (*aIter)->GetSizePixel().Height();
+ }
+ return nHeight;
+}
+//----------------------------------------------------------------------------
+sal_uInt16 OViewsWindow::getSectionCount() const
+{
+ return static_cast<sal_uInt16>(m_aSections.size());
+}
+//----------------------------------------------------------------------------
+void OViewsWindow::SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType )
+{
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (;aIter != aEnd ; ++aIter)
+ (*aIter)->getReportSection().getSectionView().SetCurrentObj( eObj, ReportInventor );
+
+ m_sShapeType = _sShapeType;
+}
+//----------------------------------------------------------------------------
+rtl::OUString OViewsWindow::GetInsertObjString() const
+{
+ return m_sShapeType;
+}
+
+//------------------------------------------------------------------------------
+void OViewsWindow::SetMode( DlgEdMode eNewMode )
+{
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::bind(&OReportSection::SetMode,_1,eNewMode),TReportPairHelper()));
+}
+//----------------------------------------------------------------------------
+sal_Bool OViewsWindow::HasSelection() const
+{
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ for (;aIter != aEnd && !(*aIter)->getReportSection().getSectionView().AreObjectsMarked(); ++aIter)
+ ;
+ return aIter != aEnd;
+}
+//----------------------------------------------------------------------------
+void OViewsWindow::Delete()
+{
+ m_bInUnmark = sal_True;
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::mem_fn(&OReportSection::Delete),TReportPairHelper()));
+ m_bInUnmark = sal_False;
+}
+//----------------------------------------------------------------------------
+void OViewsWindow::Copy()
+{
+ uno::Sequence< beans::NamedValue > aAllreadyCopiedObjects;
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::bind(&OReportSection::Copy,_1,::boost::ref(aAllreadyCopiedObjects)),TReportPairHelper()));
+
+ //TSectionsMap::iterator aIter = m_aSections.begin();
+ //TSectionsMap::iterator aEnd = m_aSections.end();
+ //for (; aIter != aEnd; ++aIter)
+ // (*aIter)->getReportSection().Copy(aAllreadyCopiedObjects);
+ OReportExchange* pCopy = new OReportExchange(aAllreadyCopiedObjects);
+ uno::Reference< datatransfer::XTransferable> aEnsureDelete = pCopy;
+ pCopy->CopyToClipboard(this);
+}
+//----------------------------------------------------------------------------
+void OViewsWindow::Paste()
+{
+ TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(this));
+ OReportExchange::TSectionElements aCopies = OReportExchange::extractCopies(aTransferData);
+ if ( aCopies.getLength() > 1 )
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::bind(&OReportSection::Paste,_1,aCopies,false),TReportPairHelper()));
+ else
+ {
+ ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
+ if ( pMarkedSection )
+ pMarkedSection->getReportSection().Paste(aCopies,true);
+ }
+}
+// ---------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const
+{
+ OSL_ENSURE(_xSection.is(),"Section is NULL!");
+
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow;
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd ; ++aIter)
+ {
+ if ((*aIter)->getReportSection().getSection() == _xSection)
+ {
+ pSectionWindow = (*aIter);
+ break;
+ }
+ }
+
+ return pSectionWindow;
+}
+
+//----------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> OViewsWindow::getMarkedSection(NearSectionAccess nsa) const
+{
+ ::boost::shared_ptr<OSectionWindow> pRet;
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ sal_uInt32 nCurrentPosition = 0;
+ for (; aIter != aEnd ; ++aIter)
+ {
+ if ( (*aIter)->getStartMarker().isMarked() )
+ {
+ if (nsa == CURRENT)
+ {
+ pRet = (*aIter);
+ break;
+ }
+ else if ( nsa == PREVIOUS )
+ {
+ if (nCurrentPosition > 0)
+ {
+ pRet = (*(--aIter));
+ if (pRet == NULL)
+ {
+ pRet = (*m_aSections.begin());
+ }
+ }
+ else
+ {
+ // if we are out of bounds return the first one
+ pRet = (*m_aSections.begin());
+ }
+ break;
+ }
+ else if ( nsa == POST )
+ {
+ sal_uInt32 nSize = m_aSections.size();
+ if ((nCurrentPosition + 1) < nSize)
+ {
+ pRet = *(++aIter);
+ if (pRet == NULL)
+ {
+ pRet = (*(--aEnd));
+ }
+ }
+ else
+ {
+ // if we are out of bounds return the last one
+ pRet = (*(--aEnd));
+ }
+ break;
+ }
+ } // ( (*aIter).second->isMarked() )
+ ++nCurrentPosition;
+ } // for (; aIter != aEnd ; ++aIter)
+
+ return pRet;
+}
+// -------------------------------------------------------------------------
+void OViewsWindow::markSection(const sal_uInt16 _nPos)
+{
+ if ( _nPos < m_aSections.size() )
+ m_pParent->setMarked(m_aSections[_nPos]->getReportSection().getSection(),sal_True);
+}
+//----------------------------------------------------------------------------
+sal_Bool OViewsWindow::IsPasteAllowed() const
+{
+ TransferableDataHelper aTransferData( TransferableDataHelper::CreateFromSystemClipboard( const_cast< OViewsWindow* >( this ) ) );
+ return aTransferData.HasFormat(OReportExchange::getDescriptorFormatId());
+}
+//-----------------------------------------------------------------------------
+void OViewsWindow::SelectAll(const sal_uInt16 _nObjectType)
+{
+ m_bInUnmark = sal_True;
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::bind(::boost::mem_fn(&OReportSection::SelectAll),_1,_nObjectType),TReportPairHelper()));
+ m_bInUnmark = sal_False;
+}
+//-----------------------------------------------------------------------------
+void OViewsWindow::unmarkAllObjects(OSectionView* _pSectionView)
+{
+ if ( !m_bInUnmark )
+ {
+ m_bInUnmark = sal_True;
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd ; ++aIter)
+ {
+ if ( &(*aIter)->getReportSection().getSectionView() != _pSectionView )
+ {
+ (*aIter)->getReportSection().deactivateOle();
+ (*aIter)->getReportSection().getSectionView().UnmarkAllObj();
+ }
+ } // for (; aIter != aEnd ; ++aIter)
+ m_bInUnmark = sal_False;
+ }
+}
+//-----------------------------------------------------------------------------
+/*
+::boost::shared_ptr<OSectionWindow> OViewsWindow::getReportSection(const uno::Reference< report::XSection >& _xSection)
+{
+ OSL_ENSURE(_xSection.is(),"Section is NULL!");
+ ::boost::shared_ptr<OSectionWindow> pRet;
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd ; ++aIter)
+ {
+ if ( (*aIter)->getReportSection().getSection() == _xSection )
+ {
+ pRet = (*aIter);
+ break;
+ } // if ( (*aIter)->getSection() == _xSection )
+ } // for (; aIter != aEnd ; ++aIter)
+ return pRet;
+}
+*/
+// -----------------------------------------------------------------------
+void OViewsWindow::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32)
+{
+ ImplInitSettings();
+ Invalidate();
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ GrabFocus();
+ const uno::Sequence< beans::PropertyValue> aArgs;
+ getView()->getReportView()->getController().executeChecked(SID_SELECT_REPORT,aArgs);
+ }
+ Window::MouseButtonDown(rMEvt);
+}
+//----------------------------------------------------------------------------
+void OViewsWindow::showRuler(sal_Bool _bShow)
+{
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::bind(&OStartMarker::showRuler,_1,_bShow),TStartMarkerHelper()));
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::bind(&OStartMarker::Window::Invalidate,_1,sal_uInt16(INVALIDATE_NOERASE)),TStartMarkerHelper()));
+}
+//----------------------------------------------------------------------------
+void OViewsWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (;aIter != aEnd ; ++aIter)
+ {
+ if ( (*aIter)->getReportSection().getSectionView().AreObjectsMarked() )
+ {
+ (*aIter)->getReportSection().MouseButtonUp(rMEvt);
+ break;
+ }
+ }
+
+ // remove special insert mode
+ for (aIter = m_aSections.begin();aIter != aEnd ; ++aIter)
+ {
+ (*aIter)->getReportSection().getPage()->resetSpecialMode();
+ }
+ }
+}
+//------------------------------------------------------------------------------
+sal_Bool OViewsWindow::handleKeyEvent(const KeyEvent& _rEvent)
+{
+ sal_Bool bRet = sal_False;
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (;aIter != aEnd ; ++aIter)
+ {
+ //if ( (*aIter).getReportSection().getSectionView().->AreObjectsMarked() )
+ if ( (*aIter)->getStartMarker().isMarked() )
+ {
+ bRet = (*aIter)->getReportSection().handleKeyEvent(_rEvent);
+ }
+ }
+ return bRet;
+}
+//----------------------------------------------------------------------------
+OViewsWindow::TSectionsMap::iterator OViewsWindow::getIteratorAtPos(sal_uInt16 _nPos)
+{
+ TSectionsMap::iterator aRet = m_aSections.end();
+ if ( _nPos < m_aSections.size() )
+ aRet = m_aSections.begin() + _nPos;
+ return aRet;
+}
+//------------------------------------------------------------------------
+void OViewsWindow::setMarked(OSectionView* _pSectionView,sal_Bool _bMark)
+{
+ OSL_ENSURE(_pSectionView != NULL,"SectionView is NULL!");
+ if ( _pSectionView )
+ setMarked(_pSectionView->getReportSection()->getSection(),_bMark);
+}
+//------------------------------------------------------------------------
+void OViewsWindow::setMarked(const uno::Reference< report::XSection>& _xSection,sal_Bool _bMark)
+{
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd ; ++aIter)
+ {
+ if ( (*aIter)->getReportSection().getSection() != _xSection )
+ {
+ (*aIter)->setMarked(sal_False);
+ }
+ else if ( (*aIter)->getStartMarker().isMarked() != _bMark )
+ {
+ (*aIter)->setMarked(_bMark);
+ }
+ }
+}
+//------------------------------------------------------------------------
+void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes,sal_Bool _bMark)
+{
+ bool bFirst = true;
+ const uno::Reference< report::XReportComponent>* pIter = _aShapes.getConstArray();
+ const uno::Reference< report::XReportComponent>* pEnd = pIter + _aShapes.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ const uno::Reference< report::XSection> xSection = (*pIter)->getSection();
+ if ( xSection.is() )
+ {
+ if ( bFirst )
+ {
+ bFirst = false;
+ m_pParent->setMarked(xSection,_bMark);
+ }
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = getSectionWindow(xSection);
+ if ( pSectionWindow )
+ {
+ SvxShape* pShape = SvxShape::getImplementation( *pIter );
+ SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL;
+ OSL_ENSURE( pObject, "OViewsWindow::setMarked: no SdrObject for the shape!" );
+ if ( pObject )
+ pSectionWindow->getReportSection().getSectionView().MarkObj( pObject, pSectionWindow->getReportSection().getSectionView().GetSdrPageView(), !_bMark );
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::collectRectangles(TRectangleMap& _rSortRectangles, bool _bBoundRects)
+{
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (aIter = m_aSections.begin();aIter != aEnd ; ++aIter)
+ {
+ OSectionView& rView = (*aIter)->getReportSection().getSectionView();
+ if ( rView.AreObjectsMarked() )
+ {
+ rView.SortMarkedObjects();
+ const sal_uInt32 nCount = rView.GetMarkedObjectCount();
+ for (sal_uInt32 i=0; i < nCount; ++i)
+ {
+ const SdrMark* pM = rView.GetSdrMarkByIndex(i);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ Rectangle aObjRect(_bBoundRects ? pObj->GetCurrentBoundRect() : pObj->GetSnapRect());
+ _rSortRectangles.insert(TRectangleMap::value_type(aObjRect,TRectangleMap::mapped_type(pObj,&rView)));
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::collectBoundResizeRect(const TRectangleMap& _rSortRectangles,sal_Int32 _nControlModification,bool _bAlignAtSection, bool _bBoundRects,Rectangle& _rBound,Rectangle& _rResize)
+{
+ bool bOnlyOnce = false;
+ TRectangleMap::const_iterator aRectIter = _rSortRectangles.begin();
+ TRectangleMap::const_iterator aRectEnd = _rSortRectangles.end();
+ for (;aRectIter != aRectEnd ; ++aRectIter)
+ {
+ Rectangle aObjRect = aRectIter->first;
+ if ( _rResize.IsEmpty() )
+ _rResize = aObjRect;
+ switch(_nControlModification)
+ {
+ case ControlModification::WIDTH_SMALLEST:
+ if ( _rResize.getWidth() > aObjRect.getWidth() )
+ _rResize = aObjRect;
+ break;
+ case ControlModification::HEIGHT_SMALLEST:
+ if ( _rResize.getHeight() > aObjRect.getHeight() )
+ _rResize = aObjRect;
+ break;
+ case ControlModification::WIDTH_GREATEST:
+ if ( _rResize.getWidth() < aObjRect.getWidth() )
+ _rResize = aObjRect;
+ break;
+ case ControlModification::HEIGHT_GREATEST:
+ if ( _rResize.getHeight() < aObjRect.getHeight() )
+ _rResize = aObjRect;
+ break;
+ }
+
+ SdrObjTransformInfoRec aInfo;
+ const SdrObject* pObj = aRectIter->second.first;
+ pObj->TakeObjInfo(aInfo);
+ sal_Bool bHasFixed = !aInfo.bMoveAllowed || pObj->IsMoveProtect();
+ if ( bHasFixed )
+ _rBound.Union(aObjRect);
+ else
+ {
+ if ( _bAlignAtSection || _rSortRectangles.size() == 1 )
+ { // einzelnes Obj an der Seite ausrichten
+ if ( ! bOnlyOnce )
+ {
+ bOnlyOnce = true;
+ OReportSection* pReportSection = aRectIter->second.second->getReportSection();
+ const uno::Reference< report::XSection> xSection = pReportSection->getSection();
+ try
+ {
+ uno::Reference<report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
+ _rBound.Union(Rectangle(getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN),0,
+ getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width - getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN),
+ xSection->getHeight()));
+ }
+ catch(uno::Exception){}
+ }
+ }
+ else
+ {
+ if (_bBoundRects)
+ _rBound.Union(aRectIter->second.second->GetMarkedObjBoundRect());
+ else
+ _rBound.Union(aRectIter->second.second->GetMarkedObjRect());
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool _bBoundRects)
+{
+ if ( _nControlModification == ControlModification::NONE )
+ return;
+
+ Point aRefPoint;
+ RectangleLess::CompareMode eCompareMode = RectangleLess::POS_LEFT;
+ switch (_nControlModification)
+ {
+ case ControlModification::TOP : eCompareMode = RectangleLess::POS_UPPER; break;
+ case ControlModification::BOTTOM: eCompareMode = RectangleLess::POS_DOWN; break;
+ case ControlModification::LEFT : eCompareMode = RectangleLess::POS_LEFT; break;
+ case ControlModification::RIGHT : eCompareMode = RectangleLess::POS_RIGHT; break;
+ case ControlModification::CENTER_HORIZONTAL :
+ case ControlModification::CENTER_VERTICAL :
+ {
+ eCompareMode = (ControlModification::CENTER_VERTICAL == _nControlModification) ? RectangleLess::POS_CENTER_VERTICAL : RectangleLess::POS_CENTER_HORIZONTAL;
+ uno::Reference<report::XSection> xSection = (*m_aSections.begin())->getReportSection().getSection();
+ uno::Reference<report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
+ aRefPoint = Rectangle(getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN),0,
+ getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width - getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN),
+ xSection->getHeight()).Center();
+ }
+ break;
+ default: break;
+ }
+ RectangleLess aCompare(eCompareMode,aRefPoint);
+ TRectangleMap aSortRectangles(aCompare);
+ collectRectangles(aSortRectangles,_bBoundRects);
+
+ Rectangle aBound;
+ Rectangle aResize;
+ collectBoundResizeRect(aSortRectangles,_nControlModification,_bAlignAtSection,_bBoundRects,aBound,aResize);
+
+ bool bMove = true;
+
+ ::std::mem_fun_t<long&,Rectangle> aGetFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Bottom);
+ ::std::mem_fun_t<long&,Rectangle> aRefFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Top);
+ TRectangleMap::iterator aRectIter = aSortRectangles.begin();
+ TRectangleMap::iterator aRectEnd = aSortRectangles.end();
+ for (;aRectIter != aRectEnd ; ++aRectIter)
+ {
+ Rectangle aObjRect = aRectIter->first;
+ SdrObject* pObj = aRectIter->second.first;
+ SdrView* pView = aRectIter->second.second;
+ Point aCenter(aBound.Center());
+ SdrObjTransformInfoRec aInfo;
+ pObj->TakeObjInfo(aInfo);
+ if (aInfo.bMoveAllowed && !pObj->IsMoveProtect())
+ {
+ long nXMov = 0;
+ long nYMov = 0;
+ long* pValue = &nXMov;
+ switch(_nControlModification)
+ {
+ case ControlModification::TOP :
+ aGetFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Top);
+ aRefFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Bottom);
+ pValue = &nYMov;
+ break;
+ case ControlModification::BOTTOM:
+ // defaults are already set
+ pValue = &nYMov;
+ break;
+ case ControlModification::CENTER_VERTICAL:
+ nYMov = aCenter.Y() - aObjRect.Center().Y();
+ pValue = &nYMov;
+ bMove = false;
+ break;
+ case ControlModification::RIGHT :
+ aGetFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Right);
+ aRefFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Left);
+ break;
+ case ControlModification::CENTER_HORIZONTAL:
+ nXMov = aCenter.X() - aObjRect.Center().X();
+ bMove = false;
+ break;
+ case ControlModification::LEFT :
+ aGetFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Left);
+ aRefFun = ::std::mem_fun<long&,Rectangle>(&Rectangle::Right);
+ break;
+ default:
+ bMove = false;
+ break;
+ }
+ if ( bMove )
+ {
+ Rectangle aTest = aObjRect;
+ aGetFun(&aTest) = aGetFun(&aBound);
+ TRectangleMap::iterator aInterSectRectIter = aSortRectangles.begin();
+ for (; aInterSectRectIter != aRectIter; ++aInterSectRectIter)
+ {
+ if ( pView == aInterSectRectIter->second.second && dynamic_cast<OUnoObject*>(aInterSectRectIter->second.first) )
+ {
+ SdrObject* pPreviousObj = aInterSectRectIter->second.first;
+ Rectangle aIntersectRect = aTest.GetIntersection(_bBoundRects ? pPreviousObj->GetCurrentBoundRect() : pPreviousObj->GetSnapRect());
+ if ( !aIntersectRect.IsEmpty() && (aIntersectRect.Left() != aIntersectRect.Right() && aIntersectRect.Top() != aIntersectRect.Bottom() ) )
+ {
+ *pValue = aRefFun(&aIntersectRect) - aGetFun(&aObjRect);
+ break;
+ }
+ }
+ }
+ if ( aInterSectRectIter == aRectIter )
+ *pValue = aGetFun(&aBound) - aGetFun(&aObjRect);
+ }
+
+ if ( lcl_getNewRectSize(aObjRect,nXMov,nYMov,pObj,pView,_nControlModification,_bBoundRects) )
+ {
+ const Size aSize(nXMov,nYMov);
+ pView->AddUndo(pView->GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pObj,aSize));
+ pObj->Move(aSize);
+ aObjRect = (_bBoundRects ? pObj->GetCurrentBoundRect() : pObj->GetSnapRect());
+ }
+
+ // resizing control
+ if ( !aResize.IsEmpty() && aObjRect != aResize )
+ {
+ nXMov = aResize.getWidth();
+ nYMov = aResize.getHeight();
+ switch(_nControlModification)
+ {
+ case ControlModification::WIDTH_GREATEST:
+ case ControlModification::HEIGHT_GREATEST:
+ if ( _nControlModification == ControlModification::HEIGHT_GREATEST )
+ nXMov = aObjRect.getWidth();
+ else if ( _nControlModification == ControlModification::WIDTH_GREATEST )
+ nYMov = aObjRect.getHeight();
+ lcl_getNewRectSize(aObjRect,nXMov,nYMov,pObj,pView,_nControlModification,_bBoundRects);
+ // run through
+ case ControlModification::WIDTH_SMALLEST:
+ case ControlModification::HEIGHT_SMALLEST:
+ pView->AddUndo( pView->GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+ {
+ OObjectBase* pObjBase = dynamic_cast<OObjectBase*>(pObj);
+ OSL_ENSURE(pObjBase,"Where comes this object from?");
+ if ( pObjBase )
+ {
+ if ( _nControlModification == ControlModification::WIDTH_SMALLEST || _nControlModification == ControlModification::WIDTH_GREATEST )
+ pObjBase->getReportComponent()->setSize(awt::Size(nXMov,aObjRect.getHeight()));
+ //pObj->Resize(aObjRect.TopLeft(),Fraction(nXMov,aObjRect.getWidth()),Fraction(1,1));
+ else if ( _nControlModification == ControlModification::HEIGHT_GREATEST || _nControlModification == ControlModification::HEIGHT_SMALLEST )
+ pObjBase->getReportComponent()->setSize(awt::Size(aObjRect.getWidth(),nYMov));
+ //pObj->Resize(aObjRect.TopLeft(),Fraction(1,1),Fraction(nYMov,aObjRect.getHeight()));
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ pView->AdjustMarkHdl();
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::createDefault()
+{
+ ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection();
+ if ( pMarkedSection )
+ pMarkedSection->getReportSection().createDefault(m_sShapeType);
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::setGridSnap(sal_Bool bOn)
+{
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd ; ++aIter)
+ {
+ (*aIter)->getReportSection().getSectionView().SetGridSnap(bOn);
+ (*aIter)->getReportSection().Invalidate();
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::setDragStripes(sal_Bool bOn)
+{
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd ; ++aIter)
+ (*aIter)->getReportSection().getSectionView().SetDragStripes(bOn);
+}
+// -----------------------------------------------------------------------------
+sal_uInt16 OViewsWindow::getPosition(const OSectionWindow* _pSectionWindow) const
+{
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ sal_uInt16 nPosition = 0;
+ for (; aIter != aEnd ; ++aIter)
+ {
+ if ( _pSectionWindow == (*aIter).get() )
+ {
+ break;
+ }
+ ++nPosition;
+ }
+ return nPosition;
+}
+// -----------------------------------------------------------------------------
+::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const
+{
+ ::boost::shared_ptr<OSectionWindow> aReturn;
+
+ if ( _nPos < m_aSections.size() )
+ aReturn = m_aSections[_nPos];
+
+ return aReturn;
+}
+// -----------------------------------------------------------------------------
+namespace
+{
+ enum SectionViewAction
+ {
+ eEndDragObj,
+ eEndAction,
+ eMoveAction,
+ eMarkAction,
+ eForceToAnotherPage,
+ eBreakAction
+ };
+ class ApplySectionViewAction : public ::std::unary_function< OViewsWindow::TSectionsMap::value_type, void >
+ {
+ private:
+ SectionViewAction m_eAction;
+ sal_Bool m_bCopy;
+ Point m_aPoint;
+
+ public:
+ ApplySectionViewAction( sal_Bool _bCopy ) : m_eAction( eEndDragObj ), m_bCopy( _bCopy ) { }
+ ApplySectionViewAction(SectionViewAction _eAction = eEndAction ) : m_eAction( _eAction ) { }
+ ApplySectionViewAction( const Point& _rPoint, SectionViewAction _eAction = eMoveAction ) : m_eAction( _eAction ), m_bCopy( sal_False ), m_aPoint( _rPoint ) { }
+
+ void operator() ( const OViewsWindow::TSectionsMap::value_type& _rhs )
+ {
+ OSectionView& rView( _rhs->getReportSection().getSectionView() );
+ switch ( m_eAction )
+ {
+ case eEndDragObj:
+ rView.EndDragObj( m_bCopy );
+ break;
+ case eEndAction:
+ if ( rView.IsAction() )
+ rView.EndAction ( );
+ break;
+ case eMoveAction:
+ rView.MovAction ( m_aPoint );
+ break;
+ case eMarkAction:
+ rView.BegMarkObj ( m_aPoint );
+ break;
+ case eForceToAnotherPage:
+ rView.ForceMarkedToAnotherPage();
+ break;
+ case eBreakAction:
+ if ( rView.IsAction() )
+ rView.BrkAction ( );
+ break;
+ // default:
+
+ }
+ }
+ };
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::BrkAction()
+{
+ EndDragObj_removeInvisibleObjects();
+ ::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction(eBreakAction) );
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::BegDragObj_createInvisibleObjectAtPosition(const Rectangle& _aRect, const OSectionView& _rSection)
+{
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ Point aNewPos(0,0);
+
+ for (; aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ rReportSection.getPage()->setSpecialMode();
+ OSectionView& rView = rReportSection.getSectionView();
+
+ if ( &rView != &_rSection )
+ {
+// SdrRectObj *pNewObj = new SdrRectObj(OBJ_RECT, _aRect);
+// SdrObject *pNewObj = new SdrUnoObj(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Temp Label")));
+ SdrObject *pNewObj = new SdrUnoObj(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText")));
+ if (pNewObj)
+ {
+ pNewObj->SetLogicRect(_aRect);
+ // pNewObj->SetSize(_aRect.GetSize());
+ // pNewObj->Move(Size(_aRect.Left(), _aRect.Top()));
+
+ pNewObj->Move(Size(0, aNewPos.Y()));
+ sal_Bool bChanged = rView.GetModel()->IsChanged();
+ rReportSection.getPage()->InsertObject(pNewObj);
+ rView.GetModel()->SetChanged(bChanged);
+ m_aBegDragTempList.push_back(pNewObj);
+ Rectangle aRect = pNewObj->GetLogicRect();
+
+ // pNewObj->SetText(String::CreateFromAscii("Drag helper"));
+ rView.MarkObj( pNewObj, rView.GetSdrPageView() );
+ }
+ }
+ const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ aNewPos.Y() -= nSectionHeight;
+// aNewPos.Y() -= PixelToLogic(aIter->second.second->GetSizePixel()).Height();
+ }
+}
+// -----------------------------------------------------------------------------
+bool OViewsWindow::isObjectInMyTempList(SdrObject *_pObj)
+{
+ return ::std::find(m_aBegDragTempList.begin(),m_aBegDragTempList.end(),_pObj) != m_aBegDragTempList.end();
+}
+
+// -----------------------------------------------------------------------------
+void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionView* _pSection)
+{
+ OSL_TRACE("BegDragObj Clickpoint X:%d Y:%d\n", _aPnt.X(), _aPnt.Y() );
+
+ m_aBegDragTempList.clear();
+
+ // Calculate the absolute clickpoint in the views
+ Point aAbsolutePnt = _aPnt;
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ OSectionView* pView = &rReportSection.getSectionView();
+ if (pView == _pSection)
+ break;
+ const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ aAbsolutePnt.Y() += nSectionHeight;
+ }
+ m_aDragDelta = Point(SAL_MAX_INT32, SAL_MAX_INT32);
+ OSL_TRACE("BegDragObj Absolute X:%d Y:%d\n", aAbsolutePnt.X(), aAbsolutePnt.Y() );
+
+ // Create drag lines over all viewable Views
+ // Therefore we need to identify the marked objects
+ // and create temporary objects on all other views at the same position
+ // relative to its occurance.
+
+ OSL_TRACE("BegDragObj createInvisible Objects\n" );
+ int nViewCount = 0;
+ Point aNewObjPos(0,0);
+ Point aLeftTop = Point(SAL_MAX_INT32, SAL_MAX_INT32);
+ for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+
+ OSectionView& rView = rReportSection.getSectionView();
+
+ if ( rView.AreObjectsMarked() )
+ {
+ const sal_uInt32 nCount = rView.GetMarkedObjectCount();
+ for (sal_uInt32 i=0; i < nCount; ++i)
+ {
+ const SdrMark* pM = rView.GetSdrMarkByIndex(i);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ if (!isObjectInMyTempList(pObj))
+ {
+ Rectangle aRect( pObj->GetCurrentBoundRect() );
+ aRect.Move(0, aNewObjPos.Y());
+
+ aLeftTop.X() = ::std::min( aRect.Left(), aLeftTop.X() );
+ aLeftTop.Y() = ::std::min( aRect.Top(), aLeftTop.Y() );
+
+ OSL_TRACE("BegDragObj createInvisible X:%d Y:%d on View #%d\n", aRect.Left(), aRect.Top(), nViewCount );
+
+ BegDragObj_createInvisibleObjectAtPosition(aRect, rView);
+
+ // calculate the clickpoint
+// const sal_Int32 nDeltaX = abs(aRect.Left() - aAbsolutePnt.X());
+// const sal_Int32 nDeltaY = abs(aRect.Top() - aAbsolutePnt.Y());
+// if (m_aDragDelta.X() > nDeltaX)
+// m_aDragDelta.X() = nDeltaX;
+// if (m_aDragDelta.Y() > nDeltaY)
+// m_aDragDelta.Y() = nDeltaY;
+ }
+ }
+ }
+ ++nViewCount;
+ Rectangle aClipRect = rView.GetWorkArea();
+ aClipRect.Top() = -aNewObjPos.Y();
+ rView.SetWorkArea( aClipRect );
+
+ const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ aNewObjPos.Y() += nSectionHeight;
+
+ // don't subtract the height of the lines between the views
+ // aNewObjPos.Y() -= PixelToLogic(aIter->second.second->GetSizePixel()).Height();
+ }
+
+ const sal_Int32 nDeltaX = abs(aLeftTop.X() - aAbsolutePnt.X());
+ const sal_Int32 nDeltaY = abs(aLeftTop.Y() - aAbsolutePnt.Y());
+ m_aDragDelta.X() = nDeltaX;
+ m_aDragDelta.Y() = nDeltaY;
+
+ Point aNewPos = aAbsolutePnt;
+ // for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ // {
+ // OReportSection& rReportSection = (*aIter)->getReportSection();
+ // if ( &rReportSection.getSectionView() == _pSection )
+ // break;
+ // aNewPos.Y() += rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ // }
+
+ const short nDrgLog = static_cast<short>(PixelToLogic(Size(3,0)).Width());
+ // long nLastSectionHeight = 0;
+ // bool bAdd = true;
+ nViewCount = 0;
+ for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+
+ // if ( &rReportSection.getSectionView() == _pSection )
+ // {
+ // bAdd = false;
+ // aNewPos = _aPnt;
+ // }
+ // else if ( bAdd )
+ // {
+ // const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ // aNewPos.Y() += nSectionHeight;
+ // }
+ // else
+ // {
+ // aNewPos.Y() -= nLastSectionHeight;
+ // }
+
+ //?
+ SdrHdl* pHdl = _pHdl;
+ if ( pHdl )
+ {
+ if ( &rReportSection.getSectionView() != _pSection )
+ {
+ const SdrHdlList& rHdlList = rReportSection.getSectionView().GetHdlList();
+ pHdl = rHdlList.GetHdl(_pHdl->GetKind());
+ }
+ }
+ OSL_TRACE("BegDragObj X:%d Y:%d on View#%d\n", aNewPos.X(), aNewPos.Y(), nViewCount++ );
+ rReportSection.getSectionView().BegDragObj(aNewPos, (OutputDevice*)NULL, pHdl, nDrgLog, NULL);
+
+ const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ aNewPos.Y() -= nSectionHeight;
+ // subtract the height between the views, because they are visible but not from interest here.
+ // aNewPos.Y() -= PixelToLogic(aIter->second.second->GetSizePixel()).Height();
+ }
+}
+
+// -----------------------------------------------------------------------------
+void OViewsWindow::ForceMarkedToAnotherPage()
+{
+ ::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction(eForceToAnotherPage ) );
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::BegMarkObj(const Point& _aPnt,const OSectionView* _pSection)
+{
+ bool bAdd = true;
+ Point aNewPos = _aPnt;
+
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ long nLastSectionHeight = 0;
+ for (; aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ if ( &rReportSection.getSectionView() == _pSection )
+ {
+ bAdd = false;
+ aNewPos = _aPnt; // 2,2
+ }
+ else if ( bAdd )
+ {
+ const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ aNewPos.Y() += nSectionHeight;
+ }
+ else
+ {
+ aNewPos.Y() -= nLastSectionHeight;
+ }
+ rReportSection.getSectionView().BegMarkObj ( aNewPos );
+ nLastSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+
+ // aNewPos.Y() -= PixelToLogic(aIter->second.second->GetSizePixel()).Height();
+ }
+ //::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction( _aPnt , eMarkAction) );
+}
+// -----------------------------------------------------------------------------
+OSectionView* OViewsWindow::getSectionRelativeToPosition(const OSectionView* _pSection,Point& _rPnt)
+{
+ OSectionView* pSection = NULL;
+ sal_Int32 nCount = 0;
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ const TSectionsMap::iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd ; ++aIter,++nCount)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ if ( &rReportSection.getSectionView() == _pSection)
+ break;
+ }
+ OSL_ENSURE(aIter != aEnd,"This can never happen!");
+ if ( _rPnt.Y() < 0 )
+ {
+ if ( nCount )
+ --aIter;
+ for (; nCount && (_rPnt.Y() < 0); --nCount)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ const sal_Int32 nHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ _rPnt.Y() += nHeight;
+ if ( (nCount -1) > 0 && (_rPnt.Y() < 0) )
+ --aIter;
+ }
+ if ( nCount == 0 )
+ pSection = &(*m_aSections.begin())->getReportSection().getSectionView();
+ else
+ pSection = &(*aIter)->getReportSection().getSectionView();
+ }
+ else
+ {
+ for (; aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ const long nHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ if ( (_rPnt.Y() - nHeight) < 0 )
+ break;
+ _rPnt.Y() -= nHeight;
+ }
+ if ( aIter != aEnd )
+ pSection = &(*aIter)->getReportSection().getSectionView();
+ else
+ pSection = &(*(aEnd-1))->getReportSection().getSectionView();
+ }
+
+ return pSection;
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::EndDragObj_removeInvisibleObjects()
+{
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+
+ for (; aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ rReportSection.getPage()->resetSpecialMode();
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::EndDragObj(sal_Bool _bControlKeyPressed, const OSectionView* _pSection,const Point& _aPnt)
+{
+ const String sUndoAction = String((ModuleRes(RID_STR_UNDO_CHANGEPOSITION)));
+ const UndoContext aUndoContext( getView()->getReportView()->getController().getUndoManager(), sUndoAction );
+
+ Point aNewPos = _aPnt;
+ OSectionView* pInSection = getSectionRelativeToPosition(_pSection, aNewPos);
+ if (!_bControlKeyPressed &&
+ (_pSection && ( _pSection->IsDragResize() == false ) ) && /* Not in resize mode */
+ _pSection != pInSection)
+ {
+ EndDragObj_removeInvisibleObjects();
+
+ // we need to manipulate the current clickpoint, we substract the old delta from BeginDrag
+ // OSectionView* pInSection = getSectionRelativeToPosition(_pSection, aPnt);
+ // aNewPos.X() -= m_aDragDelta.X();
+ // aNewPos.Y() -= m_aDragDelta.Y();
+ aNewPos -= m_aDragDelta;
+
+ uno::Sequence< beans::NamedValue > aAllreadyCopiedObjects;
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ const TSectionsMap::iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ if ( pInSection != &rReportSection.getSectionView() )
+ {
+ rReportSection.getSectionView().BrkAction();
+ rReportSection.Copy(aAllreadyCopiedObjects,true);
+ }
+ else
+ pInSection->EndDragObj(sal_False);
+ } // for (; aIter != aEnd; ++aIter)
+
+ if ( aAllreadyCopiedObjects.getLength() )
+ {
+ beans::NamedValue* pIter = aAllreadyCopiedObjects.getArray();
+ const beans::NamedValue* pEnd = pIter + aAllreadyCopiedObjects.getLength();
+ try
+ {
+ uno::Reference<report::XReportDefinition> xReportDefinition = getView()->getReportView()->getController().getReportDefinition();
+ const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
+ const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
+
+ if ( aNewPos.X() < nLeftMargin )
+ aNewPos.X() = nLeftMargin;
+ if ( aNewPos.Y() < 0 )
+ aNewPos.Y() = 0;
+
+ Point aPrevious;
+ for (; pIter != pEnd; ++pIter)
+ {
+ uno::Sequence< uno::Reference<report::XReportComponent> > aClones;
+ pIter->Value >>= aClones;
+ uno::Reference<report::XReportComponent>* pColIter = aClones.getArray();
+ const uno::Reference<report::XReportComponent>* pColEnd = pColIter + aClones.getLength();
+
+ // move the cloned Components to new positions
+ for (; pColIter != pColEnd; ++pColIter)
+ {
+ uno::Reference< report::XReportComponent> xRC(*pColIter);
+ aPrevious = VCLPoint(xRC->getPosition());
+ awt::Size aSize = xRC->getSize();
+
+ if ( aNewPos.X() < nLeftMargin )
+ {
+ aNewPos.X() = nLeftMargin;
+ }
+ else if ( (aNewPos.X() + aSize.Width) > (nPaperWidth - nRightMargin) )
+ {
+ aNewPos.X() = nPaperWidth - nRightMargin - aSize.Width;
+ }
+ if ( aNewPos.Y() < 0 )
+ {
+ aNewPos.Y() = 0;
+ }
+ if ( aNewPos.X() < 0 )
+ {
+ aSize.Width += aNewPos.X();
+ aNewPos.X()= 0;
+ xRC->setSize(aSize);
+ }
+ xRC->setPosition(AWTPoint(aNewPos));
+ if ( (pColIter+1) != pColEnd )
+ {
+ // bring aNewPos to the position of the next object
+ uno::Reference< report::XReportComponent> xRCNext(*(pColIter + 1),uno::UNO_QUERY);
+ Point aNextPosition = VCLPoint(xRCNext->getPosition());
+ aNewPos += (aNextPosition - aPrevious);
+ }
+ }
+ }
+ }
+ catch(uno::Exception&)
+ {
+ }
+ pInSection->getReportSection()->Paste(aAllreadyCopiedObjects,true);
+ }
+ }
+ else
+ {
+ ::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction( sal_False ) );
+ EndDragObj_removeInvisibleObjects();
+ }
+ m_aDragDelta = Point(SAL_MAX_INT32, SAL_MAX_INT32);
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::EndAction()
+{
+ ::std::for_each( m_aSections.begin(), m_aSections.end(), ApplySectionViewAction() );
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection,bool _bMove, bool _bControlKeySet)
+{
+ (void)_bMove;
+
+ Point aRealMousePos = _aPnt;
+ Point aCurrentSectionPos;
+ OSL_TRACE("MovAction X:%d Y:%d\n", aRealMousePos.X(), aRealMousePos.Y() );
+
+ Point aHdlPos;
+ SdrHdl* pHdl = _pSection->GetDragHdl();
+ if ( pHdl )
+ {
+ aHdlPos = pHdl->GetPos();
+ }
+
+ TSectionsMap::iterator aIter/* = m_aSections.begin() */;
+ TSectionsMap::iterator aEnd = m_aSections.end();
+
+ //if ( _bMove )
+ //{
+ for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ if ( &rReportSection.getSectionView() == _pSection )
+ break;
+ const long nSectionHeight = (*aIter)->PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ aCurrentSectionPos.Y() += nSectionHeight;
+ } // for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ //}
+ aRealMousePos += aCurrentSectionPos;
+
+ // If control key is pressed the work area is limited to the section with the current selection.
+ Point aPosForWorkArea(0,0);
+ for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ OSectionView& rView = rReportSection.getSectionView();
+ const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height();
+
+ if (_bControlKeySet)
+ {
+ Rectangle aClipRect = rView.GetWorkArea();
+ aClipRect.Top() = aCurrentSectionPos.Y() - aPosForWorkArea.Y();
+ // if (aClipRect.Top() < 0) aClipRect.Top() = 0;
+ aClipRect.Bottom() = aClipRect.Top() + nSectionHeight;
+ rView.SetWorkArea( aClipRect );
+ }
+ else
+ {
+ Rectangle aClipRect = rView.GetWorkArea();
+ aClipRect.Top() = -aPosForWorkArea.Y();
+ rView.SetWorkArea( aClipRect );
+ }
+ aPosForWorkArea.Y() += nSectionHeight;
+ // aNewPos.Y() += PixelToLogic(aIter->second.second->GetSizePixel()).Height();
+ }
+
+
+ for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ SdrHdl* pCurrentHdl = rReportSection.getSectionView().GetDragHdl();
+ if ( pCurrentHdl )
+ {
+ if ( aRealMousePos.Y() > 0 )
+ aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos;
+ }
+ rReportSection.getSectionView().MovAction ( aRealMousePos );
+ const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height();
+ aRealMousePos.Y() -= nSectionHeight;
+ }
+#if 0
+#if OSL_DEBUG_LEVEL > 0
+ // TEST TEST TEST TEST
+ // Ich versuche gerade rauszubekommen, ob ich ein Object bewege oder nur resize.
+ // TEST TEST TEST TEST
+
+ for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ OSectionView& rView = rReportSection.getSectionView();
+ if ( rView.AreObjectsMarked() )
+ {
+ rView.SortMarkedObjects();
+ const sal_uInt32 nCount = rView.GetMarkedObjectCount();
+ for (sal_uInt32 i=0; i < nCount; ++i)
+ {
+ const SdrMark* pM = rView.GetSdrMarkByIndex(i);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ (void)pObj;
+
+ int dummy = 0;
+ (void)dummy;
+ }
+ }
+
+ /*
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ OSectionView& rView = rReportSection.getSectionView();
+ const SdrHdlList& rHdlList = rView.GetHdlList();
+ SdrHdl* pHdl2 = rHdlList.GetFocusHdl();
+
+ if ( pHdl2 != 0 )
+ {
+ SdrHdlKind eKind = pHdl->GetKind();
+ int dummy = 0;
+ switch(eKind)
+ {
+ case HDL_UPLFT: // Oben links
+ case HDL_UPPER: // Oben
+ case HDL_UPRGT: // Oben rechts
+ case HDL_LEFT: // Links
+ case HDL_RIGHT: // Rechts
+ case HDL_LWLFT: // Unten links
+ case HDL_LOWER: // Unten
+ case HDL_LWRGT: // Unten rechts
+ dummy = 1;
+ break;
+ default:
+ dummy = 0;
+ }
+ }
+ */
+ }
+ // TEST TEST TEST TEST
+#endif
+#endif
+}
+// -----------------------------------------------------------------------------
+sal_Bool OViewsWindow::IsAction() const
+{
+ sal_Bool bAction = sal_False;
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ for (; !bAction && aIter != aEnd; ++aIter)
+ bAction = (*aIter)->getReportSection().getSectionView().IsAction();
+ return bAction;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OViewsWindow::IsDragObj() const
+{
+ sal_Bool bAction = sal_False;
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ for (; !bAction && aIter != aEnd; ++aIter)
+ bAction = (*aIter)->getReportSection().getSectionView().IsAction();
+ return bAction;
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 OViewsWindow::getMarkedObjectCount() const
+{
+ sal_uInt32 nCount = 0;
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd; ++aIter)
+ nCount += (*aIter)->getReportSection().getSectionView().GetMarkedObjectCount();
+ return nCount;
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::handleKey(const KeyCode& _rCode)
+{
+ const sal_uInt16 nCode = _rCode.GetCode();
+ if ( _rCode.IsMod1() )
+ {
+ // scroll page
+ OScrollWindowHelper* pScrollWindow = getView()->getScrollWindow();
+ ScrollBar* pScrollBar = ( nCode == KEY_LEFT || nCode == KEY_RIGHT ) ? pScrollWindow->GetHScroll() : pScrollWindow->GetVScroll();
+ if ( pScrollBar && pScrollBar->IsVisible() )
+ pScrollBar->DoScrollAction(( nCode == KEY_RIGHT || nCode == KEY_UP ) ? SCROLL_LINEUP : SCROLL_LINEDOWN );
+ return;
+ }
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ for (; aIter != aEnd; ++aIter)
+ {
+ OReportSection& rReportSection = (*aIter)->getReportSection();
+ long nX = 0;
+ long nY = 0;
+
+ if ( nCode == KEY_UP )
+ nY = -1;
+ else if ( nCode == KEY_DOWN )
+ nY = 1;
+ else if ( nCode == KEY_LEFT )
+ nX = -1;
+ else if ( nCode == KEY_RIGHT )
+ nX = 1;
+
+ if ( rReportSection.getSectionView().AreObjectsMarked() )
+ {
+ if ( _rCode.IsMod2() )
+ {
+ // move in 1 pixel distance
+ const Size aPixelSize = rReportSection.PixelToLogic( Size( 1, 1 ) );
+ nX *= aPixelSize.Width();
+ nY *= aPixelSize.Height();
+ }
+ else
+ {
+ // move in 1 mm distance
+ nX *= DEFAUL_MOVE_SIZE;
+ nY *= DEFAUL_MOVE_SIZE;
+ }
+
+ OSectionView& rView = rReportSection.getSectionView();
+ const SdrHdlList& rHdlList = rView.GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if ( pHdl == 0 )
+ {
+ // no handle selected
+ if ( rView.IsMoveAllowed() )
+ {
+ // restrict movement to work area
+ Rectangle rWorkArea = rView.GetWorkArea();
+
+ if ( !rWorkArea.IsEmpty() )
+ {
+ if ( rWorkArea.Top() < 0 )
+ rWorkArea.Top() = 0;
+ Rectangle aMarkRect( rView.GetMarkedObjRect() );
+ aMarkRect.Move( nX, nY );
+
+ if ( !rWorkArea.IsInside( aMarkRect ) )
+ {
+ if ( aMarkRect.Left() < rWorkArea.Left() )
+ nX += rWorkArea.Left() - aMarkRect.Left();
+
+ if ( aMarkRect.Right() > rWorkArea.Right() )
+ nX -= aMarkRect.Right() - rWorkArea.Right();
+
+ if ( aMarkRect.Top() < rWorkArea.Top() )
+ nY += rWorkArea.Top() - aMarkRect.Top();
+
+ if ( aMarkRect.Bottom() > rWorkArea.Bottom() )
+ nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
+ }
+ bool bCheck = false;
+ const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
+ for (sal_uInt32 i = 0; !bCheck && i < rMarkList.GetMarkCount();++i )
+ {
+ SdrMark* pMark = rMarkList.GetMark(i);
+ bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
+ }
+
+ if ( bCheck && isOver(aMarkRect,*rReportSection.getPage(),rView) )
+ break;
+ }
+
+ if ( nX != 0 || nY != 0 )
+ {
+ rView.MoveAllMarked( Size( nX, nY ) );
+ rView.MakeVisible( rView.GetAllMarkedRect(), rReportSection);
+ }
+ }
+ }
+ else
+ {
+ // move the handle
+ if ( pHdl && ( nX || nY ) )
+ {
+ const Point aStartPoint( pHdl->GetPos() );
+ const Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) );
+ const SdrDragStat& rDragStat = rView.GetDragStat();
+
+ // start dragging
+ rView.BegDragObj( aStartPoint, 0, pHdl, 0 );
+
+ if ( rView.IsDragObj() )
+ {
+ const FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
+ const sal_Bool bWasSnapEnabled = rView.IsSnapEnabled();
+
+ // switch snapping off
+ if ( !bWasNoSnap )
+ ((SdrDragStat&)rDragStat).SetNoSnap( sal_True );
+ if ( bWasSnapEnabled )
+ rView.SetSnapEnabled( sal_False );
+
+ Rectangle aNewRect;
+ bool bCheck = false;
+ const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
+ for (sal_uInt32 i = 0; !bCheck && i < rMarkList.GetMarkCount();++i )
+ {
+ SdrMark* pMark = rMarkList.GetMark(i);
+ bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
+ if ( bCheck )
+ aNewRect.Union(pMark->GetMarkedSdrObj()->GetLastBoundRect());
+ }
+
+ switch(pHdl->GetKind())
+ {
+ case HDL_LEFT:
+ case HDL_UPLFT:
+ case HDL_LWLFT:
+ case HDL_UPPER:
+ aNewRect.Left() += nX;
+ aNewRect.Top() += nY;
+ break;
+ case HDL_UPRGT:
+ case HDL_RIGHT:
+ case HDL_LWRGT:
+ case HDL_LOWER:
+ aNewRect.setWidth(aNewRect.getWidth() + nX);
+ aNewRect.setHeight(aNewRect.getHeight() + nY);
+ break;
+ default:
+ break;
+ }
+ if ( !(bCheck && isOver(aNewRect,*rReportSection.getPage(),rView)) )
+ rView.MovAction(aEndPoint);
+ rView.EndDragObj();
+
+ // restore snap
+ if ( !bWasNoSnap )
+ ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap );
+ if ( bWasSnapEnabled )
+ rView.SetSnapEnabled( bWasSnapEnabled );
+ }
+
+ // make moved handle visible
+ const Rectangle aVisRect( aEndPoint - Point( DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE ), Size( 200, 200 ) );
+ rView.MakeVisible( aVisRect, rReportSection);
+ }
+ }
+ rView.AdjustMarkHdl();
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::stopScrollTimer()
+{
+ ::std::for_each(m_aSections.begin(),m_aSections.end(),
+ ::std::compose1(::boost::mem_fn(&OReportSection::stopScrollTimer),TReportPairHelper()));
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
+{
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ for (sal_uInt16 i = 0;aIter != aEnd ; ++aIter,++i)
+ {
+ if ( (*aIter)->getStartMarker().isCollapsed() )
+ _rCollapsedPositions.push_back(i);
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollpasedSections)
+{
+ const beans::PropertyValue* pIter = _aCollpasedSections.getConstArray();
+ const beans::PropertyValue* pEnd = pIter + _aCollpasedSections.getLength();
+ for (; pIter != pEnd; ++pIter)
+ {
+ sal_uInt16 nPos = sal_uInt16(-1);
+ if ( (pIter->Value >>= nPos) && nPos < m_aSections.size() )
+ {
+ m_aSections[nPos]->setCollapsed(sal_True);
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::zoom(const Fraction& _aZoom)
+{
+ const MapMode& aMapMode = GetMapMode();
+
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ if ( _aZoom < aMapMode.GetScaleX() )
+ aStartWidth *= aMapMode.GetScaleX();
+ else
+ aStartWidth *= _aZoom;
+
+ setZoomFactor(_aZoom,*this);
+
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (;aIter != aEnd ; ++aIter)
+ {
+ (*aIter)->zoom(_aZoom);
+ } // for (;aIter != aEnd ; ++aIter)
+
+ Resize();
+
+ Size aOut = GetOutputSizePixel();
+ aOut.Width() = aStartWidth;
+ aOut = PixelToLogic(aOut);
+
+ Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
+ Invalidate(aRect,/*INVALIDATE_NOERASE | */INVALIDATE_NOCHILDREN /*| INVALIDATE_TRANSPARENT*/);
+}
+//----------------------------------------------------------------------------
+void OViewsWindow::scrollChildren(const Point& _aThumbPos)
+{
+ const Point aPos(PixelToLogic(_aThumbPos));
+ {
+ MapMode aMapMode = GetMapMode();
+ const Point aOld = aMapMode.GetOrigin();
+ aMapMode.SetOrigin(m_pParent->GetMapMode().GetOrigin());
+
+ const Point aPosY(m_pParent->PixelToLogic(_aThumbPos,aMapMode));
+
+ aMapMode.SetOrigin( Point(aOld.X() , - aPosY.Y()));
+ SetMapMode( aMapMode );
+ //OWindowPositionCorrector aCorrector(this,0,-( aOld.Y() + aPosY.Y()));
+ Scroll(0, -( aOld.Y() + aPosY.Y()),SCROLL_CHILDREN);
+ Resize();
+ Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_TRANSPARENT);
+ }
+
+ TSectionsMap::iterator aIter = m_aSections.begin();
+ TSectionsMap::iterator aEnd = m_aSections.end();
+ for (;aIter != aEnd ; ++aIter)
+ {
+ (*aIter)->scrollChildren(aPos.X());
+ } // for (;aIter != aEnd ; ++aIter)
+}
+// -----------------------------------------------------------------------------
+void OViewsWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
+{
+ TSectionsMap::const_iterator aIter = m_aSections.begin();
+ TSectionsMap::const_iterator aEnd = m_aSections.end();
+ for(;aIter != aEnd; ++aIter)
+ {
+ (*aIter)->getReportSection().fillControlModelSelection(_rSelection);
+ }
+}
+//==============================================================================
+} // rptui
+//==============================================================================
diff --git a/reportdesign/source/ui/report/dlgedclip.cxx b/reportdesign/source/ui/report/dlgedclip.cxx
new file mode 100644
index 000000000000..d0c1b03bda11
--- /dev/null
+++ b/reportdesign/source/ui/report/dlgedclip.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * 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 "dlgedclip.hxx"
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/datatransfer/XMimeContentType.hpp>
+#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp>
+
+namespace rptui
+{
+
+using namespace comphelper;
+using namespace ::com::sun::star;
+
+//============================================================================
+// OReportExchange
+//============================================================================
+//----------------------------------------------------------------------------
+OReportExchange::OReportExchange(const TSectionElements& _rCopyElements )
+: m_aCopyElements(_rCopyElements)
+{
+}
+//--------------------------------------------------------------------
+sal_uInt32 OReportExchange::getDescriptorFormatId()
+{
+ static sal_uInt32 s_nFormat = (sal_uInt32)-1;
+ if ((sal_uInt32)-1 == s_nFormat)
+ {
+ s_nFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"report.ReportObjectsTransfer\""));
+ OSL_ENSURE((sal_uInt32)-1 != s_nFormat, "OReportExchange::getDescriptorFormatId: bad exchange id!");
+ }
+ return s_nFormat;
+}
+//--------------------------------------------------------------------
+void OReportExchange::AddSupportedFormats()
+{
+ AddFormat(getDescriptorFormatId());
+}
+//--------------------------------------------------------------------
+sal_Bool OReportExchange::GetData( const datatransfer::DataFlavor& _rFlavor )
+{
+ const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor);
+ return (nFormatId == getDescriptorFormatId()) ?
+ SetAny( uno::Any(m_aCopyElements), _rFlavor )
+ : sal_False;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OReportExchange::canExtract(const DataFlavorExVector& _rFlavor)
+{
+ return IsFormatSupported(_rFlavor,getDescriptorFormatId());
+}
+// -----------------------------------------------------------------------------
+OReportExchange::TSectionElements OReportExchange::extractCopies(const TransferableDataHelper& _rData)
+{
+ sal_Int32 nKnownFormatId = getDescriptorFormatId();
+ if ( _rData.HasFormat( nKnownFormatId ) )
+ {
+ // extract the any from the transferable
+ datatransfer::DataFlavor aFlavor;
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+#endif
+ SotExchange::GetFormatDataFlavor(nKnownFormatId, aFlavor);
+ OSL_ENSURE(bSuccess, "OReportExchange::extractCopies: invalid data format (no flavor)!");
+
+ uno::Any aDescriptor = _rData.GetAny(aFlavor);
+
+ TSectionElements aCopies;
+#if OSL_DEBUG_LEVEL > 0
+ bSuccess =
+#endif
+ aDescriptor >>= aCopies;
+ OSL_ENSURE(bSuccess, "OReportExchange::extractCopies: invalid clipboard format!");
+
+ // build the real descriptor
+ return aCopies;
+ }
+
+ return TSectionElements();
+}
+//============================================================================
+} // rptui
+//============================================================================
diff --git a/reportdesign/source/ui/report/dlgedfac.cxx b/reportdesign/source/ui/report/dlgedfac.cxx
new file mode 100644
index 000000000000..7e6bd00d0091
--- /dev/null
+++ b/reportdesign/source/ui/report/dlgedfac.cxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * 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 "dlgedfac.hxx"
+#ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
+#include "uistrings.hrc"
+#endif
+#include "RptObject.hxx"
+#include <RptDef.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <svx/svdoole2.hxx>
+namespace rptui
+{
+using namespace ::com::sun::star;
+
+//----------------------------------------------------------------------------
+
+DlgEdFactory::DlgEdFactory()
+{
+ SdrObjFactory::InsertMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
+}
+
+//----------------------------------------------------------------------------
+
+DlgEdFactory::~DlgEdFactory()
+{
+ SdrObjFactory::RemoveMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) );
+}
+
+//----------------------------------------------------------------------------
+
+IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
+{
+ if ( pObjFactory->nInventor == ReportInventor )
+ {
+ switch( pObjFactory->nIdentifier )
+ {
+ case OBJ_DLG_FIXEDTEXT:
+ pObjFactory->pNewObj = new OUnoObject( SERVICE_FIXEDTEXT
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText"))
+ ,OBJ_DLG_FIXEDTEXT);
+ break;
+ case OBJ_DLG_IMAGECONTROL:
+ pObjFactory->pNewObj = new OUnoObject( SERVICE_IMAGECONTROL
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl"))
+ ,OBJ_DLG_IMAGECONTROL);
+ break;
+ case OBJ_DLG_FORMATTEDFIELD:
+ pObjFactory->pNewObj = new OUnoObject( SERVICE_FORMATTEDFIELD
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FormattedField"))
+ ,OBJ_DLG_FORMATTEDFIELD);
+ break;
+ case OBJ_DLG_VFIXEDLINE:
+ case OBJ_DLG_HFIXEDLINE:
+ {
+ OUnoObject* pObj = new OUnoObject( SERVICE_FIXEDLINE
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel"))
+ ,pObjFactory->nIdentifier);
+ pObjFactory->pNewObj = pObj;
+ if ( pObjFactory->nIdentifier == OBJ_DLG_HFIXEDLINE )
+ {
+ uno::Reference<beans::XPropertySet> xProp = pObj->getAwtComponent();
+ xProp->setPropertyValue( PROPERTY_ORIENTATION, uno::makeAny(sal_Int32(0)) );
+ }
+ }
+ break;
+ case OBJ_CUSTOMSHAPE:
+ pObjFactory->pNewObj = new OCustomShape(SERVICE_SHAPE);
+ break;
+ case OBJ_DLG_SUBREPORT:
+ pObjFactory->pNewObj = new OOle2Obj(SERVICE_REPORTDEFINITION,OBJ_DLG_SUBREPORT);
+ break;
+ case OBJ_OLE2:
+ pObjFactory->pNewObj = new OOle2Obj(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.ChartDocument")),OBJ_OLE2);
+ break;
+ default:
+ OSL_ENSURE(0,"Unknown object id");
+ break;
+ }
+ }
+
+ return 0;
+}
+//----------------------------------------------------------------------------
+}
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
new file mode 100644
index 000000000000..b17b68bdba4b
--- /dev/null
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -0,0 +1,1119 @@
+/*************************************************************************
+ *
+ * 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 <vcl/scrbar.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/seleng.hxx>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <svx/svdview.hxx>
+#include <svx/svdpagv.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/editstat.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svddrgmt.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svditer.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include "dlgedfunc.hxx"
+#include "ReportSection.hxx"
+#include "DesignView.hxx"
+#include "ReportController.hxx"
+#include "SectionView.hxx"
+#include "ViewsWindow.hxx"
+#include "ReportWindow.hxx"
+#include "RptObject.hxx"
+#include "ScrollHelper.hxx"
+
+#include "ReportRuler.hxx"
+#include "UITools.hxx"
+
+#include <uistrings.hrc>
+#include "UndoEnv.hxx"
+#include <RptModel.hxx>
+#include <tools/diagnose_ex.h>
+
+#define DEFAUL_MOVE_SIZE 100
+namespace rptui
+{
+using namespace ::com::sun::star;
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+
+IMPL_LINK( DlgEdFunc, ScrollTimeout, Timer *, )
+{
+ ForceScroll( m_pParent->PixelToLogic( m_pParent->GetPointerPosPixel() ) );
+ return 0;
+}
+
+//----------------------------------------------------------------------------
+
+void DlgEdFunc::ForceScroll( const Point& rPos )
+{
+ aScrollTimer.Stop();
+
+ OReportWindow* pReportWindow = m_pParent->getSectionWindow()->getViewsWindow()->getView();
+ OScrollWindowHelper* pScrollWindow = pReportWindow->getScrollWindow();
+
+ Size aOut = pReportWindow->GetOutputSizePixel();
+ Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ aStartWidth *= m_pParent->GetMapMode().GetScaleX();
+
+ aOut.Width() -= (long)aStartWidth;
+
+ Rectangle aOutRect( pScrollWindow->getThumbPos(), aOut );
+ aOutRect = m_pParent->PixelToLogic( aOutRect );
+ //Rectangle aWorkArea = m_pParent->getView()->GetWorkArea();
+ Point aGcc3WorkaroundTemporary;
+ Rectangle aWorkArea(aGcc3WorkaroundTemporary,pScrollWindow->getTotalSize());
+ aWorkArea.Right() -= (long)aStartWidth;
+ aWorkArea = pScrollWindow->PixelToLogic( aWorkArea );
+ if( !aOutRect.IsInside( rPos ) && aWorkArea.IsInside( rPos ) )
+ {
+ ScrollBar* pHScroll = pScrollWindow->GetHScroll();
+ ScrollBar* pVScroll = pScrollWindow->GetVScroll();
+ ScrollType eH = SCROLL_LINEDOWN,eV = SCROLL_LINEDOWN;
+ if( rPos.X() < aOutRect.Left() )
+ eH = SCROLL_LINEUP;
+ else if( rPos.X() <= aOutRect.Right() )
+ eH = SCROLL_DONTKNOW;
+
+ if( rPos.Y() < aOutRect.Top() )
+ eV = SCROLL_LINEUP;
+ else if( rPos.Y() <= aOutRect.Bottom() )
+ eV = SCROLL_DONTKNOW;
+
+ pHScroll->DoScrollAction(eH);
+ pVScroll->DoScrollAction(eV);
+ }
+
+ aScrollTimer.Start();
+}
+
+//----------------------------------------------------------------------------
+
+DlgEdFunc::DlgEdFunc( OReportSection* _pParent )
+:m_pParent(_pParent),
+ m_rView(_pParent->getSectionView()),
+ m_xOverlappingObj(NULL),
+ m_pOverlappingObj(NULL),
+ m_bSelectionMode(false),
+ m_bUiActive(false),
+ m_bShowPropertyBrowser(false)
+{
+ // m_pParent = _pParent;
+ aScrollTimer.SetTimeoutHdl( LINK( this, DlgEdFunc, ScrollTimeout ) );
+ m_rView.SetActualWin( m_pParent);
+ aScrollTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
+}
+
+//----------------------------------------------------------------------------
+void DlgEdFunc::setOverlappedControlColor(sal_Int32 _nColor)
+{
+ m_nOverlappedControlColor = _nColor;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 lcl_setColorOfObject(uno::Reference< uno::XInterface > _xObj, long _nColorTRGB)
+{
+ sal_Int32 nBackColor = 0;
+ try
+ {
+ uno::Reference<report::XReportComponent> xComponent(_xObj, uno::UNO_QUERY_THROW);
+ // NOT NEED if UNO_QUERY_THROW:
+ // if (xComponent.is())
+ // {
+ uno::Reference< beans::XPropertySet > xProp(xComponent, uno::UNO_QUERY_THROW);
+ // if (xProp.is())
+ // {
+ // ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlBackground"))
+ // is PROPERTY_CONTROLBACKGROUND
+ uno::Any aAny = xProp->getPropertyValue(PROPERTY_CONTROLBACKGROUND);
+ if (aAny.hasValue())
+ {
+ aAny >>= nBackColor;
+ // try to set background color at the ReportComponent
+ uno::Any aBlackColorAny = uno::makeAny(_nColorTRGB);
+ xProp->setPropertyValue(PROPERTY_CONTROLBACKGROUND, aBlackColorAny);
+ }
+ // aCopies.push_back(xComponent->createClone());
+ }
+ catch(uno::Exception&)
+ {
+ // bit my shiny metal as!
+ // OSL_ENSURE(0,"Can't copy report elements!");
+ }
+ return nBackColor;
+}
+// -----------------------------------------------------------------------------
+DlgEdFunc::~DlgEdFunc()
+{
+ unColorizeOverlappedObj();
+ aScrollTimer.Stop();
+}
+
+//----------------------------------------------------------------------------
+
+sal_Bool DlgEdFunc::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ m_aMDPos = m_pParent->PixelToLogic( rMEvt.GetPosPixel() );
+ m_pParent->GrabFocus();
+ sal_Bool bHandled = sal_False;
+ if ( rMEvt.IsLeft() )
+ {
+ if ( rMEvt.GetClicks() > 1 )
+ {
+ // show property browser
+ if ( m_pParent->GetMode() != RPTUI_READONLY )
+ {
+ uno::Sequence<beans::PropertyValue> aArgs(1);
+ aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowProperties"));
+ aArgs[0].Value <<= sal_True;
+ m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController().executeUnChecked(SID_SHOW_PROPERTYBROWSER,aArgs);
+ m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
+ // TODO character in shapes
+ // SdrViewEvent aVEvt;
+ // m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ // if ( aVEvt.pRootObj && aVEvt.pRootObj->ISA(SdrTextObj) )
+ // SetInEditMode(static_cast<SdrTextObj *>(aVEvt.pRootObj),rMEvt, sal_False);
+ bHandled = sal_True;
+ }
+ }
+ else
+ {
+ SdrHdl* pHdl = m_rView.PickHandle(m_aMDPos);
+ //m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(m_pView);
+
+ // if selected object was hit, drag object
+ if ( pHdl!=NULL || m_rView.IsMarkedHit(m_aMDPos) )
+ {
+ bHandled = sal_True;
+ m_pParent->CaptureMouse();
+ m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, pHdl,&m_rView);
+ }
+ }
+ }
+ else if ( rMEvt.IsRight() && !rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) // mark object when context menu was selected
+ {
+ SdrPageView* pPV = m_rView.GetSdrPageView();
+ SdrViewEvent aVEvt;
+ if ( m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt) != SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() )
+ m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
+ if ( aVEvt.pRootObj )
+ m_rView.MarkObj(aVEvt.pRootObj, pPV);
+ else
+ m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
+
+ bHandled = sal_True;
+ }
+ else if( !rMEvt.IsLeft() )
+ bHandled = sal_True;
+ if ( !bHandled )
+ m_pParent->CaptureMouse();
+ return bHandled;
+}
+
+//----------------------------------------------------------------------------
+
+sal_Bool DlgEdFunc::MouseButtonUp( const MouseEvent& /*rMEvt*/ )
+{
+ sal_Bool bHandled = sal_False;
+ m_pParent->getSectionWindow()->getViewsWindow()->stopScrollTimer();
+ return bHandled;
+}
+// -----------------------------------------------------------------------------
+void DlgEdFunc::checkTwoCklicks(const MouseEvent& rMEvt)
+{
+ deactivateOle();
+
+ const sal_uInt16 nClicks = rMEvt.GetClicks();
+ if ( nClicks == 2 && rMEvt.IsLeft() )
+ {
+ if ( m_rView.AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ const SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+ activateOle(pObj);
+ } // if (rMarkList.GetMarkCount() == 1)
+ } // if ( pView->AreObjectsMarked() )
+ }
+}
+// -----------------------------------------------------------------------------
+void DlgEdFunc::stopScrollTimer()
+{
+ unColorizeOverlappedObj();
+ aScrollTimer.Stop();
+ if ( m_pParent->IsMouseCaptured() )
+ m_pParent->ReleaseMouse();
+}
+//----------------------------------------------------------------------------
+
+sal_Bool DlgEdFunc::MouseMove( const MouseEvent& /*rMEvt*/ )
+{
+ return sal_False;
+}
+//------------------------------------------------------------------------------
+sal_Bool DlgEdFunc::handleKeyEvent(const KeyEvent& _rEvent)
+{
+ sal_Bool bReturn = sal_False;
+
+ if ( !m_bUiActive )
+ {
+ const KeyCode& rCode = _rEvent.GetKeyCode();
+ sal_uInt16 nCode = rCode.GetCode();
+
+ switch ( nCode )
+ {
+ case KEY_ESCAPE:
+ {
+ if ( m_pParent->getSectionWindow()->getViewsWindow()->IsAction() )
+ {
+ m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
+ bReturn = sal_True;
+ }
+ else if ( m_rView.IsTextEdit() )
+ {
+ m_rView.SdrEndTextEdit();
+ bReturn = sal_True;
+ }
+ else if ( m_rView.AreObjectsMarked() )
+ {
+ const SdrHdlList& rHdlList = m_rView.GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+ if ( pHdl )
+ ((SdrHdlList&)rHdlList).ResetFocusHdl();
+ else
+ m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
+ //m_rView.UnmarkAll();
+
+ deactivateOle(true);
+ bReturn = sal_False;
+ }
+ else
+ {
+ deactivateOle(true);
+ }
+ }
+ break;
+ case KEY_TAB:
+ {
+ if ( !rCode.IsMod1() && !rCode.IsMod2() )
+ {
+ // mark next object
+ if ( !m_rView.MarkNextObj( !rCode.IsShift() ) )
+ {
+ // if no next object, mark first/last
+ m_rView.UnmarkAllObj();
+ m_rView.MarkNextObj( !rCode.IsShift() );
+ }
+
+ if ( m_rView.AreObjectsMarked() )
+ m_rView.MakeVisible( m_rView.GetAllMarkedRect(), *m_pParent);
+
+ bReturn = sal_True;
+ }
+ else if ( rCode.IsMod1() && rCode.IsMod2())
+ {
+ // selected handle
+ const SdrHdlList& rHdlList = m_rView.GetHdlList();
+ ((SdrHdlList&)rHdlList).TravelFocusHdl( !rCode.IsShift() );
+
+ // guarantee visibility of focused handle
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+ if ( pHdl )
+ {
+ Point aHdlPosition( pHdl->GetPos() );
+ Rectangle aVisRect( aHdlPosition - Point( DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE ), Size( 200, 200 ) );
+ m_rView.MakeVisible( aVisRect, *m_pParent);
+ }
+
+ bReturn = sal_True;
+ }
+ }
+ break;
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ {
+ m_pParent->getSectionWindow()->getViewsWindow()->handleKey(rCode);
+ bReturn = sal_True;
+ }
+ break;
+ case KEY_RETURN:
+ if ( !rCode.IsMod1() )
+ {
+ const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
+ if ( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ activateOle(pObj);
+ }
+ }
+ break;
+ case KEY_DELETE:
+ if ( !rCode.IsMod1() && !rCode.IsMod2() )
+ {
+ bReturn = sal_True;
+ break;
+ } // if ( !rCode.IsMod1() && !rCode.IsMod2() )
+ // run through
+ default:
+ {
+ bReturn = m_rView.KeyInput(_rEvent, m_pParent);
+ }
+ break;
+ }
+ }
+
+ if ( bReturn && m_pParent->IsMouseCaptured() )
+ m_pParent->ReleaseMouse();
+
+ return bReturn;
+}
+// -----------------------------------------------------------------------------
+void DlgEdFunc::activateOle(SdrObject* _pObj)
+{
+ if ( _pObj )
+ {
+ const sal_uInt16 nSdrObjKind = _pObj->GetObjIdentifier();
+ //
+ // OLE: activate
+ //
+ if (nSdrObjKind == OBJ_OLE2)
+ {
+ bool bIsInplaceOle = false;
+ if (!bIsInplaceOle)
+ {
+ SdrOle2Obj* pOleObj = dynamic_cast<SdrOle2Obj*>(_pObj);
+ if ( pOleObj->GetObjRef().is() )
+ {
+ if (m_rView.IsTextEdit())
+ {
+ m_rView.SdrEndTextEdit();
+ }
+
+ pOleObj->AddOwnLightClient();
+ pOleObj->SetWindow(VCLUnoHelper::GetInterface(m_pParent));
+ try
+ {
+ pOleObj->GetObjRef()->changeState( embed::EmbedStates::UI_ACTIVE );
+ m_bUiActive = true;
+ OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
+ m_bShowPropertyBrowser = rController.isCommandChecked(SID_SHOW_PROPERTYBROWSER);
+ if ( m_bShowPropertyBrowser )
+ rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
+ }
+ catch( uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ } // if (nSdrObjKind == OBJ_OLE2)
+ } // if ( _pObj )
+}
+// -----------------------------------------------------------------------------
+void DlgEdFunc::deactivateOle(bool _bSelect)
+{
+ OLEObjCache& rObjCache = GetSdrGlobalData().GetOLEObjCache();
+ const sal_uLong nCount = rObjCache.Count();
+ for(sal_uLong i = 0 ; i< nCount;++i)
+ {
+ SdrOle2Obj* pObj = reinterpret_cast<SdrOle2Obj*>(rObjCache.GetObject(i));
+ if ( m_pParent->getPage() == pObj->GetPage() )
+ {
+ uno::Reference< embed::XEmbeddedObject > xObj = pObj->GetObjRef();
+ if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
+ {
+ xObj->changeState( embed::EmbedStates::RUNNING );
+ m_bUiActive = false;
+ if ( m_bShowPropertyBrowser )
+ {
+ OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
+ rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
+ }
+
+ if ( _bSelect )
+ {
+ SdrPageView* pPV = m_rView.GetSdrPageView();
+ m_rView.MarkObj(pObj, pPV);
+ }
+ } // if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
+ }
+ } // for(sal_uLong i = 0 ; i< nCount;++i)
+}
+// -----------------------------------------------------------------------------
+void DlgEdFunc::colorizeOverlappedObject(SdrObject* _pOverlappedObj)
+{
+ OObjectBase* pObj = dynamic_cast<OObjectBase*>(_pOverlappedObj);
+ if ( pObj )
+ {
+ uno::Reference<report::XReportComponent> xComponent = pObj->getReportComponent();
+ if (xComponent.is() && xComponent != m_xOverlappingObj)
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(_pOverlappedObj->GetModel());
+ if ( pRptModel )
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+
+ // uncolorize an old object, if there is one
+ unColorizeOverlappedObj();
+
+ m_nOldColor = lcl_setColorOfObject(xComponent, m_nOverlappedControlColor);
+ m_xOverlappingObj = xComponent;
+ m_pOverlappingObj = _pOverlappedObj;
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void DlgEdFunc::unColorizeOverlappedObj()
+{
+ // uncolorize an old object, if there is one
+ if (m_xOverlappingObj.is())
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(m_pOverlappingObj->GetModel());
+ if ( pRptModel )
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+
+ lcl_setColorOfObject(m_xOverlappingObj, m_nOldColor);
+ m_xOverlappingObj = NULL;
+ m_pOverlappingObj = NULL;
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+bool DlgEdFunc::isOverlapping(const MouseEvent& rMEvt)
+{
+ bool bOverlapping = false;
+ SdrViewEvent aVEvt;
+ bOverlapping = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONUP, aVEvt) != SDRHIT_NONE;
+ if (bOverlapping && aVEvt.pObj)
+ {
+ colorizeOverlappedObject(aVEvt.pObj);
+ }
+ else
+ {
+ unColorizeOverlappedObj();
+ }
+
+ return bOverlapping;
+}
+// -----------------------------------------------------------------------------
+void DlgEdFunc::checkMovementAllowed(const MouseEvent& rMEvt)
+{
+ if ( m_pParent->getSectionWindow()->getViewsWindow()->IsDragObj() )
+ {
+ if ( isRectangleHit(rMEvt) )
+ {
+ // there is an other component under use, break action
+ m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
+ }
+ // object was dragged
+ Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
+ if (m_bSelectionMode)
+ {
+ m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
+ }
+ else
+ {
+ bool bControlKeyPressed = rMEvt.IsMod1();
+ // Don't allow points smaller 0
+ if (bControlKeyPressed && (aPnt.Y() < 0))
+ {
+ aPnt.Y() = 0;
+ }
+ if (m_rView.IsDragResize())
+ {
+ // we resize the object don't resize to above sections
+ if ( aPnt.Y() < 0 )
+ {
+ aPnt.Y() = 0;
+ }
+ }
+ m_pParent->getSectionWindow()->getViewsWindow()->EndDragObj( bControlKeyPressed, &m_rView, aPnt );
+ }
+ m_pParent->getSectionWindow()->getViewsWindow()->ForceMarkedToAnotherPage();
+ m_pParent->Invalidate(INVALIDATE_CHILDREN);
+ }
+ else
+ m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
+}
+// -----------------------------------------------------------------------------
+bool DlgEdFunc::isOnlyCustomShapeMarked()
+{
+ bool bReturn = true;
+ const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
+ for (sal_uInt32 i = 0; i < rMarkList.GetMarkCount();++i )
+ {
+ SdrMark* pMark = rMarkList.GetMark(i);
+ // bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+ if (pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE)
+ {
+ // we found an object in the marked objects, which is not a custom shape.
+ bReturn = false;
+ break;
+ }
+ }
+ return bReturn;
+}
+// -----------------------------------------------------------------------------
+bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt)
+{
+ if (isOnlyCustomShapeMarked())
+ {
+ return false;
+ }
+
+ SdrViewEvent aVEvt;
+ const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEMOVE, aVEvt);
+ bool bIsSetPoint = (eHit == SDRHIT_UNMARKEDOBJECT);
+ if ( !bIsSetPoint )
+ {
+ // no drag rect, we have to check every single select rect
+ //const Rectangle& rRect = m_rView.GetDragStat().GetActionRect();
+ const SdrDragStat& rDragStat = m_rView.GetDragStat();
+ if (rDragStat.GetDragMethod() != NULL)
+ {
+ SdrObjListIter aIter(*m_pParent->getPage(),IM_DEEPNOGROUPS);
+ SdrObject* pObjIter = NULL;
+ // loop through all marked objects and check if there new rect overlapps an old one.
+ while( (pObjIter = aIter.Next()) != NULL && !bIsSetPoint)
+ {
+ if ( m_rView.IsObjMarked(pObjIter)
+ && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ {
+ Rectangle aNewRect = pObjIter->GetLastBoundRect();
+ long nDx = rDragStat.IsHorFixed() ? 0 : rDragStat.GetDX();
+ long nDy = rDragStat.IsVerFixed() ? 0 : rDragStat.GetDY();
+ if ( (nDx + aNewRect.Left()) < 0 )
+ nDx = -aNewRect.Left();
+ if ( (nDy + aNewRect.Top()) < 0 )
+ nDy = -aNewRect.Top();
+
+ if ( rDragStat.GetDragMethod()->getMoveOnly() )
+ aNewRect.Move(nDx,nDy);
+ else
+ ::ResizeRect(aNewRect,rDragStat.GetRef1(),rDragStat.GetXFact(),rDragStat.GetYFact());
+
+
+ SdrObject* pObjOverlapped = isOver(aNewRect,*m_pParent->getPage(),m_rView,false,pObjIter, ISOVER_IGNORE_CUSTOMSHAPES);
+ bIsSetPoint = pObjOverlapped ? true : false;
+ if (pObjOverlapped && !m_bSelectionMode)
+ {
+ colorizeOverlappedObject(pObjOverlapped);
+ }
+ }
+ }
+ }
+ }
+ else if ( aVEvt.pObj && !m_bSelectionMode)
+ {
+ colorizeOverlappedObject(aVEvt.pObj);
+ }
+ return bIsSetPoint;
+}
+// -----------------------------------------------------------------------------
+bool DlgEdFunc::setMovementPointer(const MouseEvent& rMEvt)
+{
+ bool bIsSetPoint = isRectangleHit(rMEvt);
+ if ( bIsSetPoint )
+ m_pParent->SetPointer( Pointer(POINTER_NOTALLOWED));
+ else
+ {
+ bool bCtrlKey = rMEvt.IsMod1();
+ (void)bCtrlKey;
+ if (bCtrlKey)
+ {
+ m_pParent->SetPointer( Pointer(POINTER_MOVEDATALINK ));
+ bIsSetPoint = true;
+ }
+ }
+ return bIsSetPoint;
+}
+//----------------------------------------------------------------------------
+
+DlgEdFuncInsert::DlgEdFuncInsert( OReportSection* _pParent ) :
+ DlgEdFunc( _pParent )
+{
+ m_rView.SetCreateMode( sal_True );
+}
+
+//----------------------------------------------------------------------------
+
+DlgEdFuncInsert::~DlgEdFuncInsert()
+{
+ m_rView.SetEditMode( sal_True );
+}
+
+//----------------------------------------------------------------------------
+
+sal_Bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( DlgEdFunc::MouseButtonDown(rMEvt) )
+ return sal_True;
+
+ SdrViewEvent aVEvt;
+ sal_Int16 nId = m_rView.GetCurrentObjIdentifier();
+
+ const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+// eHit == SDRHIT_UNMARKEDOBJECT under the mouse cursor is a unmarked object
+
+ if (eHit == SDRHIT_UNMARKEDOBJECT &&
+ nId != OBJ_CUSTOMSHAPE)
+ {
+ // there is an object under the mouse cursor, but not a customshape
+ // rtl::OUString suWasN = m_rView.getInsertObjString();
+ // rtl::OUString suWasN2 = m_pParent->getSectionWindow()->getViewsWindow()->GetInsertObjString();
+
+ m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
+ return sal_False;
+ }
+
+ if( eHit != SDRHIT_UNMARKEDOBJECT || nId == OBJ_CUSTOMSHAPE)
+ {
+ // if no action, create object
+ if ( !m_pParent->getSectionWindow()->getViewsWindow()->IsAction() )
+ {
+ deactivateOle(true);
+ if ( m_pParent->getSectionWindow()->getViewsWindow()->HasSelection() )
+ m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView);
+ m_rView.BegCreateObj(m_aMDPos);
+ m_pParent->getSectionWindow()->getViewsWindow()->createDefault();
+ }
+ }
+ else
+ {
+ if( !rMEvt.IsShift() )
+ {
+ // shift key pressed?
+ m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
+ }
+ m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos,&m_rView );
+ }
+
+ return sal_True;
+}
+
+//----------------------------------------------------------------------------
+sal_Bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
+ return sal_True;
+
+ const Point aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
+ const sal_uInt16 nHitLog = sal_uInt16 ( m_pParent->PixelToLogic(Size(3,0)).Width() );
+
+ sal_Bool bReturn = sal_True;
+ // object creation active?
+ if ( m_rView.IsCreateObj() )
+ {
+ if ( isOver(m_rView.GetCreateObj(),*m_pParent->getPage(),m_rView) )
+ {
+ m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
+ // BrkAction disables the create mode
+ m_rView.SetCreateMode( sal_True );
+ return sal_True;
+ }
+
+ m_rView.EndCreateObj(SDRCREATE_FORCEEND);
+
+ if ( !m_rView.AreObjectsMarked() )
+ {
+ m_rView.MarkObj(aPos, nHitLog);
+ }
+
+ bReturn = m_rView.AreObjectsMarked();
+ if ( bReturn )
+ {
+ OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
+ const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
+ for (sal_uInt32 i = 0; i < rMarkList.GetMarkCount();++i )
+ {
+ SdrMark* pMark = rMarkList.GetMark(i);
+ // bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
+ OOle2Obj* pObj = dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj());
+ if ( pObj && !pObj->IsEmpty() )
+ {
+ pObj->initializeChart(rController.getModel());
+ }
+ }
+ }
+ }
+ else
+ checkMovementAllowed(rMEvt);
+
+ if ( !m_rView.AreObjectsMarked() &&
+ Abs(m_aMDPos.X() - aPos.X()) < nHitLog &&
+ Abs(m_aMDPos.Y() - aPos.Y()) < nHitLog &&
+ !rMEvt.IsShift() && !rMEvt.IsMod2() )
+ {
+ SdrPageView* pPV = m_rView.GetSdrPageView();
+ SdrViewEvent aVEvt;
+ m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ m_rView.MarkObj(aVEvt.pRootObj, pPV);
+ } // ift() && !rMEvt.IsMod2() )
+ checkTwoCklicks(rMEvt);
+ m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
+ return bReturn;
+}
+
+//----------------------------------------------------------------------------
+
+sal_Bool DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( DlgEdFunc::MouseMove(rMEvt ) )
+ return sal_True;
+ Point aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( m_rView.IsCreateObj() )
+ {
+ m_rView.SetOrtho(SdrObjCustomShape::doConstructOrthogonal(m_rView.getReportSection()->getSectionWindow()->getViewsWindow()->getShapeType()) ? !rMEvt.IsShift() : rMEvt.IsShift());
+ m_rView.SetAngleSnapEnabled(rMEvt.IsShift());
+ }
+
+ bool bIsSetPoint = false;
+ if ( m_rView.IsAction() )
+ {
+ if ( m_rView.IsDragResize() )
+ {
+ // we resize the object don't resize to above sections
+ if ( aPos.Y() < 0 )
+ {
+ aPos.Y() = 0;
+ }
+ }
+ bIsSetPoint = setMovementPointer(rMEvt);
+ ForceScroll(aPos);
+ m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPos,&m_rView, m_rView.GetDragMethod() == NULL, false);
+ }
+
+ //if ( isOver(m_rView.GetCreateObj(),*m_pParent->getPage(),*m_pView) )
+ // m_pParent->SetPointer( Pointer(POINTER_NOTALLOWED));
+ //else
+ if ( !bIsSetPoint )
+ m_pParent->SetPointer( m_rView.GetPreferedPointer( aPos, m_pParent) );
+
+ return sal_True;
+}
+
+//----------------------------------------------------------------------------
+
+DlgEdFuncSelect::DlgEdFuncSelect( OReportSection* _pParent ) :
+ DlgEdFunc( _pParent )
+{
+}
+
+//----------------------------------------------------------------------------
+
+DlgEdFuncSelect::~DlgEdFuncSelect()
+{
+}
+
+//----------------------------------------------------------------------------
+
+sal_Bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ m_bSelectionMode = false;
+ if ( DlgEdFunc::MouseButtonDown(rMEvt) )
+ return sal_True;
+
+ SdrViewEvent aVEvt;
+ const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ if( eHit == SDRHIT_UNMARKEDOBJECT )
+ {
+ // if not multi selection, unmark all
+ if ( !rMEvt.IsShift() )
+ m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
+
+ if ( m_rView.MarkObj(m_aMDPos) && rMEvt.IsLeft() )
+ {
+ // drag object
+ m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, m_rView.PickHandle(m_aMDPos), &m_rView);
+ }
+ else
+ {
+ // select object
+ m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj(m_aMDPos,&m_rView);
+ }
+ }
+ else
+ {
+ if( !rMEvt.IsShift() )
+ m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
+ //m_rView.UnmarkAll();
+
+ if ( rMEvt.GetClicks() == 1 )
+ {
+ m_bSelectionMode = true;
+ m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos ,&m_rView);
+ }
+ else
+ {
+ m_rView.SdrBeginTextEdit( aVEvt.pRootObj,m_rView.GetSdrPageView(),m_pParent,sal_False );
+ }
+ }
+
+ return sal_True;
+}
+
+//----------------------------------------------------------------------------
+
+sal_Bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
+ return sal_True;
+
+ // get view from parent
+ const Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( rMEvt.IsLeft() ) // left mousebutton pressed
+ checkMovementAllowed(rMEvt);
+
+ m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
+ checkTwoCklicks(rMEvt);
+
+ m_pParent->SetPointer( m_rView.GetPreferedPointer( aPnt, m_pParent) );
+
+ if ( !m_bUiActive )
+ m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
+ m_bSelectionMode = false;
+ return sal_True;
+}
+
+//----------------------------------------------------------------------------
+
+sal_Bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( DlgEdFunc::MouseMove(rMEvt ) )
+ return sal_True;
+
+ Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
+ bool bIsSetPoint = false;
+
+ if ( m_rView.IsAction() ) // Drag Mode
+ {
+ bIsSetPoint = setMovementPointer(rMEvt);
+ ForceScroll(aPnt);
+ if (m_rView.GetDragMethod()==NULL)
+ {
+ // create a selection
+ m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, true, false);
+ }
+ else
+ {
+ if ( m_rView.IsDragResize() )
+ {
+ // we resize the object don't resize to above sections
+ if ( aPnt.Y() < 0 )
+ {
+ aPnt.Y() = 0;
+ }
+ // grow section if it is under the current section
+// else
+// {
+// const Size& aSectionSize = m_rView->GetSizePixel();
+// if ( aPnt.Y() > aSectionSize.Height() )
+// {
+// aPnt.Y() = aSectionSize.Height();
+// }
+// }
+ }
+ // drag or resize an object
+ bool bControlKey = rMEvt.IsMod1();
+ m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, false, bControlKey);
+ }
+ }
+
+ if ( !bIsSetPoint )
+ {
+ m_pParent->SetPointer( m_rView.GetPreferedPointer( aPnt, m_pParent) );
+
+ // restore color
+ unColorizeOverlappedObj();
+ }
+
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+//void DlgEdFuncSelect::SetInEditMode(SdrTextObj* _pTextObj,const MouseEvent& rMEvt, sal_Bool bQuickDrag)
+//{
+//
+// SdrPageView* pPV = m_rView.GetSdrPageView();
+// if( _pTextObj && _pTextObj->GetPage() == pPV->GetPage() )
+// {
+// m_rView.SetCurrentObj(OBJ_TEXT);
+// m_rView.SetEditMode(SDREDITMODE_EDIT);
+//
+// sal_Bool bEmptyOutliner = sal_False;
+//
+// if (!_pTextObj->GetOutlinerParaObject() && m_rView.GetTextEditOutliner())
+// {
+// ::SdrOutliner* pOutl = m_rView.GetTextEditOutliner();
+// sal_uLong nParaAnz = pOutl->GetParagraphCount();
+// Paragraph* p1stPara = pOutl->GetParagraph( 0 );
+//
+// if (nParaAnz==1 && p1stPara)
+// {
+// // Bei nur einem Pararaph
+// if (pOutl->GetText(p1stPara).Len() == 0)
+// {
+// bEmptyOutliner = sal_True;
+// }
+// }
+// }
+//
+// if (_pTextObj != m_rView.GetTextEditObject() || bEmptyOutliner)
+// {
+// sal_uInt32 nInv = _pTextObj->GetObjInventor();
+// sal_uInt16 nSdrObjKind = _pTextObj->GetObjIdentifier();
+//
+// if (nInv == SdrInventor && _pTextObj->HasTextEdit() &&
+// (nSdrObjKind == OBJ_TEXT ||
+// nSdrObjKind == OBJ_TITLETEXT ||
+// nSdrObjKind == OBJ_OUTLINETEXT ||
+// (_pTextObj->ISA(SdrTextObj) && !_pTextObj->IsEmptyPresObj())))
+// {
+// // Neuen Outliner machen (gehoert der SdrObjEditView)
+// SdrModel* pModel = _pTextObj->GetModel();
+// SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, pModel );
+// pOutl->SetMinDepth(0);
+// pOutl->SetStyleSheetPool((SfxStyleSheetPool*) pModel->GetStyleSheetPool());
+// //pOutl->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
+// sal_uLong nCntrl = pOutl->GetControlWord();
+// nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
+// nCntrl |= EE_CNTRL_URLSFXEXECUTE;
+// nCntrl |= EE_CNTRL_MARKFIELDS;
+// nCntrl |= EE_CNTRL_AUTOCORRECT;
+//
+// nCntrl &= ~EE_CNTRL_ULSPACESUMMATION;
+// //if ( pModel->IsSummationOfParagraphs() )
+// // nCntrl |= EE_CNTRL_ULSPACESUMMATION;
+//
+// //SetSpellOptions( nCntrl );
+//
+// pOutl->SetControlWord(nCntrl);
+//
+// uno::Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+// if ( xSpellChecker.is() )
+// pOutl->SetSpeller( xSpellChecker );
+//
+// uno::Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+// if( xHyphenator.is() )
+// pOutl->SetHyphenator( xHyphenator );
+//
+// pOutl->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
+//
+// // in einem Gliederungstext darf nicht auf die 0-te
+// // Ebene ausgerueckt werden
+// if (_pTextObj->GetObjInventor() == SdrInventor &&
+// _pTextObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
+// {
+// pOutl->SetMinDepth(1);
+// }
+//
+// if (bEmptyOutliner)
+// {
+// m_rView.SdrEndTextEdit(sal_True);
+// }
+//
+// if( _pTextObj )
+// {
+// OutlinerParaObject* pOPO = _pTextObj->GetOutlinerParaObject();
+// if( ( pOPO && pOPO->IsVertical() ) /*||
+// nSlotId == SID_ATTR_CHAR_VERTICAL ||
+// nSlotId == SID_TEXT_FITTOSIZE_VERTICAL */)
+// pOutl->SetVertical( sal_True );
+//
+//
+// if (m_rView.SdrBeginTextEdit(_pTextObj, pPV, pParent, sal_True, pOutl) && _pTextObj->GetObjInventor() == SdrInventor)
+// {
+// //bFirstObjCreated = sal_True;
+// //DeleteDefaultText();
+//
+// OutlinerView* pOLV = m_rView.GetTextEditOutlinerView();
+//
+// nSdrObjKind = _pTextObj->GetObjIdentifier();
+//
+// SdrViewEvent aVEvt;
+// SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+//
+// if (eHit == SDRHIT_TEXTEDIT)
+// {
+// // Text getroffen
+// if (nSdrObjKind == OBJ_TEXT ||
+// nSdrObjKind == OBJ_TITLETEXT ||
+// nSdrObjKind == OBJ_OUTLINETEXT ||
+// //nSlotId == SID_TEXTEDIT ||
+// !bQuickDrag)
+// {
+// pOLV->MouseButtonDown(rMEvt);
+// pOLV->MouseMove(rMEvt);
+// pOLV->MouseButtonUp(rMEvt);
+// }
+//
+// if ( bQuickDrag && _pTextObj->GetOutlinerParaObject())
+// {
+// pOLV->MouseButtonDown(rMEvt);
+// }
+// }
+// else
+// {
+// // #98198# Move cursor to end of text
+// ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
+// pOLV->SetSelection(aNewSelection);
+// }
+// }
+// else
+// {
+// //RestoreDefaultText();
+// }
+// }
+// }
+// }
+// }
+// else
+// _pTextObj = NULL;
+//}
+
+
+//----------------------------------------------------------------------------
+}
diff --git a/reportdesign/source/ui/report/makefile.mk b/reportdesign/source/ui/report/makefile.mk
new file mode 100644
index 000000000000..3c19923f4c19
--- /dev/null
+++ b/reportdesign/source/ui/report/makefile.mk
@@ -0,0 +1,72 @@
+#*************************************************************************
+#
+# 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=report
+
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+# .INCLUDE : $(PRJ)$/util$/dll.pmk
+
+IMGLST_SRS=$(SRS)$/$(TARGET).srs
+# --- Files --------------------------------------------------------
+
+SLOFILES =\
+ $(SLO)$/SectionWindow.obj \
+ $(SLO)$/ReportController.obj \
+ $(SLO)$/ReportControllerObserver.obj \
+ $(SLO)$/FormattedFieldBeautifier.obj \
+ $(SLO)$/FixedTextColor.obj \
+ $(SLO)$/ReportSection.obj \
+ $(SLO)$/SectionView.obj \
+ $(SLO)$/ViewsWindow.obj \
+ $(SLO)$/ScrollHelper.obj \
+ $(SLO)$/StartMarker.obj \
+ $(SLO)$/EndMarker.obj \
+ $(SLO)$/dlgedfunc.obj \
+ $(SLO)$/dlgedfac.obj \
+ $(SLO)$/dlgedclip.obj \
+ $(SLO)$/ReportWindow.obj \
+ $(SLO)$/DesignView.obj \
+ $(SLO)$/propbrw.obj
+
+
+SRS1NAME=$(TARGET)
+SRC1FILES = report.src
+
+# --- Targets -------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
+$(SRS)$/$(TARGET).srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
new file mode 100644
index 000000000000..c737ce5c3f34
--- /dev/null
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -0,0 +1,619 @@
+/*************************************************************************
+ *
+ * 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 "propbrw.hxx"
+#include "RptObject.hxx"
+#include "ReportController.hxx"
+#include <cppuhelper/component_context.hxx>
+#ifndef _REPORT_DLGRESID_HRC
+#include <RptResId.hrc>
+#endif
+#ifndef _RPTUI_SLOTID_HRC_
+#include "rptui_slotid.hrc"
+#endif
+#include <tools/debug.hxx>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/inspection/ObjectInspector.hpp>
+#include <com/sun/star/inspection/DefaultHelpProvider.hpp>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <vcl/stdtext.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svditer.hxx>
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/unohlp.hxx>
+#endif
+#include <comphelper/property.hxx>
+#include <comphelper/namecontainer.hxx>
+#include <comphelper/composedprops.hxx>
+#include <comphelper/stl_types.hxx>
+#include <comphelper/types.hxx>
+#include <comphelper/sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/report/inspection/DefaultComponentInspectorModel.hpp>
+#include <comphelper/processfactory.hxx>
+#include "SectionView.hxx"
+#include "ReportSection.hxx"
+#ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
+#include "uistrings.hrc"
+#endif
+#include "DesignView.hxx"
+#include "ViewsWindow.hxx"
+#include "UITools.hxx"
+#include <unotools/confignode.hxx>
+
+namespace rptui
+{
+#define STD_WIN_SIZE_X 300
+#define STD_WIN_SIZE_Y 350
+
+using namespace ::com::sun::star;
+using namespace uno;
+using namespace lang;
+using namespace frame;
+using namespace beans;
+using namespace container;
+using namespace ::comphelper;
+
+//----------------------------------------------------------------------------
+//-----------------------------------------------------------------------
+namespace
+{
+ static bool lcl_shouldEnableHelpSection( const Reference< XMultiServiceFactory >& _rxFactory )
+ {
+ const ::rtl::OUString sConfigName( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.ReportDesign/PropertyBrowser/" ) );
+ const ::rtl::OUString sPropertyName( RTL_CONSTASCII_USTRINGPARAM( "DirectHelp" ) );
+
+ ::utl::OConfigurationTreeRoot aConfiguration(
+ ::utl::OConfigurationTreeRoot::createWithServiceFactory( _rxFactory, sConfigName ) );
+
+ bool bEnabled = false;
+ OSL_VERIFY( aConfiguration.getNodeValue( sPropertyName ) >>= bEnabled );
+ return bEnabled;
+ }
+}
+//-----------------------------------------------------------------------
+//============================================================================
+// PropBrw
+//============================================================================
+
+DBG_NAME( rpt_PropBrw )
+
+//----------------------------------------------------------------------------
+
+PropBrw::PropBrw(const Reference< XMultiServiceFactory >& _xORB,Window* pParent,ODesignView* _pDesignView)
+ :DockingWindow(pParent,WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_3DLOOK|WB_ROLLABLE))
+ ,m_xORB(_xORB)
+ ,m_pDesignView(_pDesignView)
+ ,m_pView( NULL )
+ ,m_bInitialStateChange(sal_True)
+{
+ DBG_CTOR( rpt_PropBrw,NULL);
+
+ Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y);
+ SetOutputSizePixel(aPropWinSize);
+
+ try
+ {
+ // create a frame wrapper for myself
+ m_xMeAsFrame = Reference< XFrame >(m_xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame"))), UNO_QUERY);
+ if (m_xMeAsFrame.is())
+ {
+ m_xMeAsFrame->initialize( VCLUnoHelper::GetInterface ( this ) );
+ m_xMeAsFrame->setName(::rtl::OUString::createFromAscii("report property browser")); // change name!
+ }
+ }
+ catch (Exception&)
+ {
+ DBG_ERROR("PropBrw::PropBrw: could not create/initialize my frame!");
+ m_xMeAsFrame.clear();
+ }
+
+ if (m_xMeAsFrame.is())
+ {
+ Reference< XComponentContext > xOwnContext;
+ try
+ {
+ // our own component context
+ Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW );
+ xOwnContext.set(
+ xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
+ UNO_QUERY_THROW );
+
+ /*uno::Reference< XComponent> xModel = new OContextHelper(m_xORB,uno::Reference< XComponent>(m_pDesignView->getController().getModel(),uno::UNO_QUERY) );
+ uno::Reference< XComponent> xDialogParentWindow = new OContextHelper(m_xORB,uno::Reference< XComponent>(VCLUnoHelper::GetInterface ( this ),uno::UNO_QUERY) );
+ uno::Reference< XComponent> xConnection = new OContextHelper(m_xORB,uno::Reference< XComponent>(m_pDesignView->getController().getConnection(),uno::UNO_QUERY) );*/
+ // a ComponentContext for the
+ ::cppu::ContextEntry_Init aHandlerContextInfo[] =
+ {
+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_pDesignView->getController().getModel() )),
+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface ( this ) )),
+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) ), makeAny( m_pDesignView->getController().getConnection() ) ),
+ };
+ m_xInspectorContext.set(
+ ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
+ xOwnContext ) );
+ // create a property browser controller
+ bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB );
+ Reference< inspection::XObjectInspectorModel> xInspectorModel( bEnableHelpSection
+ ? report::inspection::DefaultComponentInspectorModel::createWithHelpSection( m_xInspectorContext, 3, 8 )
+ : report::inspection::DefaultComponentInspectorModel::createDefault( m_xInspectorContext ) );
+
+ m_xBrowserController = inspection::ObjectInspector::createWithModel(m_xInspectorContext, xInspectorModel);
+ if ( !m_xBrowserController.is() )
+ {
+ const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.inspection.ObjectInspector" ) );
+ ShowServiceNotAvailableError(pParent, sServiceName, sal_True);
+ }
+ else
+ {
+ m_xBrowserController->attachFrame(m_xMeAsFrame);
+ m_xBrowserComponentWindow = m_xMeAsFrame->getComponentWindow();
+ OSL_ENSURE(m_xBrowserComponentWindow.is(), "PropBrw::PropBrw: attached the controller, but have no component window!");
+ if ( bEnableHelpSection )
+ {
+ uno::Reference< inspection::XObjectInspector > xInspector( m_xBrowserController, uno::UNO_QUERY_THROW );
+ uno::Reference< inspection::XObjectInspectorUI > xInspectorUI( xInspector->getInspectorUI() );
+ uno::Reference< uno::XInterface > xDefaultHelpProvider( inspection::DefaultHelpProvider::create( m_xInspectorContext, xInspectorUI ) );
+ }
+ }
+ xFactoryProperties->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ,makeAny(xOwnContext));
+ }
+ catch (Exception&)
+ {
+ DBG_ERROR("PropBrw::PropBrw: could not create/initialize the browser controller!");
+ try
+ {
+ ::comphelper::disposeComponent(m_xBrowserController);
+ ::comphelper::disposeComponent(m_xBrowserComponentWindow);
+ Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW );
+ if ( xOwnContext.is() )
+ xFactoryProperties->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ,makeAny(xOwnContext));
+ }
+ catch(Exception&) { }
+ m_xBrowserController.clear();
+ m_xBrowserComponentWindow.clear();
+ }
+ }
+
+ if (m_xBrowserComponentWindow.is())
+ {
+
+ m_xBrowserComponentWindow->setPosSize(0, 0, aPropWinSize.Width(), aPropWinSize.Height(),
+ awt::PosSize::WIDTH | awt::PosSize::HEIGHT | awt::PosSize::X | awt::PosSize::Y);
+ Resize();
+ m_xBrowserComponentWindow->setVisible(sal_True);
+ }
+ ::rptui::notifySystemWindow(pParent,this,::comphelper::mem_fun(&TaskPaneList::AddWindow));
+}
+
+//----------------------------------------------------------------------------
+
+PropBrw::~PropBrw()
+{
+ if (m_xBrowserController.is())
+ implDetachController();
+
+ try
+ {
+ uno::Reference<container::XNameContainer> xName(m_xInspectorContext,uno::UNO_QUERY);
+ if ( xName.is() )
+ {
+ const ::rtl::OUString pProps[] = { ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) )
+ , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) )
+ , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) )};
+ for (size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i)
+ xName->removeByName(pProps[i]);
+ }
+ }
+ catch(Exception&)
+ {}
+
+ ::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
+
+ DBG_DTOR( rpt_PropBrw,NULL);
+}
+// -----------------------------------------------------------------------------
+void PropBrw::setCurrentPage(const ::rtl::OUString& _sLastActivePage)
+{
+ m_sLastActivePage = _sLastActivePage;
+}
+//----------------------------------------------------------------------------
+
+void PropBrw::implDetachController()
+{
+ m_sLastActivePage = getCurrentPage();
+ implSetNewObject( );
+
+ if ( m_xMeAsFrame.is() )
+ m_xMeAsFrame->setComponent( NULL, NULL );
+
+ if ( m_xBrowserController.is() )
+ m_xBrowserController->attachFrame( NULL );
+
+ m_xMeAsFrame.clear();
+ m_xBrowserController.clear();
+ m_xBrowserComponentWindow.clear();
+}
+//-----------------------------------------------------------------------
+::rtl::OUString PropBrw::getCurrentPage() const
+{
+ ::rtl::OUString sCurrentPage;
+ try
+ {
+ if ( m_xBrowserController.is() )
+ {
+ OSL_VERIFY( m_xBrowserController->getViewData() >>= sCurrentPage );
+ }
+
+ if ( !sCurrentPage.getLength() )
+ sCurrentPage = m_sLastActivePage;
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "PropBrw::getCurrentPage: caught an exception while retrieving the current page!" );
+ }
+ return sCurrentPage;
+}
+//----------------------------------------------------------------------------
+
+sal_Bool PropBrw::Close()
+{
+ m_xLastSection.clear();
+ // suspend the controller (it is allowed to veto)
+ if ( m_xMeAsFrame.is() )
+ {
+ try
+ {
+ Reference< XController > xController( m_xMeAsFrame->getController() );
+ if ( xController.is() && !xController->suspend( sal_True ) )
+ return sal_False;
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmPropBrw::Close: caught an exception while asking the controller!" );
+ }
+ }
+ implDetachController();
+
+ if( IsRollUp() )
+ RollDown();
+
+ m_pDesignView->getController().executeUnChecked(SID_PROPERTYBROWSER_LAST_PAGE,uno::Sequence< beans::PropertyValue>());
+
+ return sal_True;
+}
+
+//----------------------------------------------------------------------------
+
+uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const SdrMarkList& _rMarkList)
+{
+ sal_uInt32 nMarkCount = _rMarkList.GetMarkCount();
+ ::std::vector< uno::Reference< uno::XInterface> > aSets;
+ aSets.reserve(nMarkCount);
+
+ for(sal_uInt32 i=0;i<nMarkCount;++i)
+ {
+ SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj();
+
+ ::std::auto_ptr<SdrObjListIter> pGroupIterator;
+ if (pCurrent->IsGroupObject())
+ {
+ pGroupIterator.reset(new SdrObjListIter(*pCurrent->GetSubList()));
+ pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
+ }
+
+ while (pCurrent)
+ {
+ OObjectBase* pObj = dynamic_cast<OObjectBase*>(pCurrent);
+ if ( pObj )
+ aSets.push_back(CreateComponentPair(pObj));
+
+ // next element
+ pCurrent = pGroupIterator.get() && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
+ }
+ }
+ Reference<uno::XInterface> *pSets = aSets.empty() ? NULL : &aSets[0];
+ return uno::Sequence< Reference<uno::XInterface> >(pSets, aSets.size());
+}
+//----------------------------------------------------------------------------
+void PropBrw::implSetNewObject( const uno::Sequence< Reference<uno::XInterface> >& _aObjects )
+{
+ if ( m_xBrowserController.is() )
+ {
+ try
+ {
+ m_xBrowserController->inspect(uno::Sequence< Reference<uno::XInterface> >());
+ m_xBrowserController->inspect(_aObjects);
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmPropBrw::StateChanged: caught an exception while setting the initial page!" );
+ }
+
+ //Resize();
+ }
+ SetText( GetHeadlineName(_aObjects) );
+}
+
+//----------------------------------------------------------------------------
+
+::rtl::OUString PropBrw::GetHeadlineName( const uno::Sequence< Reference<uno::XInterface> >& _aObjects )
+{
+ ::rtl::OUString aName;
+ if ( !_aObjects.getLength() )
+ {
+ aName = String(ModuleRes(RID_STR_BRWTITLE_NO_PROPERTIES));
+ }
+ else if ( _aObjects.getLength() == 1 ) // single selection
+ {
+ sal_uInt16 nResId = 0;
+ aName = String(ModuleRes(RID_STR_BRWTITLE_PROPERTIES));
+
+ uno::Reference< container::XNameContainer > xNameCont(_aObjects[0],uno::UNO_QUERY);
+ Reference< lang::XServiceInfo > xServiceInfo( xNameCont->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReportComponent"))), UNO_QUERY );
+ if ( xServiceInfo.is() )
+ {
+ if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ) )
+ {
+ nResId = RID_STR_PROPTITLE_FIXEDTEXT;
+ }
+ else if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL ) )
+ {
+ nResId = RID_STR_PROPTITLE_IMAGECONTROL;
+ }
+ else if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ) )
+ {
+ nResId = RID_STR_PROPTITLE_FORMATTED;
+ }
+ else if ( xServiceInfo->supportsService( SERVICE_SHAPE ) )
+ {
+ nResId = RID_STR_PROPTITLE_SHAPE;
+ }
+ else if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) )
+ {
+ nResId = RID_STR_PROPTITLE_REPORT;
+ }
+ else if ( xServiceInfo->supportsService( SERVICE_SECTION ) )
+ {
+ nResId = RID_STR_PROPTITLE_SECTION;
+ }
+ else if ( xServiceInfo->supportsService( SERVICE_FUNCTION ) )
+ {
+ nResId = RID_STR_PROPTITLE_FUNCTION;
+ }
+ else if ( xServiceInfo->supportsService( SERVICE_GROUP ) )
+ {
+ nResId = RID_STR_PROPTITLE_GROUP;
+ }
+ else if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE ) )
+ {
+ nResId = RID_STR_PROPTITLE_FIXEDLINE;
+ }
+ else
+ {
+ OSL_ENSURE(0,"Unknown service name!");
+ nResId = RID_STR_CLASS_FORMATTEDFIELD;
+ }
+
+ if (nResId)
+ {
+ aName += String(ModuleRes(nResId));
+ }
+ }
+ }
+ else // multiselection
+ {
+ aName = String(ModuleRes(RID_STR_BRWTITLE_PROPERTIES));
+ aName += String(ModuleRes(RID_STR_BRWTITLE_MULTISELECT));
+ }
+
+ return aName;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(OObjectBase* _pObj)
+{
+ _pObj->initializeOle();
+ return CreateComponentPair(_pObj->getAwtComponent(),_pObj->getReportComponent());
+}
+//----------------------------------------------------------------------------
+uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(const uno::Reference< uno::XInterface>& _xFormComponent
+ ,const uno::Reference< uno::XInterface>& _xReportComponent)
+{
+ uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast<Reference<XInterface> * >(NULL)));
+ xNameCont->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FormComponent")),uno::makeAny(_xFormComponent));
+ xNameCont->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReportComponent")),uno::makeAny(_xReportComponent));
+ xNameCont->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RowSet"))
+ ,uno::makeAny(uno::Reference< uno::XInterface>(m_pDesignView->getController().getRowSet())));
+
+ return xNameCont.get();
+}
+// -----------------------------------------------------------------------------
+::Size PropBrw::getMinimumSize() const
+{
+ ::Size aSize;
+ Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY );
+ if( xLayoutConstrains.is() )
+ {
+ awt::Size aMinSize = xLayoutConstrains->getMinimumSize();
+ aMinSize.Height += 4;
+ aMinSize.Width += 4;
+ aSize.setHeight( aMinSize.Height );
+ aSize.setWidth( aMinSize.Width );
+ }
+ return aSize;
+}
+//----------------------------------------------------------------------------
+void PropBrw::Resize()
+{
+ Window::Resize();
+
+ Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY );
+ if( xLayoutConstrains.is() )
+ {
+ ::Size aMinSize = getMinimumSize();
+ SetMinOutputSizePixel( aMinSize );
+ ::Size aSize = GetOutputSizePixel();
+ sal_Bool bResize = sal_False;
+ if( aSize.Width() < aMinSize.Width() )
+ {
+ aSize.setWidth( aMinSize.Width() );
+ bResize = sal_True;
+ }
+ if( aSize.Height() < aMinSize.Height() )
+ {
+ aSize.setHeight( aMinSize.Height() );
+ bResize = sal_True;
+ }
+ if( bResize )
+ SetOutputSizePixel( aSize );
+ }
+ // adjust size
+ if (m_xBrowserComponentWindow.is())
+ {
+ Size aSize = GetOutputSizePixel();
+ m_xBrowserComponentWindow->setPosSize(0, 0, aSize.Width(), aSize.Height(),
+ awt::PosSize::WIDTH | awt::PosSize::HEIGHT);
+ }
+}
+//----------------------------------------------------------------------------
+void PropBrw::Update( OSectionView* pNewView )
+{
+ try
+ {
+ if ( m_pView )
+ {
+ EndListening( *(m_pView->GetModel()) );
+ m_pView = NULL;
+ }
+
+ // set focus on initialization
+ if ( m_bInitialStateChange )
+ {
+ // if we're just newly created, we want to have the focus
+ PostUserEvent( LINK( this, PropBrw, OnAsyncGetFocus ) );
+ m_bInitialStateChange = sal_False;
+ // and additionally, we want to show the page which was active during
+ // our previous incarnation
+ if ( m_sLastActivePage.getLength() && m_xBrowserController.is() )
+ {
+ try
+ {
+ m_xBrowserController->restoreViewData( makeAny( m_sLastActivePage ) );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmPropBrw::StateChanged: caught an exception while setting the initial page!" );
+ }
+ }
+ }
+
+ if ( !pNewView )
+ return;
+ else
+ m_pView = pNewView;
+
+ uno::Sequence< Reference<uno::XInterface> > aMarkedObjects;
+ OViewsWindow* pViews = m_pView->getReportSection()->getSectionWindow()->getViewsWindow();
+ const sal_uInt16 nSectionCount = pViews->getSectionCount();
+ for (sal_uInt16 i = 0; i < nSectionCount; ++i)
+ {
+ ::boost::shared_ptr<OSectionWindow> pSectionWindow = pViews->getSectionWindow(i);
+ if ( pSectionWindow )
+ {
+ const SdrMarkList& rMarkList = pSectionWindow->getReportSection().getSectionView().GetMarkedObjectList();
+ aMarkedObjects = ::comphelper::concatSequences(aMarkedObjects,CreateCompPropSet( rMarkList ));
+ }
+ }
+
+ if ( aMarkedObjects.getLength() ) // multiple selection
+ {
+ m_xLastSection.clear();
+ implSetNewObject( aMarkedObjects );
+ }
+ else if ( m_xLastSection != m_pView->getReportSection()->getSection() )
+ {
+ uno::Reference< uno::XInterface> xTemp(m_pView->getReportSection()->getSection());
+ m_xLastSection = xTemp;
+ uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast<Reference<XInterface> * >(NULL)));
+ xNameCont->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReportComponent")),uno::makeAny(xTemp));
+ xTemp = xNameCont;
+
+ implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) );
+ }
+
+ StartListening( *(m_pView->GetModel()) );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR( "PropBrw::Update: Exception occured!" );
+ }
+}
+//----------------------------------------------------------------------------
+void PropBrw::Update( const uno::Reference< uno::XInterface>& _xReportComponent)
+{
+ if ( m_xLastSection != _xReportComponent )
+ {
+ m_xLastSection = _xReportComponent;
+ try
+ {
+ if ( m_pView )
+ {
+ EndListening( *(m_pView->GetModel()) );
+ m_pView = NULL;
+ } // if ( m_pView )
+
+ uno::Reference< uno::XInterface> xTemp(CreateComponentPair(_xReportComponent,_xReportComponent));
+ implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR( "PropBrw::Update: Exception occured!" );
+ }
+ }
+}
+//-----------------------------------------------------------------------
+IMPL_LINK( PropBrw, OnAsyncGetFocus, void*, )
+{
+ if (m_xBrowserComponentWindow.is())
+ m_xBrowserComponentWindow->setFocus();
+ return 0L;
+}
+//----------------------------------------------------------------------------
+void PropBrw::LoseFocus()
+{
+ DockingWindow::LoseFocus();
+ m_pDesignView->getController().InvalidateAll();
+}
+//----------------------------------------------------------------------------
+}
diff --git a/reportdesign/source/ui/report/report.src b/reportdesign/source/ui/report/report.src
new file mode 100644
index 000000000000..95d1629d13ac
--- /dev/null
+++ b/reportdesign/source/ui/report/report.src
@@ -0,0 +1,682 @@
+/*************************************************************************
+ *
+ * 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 "rptui_slotid.hrc"
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _SBASLTID_HRC
+#include <svx/svxids.hrc>
+#endif
+#include "helpids.hrc"
+
+// Dialog Controls ---------------------------------------------------------------
+
+String RID_STR_CLASS_FIXEDTEXT
+{
+ Text = "Label" ;
+};
+String RID_STR_CLASS_FIXEDLINE
+{
+ Text = "Line" ;
+};
+String RID_STR_CLASS_IMAGECONTROL
+{
+ Text = "Graphic" ;
+};
+String RID_STR_CLASS_FORMATTEDFIELD
+{
+ Text = "FormattedField" ;
+};
+
+
+// Property Browser Headline ----------------------------------------------------------------
+
+String RID_STR_BRWTITLE_PROPERTIES
+{
+ Text [ en-US ] = "Properties: ";
+};
+String RID_STR_BRWTITLE_NO_PROPERTIES
+{
+ Text [ en-US ] = "No Control marked";
+};
+String RID_STR_BRWTITLE_MULTISELECT
+{
+ Text [ en-US ] = "Multiselection";
+};
+
+String RID_STR_PROPTITLE_IMAGECONTROL
+{
+ Text [ en-US ] = "Image Control" ;
+};
+String RID_STR_PROPTITLE_FIXEDTEXT
+{
+ Text [ en-US ] = "Label field" ;
+};
+String RID_STR_PROPTITLE_FIXEDLINE
+{
+ Text [ en-US ] = "Line" ;
+ Text [ x-comment ] = " ";
+};
+String RID_STR_PROPTITLE_FORMATTED
+{
+ Text [ en-US ] = "Formatted Field";
+ Text [ x-comment ] = " ";
+};
+String RID_STR_PROPTITLE_SHAPE
+{
+ Text [ en-US ] = "Shape";
+ Text [ x-comment ] = " ";
+};
+String RID_STR_PROPTITLE_REPORT
+{
+ Text [ en-US ] = "Report";
+};
+String RID_STR_PROPTITLE_SECTION
+{
+ Text [ en-US ] = "Section";
+};
+String RID_STR_PROPTITLE_FUNCTION
+{
+ Text [ en-US ] = "Function";
+};
+String RID_STR_PROPTITLE_GROUP
+{
+ Text [ en-US ] = "Group";
+};
+// -----------------------------------------------------------------------
+
+Image RID_IMG_TREENODE_COLLAPSED
+{
+ ImageBitmap = Bitmap { File = "plus.bmp"; } ;
+ MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; };
+};
+
+Image RID_IMG_TREENODE_EXPANDED
+{
+ ImageBitmap = Bitmap { File = "minus.bmp"; } ;
+ MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; };
+};
+
+Image RID_IMG_TREENODE_COLLAPSED_HC
+{
+ ImageBitmap = Bitmap { File = "plus_sch.bmp"; } ;
+ MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; };
+};
+
+Image RID_IMG_TREENODE_EXPANDED_HC
+{
+ ImageBitmap = Bitmap { File = "minus_sch.bmp"; } ;
+ MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; };
+};
+
+String STR_SHOW_RULER
+{
+ Text [ en-US ] = "Show ruler";
+};
+
+String STR_SHOW_GRID
+{
+ Text [ en-US ] = "Show grid";
+};
+
+String RID_STR_UNDO_CHANGEPOSITION
+{
+ Text [ en-US ] = "Change Object";
+};
+String RID_STR_UNDO_MOVE_GROUP
+{
+ Text [ en-US ] = "Move Group(s)";
+};
+String RID_STR_UNDO_CONDITIONAL_FORMATTING
+{
+ Text [ en-US ] = "Conditional Formatting";
+};
+String RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER
+{
+ Text [ en-US ] = "Remove report header / report footer";
+};
+
+String RID_STR_UNDO_ADD_REPORTHEADERFOOTER
+{
+ Text [ en-US ] = "Add report header / report footer";
+};
+
+String RID_STR_UNDO_REMOVE_PAGEHEADERFOOTER
+{
+ Text [ en-US ] = "Remove page header / page footer";
+};
+
+String RID_STR_UNDO_ADD_PAGEHEADERFOOTER
+{
+ Text [ en-US ] = "Add page header / page footer";
+};
+
+String RID_STR_UNDO_PROPERTY
+{
+ Text [ en-US ] = "Change property '#'";
+ Text = "The # character is used for replacing";
+};
+
+String RID_STR_UNDO_ADD_GROUP_HEADER
+{
+ Text [ en-US ] = "Add group header ";
+};
+
+String RID_STR_UNDO_REMOVE_GROUP_HEADER
+{
+ Text [ en-US ] = "Remove group header ";
+};
+
+String RID_STR_UNDO_ADD_GROUP_FOOTER
+{
+ Text [ en-US ] = "Add group footer ";
+};
+
+String RID_STR_UNDO_REMOVE_GROUP_FOOTER
+{
+ Text [ en-US ] = "Remove group footer ";
+};
+String RID_STR_UNDO_ADDFUNCTION
+{
+ Text [ en-US ] = "Add function";
+};
+
+String RID_STR_UNDO_DELETEFUNCTION
+{
+ Text [ en-US ] = "Delete function";
+};
+
+String RID_STR_DESIGN_VIEW
+{
+ Text [ en-US ] = "Design";
+};
+
+String RID_STR_PREVIEW_VIEW
+{
+ Text [ en-US ] = "Preview";
+};
+
+String STR_RPT_TITLE
+{
+ Text [ en-US ] = "Report #" ;
+ Text [ x-comment ] = " ";
+};
+
+String STR_RPT_LABEL
+{
+ Text [ en-US ] = "~Report name" ;
+};
+
+String RID_STR_UNDO_REMOVE_GROUP
+{
+ Text [ en-US ] = "Delete Group" ;
+};
+
+String RID_STR_UNDO_APPEND_GROUP
+{
+ Text [ en-US ] = "Add Group" ;
+};
+
+String RID_STR_UNDO_REMOVE_SELECTION
+{
+ Text [ en-US ] = "Delete Selection" ;
+};
+String RID_STR_UNDO_REMOVE_FUNCTION
+{
+ Text [ en-US ] = "Delete Function" ;
+};
+
+String RID_STR_UNDO_CHANGE_SIZE
+{
+ Text [ en-US ] = "Change Size" ;
+};
+
+String RID_STR_UNDO_PASTE
+{
+ Text [ en-US ] = "Paste" ;
+};
+
+String RID_STR_UNDO_INSERT_CONTROL
+{
+ Text [ en-US ] = "Insert Control" ;
+};
+
+String RID_STR_UNDO_DELETE_CONTROL
+{
+ Text [ en-US ] = "Delete Control" ;
+};
+
+String RID_STR_UNDO_GROUP
+{
+ Text [ en-US ] = "Insert Group" ;
+};
+
+String RID_STR_UNDO_UNGROUP
+{
+ Text [ en-US ] = "Delete Group" ;
+};
+
+String RID_STR_GROUPHEADER
+{
+ Text [ en-US ] = "GroupHeader";
+ Text [ x-comment ] = "Please try to avoid spaces in the name. It is used as a programatic one.";
+};
+String RID_STR_GROUPFOOTER
+{
+ Text [ en-US ] = "GroupFooter";
+ Text [ x-comment ] = "Please try to avoid spaces in the name. It is used as a programatic one.";
+};
+Menu RID_MENU_REPORT
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_SORTINGANDGROUPING;
+ Command = ".uno:DbSortingAndGrouping";
+ Text [ en-US ] = "Sorting and Grouping...";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_ATTR_CHAR_COLOR_BACKGROUND;
+ Command = ".uno:DBBackgroundColor";
+ Text [ en-US ] = "Background Color...";
+ };
+ MenuItem
+ {
+ Identifier = SID_RULER;
+ Command = ".uno:ShowRuler";
+ Checkable = TRUE;
+ Text [ en-US ] = "Ruler...";
+ };
+ MenuItem
+ {
+ Identifier = SID_GRID_VISIBLE;
+ Command = ".uno:GridVisible";
+ Checkable = TRUE;
+ Text [ en-US ] = "Grid...";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_PAGEHEADERFOOTER;
+ Command = ".uno:PageHeaderFooter";
+ Checkable = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_REPORTHEADERFOOTER;
+ Command = ".uno:ReportHeaderFooter";
+ Checkable = TRUE;
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_ARRANGEMENU ;
+ Command = ".uno:ArrangeMenu" ;
+ Text [ en-US ] = "~Arrange" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FORMAT_FRAME_TO_TOP
+ };
+ MenuItem
+ {
+ Identifier = SID_FRAME_UP ;
+ HelpId = ".uno:ObjectForwardOne";
+ Text [ en-US ] = "Bring ~Forward" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FRAME_DOWN ;
+ HelpId = ".uno:ObjectBackOne";
+ Text [ en-US ] = "Send Back~ward" ;
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_FRAME_TO_BOTTOM
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_OBJECT_HEAVEN
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_OBJECT_HELL
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_OBJECT_ALIGN
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FORMAT_OBJECT_ALIGN_LEFT
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_OBJECT_ALIGN_CENTER
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_OBJECT_ALIGN_RIGHT
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_OBJECT_ALIGN_UP
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_OBJECT_ALIGN_MIDDLE
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_OBJECT_ALIGN_DOWN
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+
+ MenuItem
+ {
+ Identifier = SID_OBJECT_RESIZING ;
+ Command = ".uno:ObjectResize" ;
+ Text [ en-US ] = "~Object Resizing" ;
+ Text [ x-comment ] = " ";
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_OBJECT_SMALLESTWIDTH ;
+ Command = ".uno:SmallestWidth" ;
+ Text [ en-US ] = "~Fit to smallest width" ;
+ Text [ x-comment ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = SID_OBJECT_GREATESTWIDTH ;
+ Command = ".uno:GreatestWidth" ;
+ Text [ en-US ] = "~Fit to greatest width" ;
+ Text [ x-comment ] = " ";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_OBJECT_SMALLESTHEIGHT ;
+ Command = ".uno:SmallestHeight" ;
+ Text [ en-US ] = "~Fit to smallest height" ;
+ Text [ x-comment ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = SID_OBJECT_GREATESTHEIGHT ;
+ Command = ".uno:GreatestHeight" ;
+ Text [ en-US ] = "~Fit to greatest height" ;
+ Text [ x-comment ] = " ";
+ };
+ };
+ };
+ };
+
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_SECTION_SHRINK_MENU ;
+ Command = ".uno:SectionShrinkMenu" ;
+ Text [ en-US ] = "Section" ;
+ Text [ x-comment ] = " ";
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_SECTION_SHRINK ;
+ Command = ".uno:SectionShrink" ;
+ Text [ en-US ] = "Shrink" ;
+ Text [ x-comment ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = SID_SECTION_SHRINK_TOP ;
+ Command = ".uno:SectionShrinkTop" ;
+ Text [ en-US ] = "Shrink from top" ;
+ Text [ x-comment ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = SID_SECTION_SHRINK_BOTTOM ;
+ Command = ".uno:SectionShrinkBottom" ;
+ Text [ en-US ] = "Shrink from bottom" ;
+ Text [ x-comment ] = " ";
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_DISTRIBUTION;
+ Command = ".uno:Distribution";
+ Text [ en-US ] = "Distribution..." ;
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = SID_SHOW_PROPERTYBROWSER;
+ Command = ".uno:FormProperties";
+ Text [ en-US ] = "Properties...";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ ITEM_EDIT_CUT
+ };
+ MenuItem
+ {
+ ITEM_EDIT_COPY
+ };
+ MenuItem
+ {
+ ITEM_EDIT_PASTE
+ };
+ };
+};
+String RID_STR_FIELDSELECTION
+{
+ Text [ en-US ] = "Add field:";
+};
+
+String RID_STR_FILTER
+{
+ Text [ en-US ] = "Filter" ;
+};
+
+String RID_APP_TITLE
+{
+ Text [ en-US ] = " - %PRODUCTNAME Base Report" ;
+};
+
+String RID_APP_NEW_DOC
+{
+ Text [ en-US ] = "Untitled" ;
+};
+String RID_STR_UNDO_ALIGNMENT
+{
+ Text [ en-US ] = "Change Alignment" ;
+};
+String RID_STR_HEADER
+{
+ Text [ en-US ] = "# Header" ;
+ Text[ x-comment ] = "# will be replaced with a name.";
+};
+String RID_STR_FOOTER
+{
+ Text [ en-US ] = "# Footer" ;
+ Text[ x-comment ] = "# will be replaced with a name.";
+};
+String RID_STR_IMPORT_GRAPHIC
+{
+ Text [ en-US ] = "Insert graphics" ;
+};
+String RID_STR_DELETE
+{
+ Text [ en-US ] = "Delete" ;
+};
+String RID_STR_FUNCTION
+{
+ Text [ en-US ] = "Function" ;
+};
+Image REPORT_TREE_ICON
+{
+ ImageBitmap = Bitmap { File = "report_16"; };
+ MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; };
+};
+String RID_STR_COULD_NOT_CREATE_REPORT
+{
+ Text [ en-US ] = "An error occurred while creating the report." ;
+};
+String RID_STR_CAUGHT_FOREIGN_EXCEPTION
+{
+ Text [ en-US ] = "An exception of type $type$ was caught." ;
+};
+String RID_STR_UNDO_CHANGEFONT
+{
+ Text [ en-US ] = "Change font";
+};
+String RID_STR_UNDO_CHANGEPAGE
+{
+ Text [ en-US ] = "Change page attributes";
+};
+String RID_STR_PAGEHEADERFOOTER_INSERT
+{
+ Text [ en-US ] = "Insert Page Header/Footer";
+};
+String RID_STR_PAGEHEADERFOOTER_DELETE
+{
+ Text [ en-US ] = "Delete Page Header/Footer";
+};
+String RID_STR_COLUMNHEADERFOOTER_INSERT
+{
+ Text [ en-US ] = "Insert Column Header/Footer";
+};
+String RID_STR_COLUMNHEADERFOOTER_DELETE
+{
+ Text [ en-US ] = "Delete Column Header/Footer";
+};
+String RID_STR_REPORTHEADERFOOTER_INSERT
+{
+ Text [ en-US ] = "Insert Report Header/Footer";
+};
+String RID_STR_REPORTHEADERFOOTER_DELETE
+{
+ Text [ en-US ] = "Delete Report Header/Footer";
+};
+String RID_ERR_NO_COMMAND
+{
+ Text [ en-US ] = "The report can not be executed unless it is bound to content.";
+};
+String RID_ERR_NO_OBJECTS
+{
+ Text [ en-US ] = "The report can not be executed unless at least one object has been inserted.";
+};
+String RID_STR_UNDO_SHRINK
+{
+ Text [ en-US ] = "Shrink Section";
+};
+String RID_STR_DETAIL
+{
+ Text [ en-US ] = "Detail";
+};
+String RID_STR_PAGE_HEADER
+{
+ Text [ en-US ] = "Page Header";
+};
+String RID_STR_PAGE_FOOTER
+{
+ Text [ en-US ] = "Page Footer";
+};
+String RID_STR_REPORT_HEADER
+{
+ Text [ en-US ] = "Report Header";
+};
+String RID_STR_REPORT_FOOTER
+{
+ Text [ en-US ] = "Report Footer";
+};
+String RID_STR_INSERT
+{
+ Text [ en-US ] = "Insert";
+};